source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
__init__.py | import copy
import pickle
import threading
import requests
import logging
from typing import List
from rocketify_sdk import EventHook
from rocketify_sdk.IntervalRunner import IntervalRunner
class Sdk:
def __init__(self,
api_key: str,
polling_interval_seconds: int... |
test_longrunning_receive.py | #!/usr/bin/env python
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ---------------------------------------------... |
datasets.py | import glob
import math
import os
import random
import shutil
import time
from pathlib import Path
from threading import Thread
import cv2
import numpy as np
import torch
from PIL import Image, ExifTags
from torch.utils.data import Dataset
from tqdm import tqdm
from .utils import xyxy2xywh, xywh2xyxy
help_url = 'htt... |
utils.py | import asyncio
import functools
import html
import importlib
import inspect
import json
import logging
import multiprocessing
import os
import pkgutil
import re
import shutil
import socket
import sys
import tempfile
import threading
import warnings
import weakref
import xml.etree.ElementTree
from asyncio import Timeout... |
TaxonomyAbundanceServer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import json
import os
import random as _random
import sys
import traceback
from getopt import getopt, GetoptError
from multiprocessing import Process
from os import environ
from wsgiref.simple_server import make_server
import requests as _requests
from json... |
model.py | import threading
from typing import Callable, Generator, List, Union
import cupy
from ..seq2seq import Seq2SeqModel
from ...layers.transformer_block import TransformerBlockDecoder, TransformerBlockEncoder
from ...layers.encoder_kv import EncoderKeyValueProjection
from ...layers.position_bias import PositionBias
from ..... |
tutorial016.py | import time
from pydx12 import *
from utils import get_best_adapter, enable_debug, print_debug, setup_debug, Barrier, Rasterizer, Mesh, GLTF, ResourceBuffer
from PIL import Image
import gc
import sys
import time
import random
import numpy
import threading
from queue import Queue
from pyrr import matrix44
import struct
... |
tf_util.py | import joblib
import numpy as np
import tensorflow as tf # pylint: ignore-module
import copy
import os
import functools
import collections
import multiprocessing
def switch(condition, then_expression, else_expression):
"""Switches between two operations depending on a scalar value (int or bool).
Note that bot... |
steering_simulation_old_hand.py |
## @package steering
# Documentation for this module.
#
# Control of Roboys' shoulders, elbows and wrists for steering.
# In order to reach the requested steering-angle we target intermediate points
# between the current and the requested steering-angle to ensure Roboys' hands
# are following the captured steerin... |
utils.py | import os
import time
import signal
import platform
import multiprocessing
import pymysql
import pytest
from mycli.main import special
PASSWORD = os.getenv('PYTEST_PASSWORD')
USER = os.getenv('PYTEST_USER', 'root')
HOST = os.getenv('PYTEST_HOST', 'localhost')
PORT = os.getenv('PYTEST_PORT', 3306)
CHARSET = os.getenv... |
bruteforce.py | import itertools
import string
import random
import sys
import multiprocessing
def bruteforce(charset, maxlen, startposition):
return (''.join(candidate)
for candidate in itertools.chain.from_iterable(itertools.product(charset, repeat=i)
for i in range(startposition, maxlen + 1)))
alnum_ch... |
power_monitoring.py | import random
import threading
import time
from statistics import mean
from cereal import log
from common.params import Params, put_nonblocking
from common.realtime import sec_since_boot
from selfdrive.hardware import HARDWARE
from selfdrive.swaglog import cloudlog
CAR_VOLTAGE_LOW_PASS_K = 0.091 # LPF gain for 5s tau... |
test_server_connection.py | import asyncio
import os
from threading import Thread
from unittest.mock import Mock
import pytest
from pygls.server import LanguageServer
@pytest.mark.asyncio
async def test_tcp_connection_lost():
loop = asyncio.new_event_loop()
server = LanguageServer(loop=loop)
server.lsp.connection_made = Mock()
... |
ramps.py | import random
from queue import Queue
import json
from threading import Thread, Lock, Semaphore
import time
import uuid
import datetime
import logging
import boto3
from motorway.messages import Message
from motorway.ramp import Ramp
from boto3.dynamodb.conditions import Attr
shard_election_logger = logging.getLogger("m... |
ExperimentControl.py | #!/usr/bin/python3
import sys
from threading import Thread
# @license: public domain
# See ExperimentControl.tla for description
class ExperimentControl:
# Init ==
def __init__(self, init_temp=20, low_temp=0, high_temp=50, delta=5):
self.pc = "HEAT"
self.power = "ON"
... |
webcamvideostream.py | import cv2
from threading import Thread
import time
import numpy as np
class WebcamVideoStream:
def __init__(self, src = 0):
print("init")
self.stream = cv2.VideoCapture(src)
(self.grabbed, self.frame) = self.stream.read()
self.stopped = False
time.sleep(2.0)
def st... |
main.py | #! coding:utf-8
# python2 requires: pip install futures
import atexit
from concurrent.futures import (ProcessPoolExecutor, ThreadPoolExecutor,
as_completed)
from concurrent.futures._base import (CANCELLED, CANCELLED_AND_NOTIFIED,
FINISHED, PENDING, ... |
OSC.py | #!/usr/bin/python
"""
This module contains an OpenSoundControl implementation (in Pure Python), based
(somewhat) on the good old 'SimpleOSC' implementation by Daniel Holth & Clinton
McChesney.
This implementation is intended to still be 'simple' to the user, but much more
complete (with OSCServer & OSCClient classes) ... |
serverboards.py | import json
import os
import sys
import select
import time
import io
import threading
import sh as real_sh
from contextlib import contextmanager
plugin_id = os.environ.get("PLUGIN_ID")
# May be overwritten by user program to fore all error to log
stderr = sys.stderr
def ellipsis_str(str, maxs=50):
if len(str) < ... |
multiprocessing_log.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Multiprocessing log rotating file handler
# https://mattgathu.github.io/multiprocessing-logging-in-python/
# https://gist.github.com/JesseBuesking/10674086
from logging.handlers import RotatingFileHandler
import multiprocessing
import threading
import logging
import sys
i... |
trained.py | #/usr/bin/python
# -*- coding: utf-8 -*-
import io
import numpy as np
import argparse
import cv2
from cv2 import *
import picamera
import threading
from threading import Thread
from os import listdir
from os.path import isfile, join, isdir
import sys
import math
import time
import imutils
from imutils.video.pivideost... |
parallel_sampler.py | import time
import datetime
from multiprocessing import Process, Queue, cpu_count
import torch
import numpy as np
# from pytorch_transformers import BertModel
from transformers import BertModel
import dataset.utils as utils
import dataset.stats as stats
class ParallelSampler():
def __init__(self, data, args, nu... |
7.multiprocessing.py | import multiprocessing
import time
def clock(interval):
while True:
print("the time is %s" % time.ctime())
time.sleep(interval)
class ClockProcess(multiprocessing.Process):
def __init__(self, interval):
multiprocessing.Process.__init__(self)
self.interval = interval
def ... |
scheduler_job.py | # pylint: disable=no-name-in-module
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Versio... |
PWMServoClass.py | #!/usr/bin/python3
# encoding: utf-8
# Copyright HiWonder.hk
# Further development by ians.moyes@gmail.com
# Translation by Google
# Class to control the PWM Servo
import threading # Standard multi-tasking library
import time # Standard date & time library
class PWM_Servo(object): # Class to define & control a PWM S... |
test.py | #!/usr/bin/env python3
import time
import threading
def looper():
counter = 0
while True:
counter += 1
print(f'loop: {counter}')
time.sleep(1)
loop = threading.Thread(target=looper)
loop.start()
import asyncio
import websockets
import json
async def recv_event(socket, event_type):... |
svc.py | # -*- coding: utf-8 -*-
import sys
from SimpleXMLRPCServer import SimpleXMLRPCServer
import win32serviceutil
import win32service
import win32event
import threading
from silvercomics import ComicsApp
from flup.server.fcgi import WSGIServer
def runserver():
while True:
try:
Com... |
tonegenerator_multithreading.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import threading
import time
import queue
from softtone import SofttoneGenerator
class ToneGeneratorThread(object):
def __init__(self):
self.queue = queue.Queue()
self.generator = SofttoneGenerator()
self.thread = threading.Thread(name='Tone... |
test_integration.py | import mock
import os
import subprocess
import sys
import pytest
from ddtrace.vendor import six
import ddtrace
from ddtrace import Tracer, tracer
from ddtrace.internal.writer import AgentWriter
from ddtrace.internal.runtime import container
from tests import TracerTestCase, snapshot, AnyInt, override_global_config
... |
ParaphraseThreadState.py | # -*- coding: utf-8 -*-
"""
Created on Thu Sep 8 14:29:56 2016
@author: neerbek
"""
from threading import Thread
from threading import Lock
import queue
import time
NO_BLOCK = False
class ParaphraseThreadState:
def __init__(self):
self.threads = {}
self.threads_done = queue.Que... |
main_example.py | import signal
from threading import Thread
from PyQt5.QtWidgets import QMainWindow
import pglive.examples_pyqt5 as examples
from pglive.examples_pyqt5.designer_example.win_template import Ui_MainWindow
from pglive.sources.data_connector import DataConnector
from pglive.sources.live_plot import LiveLinePlot
class Ma... |
queue.py | # coding: utf-8
from copy import copy
from .utils import TargetRepeatingThread
from .node import nodes
from .log import get_logger
log = get_logger(__name__)
class SessionQueue(list):
def enqueue(self, dc):
delayed_session = DelayedSession(dc)
self.append(delayed_session)
return delayed_s... |
__init__.py | '''
PyMOL Molecular Graphics System
Copyright (c) Schrodinger, Inc.
Supported ways to launch PyMOL:
If $PYMOL_PATH is a non-default location, it must be set and exported
before launching PyMOL.
From a terminal:
shell> python /path/to/pymol/__init__.py [args]
From a python main thread:
>>> # with G... |
demo_gray_single_scale.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import _init_paths
import caffe
import cv2
import numpy as np
from python_wrapper import *
import os
from timeit import default_timer as timer
from picamera.array import PiRGBArray
from picamera import PiCamera
from threading import Thread
import imutils
from imutils.video... |
lego.py |
import time
import logging
import json
import random
import threading
import math
from enum import Enum
from time import sleep
from agt import AlexaGadget
from ev3dev2.led import Leds
from ev3dev2.sound import Sound
from ev3dev2.motor import LargeMotor, OUTPUT_A, OUTPUT_B, OUTPUT_C, MoveTank, SpeedPercent, MediumMot... |
publisher.py | import errno
import hashlib
import os
import posixpath
import select
import shutil
import subprocess
import tempfile
import threading
from contextlib import contextmanager
from ftplib import Error as FTPError
from werkzeug import urls
from lektor._compat import BytesIO
from lektor._compat import iteritems
from lektor... |
comm_udp.py | """
This is the communication interface for working with the NOX-derived GUI.
It may need a little love to work again, but it'd probably be a better
idea to adapt the NOX-derived GUI to use the newer TCP stream interface
instead, as it has many advantages.
"""
import comm
import socket
import json
class GuiInterface(... |
ITC503_ControlClient.py | """Module containing a class to run a (Oxford Instruments) ITC 503 Intelligent Temperature Controller in a pyqt5 application
Classes:
ITC_Updater: a class for interfacing with a ITC 503 Temperature Controller
inherits from AbstractLoopThread
there, the looping behaviour of this thread i... |
main.py | # -*- coding: utf-8 -*-
"""
Skyperious main program entrance: launches GUI application or executes command
line interface, handles logging and status calls.
------------------------------------------------------------------------------
This file is part of Skyperious - Skype chat history tool.
Released under th... |
server.py | import socket
import time
import threading
from player import Player
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) # prevents address being unavailable when restarting server
host = "" # means can run anywhere basically
port = 3033
players = []
accep... |
operate.py | # copytrue (c) 2020 PaddlePaddle Authors. All Rights Reserve.
#
# 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 applicab... |
stream.py | """Lazily-evaluated, parallelizable pipeline.
Overview
========
Streams are iterables with a pipelining mechanism to enable
data-flow programming and easy parallelization.
The idea is to take the output of a function that turn an iterable into
another iterable and plug that as the input of another such function.
Whi... |
subproc_vec_env.py | """
Adapted from https://github.com/openai/baselines/
"""
import multiprocessing as mp
import numpy as np
from .vec_env import VecEnv, CloudpickleWrapper, clear_mpi_env_vars
def worker(remote, parent_remote, env_fn_wrappers):
parent_remote.close()
envs = [env_fn_wrapper() for env_fn_wrapper in env_fn_wrappe... |
base_camera.py | import time
import logging
import threading
try:
from greenlet import getcurrent as get_ident
except ImportError:
try:
from thread import get_ident
except ImportError:
from _thread import get_ident
# configure logging system
logging.basicConfig(format='%(asctime)s :: %(message)s',
filen... |
__init__.py | import boto3
import json
import datetime
from botocore.config import Config as BotoCoreConfig
import tempfile
import os
import gzip
import time
import base64
import hashlib
import hmac
import requests
import threading
import azure.functions as func
import logging
import re
customer_id = os.environ['Wo... |
controller.py | # ----------------------------------------------------------------------------
# This file contains the BinSyncController class which acts as the the
# bridge between the plugin UI and direct calls to the binsync client found in
# the core of binsync. In the controller, you will find code used to make
# pushes and pull... |
manager.py | # Date: 05/10/2018
# Author: Pure-L0G1C
# Description: Manages bots
from .bot import Bot
from .list import List
from .spyder import Spyder
from threading import Thread
from .const import MAX_REQUESTS
class Manager(object):
def __init__(self, threads, url):
self.threads = threads
self.spyder = Spyder()
... |
__main__.py | #####################################################################
# #
# /main.pyw #
# #
# Copyright 2014, Monash University ... |
Speech_demo.py |
"""
https://cloud.ibm.com/docs/speech-to-text?topic=speech-to-text-websockets#websockets
Speech samples
https://upload.wikimedia.org/wikipedia/commons/d/d4/Samuel_George_Lewis.ogg
https://raw.githubusercontent.com/Azure-Samples/cognitive-services-speech-sdk/f9807b1079f3a85f07cbb6d762c6b5449d536027/samples/cpp/windows... |
ytchat.py | import cgi
import json
import logging
import sys
import threading
import time
from datetime import datetime, timedelta
from json import dumps, loads
from pprint import pformat
import dateutil.parser
import httplib2
from oauth2client.file import Storage
import requests
PY3 = sys.version_info[0] == 3
if PY3:
from ... |
KSP_controller.py |
import krpc
import time
import math
import numpy as np
import numpy.linalg as npl
import SC_solver as solver
import SC_params
from KSP_controller_utils import *
from threading import Thread
print('--------')
params = {}
with open('KSP_controller_params.txt', 'r', encoding='utf-8') as f:
for line in f:
... |
cockroach_workload_read.py | #!/usr/bin/env python
import os
import sys
import shutil
import time
import psycopg2
import subprocess
import multiprocessing
CURR_DIR=os.path.dirname(os.path.realpath(__file__))
server_dirs = []
server_logs = []
log_dir = None
assert len(sys.argv) >= 4
for i in range(1, 4):
server_dirs.append(sys.argv[i])
def inv... |
main.py | #!/usr/bin/env pybricks-micropython
import struct, threading
from pybricks import ev3brick as brick
from pybricks.ev3devices import (
Motor,
TouchSensor,
ColorSensor,
InfraredSensor,
UltrasonicSensor,
GyroSensor,
)
from pybricks.parameters import (
Port,
Stop,
Direction,
Button... |
util.py | #!/usr/bin/env python
# Copyright (c) 2013, Carnegie Mellon University
# All rights reserved.
# Authors: Michael Koval <mkoval@cs.cmu.edu>
# Authors: Siddhartha Srinivasa <siddh@cs.cmu.edu>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following ... |
test_tutorial_client.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import os
import sys
sys.path.append(os.path.abspath(
os.path.join(os.path.dirname(os.path.abspath(__file__)), "../")
))
from jsonthrift.jsonthrift import JsonThrift
import socket
import unittest
import multiprocessing
import time
from thrift_tutorial.server import Calc... |
dbak.py | #!/usr/bin/env python3
import configparser
import logging
import os
import sys
import dropbox
from dropbox.exceptions import ApiError, AuthError, BadInputError
from dropbox.files import WriteMode
logging.basicConfig(format='dbak %(asctime)s %(levelname)s: %(message)s',
datefmt='%Y-%m-%d %I:%M:%S'... |
edvs.py | import numpy as np
import threading
import atexit
import time
class Serial(object):
def __init__(self, port, baud):
import serial
self.conn = serial.Serial(port, baudrate=baud, rtscts=True, timeout=0)
def send(self, message):
self.conn.write(message.encode('utf-8'))
def receive(self... |
work_TCP_server.py | # import socket
#
# s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
# s.connect(('www.sina.com.cn', 80))
#
# s.send(b'GET / HTTP/1.1\r\nHost: www.sina.com.cn\r\nConnection: close\r\n\r\n')
#
# buffer = []
# while True:
# d=s.recv(1024)
# if d:
# buffer.append(d)
# else:
# break
#
# data=b... |
run_client.py | import os
import sys
import argparse
import torch
import grpc
import psutil
import numpy as np
import syft as sy
from syft.workers import websocket_server
from torchvision import transforms
import threading
import time
import logging
# Add data folder to path
pwd = os.path.join(os.path.abspath(os.path.dirname(__fil... |
name_resolution.py | # Software License Agreement (BSD License)
#
# Copyright (c) 2012, Fraunhofer FKIE/US, Alexander Tiderko
# 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 mus... |
misc.py | import subprocess
from fnmatch import fnmatch
import multiprocessing
from time import sleep, time
import itertools
__copyright__ = "Copyright 2016-2020, Netflix, Inc."
__license__ = "BSD+Patent"
import sys
import errno
import os
import re
from vmaf import run_process
from vmaf.tools.scanf import sscanf, IncompleteCa... |
robot_connection.py | #! python3
import socket
import threading
import select
import queue
from . import logger
from .decorators import retry
class RobotConnection(object):
"""
Create a RobotConnection object with a given robot ip.
"""
VIDEO_PORT = 40921
AUDIO_PORT = 40922
CTRL_PORT = 40923
PUSH_PORT = 40924
... |
afddagent.py | # -*- coding: utf-8 -*- {{{
# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et:
# Copyright (c) 2013, Battelle Memorial Institute
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistri... |
http.py | #!/usr/bin/env python3
import requests
import random
import time
from threading import Thread
# Import modules for HTTP flood
import tools.randomData as randomData
import tools.ipTools as ipTools
def HTTP_ATTACK(threads, attack_time, target):
# Finish
global FINISH
FINISH = False
if ipTools.isCloudFlare(target):... |
streamToSeedFile.py | #from verce.processing import *
from scipy.cluster.vq import whiten
import socket
import traceback
from multiprocessing import Process, Queue, Pipe
class StreamToSeedFile(SeismoPreprocessingActivity):
def writeToFile(self,stream,location):
stream.write(location,format='MSEED',encoding='FLOAT32');
... |
cam_processing.py | #!/usr/bin/python3
import cv2
import numpy as np
import matplotlib.pyplot as plt
import threading
import retinex
from ubi_test import post_request
print("Versión de OpenCV:",cv2.__version__)
global cap, frame
cap = cv2.VideoCapture(-1)
frame = np.array([])
def quitar_ruido(img):
# Create our sharpening kernel, ... |
radiosync.py | from concurrent import futures
import json as json_lib
import logging
import requests
import threading
import time
import urllib
import urlparse
WINDOW = 5.0
SCHEME = "https"
HOST = "radio-sync.appspot.com"
def log():
return logging.getLogger(__name__)
class AgedStatus(object):
def __init__(self, status... |
test_simulator.py | import multiprocessing
import random
import numpy as np
import examples.settings
import habitat_sim
def test_no_navmesh_smoke():
sim_cfg = habitat_sim.SimulatorConfiguration()
agent_config = habitat_sim.AgentConfiguration()
# No sensors as we are only testing to see if things work
# with no navmesh ... |
utils.py | import copy
import json
import os
import pipes
import re
import shutil
import subprocess
import sys
import tempfile
import time
from datetime import timedelta
import infinit.beyond
import infinit.beyond.bottle
import infinit.beyond.couchdb
from common import *
binary = 'memo'
cr = '\r\n' if os.environ.get('EXE_EXT'... |
feature_shutdown.py | #!/usr/bin/env python3
# Copyright (c) 2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test axed shutdown."""
from test_framework.test_framework import BitcoinTestFramework
from test_framework.u... |
power_monitoring.py | import random
import threading
import time
from statistics import mean
from cereal import log
from common.params import Params, put_nonblocking
from common.realtime import sec_since_boot
from selfdrive.hardware import HARDWARE
from selfdrive.swaglog import cloudlog
CAR_VOLTAGE_LOW_PASS_K = 0.091 # LPF gain for 5s tau... |
getproxy.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import, division, \
print_function
import os
import json
import time
import copy
# import signal
import logging
import requests
import geoip2.database
from threading import Thread
from queue import Queue, Empty
# f... |
base.py | #!/usr/bin/env python
# Copyright 2012 Hewlett-Packard Development Company, L.P.
#
# 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
#
# Unles... |
test_config.py | import asyncio
import copy
import pytest
import random
import yaml
from kujenga.util.config import create_default_kujenga_config, initial_config_file, load_config, save_config
from kujenga.util.path import mkdir
from multiprocessing import Pool
from pathlib import Path
from threading import Thread
from time import sle... |
uplink_bridge.py | """
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... |
integration_test.py | # Copyright (c) 2017-present, 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.
"""
Script for testing comp... |
concept.py | import threading
import matplotlib.figure
import time
import numpy as np
import pyaudio
from kivy.app import App
from kivy.config import Config
from kivy.clock import mainthread
from kivy.core.image import Image
from kivy.garden.matplotlib.backend_kivyagg import FigureCanvasKivyAgg
from kivy.graphics.context_instructi... |
server.py | # Copyright (c) 2017 Richard Sanger
#
# Licensed under MIT
#
# A simple flask based web interface for controlling a heatpump and receiving
# current state using IR.
#
#
# * /api/set accepts a JSON object that can be posted with the settings to change
# and 'apply' indicating this state should be sent to the heatpum... |
dual_thrust.py | """
The Dual Thrust trading algorithm is a famous strategy developed by Michael Chalek.
It is a breakout system, commonly used in futures, forex and equity markets.
The limits are based on today’s opening price plus or minus a certain percentage of recent trading range.
When the price breaks through the upper level, it... |
reflector.py | # specifically use concurrent.futures for threadsafety
# asyncio Futures cannot be used across threads
from concurrent.futures import Future
import time
import threading
from traitlets.config import LoggingConfigurable
from traitlets import Any, Dict, Unicode
from kubernetes import client, config, watch
from tornado.... |
futu_gateway.py | """
Please install futu-api before use.
"""
from copy import copy
from collections import OrderedDict
from datetime import datetime
from threading import Thread
from time import sleep
from futu import (
KLType,
ModifyOrderOp,
TrdSide,
TrdEnv,
OpenHKTradeContext,
OpenQuoteContext,
OpenUSTra... |
f1.py | from threading import Thread
import threading
from time import sleep
def fib_calc(begin, end):
""" Calculae fib """
a, b = 0, begin
while b < end:
print(b)
a, b = b, a + b
class CookBook(Thread):
def __init__(self):
Thread.__init__(self)
self.message = "This is my th... |
microscope.py | import logging
import os
import threading
import aiohttp_cors
from aiohttp import web
from controllers.controller import routes, IController
from bootstrapper import Bootstapper
from services.ws import WebSocketManager
from workers.workers import IWorker
ROOT = os.path.dirname(__file__)
container=Bootstapper().bootstr... |
manager.py | #!/usr/bin/env python3
import datetime
import os
import signal
import subprocess
import sys
import traceback
from multiprocessing import Process
import cereal.messaging as messaging
import selfdrive.crash as crash
from common.basedir import BASEDIR
from common.params import Params, ParamKeyType
from common.text_window... |
fastprocesspool_debug.py | # Copyright 2018 Martin Bammer. All Rights Reserved.
# Licensed under MIT license.
"""Implements a lightweight as fast process pool."""
__author__ = 'Martin Bammer (mrbm74@gmail.com)'
import sys
import atexit
import time
import inspect
import threading
import itertools
from collections import deque
from multiprocess... |
scene_manager.py | from multiprocessing import Process, Queue, Lock
from Queue import Empty
import time
import opc
import sys
import numpy as np
import utilities.process_descriptor as pd
from utilities.sleep_timer import SleepTimer
import logging
import utilities.logging_server
import argparse
from utilities import logging_handler_setup
... |
program.py | #!/usr/bin/env python
config = "/data/config.py"
from config import *
import sys
import sqlite3
import time
import threading
from flask import Flask, Response, redirect, request, url_for
import signal
import subprocess
global conn
try:
conn = sqlite3.connect(db_location, check_same_thread=False)
... |
cmsfinger.py | # -*- coding:utf-8 -*-
import os, sys
import threading
import time
import re
import ctypes
import urllib.request, urllib.parse, urllib.error
import socket
import urllib.request, urllib.error, urllib.parse
import http.cookiejar
import zlib
import struct
import ctypes
import io
class Log():
FILE = ''
LOGLOCK = ... |
test_client.py | #!/usr/bin/env python
from __future__ import with_statement
from StringIO import StringIO
import unittest
import os
import posixpath
import sys
import threading
from uuid import UUID
from dropbox import session, client
import datetime
from dropbox.rest import ErrorResponse
try:
import json
except ImportError:
... |
__init__.py |
from __future__ import annotations
from dataclasses import *
from typing import *
from collections import defaultdict
from datetime import datetime
import threading
from .serializer import Serializer, serializer, from_json, to_json # type: ignore
from .nub import nub # type: ignore
from .pp import show, pr, Color #... |
pytun.py | import argparse
import configparser
import os
import signal
import socket
import sys
import threading
import time
from concurrent.futures.thread import ThreadPoolExecutor
from multiprocessing import freeze_support
from os import listdir
from os.path import isabs, dirname, realpath
from os.path import isfile, join
impor... |
alive.py | #This file is used to keep the bot alive on replit server
from flask import Flask
from threading import Thread
app = Flask('')
@app.route('/')
def home():
return "Bot started! Running..."
def run():
app.run(host='0.0.0.0',port=8080)
def keep_alive():
t = Thread(target=run)
t.start()
|
main.py | # TimerX v1.1
# IMPORTS
ver = "1.0"
import ctypes
import os
import time
import tkinter
import webbrowser
from platform import system
from re import T
from threading import Thread
from time import sleep
from tkinter import DISABLED, Frame, Grid, PhotoImage, StringVar, TclError, Tk, ttk
from tkinter.consta... |
web.py | import os
import json
import yaml
import time
import flask
import distro
import psutil
import random
import string
import threading
import jinja2.exceptions
from flask import request
from turbo_flask import Turbo
from datetime import datetime
try:
from mcipc.query import Client
except: # server offline
pass
... |
BaseService.py | #import inspect
import logging
import random
import string
import threading
from afs.util.AFSError import AFSError
import afs
import sys
class BaseService(object):
"""
Provides implementation for basic methods for all Services.
"""
def __init__(self, conf=None, LLAList=[]):
# CO... |
poloniex.py | from befh.restful_api_socket import RESTfulApiSocket
from befh.exchanges.gateway import ExchangeGateway
from befh.market_data import L2Depth, Trade
from befh.util import Logger
from befh.instrument import Instrument
from befh.clients.sql_template import SqlClientTemplate
from functools import partial
from datetime impo... |
ssh_setup_node_multi.py | #!/usr/bin/python3
# Author: Adrian Bronder
# Date: October 15th, 2018
# Description: Setup preparing nodes for cluster create/join
import sys
import time
from threading import Thread
from pexpect import pxssh
import re
import json
def print_usage():
print("\nUsage: " + __file__ + " <config_file>\n")
print("<c... |
server.py | # Copyright (c) Microsoft 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 to in wri... |
context_test.py |
from caffe2.python import context, test_util
from threading import Thread
@context.define_context()
class MyContext(object):
pass
class TestContext(test_util.TestCase):
def use_my_context(self):
try:
for _ in range(100):
with MyContext() as a:
for... |
common.py | import io
import os
import ssl
import sys
import json
import stat
import time
import fcntl
import heapq
import types
import base64
import shutil
import struct
import decimal
import fnmatch
import hashlib
import logging
import binascii
import builtins
import tempfile
import warnings
import functools
import itertools
imp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.