source
stringlengths
3
86
python
stringlengths
75
1.04M
utils.py
# -*- coding: utf-8 -*- ''' Created on Mar 3, 2017 @author: hustcc ''' from functools import wraps from threading import Thread import json import click import datetime import copy #from webhookit import app import webhookit try: unicode # noqa except NameError: # py3 the_unicode = str # noqa else: # ...
blocks.py
import os import time from concurrent.futures import ThreadPoolExecutor, as_completed from datetime import datetime, timedelta from threading import Thread from hive_plug_play.engine.processor import BlockProcessor from hive_plug_play.hive.server_requests import make_request from hive_plug_play.utils.tools import UTC_...
test_daq_device.py
# Test daq device. # # Copyright (C) 2010-2012 Huang Xin # # See LICENSE.TXT that came with this file. import time import Pyro.core import threading import Queue from SpikeRecord.Plexon.PlexClient import PlexClient from SpikeRecord.Plexon.PlexUtil import PlexUtil from Experimenter.Experiments.Experiment import Experim...
deadlock.py
import random import time import threading from typing import List threads: List[threading.Thread] = [None] lock_map = {} def go_wait(): # Wait for other threads to initialize time.sleep(0.25) # Pick a thread at random thread = random.choice( list(filter(lambda k: k != threading.current_threa...
test_nce_remote_table_op.py
# Copyright (c) 2018 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...
scanner.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jun 23 12:18:41 2020 @author: edoardottt """ import socket import threading import time import os import struct from netaddr import IPNetwork, IPAddress from ctypes import * # host to listen on host = "192.168.0.180" # subnet to target subnet = "192...
auv_geometric_tracking_controller.py
#!/usr/bin/env python3 # Copyright (c) 2020 The Plankton Authors. # All rights reserved. # # This source code is derived from UUV Simulator # (https://github.com/uuvsimulator/uuv_simulator) # Copyright (c) 2016-2019 The UUV Simulator Authors # licensed under the Apache license, Version 2.0 # cf. 3rd-party-licenses.txt ...
controller_client.py
#################################################################### # Ruben Cardenes, Clay L. McLeod -- Feb 2020 # # File: controller_client.py # # Description: This script has to be executed on the computer connected to a # Playstation 4 Controller by USB. No driver installation needed, # ...
stateful.py
from __future__ import division import contextlib import datetime import os import time import threading try: # If galaxy-lib or Galaxy 19.05 present. from galaxy.tools.deps.dependencies import DependenciesDescription except ImportError: # If galaxy-tool-util or Galaxy 19.09 present. from galaxy.tool_...
test_ssl.py
# -*- coding: utf-8 -*- # Test the support for SSL and sockets import sys import unittest from test import test_support as support import asyncore import socket import select import time import datetime import gc import os import errno import pprint import tempfile import urllib2 import traceback import weakref import...
pa_wangyi_singer.py
# ็ˆฌๅ–็ฝ‘้กตไบ‘้Ÿณไน ๆ‰€ๆœ‰ๆญŒๆ‰‹/ๅ›ข้˜Ÿๅๅญ— ๅ’Œ ้“พๆŽฅ import json import gevent import requests import threading from lxml import etree def request_url(url): headers = { 'user-agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36', } response = requests.get...
remind.py
# coding=utf8 """ remind.py - Willie Reminder Module Copyright 2011, Sean B. Palmer, inamidst.com Licensed under the Eiffel Forum License 2. http://willie.dftba.net """ from __future__ import unicode_literals import os import re import time import threading import collections import codecs from datetime import dateti...
firecracker_microvm.py
import asyncio import dataclasses import logging from dataclasses import dataclass, field from enum import Enum from multiprocessing import Process, set_start_method from os import system from os.path import isfile, exists from typing import Optional, Dict, List import msgpack try: import psutil as psutil except ...
add_code_to_python_process.py
r''' Copyright: Brainwy Software Ltda. License: EPL. ============= Works for Windows relying on a fork of winappdbg which works in py2/3 (at least for the part we're interested in). See: https://github.com/fabioz/winappdbg (py3 branch). Note that the official branch for winappdbg is: https://github.com/MarioVilas/wi...
Crappify.py
import argparse #to pass location from threading import Thread from PIL import Image, ImageDraw, ImageFont from pathlib import Path import random ap = argparse.ArgumentParser(description="Create low-res copies of our data and add random noise to it") #Argument object ap.add_argument("-l","--location", required = True...
java_gateway.py
# -*- coding: UTF-8 -*- """Module to interact with objects in a Java Virtual Machine from a Python Virtual Machine. Variables that might clash with the JVM start with an underscore (Java Naming Convention do not recommend to start with an underscore so clashes become unlikely). Created on Dec 3, 2009 :author: Barthe...
train.py
""" @author: Viet Nguyen <nhviet1009@gmail.com> """ import os os.environ['OMP_NUM_THREADS'] = '1' import argparse import torch from src.env import create_train_env from src.model import Mnih2016ActorCritic AC_NN_MODEL = Mnih2016ActorCritic from src.optimizer import GlobalRMSProp from src.process import local_train, l...
test_content.py
from __future__ import print_function import os import re import sys import json import time import argparse import threading import subprocess import traceback from time import sleep import datetime from distutils.version import LooseVersion import pytz from google.cloud import storage from google.api_core.exception...
scu.py
from enum import Enum import time import serial from threading class Status(Enum): STOPPED = 'S' JOGGINGFORWARD ='F' JOGGINGREVERSE= 'R' PAUSED = 'P' ERROR = 'E' class ProtcolMessage(Enum): ENQ = chr(133) # <ENQ> in acsii + 128 NULL = chr(128) # <Null>: 0 + 128 ACK = chr(134) # 6 + 128 CR = ...
__init__.py
from flask import Flask, render_template, request, redirect, url_for from flask_mail import Mail, Message from threading import Thread from flask_sqlalchemy import SQLAlchemy import os from models import * base_url = os.path.abspath(os.path.dirname(__file__)) app = Flask(__name__) app.config['MAIL_SERVER'] = 'smtp...
halo.py
# -*- coding: utf-8 -*- # pylint: disable=unsubscriptable-object """Beautiful terminal spinners in Python. """ from __future__ import absolute_import, unicode_literals import atexit import functools import sys import threading import time import cursor from log_symbols.symbols import LogSymbols from spinners.spinners...
opus_server.py
import asyncio import zlib import queue import threading import audioop from google.cloud import speech from opuslib import Decoder from config.config import Config from config.config import Server from config.config import Opus buffer = queue.Queue() buffer_response = queue.Queue() dec = Decoder(Opus.rate, Opus.ch...
console_trend.py
import time import threading import logging import matplotlib.pyplot as plt from analysis.trend import SupportResistance from data import store as store from utils import ui _logger = ui.get_logger(logging.WARNING, logfile='') class Interface: def __init__(self, tickers: list[str] = [], days: int = 1000, quic...
file_observer.py
""" Wraps watchdog to observe file system for any change. """ import logging import threading import uuid from abc import ABC, abstractmethod from pathlib import Path from threading import Thread, Lock from typing import Callable, List, Dict, Optional import docker from docker import DockerClient from docker.errors i...
setup.py
from multiprocessing import Process import subprocess from setup_db import * import time import os DATA_COLLECTOR_PATH = './event_listener.js' DATA_PROCESS_PATH = './process_data.py' def node_call(path,*args): print(f'Node script at {path} called......') p = subprocess.Popen(['node', path,*args], s...
fn_api_runner.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...
serializekiller.py
#!/usr/bin/env python #------------------------------------------------------------------------------- # Name: SerializeKiller # Purpose: Finding vulnerable vulnerable servers # # Author: (c) John de Kroon, 2015 # Version: 1.0.2 #----------------------------------------------------------------------...
__init__.py
import requests import datetime import dateutil import logging import boto3 import gzip import io import csv import time import os import sys import json import hashlib import hmac import base64 from threading import Thread from io import StringIO import azure.functions as func sentinel_customer_id = os.environ.get(...
train.py
# Copyright (c) 2018 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...
utils.py
""" ===== Utils ===== This module define usefull decorators to use with data analysis. """ import os import json import time import logging import random from datetime import datetime, timedelta from multiprocessing import Process from threading import Thread from typing import Callable import re import numpy as np ...
demo_utils.py
import subprocess import time import threading import os import json import web import logging #################################################### # run background services to receive web hooks #################################################### # agent webhook callbacks class webhooks: def GET(self, topic): ...
app.py
# from connexion.resolver import RestyResolver from flask import Flask, render_template from flask import jsonify import connexion from services.bots import Bots from celery import Celery import requests import time import threading import os # Create application instance # app = connexion.FlaskApp(__name__, specifica...
test_processpool.py
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompa...
util.py
# # Copyright (C) 2012-2013 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 shutil import socket import...
test_cidr.py
# Copyright 2021 Google 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 to in writing, s...
cluster.py
""" Higher-level abstraction to start elasticsearch using the elasticsearch binary. Here's how you can use it: import time import threading cluster = ElasticsearchCluster(7541) def monitor(): cluster.wait_is_up() print('elasticsearch is up!', cluster.health()) threading.Thread(ta...
gps.py
"""Provides an interface to a USB GPS device.""" import utm import time import serial import logging import numpy as np from threading import Thread from datetime import datetime import serial.tools.list_ports logger = logging.getLogger(__name__) class GPS(): """GPS object.""" def __init__(self, comport=No...
experiment.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) 2018, Jianfeng Chen <jchen37@ncsu.edu>, Tianpei Xia <txia4@ncsu.edu> # vim: set ts=4 sts=4 sw=4 expandtab smartindent: # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation fil...
toil_wes.py
import os import json import uuid import subprocess import urllib from multiprocessing import Process import functools import logging import sys import time from six import iteritems from cwltool.main import load_job_order from argparse import Namespace from wes_service.util import WESBackend from wes_service.errors i...
gsm.py
import serial import time from threading import Thread, Lock from curses import ascii # Enable Serial Communication ser = serial.Serial() ser.port = "/dev/ttyAMA0" ser.baudrate = 115200 ser.timeout = 1 def doRead(ser, lock): while True: lock.acquire() try: rcv = ser.readline().deco...
test_flight.py
# -*- coding: utf-8 -*- # 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 # "...
test_socket.py
import unittest from test import support import errno import io import itertools import socket import select import tempfile import time import traceback import queue import sys import os import platform import array import contextlib from weakref import proxy import signal import math import pickle import struct impo...
pow_tests.py
# # Pow Default Tests # # # runtest script. # runs test with respect to some paramters # currently only os import sys import pytest # possible sys.platform results: # http://stackoverflow.com/questions/446209/possible-values-from-sys-platform MODELNAME = "pow_test_model" class TestClass: @pytest.mark.notonosx ...
multi_gym_example.py
#!/usr/bin/env python3 import gym import numpy as np import ffai from multiprocessing import Process, Pipe import ffai def worker(remote, parent_remote, env): parent_remote.close() # Get observations space (layer, height, width) obs_space = env.observation_space # Get action space act_space = e...
dummy_host.py
#!/usr/bin/python3 import threading import time import rospy import rosnode import copy import threading from nics_robot_host.srv import * class pos_data(object): def __init__(self,x,y,theta): self.x = x self.y = y self.theta = theta class DummyHost(object): def __init__(self, arg...
test_threading.py
try: from builtins import object except ImportError: pass import time from threading import Thread import logging from transitions.extensions import MachineFactory from .test_nesting import TestNestedTransitions as TestsNested from .test_core import TestTransitions as TestCore from .utils import Stuff, DummyM...
main.py
#!/bin/bash python # [ANDES] (C)2015-2020 Hantao Cui # # 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 3 of the License, or # (at your option) any later version. # # File n...
toolkit.py
# The MIT License (MIT). # Copyright (c) 2015, Nicolas Sebrecht & contributors. import os from threading import Thread def runHook(hookFunc, *args): class Hook(object): def __init__(self): self._stop = True def ended(self): self._stop = False def stop(self): ...
upnp.py
import logging import threading from queue import Queue from typing import Optional try: import miniupnpc except ImportError: pass log = logging.getLogger(__name__) class UPnP: thread: Optional[threading.Thread] = None queue: Queue = Queue() def __init__(self): def run(): t...
main.py
#!/usr/bin/python3 import os from multiprocessing import Process import json from app.client import Consumer from app.engine import Engine def main(): cpu_count = os.cpu_count() processes = [Process(target=start_consumers) for x in range(cpu_count)] for proc in processes: proc.start() prin...
_task.py
"""ESMValtool task definition.""" import abc import contextlib import datetime import logging import numbers import os import pprint import subprocess import sys import textwrap import threading import time from copy import deepcopy from multiprocessing import Pool from multiprocessing.pool import ApplyResult from path...
option_picker.py
import traceback from Tkinter import * from multiprocessing import Queue from tkColorChooser import askcolor import json from string import maketrans, lower import re import ttk import pygame.sysfont from options import Options import logging import urllib2 import webbrowser import platform import threading from error_...
launch.py
# multiprocess server and faceID import multiprocessing import time import os def faceRecog(): os.system("cd $GGPATH/FaceID && python3 -c 'from faceID import *; main()'") def server(): os.system("cd $GGPATH/GGProject && python3 $GGPATH/GGProject/manage.py runserver") if __name__ == '__main__': proc1 = ...
temp_sensor.py
try: from w1thermsensor import W1ThermSensor except Exception as e: print("W1thermsensor not installed. Ok if using sim-mode") import threading from time import sleep class Sensor: def __init__(self, read_interval): self.thread = threading.Thread(target=self._read_temp_thread) self.read_in...
test_safety.py
import threading from nose.tools import eq_ from tornado import httpclient from tornado.testing import gen_test from ddtrace.contrib.tornado import patch, unpatch from . import web from .web.app import CustomDefaultHandler from .utils import TornadoTestCase class TestAsyncConcurrency(TornadoTestCase): """ ...
mupen64plus_env.py
import sys PY3_OR_LATER = sys.version_info[0] >= 3 if PY3_OR_LATER: # Python 3 specific definitions from http.server import BaseHTTPRequestHandler, HTTPServer else: # Python 2 specific definitions from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer import abc import array from contextlib im...
train_pg.py
import numpy as np import tensorflow as tf import gym import roboschool import logz import scipy.signal import os import time import inspect from multiprocessing import Process #============================================================================================# # Utilities #==================================...
__init__.py
import redis from apscheduler.schedulers.blocking import BlockingScheduler from app.common.func import * from app.model.model import PolicyEnum from app.conf.secret import * app_path = os.path.dirname(os.path.realpath(__file__)) redis_pool = redis.ConnectionPool(host=redis_host, port=redis_port, db=redis_db, ...
lf_mapreduce.py
#!/usr/bin/env python # encoding: utf-8 from os import listdir from os.path import isfile, join from azure.storage.queue import QueueService from datetime import datetime from common.common import * import threading import json import random import re def connect_queue(): queue_service = QueueService(ACCOUNT_NAME...
test_square.py
import logging import shlex import threading import unittest import subprocess logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger() logFormatter = logging.Formatter("%(asctime)s [%(threadName)-12.12s] [%(name)-4s] %(message)s") # def launch_client_process_and_stream(command): args = shlex.split...
server.py
from __future__ import with_statement import sys, traceback import json import time import cv2 import globals import base64 import numpy as np from random import randint from threading import Thread from threading import Lock from SimpleWebSocketServer import SimpleWebSocketServer, WebSocket from util import misc_util ...
websocket_connection.py
""" Class used to process Web Socket Connections. Messages sent from the connecting clients, web socket connections, are received in here. """ from __future__ import print_function import gzip import json import logging import time from jupyter_geppetto import settings from pyecore.ecore import EList from pygeppetto....
elfin_gui.py
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Fri Jul 28 12:18:05 2017 @author: Cong Liu Software License Agreement (BSD License) Copyright (c) 2017, Han's Robot Co., Ltd. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provide...
conftest.py
# coding: utf-8 """ """ import getpass import copy import logging import os import random import threading import time import flask import flask_login import pytest import requests import sqlalchemy import sampledb import sampledb.utils import sampledb.config sampledb.config.MAIL_SUPPRESS_SEND = True sampledb.conf...
transaction.py
#!/usr/bin/python3 import functools import re import sys import threading import time from collections import deque from enum import IntEnum from hashlib import sha1 from pathlib import Path from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union from warnings import warn import black import re...
read_img.py
import rospy import numpy as np from sensor_msgs.msg import Image import cv2 from threading import Thread def callback(image): byte_image = image.data np_image = np.frombuffer(byte_image,dtype=np.uint8) bgra_image = np_image.reshape((image.height,image.width,4)) bgr_image = cv2.cvtColor(bgra_image,cv...
DataQueuer.py
import tensorflow as tf import numpy as np import threading from scipy import misc from random import randint import itertools import pre_processor class DataQueuer(object): """ Manages the concurrent fetching of data on the cpu onto the gpu does not guarantee that images are appended in order """ def __init__(s...
mesh_pool.py
import torch import torch.nn as nn from threading import Thread from models.layers.mesh_union import MeshUnion import numpy as np from heapq import heappop, heapify from .mesh_rotation_utils import * class MeshPool(nn.Module): def __init__(self, target, multi_thread=False): super(MeshPool, self).__init__...
pushService.py
#!/usr/bin/python from multiprocessing import Process, Queue from pushSocket import pushSocket from pushWork import pushWork queue = Queue() socket_proc = Process(target=pushSocket, args=(queue,)) work_proc = Process(target=pushWork, args=(queue,)) socket_proc.start() work_proc.start()
mamajenkins.py
#!/usr/bin/python # -*- coding:utf-8 -*- import json import threading import requests import datetime import socket from collections import defaultdict from init import app from flask import render_template, request JENKINS_URL = 'http://wenxianguo:ZXwxg6235269@jenkins.corp.mama.cn/jenkins' PROJECT = [ # 18 ็Žฏๅขƒ ...
parallel.py
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/03a_parallel.ipynb (unless otherwise specified). __all__ = ['threaded', 'startthread', 'set_num_threads', 'ThreadPoolExecutor', 'ProcessPoolExecutor', 'parallel', 'run_procs', 'parallel_gen'] # Cell from .imports import * from .foundation import * from .basic...
termhandler.py
__author__ = 'jbjohnso' # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2014 Lenovo Corporation # # 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/license...
page.py
import json import logging import threading from typing import List, Optional from beartype import beartype from pglet import constants from pglet.connection import Connection from pglet.control import Control from pglet.control_event import ControlEvent from pglet.protocol import Command try: from typing import...
plugin.py
# -*- coding: utf-8 -*- import time import logging import traceback import sys import json from threading import Thread from mamonsu.lib.const import Template class PluginDisableException(Exception): pass class Plugin(object): # can be 'mamonsu' or 'agent' # type depends on run command Type = 'ma...
trainer_controller.py
# # Unity ML-Agents Toolkit # ## ML-Agent Learning """Launches trainers for each External Brains in a Unity Environment.""" import os import threading from typing import Dict, Set, List from collections import defaultdict import numpy as np from mlagents.tf_utils import tf from mlagents_envs.logging_util import get_...
util.py
import os import sys import time import threading import time from os import system if os.name == 'nt': import win32com.client as wincl import pythoncom def pythonpath(): return os.environ['PYTHONPATH'] def println(s): print(s) def write(s): sys.stdout.write(s) sys.stdout.flush() # from ...
exploit.py
#Server base code obtained from: http://www.codexpedia.com/python/python-web-server-for-get-and-post-requests/ #Additional code has been added in do_POST for the assignment, same as malicious gateway post # get_mac address obtained from: http://www.aviran.org/arp-poisoning-python-scapy/ #!/usr/bin/python from scapy.a...
anonserv.py
import socket, sys, os, threading class colors: RED = '\033[31m' YELLOW = '\33[33m' GREEN = '\33[32m' PINK = '\33[35m' WHITE = '\33[37m' def header(): return(colors.RED + ''' โ–„โ–„โ–„ โ–ˆโ–ˆโ–ˆโ–„ โ–ˆ โ–’โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ โ–ˆโ–ˆโ–ˆโ–„ โ–ˆ โ–„โ–ˆโ–ˆโ–ˆโ–ˆโ–„ โ–ˆโ–ˆโ–‘ โ–ˆโ–ˆ โ–„โ–„โ–„ โ–„โ–„โ–„โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–“ โ–’โ–ˆโ–ˆโ–ˆโ–ˆโ–„ โ–ˆโ–ˆ โ–€โ–ˆ โ–ˆ โ–’โ–ˆโ–ˆโ–’ โ–ˆโ–ˆโ–’ โ–ˆโ–ˆ โ–€โ–ˆ โ–ˆ...
loader.py
#!/bin/env python3 """ M040 - Error Handling Lab Loader -------------------------------- This is a multiprocessing script that processes the dataset file in batches, where each spawned process will handle a portion of the file. Usage: loader.py [--uri=<uri>] [--file=<file>] Options: -h --help Show t...
test.py
import threading import os import time import random import requests import json from bit import Key from bit.format import bytes_to_wif import traceback maxPage = pow(2,256) / 128 #maxPage = 904625697166532776746648320380374280100293470930272690489102837043110636675 def getRandPage(): return random...
server.py
# -*- coding: utf-8 -*- from logging import getLogger from threading import Thread from zmq import REQ, REP, Poller, POLLIN, Context, ROUTER, DEALER, proxy import config from translations_server.db import get_translation from translations_server.lib import db _LOG = getLogger(__name__) _ENCODING = "utf-8" _REQUES...
demo_rtp_processes.py
import numpy as np import cv2 from multiprocessing import Process def send(): cap_send = cv2.VideoCapture('videotestsrc ! video/x-raw,framerate=20/1 ! videoscale ! videoconvert ! appsink', cv2.CAP_GSTREAMER) out_send = cv2.VideoWriter('appsrc ! videoconvert ! x264enc tune=zerolatency bitrate=500 speed-preset...
panda_new.py
# Copyright European Organization for Nuclear Research (CERN) # # 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 # # Authors: # - Ralph ...
mtcnn.py
#!/usr/bin/env python3 """ MTCNN Face detection plugin """ from __future__ import absolute_import, division, print_function import os from six import string_types, iteritems import cv2 import numpy as np from lib.multithreading import MultiThread from ._base import BoundingBox, Detector, logger # Must import ten...
test_sys.py
# -*- coding: iso-8859-1 -*- import unittest, test.test_support from test.script_helper import assert_python_ok, assert_python_failure import cStringIO import gc import operator import os import struct import sys class SysModuleTest(unittest.TestCase): def tearDown(self): test.test_support.reap_children()...
inference_webstreaming_socket_text_googleSTT_googleTTS.py
# merge of inference_webstreaming_socket_audio.py, tts_socket_server.py # run this code, then once model is loaded run the stt_stream_socket_client.py code on remote machine # finally run the ffplay command with the appropriate port forwarding etc. to see the results # Alternatively, at the client just run run_streamin...
write_to_s3.py
import time import os import progressbar import threading from glob import glob from boto.s3.connection import S3Connection progress = progressbar.ProgressBar(widgets=[progressbar.Bar('*', '[', ']'), progressbar.Percentage(), ' ']) def files_to_s3(files, bucket_name): ''' INPUT (1) list 'files': all files to...
streamcards.py
#!/usr/bin/env python # -- STOLEN FROM torch-rnn/scripts/streamfile.py -- # import os import threading import time import signal import traceback import psutil # correctly setting up a stream that won't get orphaned and left clutting the operating # system proceeds in 3 parts: # 1) invoke install_suicide_handlers(...
cloud.py
""" Object Store plugin for Cloud storage. """ import logging import multiprocessing import os import shutil import subprocess import threading import time from datetime import datetime from galaxy.exceptions import ObjectInvalid, ObjectNotFound from galaxy.util import ( directory_hash_id, safe_relpath, u...
test_debugger.py
# coding: utf-8 ''' The idea is that we record the commands sent to the debugger and reproduce them from this script (so, this works as the client, which spawns the debugger as a separate process and communicates to it as if it was run from the outside) Note that it's a python script but it'll spawn a ...
client.py
import socket import threading username = raw_input("UserName : ") #socket initialization, IPv4 protocol domain, TCP communication type client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #connecting client to server client.connect(('127.0.0.1', 7976)) def receive(): while True: # ma...
dnsmapIO.py
# -*-coding:utf-8-*- # Copyright (c) 2014, FTW Forschungszentrum Telekommunikation Wien # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above cop...
algo_three.py
from functools import reduce from sys import * import numpy as np import random as r import socket import struct import subprocess as sp import threading from threading import Thread import ast import time import datetime as dt import os import psutil from netifaces import interfaces, ifaddresses, AF_INET import paho.m...
parallel_io.py
#!/usr/bin/python """ (C) Copyright 2020 Intel Corporation. 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 ...
miner.py
import time import threading from .. import blockchain from ..wallet.address import Address from ..util.hash import sha256d REWARD = 5 DIFFICULTY = 2 ** (256 - 21) class Miner(object): def __init__(self, address=None): self.__interrupt = False self.__found = False self.__shutdown = False...
F-box.py
from tkinter import * from tkinter.tix import * #import pyvips from PIL import Image, ImageTk from idlelib.tooltip import Hovertip from tkinter import font import ctypes import win32con from multiprocessing import Process,freeze_support,pool from multiprocessing.dummy import Pool as ThreadPool import threadi...
updown.py
""" Uplink and Downlink handling for communications layer Downlink needs to happen in several stages. First, raw data is read from the adapter. This data is collected in a pool and the pool is passed to a deframer that extracts frames from this pool. Frames are queued and sent to the ground side where they are and pas...
subproc_vec_env.py
import numpy as np from multiprocessing import Process, Pipe from . import VecEnv, CloudpickleWrapper from baselines.common.tile_images import tile_images from gym.envs.classic_control import rendering def worker(remote, parent_remote, env_fn_wrapper): parent_remote.close() env = env_fn_wrapper.x() try: ...
game.py
import threading import copy import time import random import multiprocessing as mp UP = 0 DOWN = 1 LEFT = 2 RIGHT = 3 FREE = 0 WALL = 1 # Game state STOPPED = 0 STARTED = 1 GAMEOVER = 2 class GameError(Exception): pass class PlaygroundError(Exception): pass class Playgrou...
util.py
# Electrum - lightweight Bitcoin client # Copyright (C) 2011 Thomas Voegtlin # # 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 t...