source
stringlengths
3
86
python
stringlengths
75
1.04M
mmalobj.py
# vim: set et sw=4 sts=4 fileencoding=utf-8: # # Python header conversion # Copyright (c) 2013-2017 Dave Jones <dave@waveform.org.uk> # # Original headers # Copyright (c) 2012, Broadcom Europe Ltd # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted...
dirscan.py
# -*- coding: utf-8 -*- import requests import threading import time import os import sys path = os.getcwd() cache = (path+'/cache') dict = (path + '/core/dict.txt') #print(dict) f = open(cache+'/url.log') tmpurl = f.read() target_url = ('http://' + tmpurl + "/") #print(target_url) threads = [] thread_max = threadin...
kitti_raw.py
import os, sys import numpy as np import imageio from tqdm import tqdm import torch.multiprocessing as mp import pdb import shutil def process_folder(q, static_frames, test_scenes, data_dir, output_dir, stride=1): while True: if q.empty(): break folder = q.get() if folder in sta...
sparse_conditional_accumulator_ali_test.py
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
controller.py
try: import Tkinter as Tk except ModuleNotFoundError: import tkinter as Tk import threading import time try: import RPi.GPIO as GPIO except: pass from pathlib import Path from consts import * from view import View from model import Model from is_raspberry_pi import is_raspberry_pi from sound impo...
general_bag_processor.py
import multiprocessing import rosbag #pip install --extra-index-url https://rospypi.github.io/simple/ rospy rosbag import boto3 #pip install boto3 from urllib.parse import unquote_plus import s3fs import csv from multiprocessing import Pool, Process from functools import partial import datetime as dt s3_clie...
views.py
from django.template import loader, Context from django.template import RequestContext from django.core.paginator import Paginator from django.core.mail import send_mail from django.core.context_processors import csrf from django.shortcuts import render_to_response from django.shortcuts import get_object_or_404 from dj...
auto_test.py
"""Tests for letsencrypt-auto""" from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler from contextlib import contextmanager from functools import partial from json import dumps from os import chmod, environ, makedirs from os.path import abspath, dirname, exists, join import re from shutil import copy, rmtree ...
test_backenddict.py
import random import time import pytest from moto.core import BaseBackend from moto.core.utils import AccountSpecificBackend, BackendDict from threading import Thread class ExampleBackend(BaseBackend): def __init__(self, region_name, account_id): super().__init__(region_name, account_id) def test_backe...
profiler.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 app...
ch03_listing_source.py
import threading import time import unittest import redis ONE_WEEK_IN_SECONDS = 7 * 86400 VOTE_SCORE = 432 ARTICLES_PER_PAGE = 25 ''' # <start id="string-calls-1"/> >>> conn = redis.Redis() >>> conn.get('key') #A >>> conn.incr('key') #B 1 #B >>> conn.incr('key', ...
player.py
""" MIT License Copyright (c) 2021-present DTS Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, d...
datasets.py
# YOLOv5 datasets utils and dataloaders import glob import hashlib import json import logging import os import random import shutil import time from itertools import repeat from multiprocessing.pool import ThreadPool, Pool from pathlib import Path from threading import Thread import cv2 import numpy as np import torc...
CatBot_Protect.py
# -*- coding: utf-8 -*- #Cat_Bot import LINETCR from LINETCR.lib.curve.ttypes import * from datetime import datetime import time,random,sys,json,codecs,threading,glob,re,ast,os,subprocess,wikipedia,goslate import bs4 import ast import requests,json,urllib import html5lib from random import randint from bs4 import Beau...
utils.py
""" Miscellaneous utils Date: September 2018 Author: Ignacio Heredia Email: iheredia@ifca.unican.es Github: ignacioheredia """ import os import subprocess from distutils.dir_util import copy_tree from multiprocessing import Process import numpy as np from tensorflow.keras import callbacks from tensorflow.keras impor...
oplog_manager.py
# Copyright 2013-2014 MongoDB, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
conftest.py
""" Pytest configuration that spins up a single localstack instance that is shared across test modules. See: https://docs.pytest.org/en/6.2.x/fixture.html#conftest-py-sharing-fixtures-across-multiple-files It is thread/process safe to run with pytest-parallel, however not for pytest-xdist. """ import logging import mu...
mcsoda.py
#!/usr/bin/env python import re import sys import math import time import socket import string import struct import random import threading import multiprocessing import Queue import logging import logging.config from collections import deque from hashlib import md5 import json import inspect sys.path.extend(('.', 'li...
valloxserial.py
import logging import serial import time import threading class ValloxSerial: system = b'\x01' sender = b'\x22' destinations = { 'host': b'\x11', 'remote_broadcast': b'\x20', } commands = { 'speed': b'\x29', 'intake_temp': b'\x5b', } # There are wrong temp v...
processes_barrier.py
#Synchronize processes with barrier – Chapter 3: Process Based Parallelism import multiprocessing from multiprocessing import Barrier, Lock, Process from time import time from datetime import datetime def test_with_barrier(synchronizer, serializer): name = multiprocessing.current_process().name synchronizer....
conftest.py
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2021 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
convert_short.py
import os, csv, pprint, threading, sys def to_beats(time, tempo): return round(int(time)/tempo) def to_char(num): return chr(int(num)) def run(file): print(file) with open(file, encoding="utf-8", errors="replace") as f: reader = csv.reader(f) music = [] playing = "" ...
master.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...
rihanna_job.py
import requests from bs4 import BeautifulSoup import config from multiprocessing.pool import ThreadPool from threading import Thread import numpy as np import matplotlib matplotlib.use('Agg') from matplotlib import pyplot as plt import time import os import random as r pool = ThreadPool(processes=5) cities = ["London",...
MultiprocessFiles.py
"""Reads and writes Line Delimited JSON files in parallel processing.""" from __future__ import print_function import multiprocessing import gzip import json import time class MultiprocessFiles: """Reads and writes Line Delimited JSON files in parallel processing. Attributes: num_procs: int ...
logging.py
# encoding: utf-8 from __future__ import absolute_import import logging import os import random import sys import threading import time import traceback from contextlib import ExitStack from functools import wraps, partial from itertools import cycle, chain, repeat, count from collections import OrderedDict from easy...
threads.py
from threading import Thread def hello(name): print("hello " + name) th = Thread(target= hello, args=("bob", )) th.start() th.join()
serialization.py
# Copyright 2020 Huawei Technologies Co., Ltd # # 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...
setup.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import asyncio import contextlib import functools import json import os import socketserver import tempfile import threading from pathlib impo...
experiment_test.py
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
clientMedia.py
import cv2 from socket import socket, AF_INET, SOCK_STREAM from imutils.video import WebcamVideoStream # import pyaudio from array import array from threading import Thread import numpy as np import zlib import struct HOST = input("Enter Server IP\n") PORT_VIDEO = 3000 PORT_AUDIO = 4000 BufferSize = 4096 CHUNK=1024 l...
h264_pipe.py
import ffmpeg import logging from threading import Thread from . output import Output log = logging.getLogger(__name__) class H264Pipe(Output): ''' Converts raw video to a h264 stream. h264 data can be accessed by passing a callback to the config that access the data positional argument. for exa...
youtube-dl-server.py
from __future__ import unicode_literals import json import os import subprocess from queue import Queue from flask import Flask, escape, request, send_from_directory, render_template from flask_basicauth import BasicAuth from threading import Thread import youtube_dl from pathlib import Path from collections import Cha...
session_test.py
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
test_xlink_manager.py
import os import threading from time import sleep from unittest import TestCase from mock import patch, Mock, MagicMock from node.data_handler import DataHandler from node.xlink_manager import XlinkManager class TestXlinkManager(TestCase): @patch('threading.Thread.start') @patch('node.data_handler.DataHandl...
test_shell_interactive.py
#!/usr/bin/env impala-python # -*- coding: utf-8 -*- # # 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 Apach...
autohdmap_lane_deploy.py
# -*- coding: utf-8 -*- from base.log import * import os from multiprocessing import Process import redis_pool def gen_id(): r = redis_pool.get('dornaemon') return r.incr('deploy_id') def do(ver, image_name, deploy_id, register_url='http://srv-10.gzproduction.com:13900/'): log_path = 'html/deploy_logs/%d' % depl...
main.py
# -*- coding: utf-8 -*- """ Onyx Project https://onyxlabs.fr Software under licence Creative Commons 3.0 France http://creativecommons.org/licenses/by-nc-sa/3.0/fr/ You may not use this software for commercial purposes. @author :: Cassim Khouani """ from onyx.client.speech.assets import snowboydecoder import onyx, impo...
task.py
import atexit import json import os import shutil import signal import sys import threading import time from argparse import ArgumentParser from logging import getLogger from operator import attrgetter from tempfile import mkstemp, mkdtemp from zipfile import ZipFile, ZIP_DEFLATED try: # noinspection PyCompatibili...
MaskDetection.py
import numpy as np import argparse import time import cv2 import os from PyQt5 import QtWidgets, QtGui, QtCore from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5.QtCore import * # from MaskDetectionUi import Ui_MainWindow from b import Ui_MainWindow import sys from threading import Thread, L...
tracker.py
# tracker.py - CS 60 Spring 2021 # Final Project - Gabe Kotsonis, Boxian Wang, George McNulty, Karimi Itani # May 25th, 2021 # # This progam creates the class Tracker, which is a server side program using UDP that helps implement the p2p aspect # of the larger blockchain project. It essentially tracks the peers up...
realtimeLogger.py
# Copyright (C) 2015-2016 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...
test_local_task_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...
test__monkey_hub_in_thread.py
from gevent.monkey import patch_all patch_all(thread=False) from threading import Thread import time # The first time we init the hub is in the native # thread with time.sleep(), needing multiple # threads at the same time. Note: this is very timing # dependent. # See #687 def func(): time.sleep() def main(): ...
test_update_pr_preview.py
try: from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer except ImportError: # Python 3 case from http.server import BaseHTTPRequestHandler, HTTPServer import json import os import subprocess import tempfile import threading subject = os.path.join( os.path.dirname(os.path.abspath(__file__)), ...
test_io.py
import sys import gzip import os import threading import time import warnings import io import re import pytest from tempfile import NamedTemporaryFile from io import BytesIO, StringIO from datetime import datetime import locale import numpy as np import numpy.ma as ma from numpy.lib._iotools import ConverterError, Co...
ProxyRefreshSchedule.py
# -*- coding: utf-8 -*- import sys import time import logging from threading import Thread from apscheduler.schedulers.background import BackgroundScheduler sys.path.append('../') from Util.utilFunction import validUsefulProxy from Manager.ProxyManager import ProxyManager from Util.LogHandler import LogHandler __au...
trex_service_ap.py
from trex.stl.api import * from trex.utils.text_opts import * from trex.utils.common import natural_sorted_key from .trex_service import Service, ServiceFilter from .trex_service_int import ServiceCtx, simpy, TXBuffer import time from collections import deque from scapy.all import * from scapy.contrib.capwap import * f...
test_concur_expunge_ha_vms.py
''' New Integration Test for concurrent expunge vm on ceph @author: SyZhao ''' import apibinding.inventory as inventory import zstackwoodpecker.test_util as test_util import zstackwoodpecker.test_state as test_state import zstackwoodpecker.test_lib as test_lib import zstackwoodpecker.operations.resource_opera...
manager.py
from twython import Twython, TwythonAuthError from app.alchemyapi import AlchemyAPI from app.models import Tweet from datetime import datetime import config def save_tweets(tweets, search_term, location_search_term=None): """ Saves given tweet data in MongoDB database. :param tweets: Tweet dat...
tube.py
# -*- coding: utf-8 -*- from __future__ import absolute_import import logging import re import string import subprocess import sys import threading import time from pwnlib import atexit from pwnlib import term from pwnlib.context import context from pwnlib.log import Logger from pwnlib.timeout import Timeout from pwn...
feature_shutdown.py
#!/usr/bin/env python3 # Copyright (c) 2018-2020 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test bsvcoind shutdown.""" from test_framework.test_framework import BsvcoinTestFramework from test_fr...
test_ssl.py
import re import sys import pytest import threading import socket as stdlib_socket import ssl from contextlib import contextmanager from functools import partial from OpenSSL import SSL import trustme from async_generator import asynccontextmanager import trio from .. import _core from .._highlevel_socket import So...
lisp-itr.py
# ----------------------------------------------------------------------------- # # Copyright 2013-2019 lispers.net - Dino Farinacci <farinacci@gmail.com> # # 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...
common.py
#!/usr/bin/env python """ Copyright (c) 2006-2017 sqlmap developers (http://sqlmap.org/) See the file 'doc/COPYING' for copying permission """ import codecs import contextlib import cookielib import copy import getpass import hashlib import httplib import inspect import json import locale import logging import ntpath...
backends.py
from threading import Thread from django.core.mail import get_connection from django.core.mail.backends.base import BaseEmailBackend """ Sometimes we don't control the code which calls send_email so we have no choice but to subclass the default email backend and ensure the email is sent via a new thread. This is imp...
run_long_lm.py
#!/usr/bin/env python import argparse import copy import datetime from dataclasses import dataclass, field import functools import logging import math import os import pickle import re import sys import time import threading from typing import Optional import torch from torch.utils.data.dataset import Dataset from to...
IsyClass.py
"""Simple Python lib for the ISY home automation netapp This is a Python interface to the ISY rest interface providomg simple commands to query and control registared Nodes and Scenes and well as a method of setting or querying vars """ __author__ = 'Peter Shipley <peter.shipley@gmail.com>' __copyright__ = "Copyr...
SatadishaModule_final_trie.py
# coding: utf-8 # In[298]: import sys import re import string import csv import random import time #import binascii #import shlex import numpy as np import pandas as pd from itertools import groupby from operator import itemgetter from collections import Iterable, OrderedDict from nltk.tokenize import sent_tokenize...
AminoAcidCombinationsSingleLengthMultiCore.py
from itertools import product from time import time from multiprocessing import Process amino_acids = 'ACDEFGHIKLMNPQRSTVWY' amino_acids_invert = amino_acids[::-1] sequence_length = 6 #CAREFUL, TOO MUCH (more than 7) WILL FILL UP HARD DRIVE print(amino_acids) print(str(len(amino_acids)) + ' different Amino Acids poss...
test_html.py
from functools import partial from importlib import reload from io import BytesIO, StringIO import os import re import threading from urllib.error import URLError import numpy as np from numpy.random import rand import pytest from pandas.compat import is_platform_windows from pandas.errors import ParserError import p...
tipbot.py
""" Developed by @vsnation(t.me/vsnation) Email: vsnation.v@gmail.com If you'll need the support use the contacts ^(above)! """ import json import logging import threading import traceback import random import pyqrcode import schedule import re from PIL import Image, ImageFont, ImageDraw import matplotlib.p...
config.py
# -*- coding: utf-8 -*- ''' config ====== logging ------- logging verwenden:: import logging logger = logging.getLogger( "MQTT" ) debug Meldungen ausgeben:: logger.setLevel( logging.DEBUG ) logging level: * CRITICAL - 50 * ERROR - 40 * WARNING - 30 * INFO - 20 * DEBUG - 10 * NOTSET - 0 CHANGELOG...
multi_process_runner.py
# Lint as: python3 # Copyright 2019 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
worker.py
from contextlib import contextmanager import atexit import faulthandler import hashlib import inspect import io import json import logging import os import redis import sys import threading import time import traceback from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union # Ray modules from ra...
thready.py
try: from queue import Queue except ImportError: from Queue import Queue from threading import Thread import logging log = logging.getLogger(__name__) def threaded(items, func, num_threads=5, max_queue=200, join=True, daemon=True): """ Run a function ``func`` for each item in a generator...
engine.py
""" """ import logging from logging import Logger import smtplib import os from abc import ABC from datetime import datetime from email.message import EmailMessage from queue import Empty, Queue from threading import Thread from typing import Any, Sequence, Type, Dict, List, Optional from vnpy.event import Event, Eve...
pyBot.py
#!/usr/bin/env python3 ## Import needed modules import time from threading import Thread import pyBotCore ## Run the bot and flood counter in own threads def initialize(): bot = Thread(target=pyBotCore.pyBot) fld = Thread(target=pyBotCore.Flood) cobelearn = Thread(target=pyBotCore.CobeLearn) bot.daemon = True ...
crestprocessor.py
# crestprocessor.py import threading from PySide import QtCore from crest.crest import Crest class CrestProcessor(QtCore.QObject): """ CREST Middle-ware """ login_response = QtCore.Signal(str) logout_response = QtCore.Signal() location_response = QtCore.Signal(str) destination_response = ...
ai.py
#!/usr/bin/env python """ Module for creating an AI to play tic-tac-toe by training a neural network using genetic algorithms (WIP). Workflow consists of creating two populations of neural networks using the TTTNeuralNetwork class. The populations of neural networks are matched against each other in a game of tic-tac-...
message_stream.py
# Copyright 2014 Nokia Siemens Networks Oyj # # 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...
pydPiper.py
#!/usr/bin/python.pydPiper # coding: UTF-8 # pydPiper service to display music data to LCD and OLED character displays # Written by: Ron Ritchey from __future__ import unicode_literals import json, threading, logging, Queue, time, sys, getopt, moment, signal, commands, os, copy, datetime, math, requests import pages ...
data.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2017 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 requ...
server.py
from utils import inet_utils import sys sys.path.append('./bin/') import socket as sck import threading import time from bottle import * #sudo pip3 install --install-option="--prefix=/home/gabriele/Scrivania/multicat_unik" --ignore-installed bottle destinations=[] @get('/destination/add/<ip>') def add_destination...
fly_drone.py
import cv2 from fellbeast.drone import Drone from fellbeast.routines import follow_person import queue import threading q = queue.Queue() def display(): print("Start Displaying") while True: if not q.empty(): frame = q.get() cv2.imshow("frame1", frame) if cv2.wait...
multi_inf_parallel_files_continuous.py
#!/usr/bin/env python3 import os import inf_common as IC import hyperparams as HP import torch torch.set_num_threads(1) torch.set_num_interop_threads(1) from torch import Tensor import time from typing import Dict, List, Tuple, Optional from collections import defaultdict from collections import ChainMap impor...
sending.py
import urllib3 import json import threading import os.path from .playerio import * urllib3.disable_warnings() http = urllib3.PoolManager() TOKEN = open( os.path.dirname(os.path.realpath(__file__)) + '/token.txt', 'r' ).read() welcome = 'retard as shit' # Nice one thread_pool = [] thread_option = False def send_req...
run_fuzz_ubuntu.py
# monitor import subprocess import os import time import datetime import threading import shutil import argparse import Dashboard BROWSER_PATH = '' METHOD = None URL = "http://127.0.0.1:8080/flag?" MODE1 = "--incognito" # 시크릿 모드 MODE2 = "--no-sandbox" # 샌드박스 비활성화 MODE3 = "--user-data-dir=./tmp" # debug모드를 할때 FATAL...
Hiwin_RT605_ArmCommand_Socket_20190627164220.py
#!/usr/bin/env python3 # license removed for brevity import rospy import os import numpy as np from std_msgs.msg import String from ROS_Socket.srv import * from ROS_Socket.msg import * from std_msgs.msg import Int32MultiArray import math import enum pos_feedback_times = 0 mode_feedback_times = 0 msg_feedback = 1 #接收策略端...
docker_log_processor.py
#!/usr/bin/env python # Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE file in the project root for # full license information. # # filename: docker_log_processor.py # author: v-greach@microsoft.com # created: 01/29/2019 # Rev: 03/05/2019 A from multiprocessing import Pr...
crack-1.py
# -*- coding: utf-8 -*- # mau ngapain bro mau recode ea buat sendiri lah bgst import os, sys, time, datetime, random, hashlib, re, threading, json, getpass, urllib, requests, mechanize from multiprocessing.pool import ThreadPool from requests.exceptions import ConnectionError from mechanize import Browser reload(sys)...
test_net_addon.py
# -*- coding: utf8 -*- import BaseHTTPServer import SocketServer import re import socket from os.path import isfile, join, dirname, isdir from time import sleep from nose.plugins.skip import Skip, SkipTest from tests.functional_tests import isolate, run_tuttle_file, tuttle_invalidate from tuttle.error import TuttleEr...
test_client.py
import asyncio import concurrent.futures import copy import datetime import functools import os import re import threading import warnings from base64 import b64decode, b64encode from queue import Empty from unittest.mock import MagicMock, Mock import nbformat import pytest import xmltodict # type: ignore from ipytho...
__init__.py
import time from binascii import unhexlify from pylgbst.comms import Connection from pylgbst.hub import MoveHub, Hub from pylgbst.peripherals import * logging.basicConfig(level=logging.DEBUG) log = logging.getLogger('test') class HubMock(Hub): """ :type connection: ConnectionMock """ # noinspectio...
views.py
from django.conf import settings from rest_framework.views import APIView from rest_framework.generics import CreateAPIView, RetrieveAPIView, UpdateAPIView, GenericAPIView from random import randint from django_redis import get_redis_connection from rest_framework.response import Response from rest_framework_jwt.views ...
cberror_client.py
#!/usr/bin/env python import time, random import Pyro.core import Pyro.naming from Pyro.errors import * from threading import Thread import bouncer_cberror abort=0 def PyroLoop(daemon): global abort print 'Pyro daemon loop thread is running.' daemon.requestLoop(lambda: not abort) print 'Pyro daemon loop thread ...
tasmota.py
#!/usr/bin/env python import logging from json import loads from time import sleep from threading import Thread from requests import get from requests.exceptions import ConnectionError, ChunkedEncodingError, ReadTimeout from artemisremotecontrol.config import Config from artemisremotecontrol import setleds try: c...
multi_thread_sync.py
#creates a given number of threads (pass by argument) and assigns an equal portion of the workload to each one #the main thread waits actively until they finish from cassandra.cluster import Cluster import threading import sys import itertools cluster = Cluster() cluster = Cluster(["minerva-5"]) session = cluster.con...
demo2.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Topic: multiprocessing创建进程 Desc : """ # 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.get...
train_model_cli_wgan_v2.py
import os import math import re import numpy as np import tensorflow as tf from tqdm import tqdm from skimage import io import threading from async_io import AsyncIO def set_vram_growth(as_default_sess=True): config = tf.ConfigProto() config.gpu_options.allow_growth = True if as_default_sess: retu...
thread_and_processes.py
import os import time import threading import multiprocessing import random NUM_WORKERS = 10 size = 10000000 out_list = list() def do_something(count, out_list): for i in range(count): out_list.append(random.random()) """ #Serial start_time = time.time() for _ in range(NUM_WORKERS): do_something(size,out_list...
network_manager.py
import errno import datetime import threading from time import sleep from futu.common.utils import * from futu.quote.quote_query import parse_head from .err import Err from .sys_config import SysConfig from .ft_logger import * if IS_PY2: import selectors2 as selectors import Queue as queue else: import que...
run.py
import os import threading import time import sys, getopt def client(i,results,loopTimes): print("client %d start" %i) command = "./single-cold_warm.sh -R -t " + str(loopTimes) r = os.popen(command) text = r.read() results[i] = text print("client %d finished" %i) def warmup(i,warmupTimes,a...
example4_robotRestSDK_threading.py
import logging import time import threading import simplepybotsdk logging.basicConfig(level=logging.WARNING, filename='log.log', format='%(asctime)s %(levelname)s %(name)s: %(message)s') SOCKET_HOST = "localhost" # Use "0.0.0.0" for external connection SOCKET_PORT = 65432 REST_HOST = "localhost" # Use "0.0.0.0" fo...
variable_scope_shim_test.py
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
raw.py
import threading import queue import time import os import matplotlib.pyplot as plt import matplotlib.animation as animation filename = '/tmp/drips-data-monitor' plotdataL = queue.Queue() plotdataF = queue.Queue() plotdataR = queue.Queue() def update_xyvals(spectrum_message): strline = spectrum_message.strip() ...
ExpressionUtilsServer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import datetime import json import os import random as _random import sys import traceback from getopt import getopt, GetoptError from multiprocessing import Process from os import environ from wsgiref.simple_server import make_server import requests as _requests from json...
multi_process.py
from multiprocessing import Process def f(name): while True: # pass print("2", end="") def f2(name): while True: # pass print("6", end="") if __name__ == '__main__': print("0", end="") p = Process(target=f, args=('bob',)) p2 = Process(target=f2, args=('bob',)) p...
leetcode.py
import json import logging import re import time from threading import Semaphore, Thread, current_thread try: from bs4 import BeautifulSoup import requests inited = 1 except ImportError: inited = 0 try: import vim except ImportError: vim = None LC_BASE = 'https://leetcode.com' LC_LOGIN = 'ht...
FalCorr.py
#! /usr/bin/env python # -*- coding: utf-8 -*- # # GUI module generated by PAGE version 4.13 # In conjunction with Tcl version 8.6 # May 24, 2018 10:33:11 PM import sys import FCSoptionWindow #user-defined import FPGAserial #user-defined from threading import Thread import io import os import queue import time im...