source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
tests.py | import threading
from datetime import datetime, timedelta
from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist
from django.db import DEFAULT_DB_ALIAS, DatabaseError, connections
from django.db.models.manager import BaseManager
from django.db.models.query import EmptyQuerySet, QuerySet
from dj... |
process.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os
import tempfile
import subprocess
import tensorflow as tf
import numpy as np
import tfimage as im
import threading
import time
import multiprocessing
edge_pool = None
parser = argp... |
__init__.py | import sys
from multiprocessing import Manager, Process
import yaml
import json
from jsonschema import validate
import os.path
import logging
from tempfile import mkstemp, mkdtemp
import os
import shutil
from .dependentqueue import DependentQueue
from .task import enqueue, EndOfQueue, either_data
from .process import w... |
servidor.py | from socket import *
import threading
from classes import *
from datetime import *
from time import *
from pickle import *
from threading import *
from cripto import *
from ast import literal_eval
from tkinter import *
# CRIANDO O SERVIDOR
server = socket(AF_INET, SOCK_STREAM)
host = gethostname()
porta = 20000
serve... |
container.py | """
Representation of a generic Docker container
"""
import logging
import tarfile
import tempfile
import threading
import docker
import requests
from docker.errors import NotFound as DockerNetworkNotFound
from samcli.lib.utils.retry import retry
from .exceptions import ContainerNotStartableException
from .utils imp... |
polytron.py | import time
import sys
import os
import logging
import threading
import random
import math
import json
from subprocess import Popen, PIPE, STDOUT
from signal import signal, SIGINT
sem = threading.Semaphore()
import click
import numpy as np
from loguru import logger
import mido
from mido.ports import MultiPort
import ... |
tests.py | from __future__ import unicode_literals
import threading
import warnings
from datetime import datetime, timedelta
from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist
from django.db import DEFAULT_DB_ALIAS, DatabaseError, connections
from django.db.models.fields import Field
from django.db.m... |
bintotxt.py | import os
import numpy as np
import sys
from multiprocessing import Process
import time
import subprocess
def bin2float(file,dtype):
if file.endswith(".bin"):
if dtype == "fp32":
data = np.fromfile(file,dtype='float32')
elif dtype == "fp16":
data = np.fromfile(file,dtype='fl... |
HiwinRA605_socket_ros_test_20190626131757.py | #!/usr/bin/env python3
# license removed for brevity
#接收策略端命令 用Socket傳輸至控制端電腦
import socket
##多執行序
import threading
import time
##
import sys
import os
import numpy as np
import rospy
import matplotlib as plot
from std_msgs.msg import String
from ROS_Socket.srv import *
from ROS_Socket.msg import *
import HiwinRA605_s... |
webxterm.py | import os
import sys
import socket
import platform
from threading import Thread
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../')
from lib.server import websocketserver
shutdown_bind_address = "localhost"
shutdown_port = 8898
bind_address = "0.0.0.0"
port = 8899
shutdown_command = b"\x1b[^shutdown\... |
threaded_gui.py | from gi.repository import Gtk, Gdk, GdkPixbuf
from citygan import CityGan
from time import process_time
import numpy as np
import citygan_util
import threading, queue
import os
import pix2pix_citygenerator
class GanCities(Gtk.Window):
def __init__(self):
super(GanCities, self).__init__()
try:
... |
test_two_threads_resume.py | from threading import Thread, RLock
from time import sleep
lock = RLock()
def foo():
sleep(1)
while True:
lock.acquire()
x = 12
sleep(0.01)
lock.release()
print("finished foo()", x)
threads = [Thread(target=foo, name="Thread1"),
Thread(target=foo, name="Thread2... |
videoStramSubscriber2.py | import sys
import socket
import traceback
import cv2
from imutils.video import VideoStream
import imagezmq
import threading
import numpy as np
#from time import sleep
import time
import cv2
from nacl.signing import VerifyKey
class VideoStreamSubscriber:
def __init__(self, hostname, port, merkle_tree_interval, c... |
bot.py | import asyncio
import base64
import concurrent.futures
import datetime
import glob
import json
import math
import os
import pathlib
import random
import sys
import time
from json import dumps, loads
from random import randint
import re
from re import findall
import requests
import urllib3
from Crypto.... |
multiprocess_example.py | ## This program demos how to use milvus python client with multi-process
import os
from multiprocessing import Process
from factorys import *
from milvus import Milvus
############### Global variable ###########
collection_name = 'test_test'
param = {'collection_name': collection_name,
'dimension': 128,
... |
demo_gui.py | import threading
import time
# import module GUI
from tkinter import *
from tkinter.font import *
# internal module
from p2pchat import *
__version__ = "0.1-beta"
def rgb2hex(r , g, b):
return f'#{r:02x}{g:02x}{b:02x}'
def window_create_connection(event = None):
# some special function
def submitConnec... |
apiusage.py | import ftd3xx
import sys
if sys.platform == 'win32':
import ftd3xx._ftd3xx_win32 as _ft
elif sys.platform == 'linux':
import ftd3xx._ftd3xx_linux as _ft
import datetime
import time
import binascii
import itertools
import ctypes
import threading
import logging
import os
import platform
import rand... |
tello_module.py | # coding=utf-8
import logging
import socket
import time
import threading
import cv2
from threading import Thread
drones = None
client_socket = None
class Tello:
"""Python wrapper to interact with the Ryze Tello drone using the official Tello api.
Tello API documentation:
https://dl-cdn.ryzerobotics.com/d... |
test_connections.py | import socket
import os
import threading
import ssl
import OpenSSL
import pytest
from unittest import mock
from mitmproxy import connections
from mitmproxy import exceptions
from mitmproxy.net import tcp
from mitmproxy.net.http import http1
from mitmproxy.test import tflow
from mitmproxy.test import tutils
from .net i... |
test_imperative_signal_handler.py | # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
cli.py | import os
import sys
import threading
from contextlib import contextmanager
import click
import six
from gevent import pywsgi
from geventwebsocket.handler import WebSocketHandler
from dagster import check, seven
from dagster.cli.workspace import Workspace, get_workspace_from_kwargs, workspace_target_argument
from dag... |
Hiwin_RT605_ArmCommand_Socket_20190627184149.py | #!/usr/bin/env python3
# license removed for brevity
import rospy
import os
import socket
##多執行序
import threading
import time
import sys
import matplotlib as plot
import HiwinRA605_socket_TCPcmd as TCP
import HiwinRA605_socket_Taskcmd as Taskcmd
import numpy as np
from std_msgs.msg import String
from ROS_Socket.srv imp... |
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... |
reports_queue.py | # Copyright 2021 TestProject (https://testproject.io)
#
# 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 ... |
thr_1.py | import threading
import time
def thread_job():
print('T1 start\n')
for i in range(10):
time.sleep(0.2)
print('T1 end\n')
def thread_job2():
print('T2 start\n')
print('T2 end\n')
def main():
added_thread1 = threading.Thread(target=thread_job,name='T1')
added_thread2 = threading.Thr... |
read10axis.py | import beagle as bg
import argparse
import sys
import time
import csv
import threading
import socket
import pickle
from glob import glob
class Beagle(object):
def __init__(self, axis_10):
self._axis_10 = axis_10
self._mpu = bg.MPU()
self.__load_config()
def __load_config(self):
... |
run.py | '''Core run service with the initial 'run_core' function to boot a main
queue thread and waiting socket.
'''
from multiprocessing import Process, Queue
import json_socket
from log import log
from initial import run_core
standard_config = dict(
socket_uri="ws://127.0.0.1:8009",
)
queue_prc = None... |
udev-forward.py | #!/usr/bin/python3
# Copyright 2019 Linaro Limited
# Copyright (c) 2014 Taeyeon Mori (for MurmurHash2 code)
# Author: Kumar Gala <kumar.gala@linaro.org>
# 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 Softw... |
installwizard.py |
from functools import partial
import threading
import os
from kivy.app import App
from kivy.clock import Clock
from kivy.lang import Builder
from kivy.properties import ObjectProperty, StringProperty, OptionProperty
from kivy.core.window import Window
from kivy.uix.button import Button
from kivy.utils import platform... |
temperatureControlSwitch.py | import os
import time
import math
import sys
import json
import copy
from datetime import datetime
from threading import Thread, Lock
import temperatureSensorLib
import smartPlugLib
import ipc
from getTempChartArray import updateTemperatureLogFile
######################################################... |
ioloop_test.py | #!/usr/bin/env python
from __future__ import absolute_import, division, print_function, with_statement
import contextlib
import datetime
import functools
import socket
import sys
import threading
import time
from tornado import gen
from tornado.ioloop import IOLoop, TimeoutError, PollIOLoop, PeriodicCallback
from to... |
BroadcastListener.py |
import socket
import threading
import time
class BroadcastListener:
def __init__(self, port):
self._port = port
def StartListenerAsync(self):
self._haltFlag = False
self._listenerThread = threading.Thread(target=self._startListener)
self._listenerThread.start()
def StopListener(self):
self._haltFla... |
tpu.py | from six.moves import shlex_quote as shellquote
from subprocess import check_output
import json
import re
import ring
import sys
import os
import logging
import threading
import contextlib
from pprint import pprint as pp
logger = logging.getLogger('tpudiepie')
# create console handler and set level to debug
ch = logg... |
server.py | #!/usr/bin/env python
import sys
import io
import os
import shutil
from subprocess import Popen, PIPE
from string import Template
from struct import Struct
from threading import Thread
from time import sleep, time
from http.server import HTTPServer, BaseHTTPRequestHandler
from wsgiref.simple_server import make_server
... |
procWRFCHEM.py | #!/usr/bin/env python
import os, sys, subprocess
import gdal
import multiprocessing
import numpy as np
import time as tt
from netCDF4 import Dataset
from osgeo import osr
from os.path import basename
def extract_product(fileAbsPath, field, pixelSize=0.10):
ncfile = Dataset(fileAbsPath, 'r')
data = ncfile.... |
test_decimal.py | # Copyright (c) 2004 Python Software Foundation.
# All rights reserved.
# Written by Eric Price <eprice at tjhsst.edu>
# and Facundo Batista <facundo at taniquetil.com.ar>
# and Raymond Hettinger <python at rcn.com>
# and Aahz (aahz at pobox.com)
# and Tim Peters
"""
These are the test cases for the Decim... |
ITraining.py | import abc
import threading
from tfcore.utilities.utils import *
from tfcore.utilities.params_serializer import ParamsSerializer
class ITrainer_Params(ParamsSerializer):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self):
super().__init__()
self.is_train = True
se... |
main.py | # coding=utf-8
import MySQLdb
from queue import Queue
import socket
import json
from time import sleep
import threading
import os
mutex = threading.Lock() # queue mutex
queue = Queue() # 全局判题列表
myjsonfile = open("./setting.json", 'r')
judgerjson = json.loads(myjsonfile.read())
if os.environ.get("DB_USER"):
ju... |
external-func.py | import sys
print(sys.argv) # python3 external-func.py a b c
# ['external-func.py', 'a', 'b', 'c']
print(sys.path)
# You can add path using sys.path.append
# sys.exit()
import pickle
# save as object
f = open("test.txt", "wb")
data = {1: "python", 2: "you need"}
pickle.dump(data, f)
f.close()
# get object
f = o... |
installwizard.py |
from functools import partial
import threading
from kivy.app import App
from kivy.clock import Clock
from kivy.lang import Builder
from kivy.properties import ObjectProperty, StringProperty, OptionProperty
from kivy.core.window import Window
from kivy.uix.button import Button
from kivy.utils import platform
from kivy... |
advancedbutton.py | import time
import threading
DOUBLE_CLICK_TIME = 0.5
LONG_PRESS_TIME = 0.7
class AdvancedButton:
def __init__(self, hub):
self.state = 0
self.last_pressed = 0
self.press_time = None
self.hub = hub
self.hub.button.subscribe(self.pressed)
self.click = ButtonAction()
... |
person_tracker_old.py | """
Copyright (c) 2019 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 law or agreed to in writin... |
cell_widgets.py | from ipme.utils.functions import get_dim_names_options
from .global_reset import GlobalReset
from bokeh.models.widgets import Select, Button
from functools import partial
import threading
class CellWidgets:
def __init__(self):
pass
@staticmethod
def initialize_widgets(cell):
for space i... |
client.py | #!/usr/bin/python
from autobahn.twisted.websocket import WebSocketClientProtocol, WebSocketClientFactory
from twisted.internet import reactor
from twisted.internet.ssl import ClientContextFactory
import json
import hashlib
import sys
import bcrypt
import warnings
import ssl
import time
import traceback
from threading ... |
event_based_scheduler_job.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
train.py | #this should be the thing, right?
from __future__ import division
import gym
import numpy as np
import random
import tensorflow as tf
import tensorflow.contrib.layers as layers
import matplotlib.pyplot as plt
import cpp_mstar
from od_mstar3.col_set_addition import OutOfTimeError,NoSolutionError
import threading
import... |
julabo_cf41.py | """PyLabware driver for Julabo CF41 chiller."""
import threading
from time import sleep
from typing import Optional, Union
import serial
# Core imports
from .. import parsers as parser
from ..controllers import AbstractTemperatureController, in_simulation_device_returns
from ..exceptions import (PLConnectionError,
... |
qastockbase.py | #
"""
stock_base
"""
import uuid
import datetime
import json
import os
import threading
import pandas as pd
import pymongo
from qaenv import (eventmq_ip, eventmq_password, eventmq_port,
eventmq_username, mongo_ip)
import QUANTAXIS as QA
from QUANTAXIS.QAARP import QA_Risk, QA_User
from QUANTAXIS.... |
server.py | # encoding: utf-8
from src.color import colored
import socket
import sys
from src.Server import Server
def header_program():
title = "|\t\t-~=[ BlackSkull ]=~-\t\t|"
title = title.replace('\t', ' ')
bar = '+' + (len(title) - 2) * "=" + '+'
bar_light = '+' + (len(title) - 2) * "-" + '+'
brea... |
templates.py | """
Handles (deferred) loading of odML templates
"""
import os
import sys
import tempfile
import threading
try:
import urllib.request as urllib2
from urllib.error import URLError
from urllib.parse import urljoin
except ImportError:
import urllib2
from urllib2 import URLError
from urlparse impo... |
due.py | #!/usr/bin/env python
import os
import cPickle
import logging
import Queue
import shelve
import time
from threading import Lock, Thread
class MemoryDue(object):
def __init__(self, params):
self._db = {}
self._check_lock = Lock()
self.receiver = None
... |
local_service_handler.py | # Copyright (c) 2020 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... |
main.py | '''
###################################
# PYTHON AUTOCLICKER #
# BY Divdude77 #
###################################
'''
#############################################
# READ readme.md BEFORE RUNNING THIS SCRIPT #
#############################################
import pyautogui
import keyb... |
cancel_delay_test.py | # -*- coding: utf-8 -*-
u"""test cancel of sim with agent_start_delay
:copyright: Copyright (c) 2020 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
import pytest
_REPORT = 'heightWeightReport'
def te... |
blob_store_test_mixin.py | #!/usr/bin/env python
"""Mixin class to be used in tests for BlobStore implementations."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import abc
import threading
import time
from unittest import mock
from grr_response_core.lib import rdfvalue
from g... |
testH264_Jetson.py | import os
import io
import time
import multiprocessing as mp
from queue import Empty
from PIL import Image
from http import server
import socketserver
import numpy as np
import cv2
import urllib.request
Ncams = 1
streamsVideo = ('http://192.168.0.20:8000', 'http://192.168.0.20:8000',
'http://192.168.0.... |
spider.py | #!/usr/bin/env python
from __future__ import generators
## Copyright (c) 1999 - 2003 L. C. Rees. All rights reserved.
## See COPYRIGHT file for license terms.
__name__ = 'spider'
__version__ = '0.5'
__author__ = 'L.C. Rees (xanimal@users.sf.net)'
__all__ = ['ftpurls', 'ftppaths', 'weburls', 'ftpmirror', 'ftpspider',... |
IPSocket.py | #! /usr/bin/python3
import threading
import socket
import queue
from IP.IPPacket import IPPacket
class IPSocket:
LOCAL_HOST_IP="127.0.0.1"
def __init__(self, source_address):
self.is_connected=False
self.send_socket=None
self.receive_socket=None
self.destionation_ip=Non... |
feeder.py | import os
import threading
import time
import numpy as np
import tensorflow as tf
from infolog import log
from sklearn.model_selection import train_test_split
_batches_per_group = 32
import msgpack
import msgpack_numpy
msgpack_numpy.patch()
class Feeder:
"""
Feeds batches of data into queue on a backg... |
example3.py | import threading
def writer():
global text
while True:
with service:
resource.acquire()
print(f"Writing being done by {threading.current_thread().name}.")
text += f"Writing was done by {threading.current_thread().name}. "
resource.release()
def reader():
gl... |
pymkidcat.py | #!/usr/bin/env python
import sys
from hashlib import pbkdf2_hmac, sha1
import argparse
import datetime
import multiprocessing
import os
start = datetime.datetime.now()
def to_brute(sem):
sem.acquire()
with open(wordlist) as w:
for line in w:
line = line.strip()
if (len(line... |
main.py | # 🚩 Dada Ki Jay Ho 🚩
# Global Things ----------------------------------------
import speech_recognition as sr
import webbrowser as wb
import threading
import pyautogui
import datetime
import socket
import os
from Resources.Work_By_Raj.Opening_Applications import Opening_Applications
from Resources.Work_By_Raj.Auto... |
feature.py | # coding=utf-8
#
# Yu Wang (University of Yamanashi)
# Apr, 2021
#
# 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 requi... |
twitter_playground.py | # from twitter import Twitter, OAuth, Hashtag, List
import json
import re
from pprint import pprint
import os
import pandas
import tweepy as tw
import pandas as pd
from multiprocessing import Pool, Process, Lock, Queue
import time
import csv
from queue import Queue
CONSUMER_KEY = ""
CONSUMER_SECRET = ""
ACCESS_TOKEN =... |
mailslot_listener.pyw | -*- coding: utf-8 -*-
import os, sys
import marshal
import threading
import time
import pywintypes
import winerror
import win32gui
import win32con
import win32api
from winsys import core, exceptions, ipc, utils, dialogs
WINERROR_MAP = {
winerror.ERROR_INVALID_WINDOW_HANDLE : exceptions.x_invalid_handle,
}
wrappe... |
qrcode_widget.py | """
Kivy Widget that accepts data and displays qrcode.
"""
import os
from functools import partial
from threading import Thread
import qrcode
from kivy.clock import Clock
from kivy.graphics.texture import Texture
from kivy.lang import Builder
from kivy.properties import (BooleanProperty, ListProperty, NumericProperty,... |
inference_webcam.py | """
Inference on webcams: Use a model on webcam input.
Once launched, the script is in background collection mode.
Press B to toggle between background capture mode and matting mode. The frame shown when B is pressed is used as background for matting.
Press Q to exit.
Example:
python inference_webcam.py \
... |
run_py_tests.py | #!/usr/bin/env python
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""End to end tests for ChromeDriver."""
# Note that to run Android tests you must have the following line in
# .gclient (in the paren... |
__init__.py | from __future__ import absolute_import, print_function
import multiprocessing
import time
from flask import Flask
__all__ = ('create_app', 'BackgroundServerWrapper')
def create_app(name='butts', debug=False):
app = Flask(name)
app.debug = debug
app.add_url_rule('/', 'index', lambda: "INDEX")
app.ad... |
keyboardListener.py | # -*- coding: utf-8 -*-
import pythoncom
import pyHook
import win32api
import win32con
import time
import threading
import random
VK_CODE = {
'backspace': 0x08,
'tab': 0x09,
'clear': 0x0C,
'enter': 0x0D,
'shift': 0x10,
'ctrl': 0x11,
'alt': 0x12,
'pause': 0x13,
... |
utils.py | import asyncio
from asyncio import TimeoutError
import atexit
import click
from collections import deque, OrderedDict, UserDict
from concurrent.futures import ThreadPoolExecutor, CancelledError # noqa: F401
from contextlib import contextmanager, suppress
import functools
from hashlib import md5
import html
import json... |
smtpretty.py | """An SMTP server library designed specifically for running test suites.
Overview
--------
SMTPretty makes it easy to start and stop a local dummy SMTP server from within
a test suite, and perform tests and assertions on the sent emails. Usage
is straightforward:
import smtpretty
smtpretty.enable(2525)
c... |
robot_connection.py | #! python3
import socket
import threading
import select
import queue
class RobotConnection(object):
"""
Create a RobotConnection object with a given robot ip.
"""
VIDEO_PORT = 40921
AUDIO_PORT = 40922
CTRL_PORT = 40923
PUSH_PORT = 40924
EVENT_PORT = 40925
IP_PORT = 40926
def ... |
py_dummy_test.py | import os,sys,time
import logging
from ublarcvserver import ublarcvserver
from ublarcvserver import DummyPyWorker, Broker, Client
from multiprocessing import Process
"""
This script is used to test the Majordomo classes.
We implement a dummy setup where the client and worker just say hello to each other.
Also servers... |
__init__.py | # -*- coding: utf-8 -*-
'''
Set up the Salt integration test suite
'''
# Import Python libs
from __future__ import absolute_import, print_function
import os
import re
import sys
import copy
import json
import time
import stat
import errno
import signal
import shutil
import pprint
import atexit
import socket
import lo... |
test_threadstats_thread_safety.py | import re
import time
import threading
from nose import tools as t
from datadog import ThreadStats
class MemoryReporter(object):
""" A reporting class that reports to memory for testing. """
def __init__(self):
self.metrics = []
self.events = []
def flush_metrics(self, metrics):
... |
execution_test.py | from unittest.mock import MagicMock
from concurrent.futures import ThreadPoolExecutor
import concurrent.futures
import platform
import threading
import pytest
import numpy as np
from common import small_buffer
import vaex
def test_evaluate_expression_once():
calls = 0
def add(a, b):
nonlocal calls
... |
test.py | #!/usr/bin/env python
#
# Copyright 2012 the V8 project authors. 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 copyright
# noti... |
cwipc_toproxy.py | import sys
import os
import time
import threading
import traceback
import queue
import socket
import struct
from .. import CWIPC_POINT_PACKETHEADER_MAGIC
from ._scriptsupport import *
class Sender:
def __init__(self, host, port, verbose=False):
self.producer = None
self.queue = queue.Queue(max... |
sphero_manager.py | from SpheroLib.sphero_bluetooth import run_sphero
import multiprocessing as mp
import time
# from slackclient import SlackClient
import subprocess
class SpheroManager:
def __init__(self, shared_resources):
"""
Spin up the sphero processes. Monitor them for good health. If they die, restart them. T... |
power_monitoring.py | import random
import threading
import time
from statistics import mean
from cereal import log
from common.realtime import sec_since_boot
from common.params import Params, put_nonblocking
from common.hardware import TICI
from selfdrive.swaglog import cloudlog
CAR_VOLTAGE_LOW_PASS_K = 0.091 # LPF gain for 5s tau (dt/ta... |
runtests.py | #!/usr/bin/python2.7 -B
# This file is picked from project testa [https://github.com/TimeExceed/testa.git]
# Copyright (c) 2013, Taoda (tyf00@aliyun.com)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions ar... |
gamepad.py | # -*- coding: utf-8 -*-
"""Main module."""
from __future__ import print_function
import os
import struct
import array
import threading
from fcntl import ioctl
axis_names = {
0x00: 'x',
0x01: 'y',
0x02: 'z',
0x03: 'rx',
0x04: 'ry',
0x05: 'rz',
0x06: 'throttle',
0x07: 'rudder',
0x... |
exchange_rate.py | from datetime import datetime
import inspect
import requests
import sys
from threading import Thread
import time
import csv
from decimal import Decimal
from .bitcoin import COIN
from .i18n import _
from .util import PrintError, ThreadJob
# See https://en.wikipedia.org/wiki/ISO_4217
CCY_PRECISIONS = {'BHD': 3, 'BIF':... |
_http_session_local_impl.py | # -*- coding: utf-8 -*-
"""
Parameters
----------
Returns
-------
:Author: MaTianGe
:Create: 2021/1/28 13:20
:Blog: https://safe.shougang.com.cn
Copyright (c) 2021/1/28, ShouAnYun Group All Rights Reserved.
"""
import threading
import uuid
import time
from typing import Any, Dict, Tuple
from threading import... |
aerospike_optimizer.py | import numpy as np
import matplotlib.pyplot as plt
import scipy.optimize
import multiprocessing as mp
import copy
import pickle
import gasdynamics as gd
from heat_flux import heat_flux
from plug_nozzle_angelino import plug_nozzle
import MOC
## NASA CEA CONSTANTS
class CEA_constants():
def __init__(self,altitude):... |
ntlmrelayx.py | #!/usr/bin/env python
# SECUREAUTH LABS. Copyright 2018 SecureAuth Corporation. All rights reserved.
#
# This software is provided under under a slightly modified version
# of the Apache Software License. See the accompanying LICENSE file
# for more information.
#
# Generic NTLM Relay Module
#
# Authors:
# Alberto Sol... |
sub_worker_process.py | # Copyright (c) 2021-2022, NVIDIA CORPORATION. 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 ... |
threading1.py | import threading
def thread_job():
print("This is an added Thread, number is %s" % threading.current_thread())
# pass
def thread_job2():
print("why only first thread")
def main():
# 添加一个线程
added_thread = threading.Thread(target=thread_job())
added_thread2 = threading.Thread(target=thread_job... |
exp_dispersion_cb.py | """Makes BlueBot aggregate.
"""
import RPi.GPIO as GPIO
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
import os
import time
import threading
import numpy as np
from math import *
from picamera import PiCamera
from lib_utils import *
from lib_photodiode import Photodiode
from lib_depthsensor import DepthSensor
from l... |
schedule.py | import time
from multiprocessing import Process
import asyncio
import aiohttp
try:
from aiohttp.errors import ProxyConnectionError,ServerDisconnectedError,ClientResponseError,ClientConnectorError
except:
from aiohttp import ClientProxyConnectionError as ProxyConnectionError,ServerDisconnectedError,ClientRespons... |
main.py | #!/usr/bin/python
import paho.mqtt.client as paho
import psutil
import signal
import sys
import time
from threading import Thread
def interruptHandler(signal, frame):
sys.exit(0)
def on_publish(mosq, obj, msg):
pass
def dataNetwork():
netdata = psutil.net_io_counters()
return netdata.packets_sent +... |
run_unittests.py | #!/usr/bin/env python3
# Copyright 2016-2017 The Meson development team
# 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 ... |
main.py | #!/usr/bin/python3
import sys
import psutil
import threading
import ctypes
import queue
import server.server_discovery as discovery
from common.config import Config
from common.utility import read_user_config, get_current_ip_address
from matching.matcher import Matcher
from server.server import Server
from gui.app impo... |
test_mainwindow.py | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright © Spyder Project Contributors
#
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
# -----------------------------------------------------------------------------
"""
Te... |
buttons.py | from abc import abstractmethod
from threading import Thread
import tkinter as tk
MARGIN = 5
BUTTON_HEIGHT = 1
BUTTON_WIDTH = 5
PADDING_X = "2m"
PADDING_Y = "1m"
class RokuButton(tk.Button):
def __init__(self, root, *args, **kwargs):
super().__init__(root, *args, **kwargs)
self.configure(height=BU... |
test_ipc.py | from __future__ import absolute_import, print_function, division
import sys
import multiprocessing as mp
import traceback
import pickle
import numpy as np
from numba import cuda
from numba.cuda.cudadrv import drvapi, devicearray
from numba import unittest_support as unittest
from numba.cuda.testing import skip_on_cu... |
SubprocessRunner.py | # Copyright 2016 Ufora 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 i... |
Update.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import threading
import time
from Da import AppBase
from Da import Config
from Da import Updater
from View import UpdateInfoView
class Update :
def __init__ (self) :
self.app = AppBase.info
self.Updater = Updater.Updater()
self.Cfg = Config.Config()
self.UdView ... |
gpumux.py | #!/usr/bin/env python3
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.