source
stringlengths
3
86
python
stringlengths
75
1.04M
finchconnection.py
# This module implements connection of a Finch robot via USB. It is used by # finch.py to send and receive commands from the Finch. # The Finch is a robot for computer science education. Its design is the result # of a four year study at Carnegie Mellon's CREATE lab. # http://www.finchrobot.com import atexit import o...
NewsBot_WebService.py
from flask import Flask, abort, request, Response import signal import threading import time import os import requests import json import random import spacy import newspaper from newspaper import Article import nltk import en_core_web_sm #import en_core_web_md app = Flask(__name__) shuttingDown = False def exit_c...
test_dataset.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 u...
__init__.py
# Adapted from https://github.com/MoshiBin/ssdpy and https://github.com/ZeWaren/python-upnp-ssdp-example import socket import struct import threading from .ssdp_handler import SSDP_Handler class SSDPServer(): """ fHDHR SSDP server. """ def __init__(self, fhdhr): self.fhdhr = fhdhr s...
tf_record_multiprocessing_test.py
# Copyright 2019 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...
util.py
# # Copyright (C) 2012-2021 The Python Software Foundation. # See LICENSE.txt and CONTRIBUTORS.txt. # import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket try:...
fireant.py
#!/usr/bin/env python3 import os import sys import sched from threading import Thread import subprocess import time import json import requests import pyrebase # Exception class definition class TokenRequestError(Exception): """Could not retreive token exception.""" pass class InvalidTokenException(Except...
test_base_events.py
"""Tests for base_events.py""" import errno import logging import math import os import socket import sys import threading import time import unittest from unittest import mock import asyncio from asyncio import base_events from asyncio import constants from asyncio import events from test.test_asyncio import utils a...
Hiwin_RT605_ArmCommand_Socket_20190627194037.py
#!/usr/bin/env python3 # license removed for brevity import rospy import os import socket ##多執行序 import threading import time import sys import matplotlib as plot import HiwinRA605_socket_TCPcmd as TCP import HiwinRA605_socket_Taskcmd as Taskcmd import numpy as np from std_msgs.msg import String from ROS_Socket.srv imp...
entry.py
import os import shutil import subprocess import sys import threading import traceback if 'pylab' not in sys.modules: import matplotlib matplotlib.use('Agg') from pylab import * from Tkinter import TclError from django.dispatch import receiver from django.db.models.signals import post_save, post_delete from ...
framework.py
from collections import OrderedDict from configparser import ConfigParser, ExtendedInterpolation from copy import copy from csv import writer from dis import distb from functools import partial from gzip import open as open_gzip from hashlib import sha3_512 from io import StringIO from json import JSONDecoder from logg...
translate.py
#!/usr/bin/env python # -*- coding:utf-8 -* import os import argparse import dbm import re from multiprocessing.dummy import Pool as ThreadPool from multiprocessing import Process class Bing(object): def __init__(self): super(Bing, self).__init__() def query(self, word): import requests ...
upgrade_center.py
import time import threading from .base import EventBase from itertools import groupby from .upgrade_workers import UPGRADE_EVENT, UPGRADE_GROUP class UpgradeCenter(EventBase): def __init__(self): super(UpgradeCenter, self).__init__() self.workers = {} self.before_run_status = [] s...
cat_twitter_img_to_s3.py
import json import boto import urllib2 import StringIO from multiprocessing import Process, Queue from boto.s3.connection import S3Connection from boto.s3.key import Key from tweepy.streaming import StreamListener from tweepy import OAuthHandler from tweepy import Stream def uploadUrls(queue, creds): while Tru...
cluster.py
# Copyright (C) 2016-2018 Alibaba Group Holding Limited # # 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...
run-p4-sample.py
#!/usr/bin/env python2 # 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 b...
transfer.py
#!/usr/bin/env python """ Downloads files to temp locations. This script is invoked by the Transfer Manager (galaxy.jobs.transfer_manager) and should not normally be invoked by hand. """ import ConfigParser import json import logging import optparse import os import random import SocketServer import sys import tempfil...
get_story.py
#!/bin/python3 from multiprocessing import Process import urllib.request from bs4 import BeautifulSoup import requests def get_story(link): print("Getting link ", link) page = requests.get(link,headers={"User-Agent" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 S...
smoketest.py
""" Agent smoketest code. This python script is meant to be invoked within a docker image in which the proper python version is activated (e.g. via pyenv). In this way, the agent can be validated against different python versions. Concept: This code serves as a common code-base for different types of smoketest "...
VA_02C.py
# -*- coding: utf-8 -*- import pyttsx3 # pip install pyttsx3 from datetime import datetime import requests # pip install requests from bs4 import BeautifulSoup # pip install beautifulsoup4 import speech_recognition as sr # pip install SpeechRecognition import wikipedia # pip install wikipedia import webbrowser ...
core.py
#!/usr/bin/env python2 # core.py # # This file contains the main class of the framework which # includes the thread functions for the receive and send thread. # It also implements methods to setup the TCP connection to the # Android Bluetooth stack via ADB port forwarding # # Copyright (c) 2020 The InternalBlue Team. ...
OSC_stream_tryout.py
# # OSC_stream_tryout.py # # # # This code is a tryout for the setup of an OSC stream with the muse headset via mindMonitor. # # # # Author: S.H.A. Verschuren # # Date: 17-4-2020 # # # # import argparse # import numpy as np # import pandas as pd # import csv # import time # import datetime # import os # import tkinte...
makepanda.py
#!/usr/bin/env python ######################################################################## # # To build panda using this script, type 'makepanda.py' on unix # or 'makepanda.bat' on windows, and examine the help-text. # Then run the script again with the appropriate options to compile # panda3d. # ##################...
ovsdb_monitor.py
# Copyright 2016 Red Hat, 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 applicable law or agre...
TWCManager.py
#! /usr/bin/python3 ################################################################################ # Code and TWC protocol reverse engineering by Chris Dragon. # # Additional logs and hints provided by Teslamotorsclub.com users: # TheNoOne, IanAmber, and twc. # Thank you! # # For support and information, please re...
arbitrage.py
# Copyright 2020 Alejandro Suazo # # 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...
auto_change_handler.py
import threading import atexit from apscheduler.schedulers.background import BackgroundScheduler from apscheduler.triggers.interval import IntervalTrigger from src import db_context from src.commands.functions import replacements from src.enums import Replacements import time from src import logger from src import vkap...
DNSSpoofer.py
import os import atexit from scapy.all import * from netfilterqueue import NetfilterQueue from threading import Thread monitor_domain = "" # What we want to filter for server_ip = "" # What we want to redirect to class DNSSpoofer: def __init__(self, subdomain, local_ip): global monitor_domain, server_...
server.py
from flask import Flask, render_template, request from flask_cors import CORS from multiprocessing import Process import boto3 import time import paramiko import os import io app = Flask(__name__) CORS(app) #Paramiko ssh information pseudofile = io.StringIO(os.environ['SSH_KEY']) key = paramiko.RSAKey.from_private_ke...
goniometer.py
from threading import Thread import time from typing import Tuple, Union import numpy as np from pi_feeder import motor, encoder, limit_switch AZIMUTH_GEAR_RATIO = 10 AZIMUTH_HOME_OFFSET = 24.7 DISTANCE_TOLERANCE = 0.5 class Goniometer: def __init__(self, i_zero: float = 0, e_zero: float = 0, az_zero: float = 0...
plot_mode_base.py
from __future__ import print_function, division from pyglet.gl import * from plot_mode import PlotMode from threading import Thread, Event, RLock from color_scheme import ColorScheme from sympy.core import S from sympy.core.compatibility import is_sequence from time import sleep import warnings class PlotModeBase(Pl...
async.py
import threading import multiprocessing import types from collections import deque import sys import weakref catch_exceptions = True # set to False when debugging default_pool_size = multiprocessing.cpu_count() class Pool(object): def __init__(me, size=default_pool_size): me.size = size def pool_size(pool): ...
attack.py
import os import multiprocessing as mp import numpy as np import numpy.linalg as LA import argparse from multiprocessing import Process def SVD(mat, rank, proc_id): print('[rank {} -> process {}] >>> invoked <<<'.format(rank, proc_id)) while True: LA.svd(mat) if __name__ == '__main__': parser = argpars...
cli.py
import argparse import json import readline import logging import os from time import sleep import threading import sys from figment.zone import Zone from figment.logger import log PROMPT = "\033[32;1m> " RESET = "\033[m" ERASE_DOWN = "\033[J" prompt_quit = False def prompt(args): global prompt_quit zone ...
object_detection.py
import cv2 as cv import argparse import numpy as np import sys import time from threading import Thread if sys.version_info[0] == 2: import Queue as queue else: import queue from common import * from tf_text_graph_common import readTextMessage from tf_text_graph_ssd import createSSDGraph from tf_text_graph_fas...
train.py
#!/usr/bin/env python from worker import * from network import * import threading from time import sleep flags = tf.app.flags FLAGS = flags.FLAGS flags.DEFINE_boolean('is_approaching_policy', False, 'If learning approaching policy.') flags.DEFINE_integer('max_episodes', 200000, 'Maximum episodes.') flags.DEFINE_inte...
threads_current.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import threading def worker(): print("Current thread is {}".format(threading.current_thread())) def main(): threads = [] for i in range(10): thread = threading.Thread(target=worker) thread.start() threads.append(thread) for threa...
test_threading.py
""" Tests for the threading module. """ import test.support from test.support import verbose, import_module, cpython_only from test.support.script_helper import assert_python_ok, assert_python_failure import random import sys import _thread import threading import time import unittest import weakref import os import ...
util.py
# -*- coding: utf-8 -*- # # Tencent is pleased to support the open source community by making QTA available. # Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved. # Licensed under the BSD 3-Clause License (the "License"); you may not use this # file except in compliance with the License. You may ...
rtt2uart.py
import logging import pylink import time import serial import threading import socket logging.basicConfig(level=logging.NOTSET, format='%(asctime)s - [%(levelname)s] (%(filename)s:%(lineno)d) - %(message)s') logger = logging.getLogger(__name__) class rtt_to_serial(): def __init__(self, connec...
stress.py
#!/usr/bin/env python # Copyright (c) 2014, Facebook, Inc. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. from...
mac_run_exp.py
from muselsl import stream, list_muses, view, record from multiprocessing import freeze_support, set_start_method, Process, Pool from mne import Epochs, find_events from time import time, strftime, gmtime import os from utils import utils from collections import OrderedDict import sys from optparse import OptionParser ...
exporter.py
#!/usr/bin/env python3 import xmlrpc.client import argparse import logging import threading import time import json import sys from socketserver import ThreadingMixIn from http.server import HTTPServer from pprint import pformat from prometheus_client import Gauge, Counter, Enum, MetricsHandler, core class Homemati...
learn_pipe.py
import logging import multiprocessing import time logging.basicConfig( level=logging.DEBUG, format='%(processName)s: %(message)s' ) def f(conn): conn.send(['test']) time.sleep(5) conn.close if __name__ == "__main__": parent_conn, child_conn = multiprocessing.Pipe() p = multiprocessing....
threaded_udp_server.py
# Under MIT License, see LICENSE.txt from socketserver import ThreadingMixIn, UDPServer import threading import socket import struct from ipaddress import ip_address class ThreadedUDPServer(ThreadingMixIn, UDPServer): allow_reuse_address = True def __init__(self, host, port, handler): super(Threade...
test_decimal.py
# Copyright (c) 2004 Python Software Foundation. # All rights reserved. # Written by Eric Price <eprice at tjhsst.edu> # and Facundo Batista <facundo at taniquetil.com.ar> # and Raymond Hettinger <python at rcn.com> # and Aahz (aahz at pobox.com) # and Tim Peters """ These are the test cases for the Decim...
fullQueue.py
import threading import queue import time def myPublisher(queue): while not queue.full(): queue.put(1) print("{} Appended 1 to queue: {}".format(threading.current_thread(), queue.qsize())) time.sleep(1) myQueue = queue.Queue() for i in range(10): myQueue.put(i) threads = [] for i in range(4): threa...
dankcli.py
import curses from curses import wrapper from DiscordDankBot import DankBot import time from threading import Thread def main(stdscr): curses.init_pair(1, curses.COLOR_GREEN, curses.COLOR_BLACK) curses.init_pair(2, curses.COLOR_RED, curses.COLOR_BLACK) curses.init_pair(3, curses.COLOR_CYAN, curses.COLOR_BL...
DatasetLoader.py
#! /usr/bin/python # -*- encoding: utf-8 -*- import torch import torchaudio import numpy import random import pdb import os import threading import time import math from scipy.io import wavfile from queue import Queue # torchfb = torchaudio.transforms.MelSpectrogram(sample_rate=16000, n_fft=2048, win_length=800, hop_...
exercise_5.py
import socket import queue import threading import time import sys class Server(object): def __init__(self, address, port=1111): self.__address = address self.__buffer_size = 1024 self.server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # self.server.setsockopt(socket.SOL_S...
scrape_scene_image_Robothor.py
import json import os import sys sys.path.append(".") # Assume script run in project root directory from multiprocessing import Process, Queue import argparse from ai2thor.controller import BFSController from datasets.offline_sscontroller import SSController def parse_arguments(): parser = argparse.ArgumentParser...
test_flow_interval_dump_load.py
import multiprocessing import os import time import threading import pytest import numpy as np from jina import Document, Flow @pytest.fixture def config(tmpdir): os.environ['JINA_FLOW_DUMP_LOAD_INTERVAL_WORKSPACE'] = str(tmpdir) yield del os.environ['JINA_FLOW_DUMP_LOAD_INTERVAL_WORKSPACE'] @pytest.f...
notify.py
#!/usr/bin/env python3 # _*_ coding:utf-8 _*_ import base64 import hashlib import hmac import json import os import re import threading import time import urllib.parse import requests # 原先的 print 函数和主线程的锁 _print = print mutex = threading.Lock() # 定义新的 print 函数 def print(text, *args, **kw): """ 使输出有序进行,不出现多线...
buildTaxisCSVConcurrent.py
import multiprocessing import time import sys import datetime import os import csv import json # Directory where the original .csv files were downloaded to, using downloadTaxisCSVs.py: CSV_DIR = '/lucenedata/nyc-taxi-data' normalize = { 'vendorid': 'vendor_id', 'vendor_id': 'vendor_id', 'vendor_name': 'vendor_n...
server.py
# server.py # -*- coding: utf8 -*- # vim:fileencoding=utf8 ai ts=4 sts=4 et sw=4 # Copyright 2009 National Research Foundation (South African Radio Astronomy Observatory) # BSD license - see LICENSE for details """Servers for the KAT device control language.""" from __future__ import absolute_import, division, print_...
common.py
# SPDX-FileCopyrightText: Copyright (c) 2020 Dan Halbert for Adafruit Industries # # SPDX-License-Identifier: MIT """ `_bleio.common` ======================================================================= _bleio implementation for Adafruit_Blinka_bleio * Author(s): Dan Halbert for Adafruit Industries """ from __futu...
qastockbase.py
# """ stock_base """ import uuid import datetime import json import os import threading import requests import pandas as pd import pymongo from qaenv import (eventmq_ip, eventmq_password, eventmq_port, eventmq_username, mongo_ip) import QUANTAXIS as QA from QUANTAXIS.QAARP import QA_Risk, QA_User ...
py3_game_client.py
#!/usr/bin/env python import sys import json import asyncio from time import sleep import random from multiprocessing import Process import websockets class GameClient: def __init__(self): self.handle = '' self.pair_handle = '' self.open_positions = '' self.my_move = False def...
test_autotvm_measure.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 u...
client.py
import logging try: import queue except ImportError: # pragma: no cover import Queue as queue import signal import ssl import threading import time import six from six.moves import urllib try: import requests except ImportError: # pragma: no cover requests = None try: import websocket except Impo...
BeamTiltFixer.py
# The Leginon software is Copyright 2004 # The Scripps Research Institute, La Jolla, CA # For terms of the license agreement # see http://ami.scripps.edu/software/leginon-license # import threading import sys import wx from leginon.gui.wx.Choice import Choice from leginon.gui.wx.Entry import FloatEntry, IntEntry, EVT...
get_background.py
# -*-coding:utf-8-*- import imghdr import json import os import random import shutil import threading import time from concurrent.futures import ThreadPoolExecutor from concurrent.futures._base import Future from typing import Dict, List import requests import configurator as configr import const_config as const impo...
plugin.py
import threading from binascii import hexlify, unhexlify from electrum_ltc.util import bfh, bh2u from electrum_ltc.bitcoin import (b58_address_to_hash160, xpub_from_pubkey, TYPE_ADDRESS, TYPE_SCRIPT, is_segwit_address) from electrum_ltc import consta...
example_test.py
from __future__ import print_function, unicode_literals import os import re import socket import ssl from threading import Event, Thread import ttfw_idf SERVER_CERTS_DIR = 'server_certs/' def _path(f): return os.path.join(os.path.dirname(os.path.realpath(__file__)),f) def get_my_ip(): s = socket.socket(s...
ppo_discrete_step_parallel.py
import pickle from collections import deque from copy import deepcopy import gym import numpy as np import torch import torch.nn as nn import torch.optim as optim import torch.multiprocessing as mp from torch.distributions import Categorical from torch.utils.data import DataLoader from torch.utils.tensorboard import S...
gui_simple.py
""" This is the main script of main GUI of the simple Atom Probe control GUI. @author: Mehrpad Monajem <mehrpad.monajem@fau.de> """ import numpy as np import threading import datetime import os # PyQt and PyQtgraph libraries from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtCore import QThread, pyqtSignal from P...
run_car_ai.py
# coding: utf-8 # ロボットカー自走コード print("loading...") import time import logging import threading import numpy as np #from fabolib.kerberos import Kerberos from fabolib.kerberos_vl53l0x import KerberosVL53L0X as Kerberos from fabolib.car import Car from fabolib.config import CarConfig from lib.spi import SPI from lib.ai im...
ucseventhandler.py
# Copyright 2013 Cisco Systems, 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 applicable law or agreed to in writin...
lisp-itr.py
# ----------------------------------------------------------------------------- # # Copyright 2013-2019 lispers.net - Dino Farinacci <farinacci@gmail.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...
remote_manager.py
# Copyright (c) 2019 PaddlePaddle 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 app...
udp_peer.py
import socket import sys import select import threading def receive_fct(): global running contor = 0 while running: # Apelam la functia sistem IO -select- pentru a verifca daca socket-ul are date in bufferul de receptie # Stabilim un timeout de 1 secunda r, _, _ = select.select([s],...
notification_rule.py
import logging from cryptography.fernet import Fernet, InvalidToken from alerta.app import db from threading import Thread import smtplib from twilio.rest import Client from twilio.base.exceptions import TwilioRestException from sendgrid import SendGridAPIClient from sendgrid.helpers.mail import Mail from alerta.mo...
googleasr.py
""" A Module that offers different types of real time speech recognition. """ import queue import threading from retico_core import * from retico_core.text import SpeechRecognitionIU from retico_core.audio import AudioIU from google.cloud import speech as gspeech class GoogleASRModule(AbstractModule): """A Modul...
error.py
import logging import threading import uuid from logging.config import dictConfig from configs.configs import redis_key_expiry, shared_storage_path,error_prefix from .errorrepo import ErrorRepo from utils.datasetutils import DatasetUtils from service.cronrepo import StoreRepo from datetime import datetime log = loggin...
echoapp_client.py
import websocket from threading import Thread import time import sys def on_message(ws, message): print(message) def on_error(ws, error): print(error) def on_close(ws, close_status_code, close_msg): print("### closed ###") def on_open(ws): def run(*args): for i in range(3): #...
mate.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2018 JiNong, Inc. # All right reserved. # """ Base Mate를 정의함. """ import time import util import logging import logging.handlers import traceback from calibration import Calibrator from threading import Thread from mblock import MBlock, BlkType from ...
WIFIAutoCon.py
import requests import time import datetime import os import sys from threading import Thread from win10toast import ToastNotifier def loginCampusNetwork(): #登录地址 post_addr="http://172.16.30.45//drcom/login" #构造头部信息 post_header={ 'Accept': 'text/javascript, application/javascript, application/ecma...
remote.py
# Copyright (c) 2014-present PlatformIO <contact@platformio.org> # # 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...
test_autograd.py
# Owner(s): ["module: autograd"] import contextlib import gc import io import math import os import random import sys import tempfile import threading import time import unittest import uuid import warnings import operator from copy import deepcopy from collections import OrderedDict from itertools import product from...
get_gt_LOD_sdf_only.py
import numpy as np #import cv2 import os import h5py from multiprocessing import Process, Queue, Lock import queue import time import binvox_rw #import mcubes import argparse import utils import cutils #note that the cells and voxels are not aligned # = = = = = = = = = voxel # |-----| |-----| voxel /4 # |-------...
core.py
import os import sys import datetime import json import urllib.parse import logging from threading import Thread from requests.utils import requote_uri from modules.cdGetLowest import getLowestSources from collections import OrderedDict class ModuleManager(): """docstring for ModuleManager""" def __init__(se...
base.py
# Copyright 2014 ETH Zurich # # 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 writing, sof...
plugin.py
import base64 import re import threading from binascii import hexlify, unhexlify from functools import partial from denariium.bitcoin import (bc_address_to_hash_160, xpub_from_pubkey, public_key_to_p2pkh, EncodeBase58Check, TYPE_ADDRESS, TYPE_SCRIPT, ...
simple_request_test.py
from src.api_server import APIServer import threading from src.dep_controller import DepController from src.req_handler import ReqHandler from src.node_controller import NodeController from src.scheduler import Scheduler from src.load_balancer import LoadBalancer import unittest import time _nodeCtlLoop = 2 _depCtlLoo...
worker.py
""" Provide the Worker Node of the MapReduce Framework Warning: Ports 8080 and 8081 are reserved for the JobTracker(MasterNode) """ from .utils import zmq_addr, msg_deserialize, msg_serialize, get_host_ip, do_broadcast from threading import Semaphore, Thread from os.path import relpath, isdir from uuid impo...
gspeech.py
import audioop from contextlib import contextmanager from ctypes import CFUNCTYPE, c_char_p, c_int, cdll from threading import Thread import speech_recognition as sr import pyaudio # Provides Python bindings for PortAudio, the cross platform audio API from ava import VirtualAssistant CHUNK = 8000 # Smallest unit of...
MultiDimensionalProcessing.py
import typing import gettext import copy import numpy import scipy.ndimage import threading import time from nion.data import Core from nion.data import DataAndMetadata from nion.data import Calibration from nion.swift.model import Symbolic from nion.swift.model import Schema from nion.swift.model import DataStructure...
kthread.py
''' kthread.py: A killable thread implementation. Copyright (C) 2004 Connelly Barnes (connellybarnes@yahoo.com) This module allows you to kill threads. The class KThread is a drop-in replacement for threading.Thread. It adds the kill() method, which should stop most threads in their tracks. This library is free so...
contoh2.py
from multiprocessing import Process,Pipe A = 10 B = 10 def kirim(koneksi): A = [15,25,35] koneksi.send(A) print('Nilai yang dikirim :',A,B) koneksi.close() def terima(koneksi): print('Nilai yang diterima :',koneksi.recv(),B) if __name__ == '__main__': PipaIn,PipaOut = Pipe() ProsesKirim ...
update.py
import os import sys import django sys.path.append(os.path.join(os.path.dirname(__file__), "..")) os.environ.setdefault("DJANGO_SETTINGS_MODULE", "infomate.settings") django.setup() import re import logging import socket from datetime import timedelta, datetime from urllib.parse import urlparse from time import mktim...
test_comms.py
import asyncio import os import sys import threading import types import warnings from functools import partial import dask import distributed import pkg_resources import pytest from distributed.comm import ( CommClosedError, connect, get_address_host, get_local_address_for, inproc, listen, ...
grid.py
""" Codes to submit multiple jobs to JCVI grid engine """ import os.path as op import sys import re import logging from multiprocessing import Process, Queue, cpu_count from jcvi.formats.base import write_file, must_open from jcvi.apps.base import OptionParser, ActionDispatcher, popen, backup, \ mkdir, s...
MRQ1.py
import duplexPort import threading import time # init duplex port def TestCallback(): while True: time.sleep(1) #duplexPort.init(testcallback) testcallback = threading.Thread(target=TestCallback) testcallback.start() duplexPort.init(testcallback) volume = 0 # range 0-127 clock0 = 0 # range 1-127 clock1 = 0 # rang...
bot.py
import logging from threading import Thread from time import sleep import os import json import schedule #from django.utils.timezone import localtime, now from apiai import ApiAI from backend.models import Push, FacebookUser, Wiki from .fb import send_text, send_buttons, button_postback, PAGE_TOKEN from .handlers.pay...
bot.py
# -*- coding: utf-8 -*- """ The MIT License (MIT) Copyright (c) 2017-2019 TwitchIO 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...
Matrix_Work_Queue.py
#!/usr/bin/python import os import sys import zmq import numpy as np from mpi4py import MPI from multiprocessing import Process, Value # Procedure executed by the control process def control_dispatch(port, persist, progress, last_line): context = zmq.Context() socket = context.socket(zmq.REP) socket.bind("tcp...
test_generator.py
import functools import os import threading import unittest import numpy import six import cupy from cupy import core from cupy import cuda from cupy.random import generator from cupy import testing from cupy.testing import attr from cupy.testing import condition from cupy.testing import hypothesis def numpy_cupy_e...
FLandmarks2D.py
from typing import Tuple import cv2 import numpy as np import numpy.linalg as npla from ..math import Affine2DMat, Affine2DUniMat from .ELandmarks2D import ELandmarks2D from .FRect import FRect from .IState import IState class FLandmarks2D(IState): def __init__(self): """ Describes 2D face landma...
06-4-share-child-synchronize.py
#!/usr/bin/env python """Test parent and child processes sharing a run. Synchronize worker process to insure the order of logging.""" import multiprocessing as mp import wandb import yea def worker_process(run, i): with i.get_lock(): i.value += 1 run.log({"i": i.value}) def main(): wandb.r...
WebFuzzer.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # This material is part of "The Fuzzing Book". # Web site: https://www.fuzzingbook.org/html/WebFuzzer.html # Last change: 2020-01-21 11:03:22+01:00 # #!/ # Copyright (c) 2018-2020 CISPA, Saarland University, authors, and contributors # # Permission is hereby granted, free...