source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
cpu_bound_multithreaded.py | """ cpu bound single module """
from collections.abc import Generator
import itertools
import time
import threading
def fibonacci() -> Generator[int, None, None]:
""" generate an infinite sequence of fibonacci numbers """
num_1 = 0
num_2 = 1
yield num_1
yield num_2
while True:
nex... |
test_creator.py | from __future__ import absolute_import, unicode_literals
import difflib
import gc
import json
import logging
import os
import shutil
import stat
import subprocess
import sys
import zipfile
from collections import OrderedDict
from itertools import product
from stat import S_IREAD, S_IRGRP, S_IROTH
from textwrap import ... |
Hover.py | #!/usr/bin/env python
import rospy
import tf
from crazyflie_driver.msg import Hover
from std_msgs.msg import Empty
from crazyflie_driver.srv import UpdateParams
from threading import Thread
class Crazyflie:
def __init__(self, prefix):
self.prefix = prefix
worldFrame = rospy.get_param("~worldFrame... |
bridge.py | # Copyright 2020 The FedLearner Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
rebalance.py | #!/usr/bin/env python3
from pyln.client import Plugin, Millisatoshi, RpcError
from threading import Thread, Lock
from datetime import timedelta
import time
import uuid
plugin = Plugin()
plugin.rebalance_stop = False
def setup_routing_fees(plugin, route, msatoshi):
delay = plugin.cltv_final
for r in reversed(... |
wallet.py | # Electrum - lightweight Bitcoin client
# Copyright (C) 2015 Thomas Voegtlin
#
# Electron Cash - Bitcoin Cash thin client
# Copyright (C) 2017-2022 The Electron Cash Developers
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "... |
client.py | '''
/*
* Copyright 2019 ground0state. All Rights Reserved.
* Released under the MIT license
* https://opensource.org/licenses/mit-license.php
/
/*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use t... |
app.py | # home.py
from flask import Flask, render_template, request, url_for
import os
import sys
import json
import threading
import atexit
from AWSIoTPythonSDK.MQTTLib import AWSIoTMQTTShadowClient
import json
import boto3
import time
from virtual_device import VirtualDevice, VirtualSwitch, VirtualBulb
# Not a good practice... |
runtestendpoint.py | from __future__ import unicode_literals
import socket
import multiprocessing
from django.core.management.base import BaseCommand, CommandError
import time
import datetime
import logging
logger = logging.getLogger(__name__)
class Socket:
'''demonstration class only
- coded for clarity, not efficiency
''... |
Simulation.py | # Copyright 2017 Battelle Energy Alliance, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... |
testfile.py | import numpy as np
import math
import itertools
from collections import Counter
import sys
from numpy import linalg
from numba import jit
import time
from multiprocessing import Process, Queue
import csv
from itertools import permutations
#This function is obtained from pyvci plz see github resource code
#this functio... |
IPProxy.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from multiprocessing import Value, Queue, Process
from api.apiServer import start_api_server
from db.DataStore import store_data
from validator.Validator import validator, getMyIP
from spider.ProxyCrawl import startProxyCrawl
from config import TASK_QUEUE_SIZE
if __nam... |
server.py | import socket
import threading
import os
def RetemArquivo(nome, sock):
"""
Função que devolve um determinado arquivo
Recebe o nome do arquivo a ser devolvido
e a conexão estabelecida sock
"""
# Obtemos o nome do arquivo lendo os dados enviados
# pelo socket
nome_arquivo = sock.recv(1024... |
speedtest_cli.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2012-2015 Matt Martz
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.or... |
test_ssl.py | import pytest
import threading
import socket as stdlib_socket
import ssl
from contextlib import contextmanager
from functools import partial
from OpenSSL import SSL
import trustme
from async_generator import async_generator, yield_, asynccontextmanager
import trio
from .. import _core
from .._highlevel_socket import... |
aeroelastic_analysis.py | """Aeroelastic analysis module using preCICE library."""
import os
from pathlib import Path
from multiprocessing import Process
import subprocess
PRECICE_EXECUTES = {
"aero": "wsl -d Ubuntu-20.04 -e ./wsl_script_aero.bash",
"structure": "wsl -d Ubuntu-20.04 -e ./wsl_script_structures.bash",
}
def solver_exe... |
GetDep.py | #encoding=utf-8
import os
from threading import Thread
from urlparse import urlparse, urljoin
import git
import pickle
from git import Repo
from os import path, makedirs
from Queue import Queue, Empty, LifoQueue
import utils
from ParseComake import ComakeParser
from utils import RedIt, GreenIt, GetComake
REPO_URL = '... |
langserver_ext.py | import logging
import subprocess
import threading
from tornado import ioloop, process, web, websocket
from pyls_jsonrpc import streams
try:
import ujson as json
except Exception: # pylint: disable=broad-except
import json
log = logging.getLogger(__name__)
class LanguageServerWebSocketHandler(websocket.We... |
miner_statistics.py | #!/usr/bin/env python
"""
MIT License
Copyright (c) 2018 Ortis (cao.ortis.org@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the righ... |
utils.py | #!/usr/bin/env python
import calendar
import datetime
import os
import subprocess
import threading
import time
def date2seconds(date_str):
'''
converts a string date into seconds since Epoch
The string date_str can be either the output of command
`date`
or command
`date -u`
Thr... |
brute.py | #!/usr/bin/python3
# coding=utf-8
#######################################################
# File : brute.py #
# Author : Rizal F #
# Github : https://github.com/Rizal-XD #
# Facebook : https://www.facebook.com/AKUN.KERTAS... |
test_multiple_process_server.py | import multiprocessing
import os
import time
import unittest
from shutil import rmtree
from grpc import insecure_channel
from grpcalchemy import grpcmethod, Server, DefaultConfig, Context
from grpcalchemy.orm import Message
from tests.test_grpcalchemy import TestGrpcalchemy
class MultipleProcessServerTestCase(TestG... |
semaphore.py | import threading
t = threading.Semaphore(3)
def count():
t.acquire()
print("Start")
for i in range(1, 6):
print(i)
t.release()
thread1 = threading.Thread(target=count)
thread2 = threading.Thread(target=count)
thread3 = threading.Thread(target=count)
thread4 = threading.Thread(... |
007_ctr-grs.py | # dont delete this line, help us make the project known :)
print('open-source project by www.OPEN-ATS.eu \n change to your own IP and password')
import os, socket, threading, time
os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "hide" # annoying pygame support message
import pygame
pwd = b'rmxmjwby' # password
kav = b'a g... |
file_generation.py | import os, sys, time, logging, socket, fcntl, struct, ctypes, datetime
log = logging.getLogger('recd')
from threading import Thread
from common.stoppable_thread import StoppableThread
from common.byte_print import *
from common.os_utils import OSUtils
from common.time_utils import TimeUtils
from common.c_utils import C... |
build_image_data.py | # Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
bpytop.py | #!/usr/bin/env python3
# pylint: disable=not-callable, no-member
# indent = tab
# tab-size = 4
# Copyright 2020 Aristocratos (jakob@qvantnet.com)
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the... |
test_local_apigw_service.py | from unittest import TestCase
import threading
import os
import shutil
import json
import time
import requests
import random
from mock import Mock
from samcli.local.apigw.local_apigw_service import Route, LocalApigwService
from tests.functional.function_code import nodejs_lambda, API_GATEWAY_ECHO_EVENT, API_GATEWAY_B... |
droneSwarmMng.py | # ----------------------------------------------- Imports ------------------------------------------------------------ #
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time, sys, os, logging, datetime, select
import threading, multiprocessing, argparse
import subprocess, dronekit, pymavlink, random
import aDroneI... |
serverapp.py | # coding: utf-8
"""A tornado based Jupyter server."""
# This code is heaavily based on code from jupyter_server, copied under the
# following license:
#
# This project is licensed under the terms of the Modified BSD License
# (also known as New or Revised or 3-Clause BSD), as follows:
#
# - Copyright (c) 2001-2015, I... |
server.py | from database import *
from util import *
from cryptor import *
from beacon import *
import os
import sys
import flask
import pickle
import threading
#import netifaces
import logging
from collections import OrderedDict
from multiprocessing import Process
from random import choice
from string import ascii_uppercase
fr... |
zephyros.py | import socket
import threading
import json
import Queue
import sys
import time
import atexit
import itertools
def run_in_background(fn):
t = threading.Thread(target=fn)
t.daemon = True
t.start()
class ZephClient(object):
def start(self):
try:
self.sock = socket.socket(socket.AF_INE... |
_bgen2.py | import hashlib
import math
import multiprocessing
import os
import threading
from os.path import getmtime
from pathlib import Path
from typing import Any, List, Optional, Tuple, Union
import numpy as np
from cbgen import bgen_file, bgen_metafile
# from ._bgen_metafile import bgen_metafile
from cbgen._ffi import ffi a... |
client.py | import subprocess
import threading
import os
class ClickHouseClient:
def __init__(self, binary_path, port):
self.binary_path = binary_path
self.port = port
def query(self, query, timeout=10, pipe=None):
result = []
process = []
def run(path, port, text, result, in_pi... |
torch_policy_v2.py | import copy
import functools
import logging
import math
import os
import threading
import time
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Set, Tuple, Type, Union
import gym
import numpy as np
import tree # pip install dm_tree
import ray
from ray.rllib.models.catalog import ModelCatalog
from ray.rll... |
cor_nome.py | #!/usr/bin/env python3
print('Inicializando...', end=' \r')
import time
# from ev3dev.ev3 import *
print('ev3dev.ev3', end=' \r')
from ev3dev2.motor import OUTPUT_A, OUTPUT_B, MoveTank, SpeedPercent
print('motores importados', end=' \r')
from ev3dev2.sensor... |
CVE-2020-11579.py | #!/usr/bin/env python3
# coding: utf8
#
# this script exploits CVE-2020-11579, an arbitrary file
# disclosure through a MySQL client in
# PHPKB (https://www.knowledgebase-script.com/).
#
# usage: CVE-2020-11579.py [-h] [-rh RHOST] -lh LHOST [-lp LPORT] [-f FILE]
# [-c {mysql_cli,mysqlnd}] [-s] ... |
rdd.py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
_pythoncan.py | # Copyright (c) 2019 UAVCAN Consortium
# This software is distributed under the terms of the MIT License.
# Author: Alex Kiselev <a.kiselev@volz-servos.com>, Pavel Kirienko <pavel@uavcan.org>
from __future__ import annotations
import time
import typing
import asyncio
import logging
import threading
import functools
im... |
inputhook.py | """
Similar to `PyOS_InputHook` of the Python API. Some eventloops can have an
inputhook to allow easy integration with other event loops.
When the eventloop of prompt-toolkit is idle, it can call such a hook. This
hook can call another eventloop that runs for a short while, for instance to
keep a graphical user inter... |
lCom.py | # -*- coding:utf-8 -*-
import sys
import threading
import os
import re
# 差分箇所から前後何行出力するかを決める変数
OUTPUT_LINE_NUM = 10
# アノテート時の変換元を設定するワード(正規表現)
OMMIT_WORD = r'\[M.+0\]'
# アノテート時の変換後を設定するワード
REPLACE_WORD = '[OMMIT]'
# エラーID
(
ARGERROR,
NOENT,
) = range(0, 2)
def printError(errorID, arg):
"""
エラーメッセー... |
controller.py | # -*- coding: utf-8; -*-
#
# Copyright (c) 2016 Álan Crístoffer
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, ... |
scheduler_job.py | # pylint: disable=no-name-in-module
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Versio... |
client_handler.py | import socket
import sqlite3
import sys
import aes_crypt
import rsa_encrypt
import hashlib
import base64
import settings
import threading
import sqlite3
import shamir_updater
import time
import shamir_client
#set number for communication with webservers from file
comms_number = 0
with open(settings.assetsdir + "comms... |
crawler.py | #! /usr/bin/env python3
# This is a four threads crawler starts from javbus2.pw/genre/hd/1
import parsertest
import database
import os
import timeit
import threading
import sys
import datetime
from object_prototye import Counter
def parse_page(url, thread_num, counter):
""" parse function for each page"""
... |
index.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# @Author: Sricor
# @Date: 2022-4-20
"""
cron 0 08 * * * index.py
new Env('易班打卡');
"""
import os
import yiban
import utils
import logging
import datetime
import requests
import threading
from base64 import b64decode
config = {
"user": [
{"name": "xxx", "mobile":... |
network.py | import cPickle as pickle
import uuid
import logging
import time
import heapq
import socket
NAMESPACE = uuid.UUID('7e0d7720-fa98-4270-94ff-650a2c25f3f0')
def addr_to_tuple(addr):
parts = addr.split('-')
return parts[0], int(parts[1])
def tuple_to_addr(addr):
if addr[0] == '0.0.0.0':
addr = socket... |
subproc.py | import gym
import time
import ctypes
import numpy as np
from collections import OrderedDict
from multiprocessing.context import Process
from multiprocessing import Array, Pipe, connection
from typing import Any, List, Tuple, Union, Callable, Optional
from tianshou.env.worker import EnvWorker
from tianshou.env.utils im... |
youtube.py | from tkinter import messagebox
import os
from tkinter import *
import threading
from tkinter import ttk
from pytube.__main__ import YouTube
import pyttsx3
def speaker(text):
audio = pyttsx3.init()
audio.say(text)
audio.runAndWait()
root = Tk()
root.title("YouTube Downloader 0.0.1")
root... |
SentenceTransformer.py | import json
import logging
import os
import shutil
import stat
from collections import OrderedDict
from typing import List, Dict, Tuple, Iterable, Type, Union, Callable, Optional
import requests
import numpy as np
from numpy import ndarray
import transformers
from huggingface_hub import HfApi, HfFolder, Repository, hf_... |
test_wire.py | from binascii import hexlify, unhexlify
from pyln.proto.wire import PrivateKey, PublicKey, LightningConnection
import socket
from pyln.proto import wire
import threading
def test_primitives():
raw_privkey = unhexlify('1111111111111111111111111111111111111111111111111111111111111111')
privkey = PrivateKey(raw_... |
connector.py | # Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
rpc_manager.py | #
# Copyright 2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio.
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# Thi... |
shortcuts.py | """
Shortcuts for retrieving input from the user.
If you are using this library for retrieving some input from the user (as a
pure Python replacement for GNU readline), probably for 90% of the use cases,
the :func:`.prompt` function is all you need. It's the easiest shortcut which
does a lot of the underlying work lik... |
snake_bot_module.py | #!/usr/bin/env python
import rospy
import threading
import vrep
import time
from sensor_msgs.msg import Joy
from sensor_msgs.msg import JointState
from snake_bot.srv import SetMode SetModeRequest SetModeResponse
class SnakeRobot():
def __init__(self,connectionAddress='127.0.0.1' , connectionPort= 19997, wa... |
GCPDataTee.py | import struct, socket, errno, numpy, time, threading
from spt3g import core, dfmux
class PagerWatchdog(object):
'''
Module that sends a watchdog (ping) message to the GCP pager when the parent
process is running successfully. Modify the `data_valid` method for
particular use cases, and call the `run`... |
ZombieServer.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
#-------------------------------------------------------------------------------
"""pyzombie HTTP RESTful server."""
__author__ = ('Lance Finn Helsten',)
__version__ = '1.0.1'
__copyright__ = """Copyright 2009 Lance Finn Helsten (helsten@acm.org)"""
__license__ = """
Licens... |
parallel_prog.py | import os
import threading
from threading import Thread
from multiprocessing import Process, Array
import multiprocessing
import time
'''
TODO: the main thread keeps one core busy; resolve this issue
'''
def run_parallel_progs_in_threads(cmd_list, n_procs, verbose=False):
flag = [False for i in range(n_procs)]
thre... |
util.py | #
# Copyright (C) 2012-2017 The Python Software Foundation.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
import codecs
import contextlib
import csv
import io
import json
import logging
import os
import py_compile
import re
import socket
from collections import deque
from glob import iglob as std_iglob
try:
import ssl... |
core_test.py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
server.py | #!/usr/bin/env python
"""
Dummy server used for unit testing.
"""
import logging
import os
import socket
import ssl
import sys
import threading
import warnings
from datetime import datetime
from typing import Any, Callable, Dict, Optional, Tuple, Union
import tornado.httpserver
import tornado.ioloop
import tornado.n... |
threads.py | # Learning Python 101
import threading
from utils import *
def run(upto):
for i in range(0, upto):
printf("[" + str(threading.get_ident()) + "] " + str(i) + "\n")
def main():
t1 = threading.Thread(target=run, args=(35,))
t2 = threading.Thread(target=run, args=(20,))
t1.start()
t2.start... |
email_processor.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import nltk
import os
import numpy as np
import codecs
import multiprocessing as mp
from collections import Counter
from typing import Dict, List, Tuple
def preprocess(email: str) -> str:
"""
Preprocess (simplifies) raw email.
Args:
email (st... |
app.py | # -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
custom.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
__init__.py | """
* Experimental *
Like the map function, but can use a pool of threads.
Really easy to use threads. eg. tmap(f, alist)
If you know how to use the map function, you can use threads.
"""
__author__ = "Rene Dudfield"
__version__ = "0.3.0"
__license__ = 'Python license'
import traceback, sys
from pygame.compat i... |
test_pocketfft.py | import numpy as np
import pytest
from numpy.random import random
from numpy.testing import (
assert_array_equal, assert_raises, assert_allclose
)
import threading
import queue
import sys
def fft1(x):
L = len(x)
phase = -2j*np.pi*(np.arange(L)/float(L))
phase = np.arange(L).reshape(-1, 1) *... |
custom.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
multithread_downloader.py | from urllib.request import urlopen
import urllib
import os, threading, sys
from tqdm import tqdm
def download_path(link, save_in="."):
try:
response = urlopen(link)
file_ = link.split(r"/")[-1]
urllib.request.Request(link, method="HEAD")
get_head = urlopen(link)
if get_head.... |
run-bmv2-test.py | #!/usr/bin/env python
# Copyright 2013-present Barefoot Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... |
samples.py | from shared import Queue
def task(queue: Queue):
for i in range(10):
data = queue.get()
print("cur get:", data)
if __name__ == '__main__':
import multiprocessing as mp
import time
t_que = Queue(buffer_size=1024 * 4)
proc = mp.Process(target=task, args=(t_que,))
proc.start()
... |
_v5_proc_controlv.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# COPYRIGHT (C) 2014-2020 Mitsuo KONDOU.
# This software is released under the MIT License.
# https://github.com/konsan1101
# Thank you for keeping the rules.
import sys
import os
import time
import datetime
import codecs
import glob
import queue
import threading
impor... |
http_server.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from socket import socket
import random
import string
import json
import threading
import BaseHTTPServer
ADDRESS = ('localhost', 8081)
CODES = (200, 200, 200, 300, 400) # gives ~60% probability to get 200 OK
class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
... |
test_record.py | from __future__ import absolute_import, division, print_function
import os
import shutil
import subprocess
import sys
import time
from glob import glob
from multiprocessing import Process
from time import sleep
from tempfile import TemporaryDirectory
from typing import List
from pathlib import Path
import nose
from n... |
broadcast_scheduler.py | # Copyright 2018 ICON Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... |
test_cp.py | # -*- coding: utf-8 -*-
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... |
httpd.py | import hashlib
import os
import sys
import threading
from http import HTTPStatus
from http.server import HTTPServer
from RangeHTTPServer import RangeRequestHandler
class TestRequestHandler(RangeRequestHandler):
def __init__(self, *args, **kwargs):
# NOTE: `directory` was introduced in 3.7
if sys.... |
mqtt_receiver.py | # Example of using the MQTT client class to subscribe to a feed and print out
# any changes made to the feed. Edit the variables below to configure the key,
# username, and feed to subscribe to for changes.
# Import standard python modules.
import sys
import multiprocessing
import subprocess
import sys
import glob
... |
scheduler.py | import time
from concurrent.futures import ThreadPoolExecutor
from datetime import datetime, timedelta
from multiprocessing import Queue, Process
from threading import Thread
import pyppeteer
import schedule
from scylla.config import get_config
from scylla.database import ProxyIP
from scylla.jobs import validate_prox... |
run_main_experiments.py | '''
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.
'''
import time
import itertools
import subprocess
from multiprocessing import Process, Queue
def do_work(work, gpu_idx):
while not work.empty():
experiment = work.get()
experiment = experiment.replace("GP... |
vm_util.py | # Copyright 2014 PerfKitBenchmarker Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
download.py | # ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... |
context_test.py | # -*- coding: utf-8 -*-
'''
tests.unit.context_test
~~~~~~~~~~~~~~~~~~~~
'''
# Import python libs
from __future__ import absolute_import
import tornado.stack_context
import tornado.gen
from tornado.testing import AsyncTestCase, gen_test
import threading
import time
# Import Salt Testing libs
from salttesting i... |
meshtool_progressive_screenshots.py | import list
import pprint
import sys
import os
import os.path
import urllib2
import shutil
from meshtool.filters import factory
from meshtool.filters.print_filters.print_render_info import getRenderInfo
import collada
import unicodedata
import math
import traceback
import itertools
from multiprocessing import Process, ... |
jd.py | # encoding: utf-8
import logging
import sqlite3
import threading
import time
class Converter(object):
def __init__(self, database_path, file_path):
logging.basicConfig(
level=logging.DEBUG,
format="%(asctime)s %(levelname)s %(message)s",
datefmt='%Y-%m-%d %H:%M:%S',
... |
bcp_server.py | """BCP Server interface for the MPF Media Controller"""
import logging
import queue
import socket
import sys
import threading
import time
import traceback
import select
import mpf.core.bcp.bcp_socket_client as bcp
from mpf.exceptions.runtime_error import MpfRuntimeError
class BCPServer(threading.Thread):
"""Pa... |
conftest.py | """
Unit test fixture module.
"""
import threading
import time
import mock
import pytest
from mock.mock import MagicMock
from core.api.grpc.client import InterfaceHelper
from core.api.grpc.server import CoreGrpcServer
from core.api.tlv.corehandlers import CoreHandler
from core.emane.emanemanager import EmaneManager
... |
gen_train_log.py | import multiprocessing as mp
import numpy as np
import time
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-e", "--epoch",type=int, default=5)
args = parser.parse_args()
FLAG=True
EPOCH=args.epoch
CUR_EPOCH=0
AVG_LOSS=10
VAL_LOSS=1
FORCE_AVG=1
FORCE_VAL=0.01
def worker(iter=0.001):
... |
batcher.py | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
# Modifications Copyright 2017 Abigail See
# Modifications made 2018 by Logan Lebanoff
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the Licen... |
NonCompiledScript.py | # Credits To TheNewBoston | Youtube: https://www.youtube.com/channel/UCJbPGzawDH1njbqV-D5HqKw
# Spider, Main, LinkFinder, General, Domain In One File
# This Was Orginaly 5 Files Now Everything Is In One.
import os
import queue
import threading
from urllib.parse import urlparse
from html.parser import HTMLParse... |
scheduler_job.py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... |
threading_simpleargs.py | import threading
def worker(num):
"""thread worker function"""
print 'Worker: %s' % num
return
threads = []
for i in range(5):
t = threading.Thread(target=worker, args=(i,))
threads.append(t)
t.start()
|
P7_Mosquitto_Publisher_Subsriber_Pywapi_Data_net_Plotly.py | #!/usr/bin/python
#!/usr/bin/python
#P7 Mosquitto Publisher, Subscriber, Pywapi Weather, Send Data Network, Plotly
#Miguel Tlapa Juarez
#migueltlapa@gmail.com
#May 5 2016
#Internet of Things Course
import paho.mqtt.client as paho
import psutil
import pywapi
import signal
import sys
import time
from thre... |
client.py | import socket
import multiprocessing
import dns.name
import dns.message
import dns.query
import dns.flags
HOST = '127.0.0.1' # The server's hostname or IP address
PORT = 57 # The port used by the server
ADDITIONAL_RDCLASS = 65535
QUERY_LIST = ["google.com", "microsoft.com", "twitter.com", "stackoverflow.co... |
test_dota2.py | # -*- coding:utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import os
import sys
import tensorflow as tf
import cv2
import numpy as np
import math
from tqdm import tqdm
import argparse
from multiprocessing import Queue, Process
sys.path.append(".... |
task.py | """
* Copyright (C) Caleb Marshall - All Rights Reserved
* Written by Caleb Marshall <anythingtechpro@gmail.com>, June 11th, 2018
* Licensing information can found in 'LICENSE', which is part of this source code package.
"""
import enum
import time
import threading
class TaskError(RuntimeError):
"""
An ta... |
sdk_worker.py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
k10.py | from linepy import *
from akad.ttypes import Message
from akad.ttypes import ContentType as Type
from akad.ttypes import ChatRoomAnnouncementContents
from akad.ttypes import ChatRoomAnnouncement
from multiprocessing import Pool, Process
from datetime import datetime
from time import sleep
from bs4 import BeautifulSoup
... |
fstest.py | # Copyright (C) The Arvados Authors. All rights reserved.
#
# SPDX-License-Identifier: AGPL-3.0
from __future__ import print_function
from __future__ import absolute_import
from builtins import str
from builtins import range
from multiprocessing import Process
import os
import subprocess
import sys
from . import prof
... |
update.py | import rohub, time, json, sys
import threading
from threading import Thread
session_lock = False
updater_lock = False
filename = ""
if (len(sys.argv) == 1):
f = open("GIT\Massive-ROs-Creator\ROs.json", "r")
elif (len(sys.argv) == 2):
try:
f = open("GIT\Massive-ROs-Creator\\"+sys.argv[1], "r")
ex... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.