source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
lidar.py | # Display Data from Neato LIDAR XV-11
# used with XV Lidar Controller 1.2 https://www.getsurreal.com/product/xv-lidar-controller-v1-2/
# based on code from Nicolas "Xevel" Saugnier
import signal, thread, time, sys, traceback, math, os
import datetime
import numpy as np
import matplotlib.pyplot as plt
import... |
main_window.py | import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
from electrum.bitcoin import TYPE_ADDRESS
from electrum.storage import WalletStorage
from electrum.wallet import Wallet
from electrum.paymentrequest import InvoiceStore
from electrum.util import pro... |
node.py | import random
import Pyro4
from threading import Thread
import threading
import time
from chord.debug import logger as log
from chord.config import *
import hashlib
STABILIZATION_TIME = 0.2
RETRY_TIME = STABILIZATION_TIME * 4
ASSURED_LIFE_TIME = RETRY_TIME * 4
def repeat(sleep_time, condition: lambda *args: True):
... |
example_test.py | # This example code is in the Public Domain (or CC0 licensed, at your option.)
# Unless required by applicable law or agreed to in writing, this
# software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied.
# -*- coding: utf-8 -*-
from __future__ import pri... |
test_functools.py | import abc
import builtins
import collections
import collections.abc
import copy
from itertools import permutations
import pickle
from random import choice
import sys
from test import support
import threading
import time
import typing
import unittest
import unittest.mock
import os
import weakref
import gc
from weakref ... |
test.py | import multiprocessing
import time
import numpy as np
from sklearn.svm import SVC
from sklearn import datasets
def mp_worker(q):
print("Entered worker")
clf = SVC()
iris = datasets.load_iris()
clf.fit(iris.data, iris.target_names[iris.target])
while 1:
str = q.get()
l = [float(i) fo... |
basic_sanity_tests.py | # If not stated otherwise in this file or this component's LICENSE file the
# following copyright and licenses apply:
#
# Copyright 2020 Sky UK
#
# 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... |
test_nanny.py | import asyncio
from contextlib import suppress
import gc
import logging
import os
import random
import sys
import multiprocessing as mp
import numpy as np
import pytest
from tlz import valmap, first
from tornado.ioloop import IOLoop
import dask
from distributed.diagnostics import SchedulerPlugin
from distributed imp... |
futures.py | """
Support for Futures (asynchronously executed callables).
If you're using Python 3.2 or newer, also see
http://docs.python.org/3/library/concurrent.futures.html#future-objects
Pyro - Python Remote Objects. Copyright by Irmen de Jong (irmen@razorvine.net).
"""
from __future__ import with_statement
from ... |
pydoc.py | #!/usr/bin/env python3
"""Generate Python documentation in HTML or text for interactive use.
In the Python interpreter, do "from pydoc import help" to provide online
help. Calling help(thing) on a Python object documents the object.
Or, at the shell command line outside of Python:
Run "pydoc <name>" to show documen... |
Async.py | '''Adds async functionality to tkinter widgets.'''
import threading
def AddAsync(self):
'''Add Async functionality to 'self', a tkinter object; adds NewTask and CancelCallbacks.
Note: If you want to be able to kill the threads, you must pass some sort of state to each thread that enables you to tell the threa... |
main.py | from tkinter import Label,Grid,LabelFrame,Entry,Tk,N
from tkinter import filedialog
from tkinter import ttk
import timelapse
import threading
from cv2 import cv2
def devicePreview():
cap = cv2.VideoCapture(int(Device_Entry.get()),cv2.CAP_DSHOW)
if (cap.isOpened() == False):
print('No video device')
... |
specifiedTokenSniper.py | print("Loading...")
from web3 import Web3
import datetime
import threading
import json
import asyncio
import requests
import time
import os
import sys
import ctypes
from http.server import HTTPServer, BaseHTTPRequestHandler
import traceback #ONLY FOR DEBUGGING PURPOSES ONLY
os.system("mode con: lines... |
sensor.py | #!/usr/bin/env python
"""
Copyright (c) 2014-2022 Maltrail developers (https://github.com/stamparm/maltrail/)
See the file 'LICENSE' for copying permission
"""
from __future__ import print_function # Requires: Python >= 2.6
import sys
sys.dont_write_bytecode = True
import cProfile
import inspect
import math
impor... |
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... |
_channel.py | # Copyright 2016 gRPC 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 agreed to in writing... |
discordbot.py | import discord
import pkgutil
import sys
import json
import asyncio
import inspect
import time
import threading
import commands
import permissions
#import pyrepl
#interactive = None
loaded = False
#import traceback
#import warnings
import sys
def warn_with_traceback(message, category, filename, lineno, file=None, l... |
pyros.py |
#
# Copyright 2016-2017 Games Creators Club
#
# MIT License
#
import sys
import re
import time
import random
import traceback
import threading
import paho.mqtt.client as mqtt
client = None
_name = "undefined"
_host = None
_port = 1883
def doNothing():
pass
_onConnected = doNothing
_connected = False
_subscr... |
SantaClaus.py | import random
from threading import Semaphore
from threading import Thread
import time
elves_c = 0
reindeer_c = 0
santaSem = Semaphore()
reindeerSem = Semaphore()
elfTex = Semaphore()
mutex = Semaphore(1)
def prepareSleigh():
global reindeer_c
print("Santa Claus: preparing sleigh")
def helpElves():
pri... |
main.py | import argparse
import pandas as pd
import time
import matplotlib.pyplot as plt
from torch import nn
from torch.functional import split
import torch.optim as optim
from tqdm import trange
import threading
from utils import *
import cv2
from base_logger import logger
draw_threaded: bool = False
class FAST(nn.Module)... |
ui_tests.py | # -*- coding: utf-8 -*-
"""Tests for the user interface."""
#
# (C) Pywikibot team, 2008-2017
#
# Distributed under the terms of the MIT license.
#
# NOTE FOR RUNNING WINDOWS UI TESTS
#
# Windows UI tests have to be run using the tests\ui_tests.bat helper script.
# This will set PYTHONPATH and PYWIKIBOT2_DIR, and then ... |
thread_name_and_process.py |
##Consider the python program given below in which we print thread name and corresponding process for each task:
# Python program to illustrate the concept
# of threading
import threading
import os
def task1():
print("Task 1 assigned to thread: {}".format(threading.current_thread().name))
print("ID of proc... |
_ip.py | #! /usr/bin/env python3
import collections
import logging
import random
import requests
import threading
import typing
from queue import Queue
URLS = [
"https://api.ipify.org",
"https://checkip.amazonaws.com",
"https://icanhazip.com",
"https://ifconfig.co/ip",
"https://ipecho.net/plain",
"http... |
process_scenario.py | import copy
import logging
import os
import time
import traceback
from enum import Enum, unique
from multiprocessing import Semaphore
from multiprocessing.context import Process
from typing import Tuple, List
from commonroad.common.solution import PlanningProblemSolution, Solution, \
CommonRoadSolutionWriter
from ... |
pinybot.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
""" A Tinychat bot (based on the pinylib library) with additional features/commands. """
# Supplementary Information:
# Description: Tinychat Python bot,
# Repository homepage: https://techwhizz199.github.io/pinybot/,
# Repository: https://github.com/TechWhizZ199/pinybot... |
test_browser.py | # coding=utf-8
# Copyright 2013 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.
from __future__ import print_function
import argparse
... |
keepalived_state_change.py | # Copyright (c) 2015 Red Hat Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
mp_fj_test.py | import numpy
import time
import multiprocessing
import ctypes
import warnings
#Suppress the divide by zero errors
warnings.filterwarnings('ignore', category=RuntimeWarning)
def fisher_jenks(values, classes=5, cores=None, sort=True):
'''Fisher-Jenks Optimal Partitioning of an ordered array into k classes
Para... |
train.py | """
@author: Viet Nguyen <nhviet1009@gmail.com>
"""
import os
os.environ['OMP_NUM_THREADS'] = '1'
import argparse
import torch
from src.model import ActorCritic, IntrinsicCuriosityModule
from src.optimizer import GlobalAdam
from src.process import local_train
import torch.multiprocessing as _mp
import shutil
def ge... |
REDItoolDnaRnav13.py | #!/home/epicardi/bin/python27/bin/python
# Copyright (c) 2013-2014 Ernesto Picardi <ernesto.picardi@uniba.it>
#
# 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 ... |
pseudo_fiber.py | import sys, threading
from queue import Queue
_current_fiber = None
def set_current_fiber(f):
global _current_fiber
_current_fiber = f
def current():
global _current_fiber
if _current_fiber is None:
_current_fiber = _create_main_fiber()
return _current_fiber
class Fiber:
def __ini... |
main.py | import web,socket,time,Adafruit_ADS1x15,tempvar
from web import form
import RPi.GPIO as GPIO
from threading import Thread
localhost = "http://" + socket.gethostbyname(socket.gethostname()) + ":8080"
print(localhost)
#global infrared, ultrasonic, servomotor, motor_L1, motor_L2, motor_R1, motor_R2, servo_turning_ti... |
singleMachine.py | # Copyright (C) 2015-2021 Regents of the University of California
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
client1.py | import logging
import random
from multiprocessing.dummy import Pool
import time
import grpc
import wav2letter_pb2
import wav2letter_pb2_grpc
import queue
import threading
logging.basicConfig(level=logging.INFO)
SERVER_URL = 'localhost:50051'
class recieved_msg:
recieved_msg=[]
st_time=[]
end_time=[]
de... |
Thread_Synchronization_Semafore.py | # Thread synchronazation semafare
from threading import *
import time
l=RLock()
def factorial(n):
l.acquire()
if n==0:
result=1
else:
result=n*factorial(n-1)
l.release()
return result
def results(n):
print("The Factorial of", n, "is:", factorial(n))
t1=Thread(target=results, args=(5,))
... |
arp.py | import os
import sys
import signal
import threading
import random
from System.Core.Global import *
from System.Core.Colors import *
from System.Core.Modbus import *
from System.Lib import ipcalc
down = False
class Module:
info = {
'Name': 'DOS Arp Poisoning',
'Author': ['@enddo'],
'Description': ("DOS with... |
udpclient_record.py | import socket
import sys
import time
import serial
import threading
import numpy as np
from scipy import signal
from scipy.signal import lfilter , iirnotch , butter , filtfilt , medfilt
import csv
writeToFile = True
read = True
thrf = 350
thrs = 450
def process():
global strm,m1p,m2p,m3p,m4p,o1p,o2p,o3p,o4p,win,... |
jobs.py | import threading
from Queue import Queue
from framework.fuzzer.fuzzobjects import FuzzResult
from framework.fuzzer.fuzzobjects import FuzzRequest
from framework.plugins.pluginobjects import PluginResult
from framework.plugins.pluginobjects import PluginRequest
from framework.core.myexception import FuzzException
from ... |
shell.py | #!/usr/bin/env python3
import sys
import subprocess
import argparse
import time
from collections import OrderedDict
from threading import Thread
import logging
logging.disable(logging.WARN)
from gridvm.simplescript.runtime.runtime import Runtime, LocalRequest
# YO DWAG, WE HEARD YOU LIKE RUNTIME... |
only_python.py | import psutil
import pythoncom
import subprocess
import threading
import time
import wmi
#We don't need to be faster
WAIT_SECONDS = 1
#Start the Software that gets the data
def start_sensors():
subprocess.call(['OpenHardwareMonitor/OpenHardwareMonitor.exe'])
def get_data():
pythoncom.CoInitialize() #CoInitialize... |
run_manager.py | # -*- encoding: utf-8 -*-
import errno
import json
import logging
import os
import re
import signal
import socket
import stat
import subprocess
import sys
import time
from tempfile import NamedTemporaryFile
import threading
import yaml
import numbers
import inspect
import glob
import platform
import fnmatch
import cl... |
sjf_p.py | import math
import time
from os import getppid, remove
from random import randint
from re import split, sub
from threading import Thread, current_thread, enumerate
from typing import NoReturn, Any, Dict, List, Tuple
import numpy as np
def worker(burstTime: float) -> NoReturn:
print(space, burstTime, space, "Thre... |
opusdir.py | # opusdir - transcode a directory tree from FLAC to Opus
# requires Python 3.3
import argparse
import collections
import os
import queue
import shutil
import stat
import subprocess
import sys
import threading
import unittest
num_workers_default = 2
opusenc_path = "/home/andrew/bin/opusenc"
cover_names = ['cover.jpg',... |
coverage_test_multicast_ipv6.py | from Queue import Queue
import random
import threading
import unittest
from coapclient import HelperClient
from coapserver import CoAPServer
from coapthon import defines
from coapthon.messages.message import Message
from coapthon.messages.option import Option
from coapthon.messages.request import Request
from coapthon.... |
scheduler.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: set ts=4 sw=4 et ai:
"""
| This file is part of the web2py Web Framework
| Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
| License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
Background processes made simple
---------------------------------
"""
fr... |
signal_management.py | # Copyright 2018 Open Source Robotics Foundation, 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... |
mesos_executor.py | import sys
import threading
from pulsar.mesos import (
Executor,
MesosExecutorDriver,
mesos_pb2,
ensure_mesos_libs,
)
from pulsar.client.util import from_base64_json
from pulsar.scripts.submit_util import (
manager_from_args,
wait_for_job
)
from pulsar.manager_endpoint_util import submit_job
f... |
reflectionhandler.py | # Copyright (c) 2011 Google Inc. 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
# notice, this list of conditions and the ... |
utils_PC.py | #!/usr/bin/env python3.9
from cProfile import label
import tkinter as tk
import tkinter.filedialog
from tkinter.ttk import *
from tkinter import ttk
from tkinter import *
from tkinter.filedialog import askopenfile
import tkinter.scrolledtext as scrolledtext
from tkinter import messagebox as msg
from tkinter import fon... |
TTi.py | #from GPIBdevices import GPIBDevice
#from SERIALdevices import SERIALDevice
from DummyMeter import Bedna
# import bus
from numpy import array
from time import sleep
class PStsx3510P(Bedna):
"""
# test PowerSource
from threading import Thread
from time import sleep
import random
... |
admin_finder.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# This is a part of CMSeeK, check the LICENSE file for more information
# Copyright (c) 2018 - 2020 Tuhinshubhra
import threading
import cmseekdb.basic as cmseek
joom_admin_found = 0
joom_admins = []
def check_admin(url,file,ua):
global joom_admin_found, joom_admins
... |
benchmark_grpc.py | #!/usr/bin/env python3
import time
import threading
from dubbo.test_pb2_grpc import TestStub
from google.protobuf.empty_pb2 import Empty
from google.protobuf.wrappers_pb2 import StringValue
import grpc
# 当前启动的测试服务
host = "localhost:8093"
def test():
# 链接服务器
channel = grpc.insecure_channel(host)
stub = ... |
planificador_matrices.py | import Sensor_matrices
import random
import time
import numpy
import sys
from multiprocessing import Process, Manager, Lock
from multiprocessing.managers import BaseManager
def alarmas(object, num_process, tiempo_limite):
#bucle de 100 para el promedio
tiempo_inicio = time.time()
while (1):
# ti... |
eui.py | import base64
import hashlib
import json
import logging
import os
import queue
import random
import socket
import struct
import threading
from concurrent import futures
log = logging.getLogger('eui')
_RECEIVE_QUEUE = queue.Queue()
_SEND_QUEUE = queue.Queue()
_DISPATCHERS = futures.ThreadPoolExecutor(max_workers=100)
_... |
tests.py | from unittest import skipIf
from django.test import TestCase, TransactionTestCase
from django.core.exceptions import ImproperlyConfigured
from django.urls import reverse
from django.test.client import Client
from django import db
from djongo import transaction
from dol import ConcurrentUpdate
from .models import (Si... |
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... |
update_site_data.py | #!/usr/bin/env python3
"""Maigret: Supported Site Listing with Alexa ranking and country tags
This module generates the listing of supported sites in file `SITES.md`
and pretty prints file with sites data.
"""
import json
import sys
import requests
import logging
import threading
import xml.etree.ElementTree as ET
from... |
client.py | import os, sys, time, re
import threading, subprocess
import json, xml.dom.minidom, mimetypes
import copy, pickle
from . import config, storage, out, tools
import requests
BASE_URL = config.BASE_URL
class client(object):
def __init__(self):
self.storageClass = storage.Storage()
sel... |
cleanup_db.py | __author__ = 'anushabala'
import sqlite3
import time
import atexit
import json
from argparse import ArgumentParser
from src.basic.systems.human_system import HumanSystem
import multiprocessing
class DBCleaner():
SLEEP_TIME = 15
def __init__(self, db_file, chat_timeout, user_timeout):
self.db_file = ... |
fsdf.py | import threading
# 定义一个普通的action函数,该函数准备作为线程执行体
def action(max, a, b, c, e):
print(max)
print(a)
print(b)
print(c)
print(e)
# for i in range(max):
# # 调用threading模块current_thread()函数获取当前线程
# # 线程对象的getName()方法获取当前线程的名字
# print(threading.current_thread().getName() + ... |
multi_sum_threading.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
from Queue import Queue
# from rons_tutorial_formatting import *
import threading as TH
# start_block('Multi sum')
def range_sum(start, end, queue):
print ("start => {} end => {}".format(start, end))
sum_of_range = 0
for n in range(start, end+1):
... |
sendalerts.py | import time
from threading import Thread
from django.core.management.base import BaseCommand
from django.utils import timezone
from hc.api.models import Check
def notify(check_id, stdout):
check = Check.objects.get(id=check_id)
tmpl = "Sending alert, status=%s, code=%s\n"
stdout.write(tmpl % (check.statu... |
client6.py | import socket
import time
from select import select
from threading import Thread
from collections import deque
class EventLoop:
def __init__(self):
self.tasks = deque()
self.stopped = {}
def add_task(self, task):
self.tasks.append(task)
def add_future(self, future):
self.t... |
set_param_list_node.py | #!/usr/bin/env python2
"""
This module is used to set a list of PX4 parameters
"""
from __future__ import division
from mavros_msgs.msg import ParamValue
from cx_model_px4.argparse_cx import *
from mavros_interface import *
from definitions_pyx4 import *
class Px4_param_setter(object):
def __init__(self,
... |
ghdl.py | # Copyright 2018 Delft University of Technology
#
# 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 agr... |
ex_2.py |
"""
Example 2:
How do I manage memory during multiprocessing?
"""
# Imports
import numpy as np
import multiprocessing as mp
import tracemalloc
from time import sleep
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def forked_processes():
### What's happening to the memory (forking)?
tracemalloc.sta... |
wsgi_server.py | #!/usr/bin/env python
#
# Copyright 2007 Google 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 o... |
mininet_tests.py | #!/usr/bin/env python3
"""Mininet tests for FAUCET."""
# pylint: disable=too-many-lines
# pylint: disable=missing-class-docstring,missing-function-docstring
# pylint: disable=too-many-arguments
import binascii
import collections
import copy
import itertools
import ipaddress
import json
import os
import random
import... |
node_feature.py | # -*- coding: utf-8 -*-
"""node_feature.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1wbwDJMinevspuioUNqc5cVMjy6cZsY72
"""
import gzip
import dgl
import pickle
import torch as th
import torch
import random
import numpy as np
import torch.nn as... |
test_selenium.py | import re
import threading
import time
import unittest
from selenium import webdriver
from app import create_app, db
from app.models import Role, User, Post
class SeleniumTestCase(unittest.TestCase):
client = None
@classmethod
def setUpClass(cls):
# start Chrome
try:
cls.c... |
test.py | import json
import os.path as p
import random
import socket
import subprocess
import threading
import time
import avro.schema
from confluent_kafka.avro.cached_schema_registry_client import CachedSchemaRegistryClient
from confluent_kafka.avro.serializer.message_serializer import MessageSerializer
import kafka.errors
i... |
real_time.py | import threading
import time
from tkinter import *
from tkinter import ttk, messagebox
from tkinter.font import Font
import numpy
import seaborn as sns
import mne
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
from pylsl import StreamInlet, resolve_stream
# https://labstreaminglayer.read... |
uart.py | from serial.serialutil import SerialException
from threading import Thread
from django_redis import get_redis_connection
from app.utils.tools import create_lighting_usage_record
import time
import serial
import logging
redis_conn = get_redis_connection('default') # 获取redis连接
receive_flag = True # 串口数据接收标志
con... |
factory.py | from twisted.names.server import DNSServerFactory
from twisted.names import dns
import threading
import time
import csv
csv_logging_lock = threading.Lock()
class DatabaseDNSFactory(DNSServerFactory):
@property
def csv_location(self):
return self.__csv_location
@csv_location.setter
def csv_lo... |
dlwsrestapi.py | import sys
import json
import os
import signal
import base64
import yaml
import uuid
import requests
import logging
import timeit
import thread
import time
import sys
import math
import traceback
import threading
from logging.config import dictConfig
from flask import Flask, Response,redirect,render_template
from flask... |
ThreadedMainWindow.py | """
Zachary Cook
Extends QMainWindow to improve threading.
"""
from typing import Callable, Dict
from PyQt5 import QtWidgets, QtCore
class ThreadedMainWindow(QtWidgets.QMainWindow):
"""Class for a threaded main window.
"""
runThreadedOperationEvent = QtCore.pyqtSignal(dict)
def __init__(self):
... |
NarrativeTestDynamicServer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from wsgiref.simple_server import make_server
import sys
import json
import traceback
import datetime
from multiprocessing import Process
from getopt import getopt, GetoptError
from jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError,\
JSONRPCError, Inva... |
_background_server.py | # Note: the code in this file is adapted from source at
# https://github.com/googlecolab/colabtools/blob/master/google/colab/html/_background_server.py
# The following is its original license:
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file ex... |
managers.py | #
# Module providing manager classes for dealing
# with shared objects
#
# multiprocessing/managers.py
#
# Copyright (c) 2006-2008, R Oudkerk
# Licensed to PSF under a Contributor Agreement.
#
__all__ = [ 'BaseManager', 'SyncManager', 'BaseProxy', 'Token',
'SharedMemoryManager' ]
#
# Imports
#
import sys... |
keepkey.py | from binascii import hexlify, unhexlify
import traceback
import sys
from electrum.util import bfh, bh2u, UserCancelled, UserFacingException
from electrum.bitcoin import TYPE_ADDRESS, TYPE_SCRIPT
from electrum.bip32 import deserialize_xpub
from electrum import constants
from electrum.i18n import _
from electrum.transac... |
train.py | # Copyright (c) 2020 DeNA Co., Ltd.
# Licensed under The MIT License [see LICENSE for details]
# training
import os
import time
import copy
import threading
import random
import bz2
import pickle
from collections import deque
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
impor... |
njrat.py | #!/usr/bin/env python3
# MIT License
#
# Copyright (C) 2020, Entynetproject. All Rights Reserved.
#
# 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 lim... |
main.py | import sys
import threading
import os
import toml
import time
from datetime import datetime
from Input.Simulator import Simulator
from Observer.ObserverClass import Observer
from Input.Fibaro import Fibaro
from Input.Widefind import WideFind
from Output.Output import Output
class Main:
current_states = []
... |
conftest.py | from __future__ import print_function
import pytest
import time
import platform
import tempfile
import datetime
import requests
import os
import sys
import threading
import logging
import shutil
from contextlib import contextmanager
from tests import utils
from six.moves import queue
from wandb import wandb_sdk
# fro... |
CameraSystem.py | from detection_number.DetectionNumber import DetectionNumber
from Camera import Camera
from bluetooth.Bluetooth import Bluetooth
from detection_block.BlockRecognizer import BlockRecognizer
from block_bingo.BlackBlockCommands import BlackBlockCommands
from block_bingo.commands import Instructions
from block_bingo.BlockB... |
utils.py | import cv2
from bresenham import bresenham
# from PIL import Image, ImageDraw
import matplotlib.pyplot as plt
import cv2
import numpy as np
# from multiprocessing import Process, Queue
from threading import Thread as Process
from queue import Queue
from collections import Counter
w_occ = 2.0
thresh_floor = -0.3
def ... |
controller.py | import sys
import time
import json
import random
import threading
import pynput
class MouseRecord(object):
"""
记录键盘鼠标事件值json文件,
包括鼠标移动,滚动,左右键
键盘按下,放开
"""
def __init__(self, file_name):
self.start_time = 0
self.mouse_list = []
self.running = True
self.save_file =... |
threads.py | import threading
from .utils import createID
class StoppableThread(threading.Thread):
def __init__(self, *args, **kwargs):
super(StoppableThread, self).__init__(*args, **kwargs)
self._stop_event = threading.Event()
def stop(self):
self._stop_event.set()
def stopped(sel... |
testgaidaros.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import with_statement
import socket as sock, ssl, multiprocessing as mp, time, subprocess as sp, tempfile as tf, re
from gaidaros import Gaidaros
def tests():
def _do_single(*args, **kwargs):
srv = Gaidaros(*args, **kwargs)
srv.handle()... |
test_views.py | # encoding: utf-8
from __future__ import absolute_import, division, print_function, unicode_literals
from threading import Thread
from django import forms
from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import HttpRequest, QueryDict
from django.test import override_sett... |
app.py | import json
import threading
import redis
from sqlalchemy import create_engine, func, Column, Integer
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from tornado import websocket, web, ioloop
engine = create_engine('sqlite:///:memory:', echo=True)
Base = declarative_ba... |
proto_client2.py | import socket
import msvcrt
from threading import Thread
class SharedData:
def __init__(self, data=None):
self.__value = [data]
def setData(self, data):
self.__value[0] = data
def getData(self):
return self.__value[0]
def keyChecker(dataPasser):
while True:
if msvcrt.... |
main.py | import argparse
import github3
import toml
import json
import re
import functools
from . import comments
from . import utils
from .parse_issue_comment import parse_issue_comment
from .auth import verify as verify_auth
from .utils import lazy_debug
import logging
from threading import Thread, Lock, Timer
import time
imp... |
timeout_guard.py | ## @package timeout_guard
# Module caffe2.python.timeout_guard
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import contextlib
import threading
import os
import time
import signal
import logging
from future.utils imp... |
_logger.py | """
.. References and links rendered by Sphinx are kept here as "module documentation" so that they can
be used in the ``Logger`` docstrings but do not pollute ``help(logger)`` output.
.. |Logger| replace:: :class:`~Logger`
.. |add| replace:: :meth:`~Logger.add()`
.. |remove| replace:: :meth:`~Logger.remove()`
.. |... |
test_serial_reader.py | #!/usr/bin/env python3
import logging
import sys
import tempfile
import time
import threading
import unittest
import warnings
from os.path import dirname, realpath
sys.path.append(dirname(dirname(dirname(realpath(__file__)))))
from logger.utils.simulate_serial import SimSerial # noqa: E402
from logger.transforms.sli... |
test_socket_jy.py | import errno
import os
import socket
import ssl
import threading
import time
import unittest
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from SocketServer import ThreadingMixIn
from test import test_support
def data_file(*name):
return os.path.join(os.path.dirname(__file__), *name)
CERTFILE = d... |
mvdemo.py | import cv2
import time
from threading import Thread
import argparse
import os
#from multiprocessing import Process, Queue
from queue import Queue
from utils import *
from MvDetector import MvDetector
frameDrops = 0
imgQueue = Queue(10)
imgScaledQueue = Queue(10)
resQueue = Queue(10)
imgVisQueue = Queue(10)
stopThreads... |
monkey.py | import random
import pyaudio
from clear_osc import SineOsc
import multiprocessing as mp
import time
import argparse
import random
from pythonosc import osc_bundle_builder
from pythonosc import osc_message_builder
from pythonosc import udp_client
parser = argparse.ArgumentParser()
parser.add_argument("--ip", default="1... |
python_yndexer.py | import os
import sys
import threading
import subprocess
def _try_to_kill(process):
try:
process.kill()
except Exception:
pass
def touch(path):
if not os.path.exists(path):
with open(path, 'w') as _:
pass
class Process(object):
def __init__(self, args):
s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.