source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
unsync.py | import asyncio
import concurrent
import functools
import inspect
import threading
import os
from threading import Thread
from typing import Generic, TypeVar
class unsync(object):
thread_executor = concurrent.futures.ThreadPoolExecutor()
process_executor = None
loop = asyncio.new_event_loop()
thread = ... |
botapi.py | # -*- coding: utf-8 -*-
"""Unofficial Telegram Bot API
.. _Google Python Style Guide:
http://google.github.io/styleguide/pyguide.html
"""
from requests import Request, Session
from collections import namedtuple
from abc import ABCMeta, abstractmethod
from threading import Thread
from enum import Enum
import json... |
run_mndo.py | #!/usr/bin/env python2
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
#
# ... |
bsplayer.py | # -*- coding: utf-8 -*-
__soap_format = (
'<?xml version="1.0" encoding="UTF-8"?>\n'
'<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" '
'xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" '
'xmlns:xsi="http://www.w3.org/2001/XM... |
_stack.py | # Copyright 2016-2021, Pulumi 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 law or agreed t... |
pyminer.py | #!/usr/bin/python
#
# Copyright (c) 2011 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
import... |
Experiment.py | import logging
import os.path as op
import time
from os import remove, rmdir, walk
from threading import Thread
from . import Tests
from . import Adb
import paths
from .Devices import Devices
from .Profilers import Profilers
from .Scripts import Scripts
from .util import ConfigError, makedirs, slugify_dir
# noinspec... |
et_server.py | import socket
import time
import sys
import json
import threading
from talon import eye, ctrl, tap
from talon_plugins.eye_mouse import tracker, menu, config
from talon.track.geom import Point2d, EyeFrame
IP = 'localhost'
PORT = 8324
BUFFER_SIZE = 1024
class EyeTrackingServer:
def __init__(self):
self._c... |
twisted_socket.py | from socket import AF_INET, SOCK_STREAM, socket, SOL_SOCKET, SO_REUSEADDR
#from threading import Thread
#from multiprocessing import Process
from twisted.internet import reactor, protocol
class Echo(protocol.Protocol):
def dataReceived(self, data):
self.transport.write(data)
def main(port):
factory = ... |
managers.py | #
# Module providing the `SyncManager` class for dealing
# with shared objects
#
# multiprocessing/managers.py
#
# Copyright (c) 2006-2008, R Oudkerk
# Licensed to PSF under a Contributor Agreement.
#
from __future__ import absolute_import
#
# Imports
#
import sys
import threading
import array
from traceback import ... |
runner.py | from threading import Thread
from queue import Queue
from franQ import Env, Replay, Agent, common_utils
import torch
from torch import Tensor
from torch.utils.tensorboard import SummaryWriter
import typing as T
from pathlib import Path
import itertools
from franQ.common_utils import TimerSummary
import copy
class Run... |
executors.py | __author__ = "Johannes Köster"
__contributors__ = ["David Alexander", "Soohyun Lee"]
__copyright__ = "Copyright 2015, Johannes Köster"
__email__ = "koester@jimmy.harvard.edu"
__license__ = "MIT"
import os
import sys
import contextlib
import time
import datetime
import json
import textwrap
import stat
import shutil
imp... |
UR3_move.py | #!/usr/bin/env python
import time
import roslib; roslib.load_manifest('ur_driver')
import rospy
import actionlib
from control_msgs.msg import *
from trajectory_msgs.msg import *
from sensor_msgs.msg import JointState
from std_msgs.msg import Float32
from math import pi
import serial
from numpy import * ... |
server.py | import socket
import threading
import pickle
import json
from chessProtocol import ChessProtocol
from match import Match
from player import Player
from arguments import get_args
class Server:
""" Responsible for all inter game management between games!! """
def __init__(self):
self.args = get_args()
... |
test_urllib.py | """Regresssion tests for what was in Python 2's "urllib" module"""
import urllib.parse
import urllib.request
import urllib.error
import http.client
import email.message
import io
import unittest
from unittest.mock import patch
from test import support
import os
try:
import ssl
except ImportError:
ssl = None
im... |
baseline_externalDynamics.py | from argparse import ArgumentParser
import airsimdroneracinglab as airsim
import cv2
import threading
import time
import utils
import numpy as np
import math
from controller import simulate
import transformations
def State(phase, idx=None, coord=None):
return {'phase': phase, 'id': idx, 'coord': coord}
def to_lis... |
server.py | import json
import logging
import os
import uuid
from typing import List
import sys
import cache
import math
import base64
from random import randint
from multiprocessing import Process, Pool
from threading import Thread
import boto3
import botocore
from botocore.config import Config
import requests
import uvicorn as ... |
camera.py | #!/usr/bin/python
'''
MIT License
Copyright (c) 2018 Sigmur
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, modify, merg... |
car_control.py | # Copyright (c) 2014, Linh Nguyen <nvl1109@gmail.com>
# All rights reserved.
from __future__ import division
import os
import rospkg
import threading
import time
import math
import rospy
from python_qt_binding.QtCore import Qt, QTimer, Slot
from python_qt_binding.QtGui import QKeySequence, QShortcut, QWidget
from pyt... |
User.py |
import services.LogInService as lgn
import services.UserService as usr
import socket
import threading
userInfo = lgn.userConnectionObjects()
def startClient(packet):
skt = socket.socket()
miner = lgn.getLogInMiner()
skt.connect((miner[0],int(miner[1])))
skt.send(packet)
skt.close()
def trasacti... |
viewer.py | #!/usr/bin/env python
import argparse
import configparser
import datetime
import threading
import time
import webbrowser
from typing import List, Tuple
import pytz
import flask_wtf
import pymongo
import wtforms
from bson.objectid import ObjectId
from flask import Flask, render_template, request
from javus.settings im... |
buffer_test.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import collections
import unittest
import multiprocessing as mp
import time
import numpy as np
import torch
import nest
import postman
import... |
server.py | """Remote server recorder
=========================
This class acts as a recorder that receives media from a camera and records it
to the network. E.g. the server can be configured
to receive video from a FFmpeg player and send it to the network where a client
player plays the video.
"""
from itertools import accumula... |
webgui02.py | # Another simple example of how PyMOL can be controlled using a web browser
# using Python's built-in web server capabilities
import SocketServer
import BaseHTTPServer
import time
import cgi
import threading
import traceback
import os, sys, re
from pymol import cmd
from chempy.sdf import SDF
# example 3D sd file
i... |
graham_bazin_greenblatt.py | #!/usr/bin/env python3
# Princípios utilizados:
# Aplica todas as estratégias abaixo nas ações e mostra uma tabela contendo todos os rankings
# A tabela resultante é ordenada pelo resultado da soma dos rankings depois de aplicar essas
# 4 diferentes estratégias
# Graham:
# - [x] 1. Sobrevivência: Sobreviveu nos últ... |
music_player.py | '''
Kivy music player from Automator
================================
github: https://github.com/Davide255/Automator
module from core.graphics
MIT License
Copyright (c) 2022 Davide
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentat... |
runner.py | #!/usr/bin/env python3
# Copyright 2010 The Emscripten Authors. All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.
"""This is the Emscripten test runner. To run ... |
burst.py | # -*- coding: utf-8 -*-
"""
Burst processing thread
"""
import re
import json
import time
import xbmc
import xbmcaddon
import xbmcgui
from Queue import Queue
from threading import Thread
from urlparse import urlparse
from urllib import unquote
from elementum.provider import append_headers, get_setting, log
from pars... |
misc.py | import shutil
import sys
import os
import tables
import warnings
from threading import Thread
from queue import Queue, Empty
from tierpsy import AUX_FILES_DIR
# get the correct path for ffmpeg. First we look in the aux
# directory, otherwise we look in the system path.
def get_local_or_sys_path(file_name):
file... |
action.py | from django.conf import settings
from django.db import connection
from django.core.management.base import CommandError
from systems.commands.index import CommandMixin
from systems.commands.mixins import exec
from systems.commands import base, args, messages
from systems.api import client
from utility.runtime import Ru... |
server.py | import hmac
import json
import urllib.parse
from .main import PullReqState, parse_commands, db_query, INTERRUPTED_BY_HOMU_RE, synchronize
from . import utils
from .utils import lazy_debug
import github3
import jinja2
import requests
import pkg_resources
from bottle import get, post, run, request, redirect, abort, respo... |
run_multiple.py | #!/usr/bin/env python3
import threading
import subprocess
import time
import datetime
import sys
#print("The Python version is {}".format( sys.version_info))
def popenAndCall(my_list, popenArgs):
"""
Runs the given args in a subprocess.Popen, and then calls the function
onExit when the subprocess complete... |
writer.py | import os
import time
from threading import Thread
from queue import Queue
import cv2
import numpy as np
import torch
import torch.multiprocessing as mp
from alphapose.utils.transforms import get_func_heatmap_to_coord
from alphapose.utils.pPose_nms import pose_nms, write_json
DEFAULT_VIDEO_SAVE_OPT = {
'savepath... |
SerialDataRecorder.py | import getopt
import os
import logging
import sys
import socket
import threading
from Comm.AdcpSerialPortServer import AdcpSerialPortServer
logger = logging.getLogger("Ensemble File Report")
logger.setLevel(logging.DEBUG)
FORMAT = '[%(asctime)-15s][%(levelname)s][%(funcName)s] %(message)s'
logging.basicConfig(format=... |
utils.py | # copyright (c) 2021 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 appli... |
run_jupyter_instance.py | import json
import sys, os
import threading
stdoutlock = threading.Lock()
def read_stdin(stdoutlock, app):
while 1:
l = sys.stdin.readline()
try:
d = json.loads(l)
with stdoutlock:
print(json.dumps({'read_stdin_received':l}))
sys.stdout.flu... |
api.py | import pathlib
import ssl
from threading import Thread
import sanic
from blackburn import load_json_file
from sanic import Sanic, response
from sanic_jwt import Initialize, exceptions, decorators
from sanic_openapi import doc, openapi2_blueprint
import inntinn
"""api: Inntinn scoring and data access API"""
__author... |
graph.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020 Alibaba Group Holding Limited. 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... |
main.py | from bs4 import BeautifulSoup
from threading import Thread
from queue import Queue
import requests
import warnings
import logging
import os
logging.basicConfig(
format = '%(asctime)s %(levelname)-8s %(message)s',
level = logging.INFO,
datefmt = '%Y-%m-%d %H:%M:%S')
def nextn(l, n):
if n == 0:
... |
y_cable_helper.py | """
y_cable_helper.py
helper utlities configuring y_cable for xcvrd daemon
"""
import datetime
import threading
from sonic_py_common import daemon_base, logger
from sonic_py_common import multi_asic
from sonic_y_cable import y_cable
from swsscommon import swsscommon
SELECT_TIMEOUT = 1000
y_cable_platform_s... |
gui.py | import threading
import time
from tkinter import *
from tkinter import ttk
from tkinter.filedialog import askopenfilename
import tkinter as tk
from password_breaker import PassWordBreaker
class GUI:
def __init__(self):
self.root = Tk()
self.root.title = "PassWord Breaker"
self.breaker = ... |
controller.py | #!/usr/bin/env python3
#
# Copyright (c) Bo Peng and the University of Texas MD Anderson Cancer Center
# Distributed under the terms of the 3-clause BSD License.
import os
import sys
import zmq
import time
import threading
from collections import defaultdict
from .utils import env, ProcessKilled
from .signatures import... |
app.py | import numpy as np
import os
import six.moves.urllib as urllib
import sys
import tarfile
import tensorflow as tf
import zipfile
import cv2
import time
from threading import Thread
import importlib.util
from collections import defaultdict
from io import StringIO
from matplotlib import pyplot as plt
from ... |
keep_alive.py | # AUTHOR UNKNOWN
# TAKEN FROM A BOT TEMPLATE FROM REPLIT
from flask import Flask
from threading import Thread
import random
app = Flask('')
@app.route('/')
def home():
return 'Im in!'
def run():
app.run(
host='0.0.0.0',
port=random.randint(2000,9000)
)
def keep_alive():
'''
Creates and starts new thread... |
temporary.py | """Temporary worker module."""
import logging
import os
import threading
import time
from typing import Any, List, Mapping
from celery import Celery
from celery.utils.nodenames import default_nodename
logger = logging.getLogger(__name__)
class TemporaryWorker:
"""Temporary worker that automatically shuts down w... |
ServerMode.py | #!usr/bin/python
__author='''
POZEL
mail us at pozel2017@gmail.com
'''
# Here Importing Module
try:
import Tkinter, ttk
except:
import tkinter as Tkinter
import tkinter.ttk as ttk
# import Modules for Connections'
import socket,threading
# Your Machine Trial Informations
IP_Address = socket.ge... |
subset.py | from flask import Blueprint, jsonify, request, send_file, session, Response
import csv
from uuid import uuid4
from tsx.api.util import db_session, get_user, get_roles
from tsx.config import data_dir
import os
from threading import Thread, Lock
import shutil
import subprocess
import importlib.resources
bp = Blueprint('... |
timer_aggregation_skywalking_core_interface.py | import logging
import threading
import time
from rest.handle_skywalking_alarm import collection_date
logger = logging.getLogger('timer_aggregation_skywalking_core_interface')
logger.setLevel(logging.DEBUG)
def aggregate_alarm(current_times_collection_date):
logger.debug(current_times_collection_date)
def time... |
manual_control_test.py | import random
import threading
import time
def inp_handler(name):
from pynput.keyboard import Controller as KeyboardController
from pynput.keyboard import Key
keyboard = KeyboardController()
time.sleep(0.1)
choices = ["w", "a", "s", "d", "j", "k", Key.left, Key.right, Key.up, Key.down]
NUM_TE... |
do_onedata.py | #!/usr/bin/env python3
#
################################################################################
# Original Author: A.J. Rubio-Montero (http://orcid.org/0000-0001-6497-753X), #
# CIEMAT - Sci-Track Group (http://rdgroups.ciemat.es/web/sci-track), #
# for the EOSC-Synergy project (EU H2020 RI... |
test_distributed_losses.py | # coding=utf-8
# Copyright 2022 Marcel Jahnke
# Copyright 2022 The Google Research Authors.
#
# 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
... |
downloadandunbundle.py | # Copyright (c) 2009-2016 Hewlett Packard Enterprise Development LP
#
# Redistribution and use of this software 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 copyright notice,
# thi... |
start.py | #!/usr/bin/env python3
from threading import Thread, Lock
from colorama import Fore
import socket
import pathlib
import pty
import os
import yaml
import signal
class Host:
def __init__(self, username, hostname, run_cmd, exec_cmd, roscore):
self.username = username
self.hostname = hostname
... |
commands.py | import chainer.functions as F
from chainer import Variable, FunctionSet, optimizers
from chainer.links import caffe
from chainer import computational_graph
from chainer import cuda
from chainer import optimizers
from chainer import serializers
from .tensor import *
from .network import *
from .deel import *
import json... |
tnode.py | #!/usr/bin/python
# Author:
# Marc Pucci (Vencore Labs)
# tnode: traffic node - gen / recv traffic on demand
import socket
import sys
import threading
import time
import json
import Queue
import platform
import os
import string
import subprocess
import copy
import shlex
import tlib
buf = "\x00" * 1024 # buffe... |
module.py | import os
import rospy
import rospkg
import threading
from qt_gui.plugin import Plugin
from python_qt_binding import loadUi
from python_qt_binding.QtWidgets import QWidget
from ros_control_boilerplate.msg import AutoMode
from ros_control_boilerplate.msg import MatchSpecificData
class DriverStationSim(Plugin):
d... |
twisterlib.py | #!/usr/bin/env python3
# vim: set syntax=python ts=4 :
#
# Copyright (c) 2018 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import contextlib
import string
import mmap
import sys
import re
import subprocess
import select
import shutil
import shlex
import signal
import threading
import concurrent.fu... |
mitm_attack.py | import argparse
import os
import subprocess
import threading
import time
from pathlib import Path
from typing import List
from dhalsim.network_attacks.utilities import launch_arp_poison, restore_arp
from dhalsim.network_attacks.synced_attack import SyncedAttack
class MitmAttack(SyncedAttack):
"""
This is a M... |
Overlay.py | import threading
from ctypes.wintypes import PRECT
from time import sleep
import win32api
import win32con
import win32gui
import win32ui
"""
File:Overlay.py
Description:
Class to support drawing lines and text which would overlay the parent screen
Author: sumzer0@yahoo.com
to use:
ov = Overlay("")
# key = a ... |
aruco_lib_localization_distributed_stand_alone.py |
import numpy as np
import cv2
import cv2.aruco as aruco
import sys, time, math
from copy import deepcopy
from threading import Thread, Lock
class LocalizationTracker():
def __init__(self,
id_to_find,
marker_size,
src,
camera_matrix,
... |
pkb.py | # Copyright 2019 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... |
utils.py | import math
import pickle
import random
import threading
from collections import namedtuple
from enum import Enum
import numpy as np
import torch
Transition = namedtuple(
'Transition', ('state', 'action', 'reward', 'state_next', 'done')
)
class TestMetric(Enum):
CUMULATIVE_REWARD = 1
BEST_ENERGY = 2
... |
__init__.py | from __future__ import print_function, division, absolute_import
import os
import sys
import shutil
import subprocess
import optparse
import math
import signal
import threading
import atexit
import imp
import re
import pprint
import time
import traceback
import locale
try:
import Queue as queue
except ImportError... |
video_processor.py | #! /usr/bin/env python3
# Copyright(c) 2017 Intel Corporation.
# License: MIT See LICENSE file in root directory.
# NPS
# pulls images from video device and places them in a Queue or starts an inference for them on a network processor
import cv2
import queue
import threading
import time
from ssd_mobilenet_processor ... |
THUNDER.py | import os
import requests
import argparse
import colorama
import sys
import threading
import getpass
def print_usage():
usage = """
########################################
usage : python3 Thunder.py -t {target}
########################################
"""
print(usage)
sys.exit(1)
word... |
task.py | # task.py
# Author: Mason Rowe <mason@rowe.sh>
# Project: pyPatrol-server
# License: WTFPL <http://www.wtfpl.net/>
# Last Updated: 17 Oct 2018
#
# Purpose: Dispatches a single service check to three pyPatrol-node workers and checks
# the results for a status change. If a status change has occured, notify the
#... |
twistlet.py | # Copyright 2013 The greplin-twisted-utils Authors.
#
# 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... |
sqlinstance.py | # -*- coding: utf-8 -*-
# --------------------------------------------------------------------------
# Copyright Commvault 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 a... |
xla_client_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... |
test_imperative_thread_local_has_grad.py | # Copyright (c) 2021 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 ap... |
simulator.py | #!/usr/bin/env python
import argparse
import logging
import time
import sys
import threading
from MqttHandler import MqttHandler
logger = logging.getLogger(__name__)
running = True
def _initializeLogging(loglevel):
numeric_level = getattr(logging, loglevel.upper(), None)
if not isinstance(numeric_level, int):
... |
runner.py | #!/usr/bin/env python2
# Copyright 2010 The Emscripten Authors. All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.
"""This is the Emscripten test runner. To run ... |
multiprocess_vector_env.py | from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from builtins import * # NOQA
from future import standard_library
standard_library.install_aliases() # NOQA
from multiprocessing import Pipe
from multiprocessing import... |
test_discovery_and_monitoring.py | # Copyright 2014-present MongoDB, 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 wri... |
acquisition.py | #
# COPYRIGHT:
# The Leginon software is Copyright 2003-2012
# The Scripps Research Institute, La Jolla, CA
# For terms of the license agreement
# see http://ami.scripps.edu/software/leginon-license
#
'''
Acquisition node is a TargetWatcher, so it receives either an ImageTargetData
or an ImageT... |
main.py | import pyvirtualcam
import numpy as np
import cv2
from tkinter import Tk, Label, Button, Toplevel, StringVar, OptionMenu
from yaml import load, dump, FullLoader
import random
import threading
from PIL import Image, ImageTk
import os
root = Tk()
# Load settings
try:
with open('options.yml') as f:
... |
trezor.py | from binascii import hexlify, unhexlify
from collections import defaultdict
import traceback
import sys
from electroncash.util import bfh, bh2u, versiontuple, UserCancelled
from electroncash.bitcoin import (b58_address_to_hash160, xpub_from_pubkey, deserialize_xpub,
TYPE_ADDRESS, TYPE... |
__init__.py | import struct, socket, threading, json, os, pickle
from essentials import tokening
import essentials
import copy
import time
from hashlib import sha1
import base64
import time
import six
PYTHONIC = "python based"
WEBONIC = "web based"
LEGACY = "legacy"
def SocketDownload(sock, data, usage=None):
"""
Helpe... |
viewer.py | import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
import procon
from threading import Thread, Lock
from collections import deque
FPS = 30
STICK_MAX = 2**15
LEN_QUEUE = 30
DEADZONE_RADIUS = 0.05
def main():
L = np.zeros(2)
mutex = Lock()
def get_leftstic... |
test_action.py | import pickle
from functools import reduce
from threading import Thread
from unittest import TestCase
from actionpack import Action
from actionpack.action import Result
from actionpack.utils import pickleable
from tests.actionpack import FakeAction
from tests.actionpack import FakeFile
from tests.actionpack.actions i... |
db.py | # -*- coding: utf-8 -*-
# Copyright 2014 matrix.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 applicable law o... |
mininglove.py | import binascii
import hashlib
from PoolSetting import STANDARD_RETURN, MAIN_SETTING
import asyncio
import socket
import json
import base58
import threading
import zmq
import secrets
import requests
import time
import datetime
from decimal import *
import re
import tornado.web
import tornado.websocket
from tornado.pla... |
run_mujoco_all.py | from baselines.ppo2 import run_mujoco
from baselines import bench, logger
from multiprocessing import Process
import numpy as np
def arg_parser():
"""
Create an empty argparse.ArgumentParser.
"""
import argparse
return argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
... |
test_kudu.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... |
email.py |
# Copyright 2016 The COMPEIT Consortium
#
# 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 w... |
THREADPractice.py | import threading
from random import randint
from time import sleep
def print_number(number):
# Sleeps a random 1 to 10 seconds
rand_int_var = randint(1, 10)
sleep(rand_int_var)
print("Thread " + str(number) + " slept for " + str(rand_int_var) + " seconds")
thread_list = []
for i in range(1, 10):
... |
util.py | """Test utilities.
.. warning:: This module is not part of the public API.
"""
import multiprocessing
import os
import pkg_resources
import shutil
import tempfile
import unittest
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization
import mock
import OpenS... |
utils.py | from bitcoin.rpc import RawProxy as BitcoinProxy
from lightning import LightningRpc
import logging
import os
import re
import sqlite3
import subprocess
import threading
import time
BITCOIND_CONFIG = {
"rpcuser": "rpcuser",
"rpcpassword": "rpcpass",
"rpcport": 18332,
}
LIGHTNINGD_CONFIG = {
"bitcoin... |
base.py | """Base class for nbviewer tests.
Derived from IPython.html notebook test case in 2.0
"""
#-----------------------------------------------------------------------------
# Copyright (C) Jupyter Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distribut... |
ctpGateway.py | # encoding: UTF-8
'''
vn.ctp的gateway接入
考虑到现阶段大部分CTP中的ExchangeID字段返回的都是空值
vtSymbol直接使用symbol
'''
print('loading ctpGateway.py')
import os
import json
# 加载经booster编译转换的SO API库
from vnpy.trader.gateway.ctpGateway.vnctpmd import MdApi
from vnpy.trader.gateway.ctpGateway.vnctptd import TdApi
print(u'loaded vnctpmd/vnctpt... |
spot_tests.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import subprocess
from time import *
from datetime import *
import unittest
import ast
sys.path.append(os.getenv('SCRIPT_DIR'))
from constants import *
sys.path.append(os.getenv('CEPS_DIR') + "binance")
sys.path.append(os.getenv('CEPS_DIR') + "bybit")
from strategy... |
run-tests.py | #!/usr/bin/env python
#
# 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 "Li... |
matrix.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020 by Murray Altheim. All rights reserved. This file is part of
# the Robot OS project and is released under the "Apache Licence, Version 2.0".
# Please see the LICENSE file included as part of this package.
#
import sys, time, threading
from colorama impo... |
binanceMoonShot.py | """
Disclaimer
All investment strategies and investments involve risk of loss.
Nothing contained in this program, scripts, code or repositoy should be
construed as investment advice.Any reference to an investment's past or
potential performance is not, and should not be construed as, a recommendation
or as a guarantee... |
monitor.py | import threading
import time
import fedn.common.net.grpc.fedn_pb2 as alliance
import fedn.common.net.grpc.fedn_pb2_grpc as rpc
import grpc
from fedn.common.storage.db.mongo import connect_to_mongodb
from google.protobuf.json_format import MessageToDict
class Monitor:
""" A client that listens to the status steam... |
dataPreparation.py | # native imports
import datetime
import pandas
# front-end imports
import streamlit as st
import sys
sys.path.append('./source/bobcat')
from bobcat import main as bobcat
from multiprocessing import Process
@st.cache(allow_output_mutation=True)
def getDataFromYML(files):
file_names = [file.name for file in files... |
client.py | #!/usr/bin/env python
import os
import sys
import logging
import signal
from argparse import ArgumentParser, RawDescriptionHelpFormatter
from functools import partial, wraps
from getpass import getpass, getuser
from json import dumps
from os.path import abspath
from socket import create_connection
from textwrap import... |
client.py | import socket
import threading
import tkinter.scrolledtext
from tkinter import *
from tkinter.font import BOLD
import pickle
import re
class Client:
def __init__(self,IP,userName,UIObject):
self.BUFFER = 1000000
self.IP = IP
self.userName = userName
self.isOwner = False
... |
executor.py | import logging
from threading import Thread
import asyncio
import aiojobs
from attrdict import AttrDict
from .message import ActorMessage
from .helper import unsafe_kill_thread, auto_restart_when_crash
from .registery import ActorRegistery
from .client import AsyncActorClient, ActorClient
from .queue import ActorMess... |
spider.py | import re
import os
import json
import time
from bs4 import BeautifulSoup
import utils
import db
import conf
import multiprocessing
config = conf.getconfig()
alljsonpath = './infolist/all.json'
def getsubinfo(htmlstr):
subsoup = BeautifulSoup(htmlstr, "lxml")
sublistitem = subsoup.select('#list_videos_common... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.