source
stringlengths
3
86
python
stringlengths
75
1.04M
websocket-client.py
import websocket from threading import Thread import time import sys def on_message(ws, message): print(message) def on_error(ws, error): print(error) def on_close(ws): print("### closed ###") def on_open(ws): def run(*args): for i in range(3): # send the message, then wait # so thread d...
pants_daemon.py
# coding=utf-8 # Copyright 2015 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import absolute_import, division, print_function, unicode_literals import logging import os import sys import threading from contextlib import contextmanage...
__init__.py
''' Module camera provides the VideoStream class which offers a threaded interface to multiple types of cameras. ''' from threading import Thread import io import os import platform import numpy as np # pylint: disable=import-error class VideoStream: ''' Instantiate the VideoStream class. Use the method r...
crawler.py
#!/usr/bin/env python # coding=utf-8 # This is a demo of crawler(just test) import re import urllib2 import threading import json import jieba from time import sleep from lxml import etree from chardet import detect from selenium import webdriver from pymongo import MongoClient import sys reload(sys) sys.setdefaulte...
test_threaded_import.py
# This is a variant of the very old (early 90's) file # Demo/threads/bug.py. It simply provokes a number of threads into # trying to import the same module "at the same time". # There are no pleasant failure modes -- most likely is that Python # complains several times about module random having no attribute # randran...
views.py
from datetime import date, datetime, timedelta from django.contrib.auth.decorators import login_required from django.db import transaction from threading import Thread from django.http import HttpResponse, HttpResponseRedirect, JsonResponse from django.shortcuts import redirect, render from django.views.decorator...
timeout_handler.py
# -*- coding: utf-8 -*- import sys import threading class KThread(threading.Thread): """A subclass of threading.Thread, with a kill() method. Come from: Kill a thread in Python: http://mail.python.org/pipermail/python-list/2004-May/260937.html """ def __init__(self, *args, **kwargs): ...
urltester_v6.py
from itertools import product from os import error import threading from time import time, sleep from threading import Thread import requests from os import system from sys import argv ######## url = "" # https://url.com/ ext = ".png" fileNameLength = 5 # https://url.com/xxxxx.png/ verboose = True webh...
quickserve.py
#!/usr/bin/env python from subprocess import Popen, PIPE from threading import Thread from os import path, mkdir, getcwd, remove, getenv from getpass import getuser from random import choice from string import hexdigits from argparse import ArgumentParser from shutil import rmtree import sys # Parse arguments parser =...
apkleaks.py
#!/usr/bin/env python3 import io import json import logging.config import os import re import shutil import sys import tempfile import threading from contextlib import closing from distutils.spawn import find_executable from pathlib import Path from pipes import quote from urllib.request import urlopen from zipfile im...
terminal.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import os import re import sys import time import shlex import codecs import curses import logging import threading import webbrowser import subprocess import curses.ascii from curses import textpad from multiprocessing import Process from contextlib impo...
translation.py
import random import sys import threading import time from multiprocessing.dummy import Pool from queue import Queue import requests from cli.mmt.engine import EngineNode, ApiException from cli.mmt.processing import XMLEncoder from cli.utils import nvidia_smi class TranslateError(Exception): def __init__(self, ...
kBot.py
import requests import time import threading import argparse import pprint import os from requests_html import HTMLSession from bs4 import BeautifulSoup def get_keys_send_kudos(session, proxy, counter): session.proxies = { 'http': proxy, 'https': proxy } accept_adult = { 'view_ad...
decode_testset.py
import os import argparse import datetime import torch from models.cnnlstm import CnnOcrModel from torch.autograd import Variable import imagetransforms from datautils import GroupedSampler, SortByWidthCollater from ocr_dataset import OcrDataset from textutils import * from decoder import ArgmaxDecoder, LmDecoder im...
data_consumers.py
import queue, os, json, threading, time, datetime class DataConsumer(object): def __init__(self, device_name, data_dir): self.device_name = device_name self.data_dir = data_dir self.queue = queue.Queue() def consume_queue_item(self, item): """ Takes an item put into the...
AVR_Miner.py
#!/usr/bin/env python3 ########################################## # Duino-Coin Python AVR Miner (v2.2) # https://github.com/revoxhere/duino-coin # Distributed under MIT license # © Duino-Coin Community 2019-2021 ########################################## import socket, threading, time, re, subprocess, configparser, sys...
countdown.py
NODE = "countdown" import os, sys import logging logger = logging.getLogger(NODE) LOGGING_FILEPATH = f"escape-{NODE}.log" formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') stream_handler = logging.StreamHandler() stream_handler.setFormatter(formatter) stream_handler.setLevel(loggin...
test_queue.py
import os import shutil import tempfile import threading import time from unittest import TestCase from vsqs import queue class QueueTest(TestCase): def setUp(self): self.q = queue.Queue(tempfile.mkdtemp()) def tearDown(self): self.q.close() shutil.rmtree(self.q.path) # reset ...
SBkris.py
# -*- coding: utf-8 -*- import KRIS from KRIS.lib.curve.ttypes import * from datetime import datetime import time, random, sys, ast, re, os, io, json, subprocess, threading, string, codecs, requests, ctypes, urllib, urllib2, urllib3, wikipedia, tempfile from bs4 import BeautifulSoup from urllib import urlopen import r...
threading_utils_test.py
#!/usr/bin/env python # Copyright 2013 The LUCI Authors. All rights reserved. # Use of this source code is governed under the Apache License, Version 2.0 # that can be found in the LICENSE file. # Lambda may not be necessary. # pylint: disable=W0108 import functools import logging import os import signal import sys i...
python3-53.py
#Simple producer and consumer #Demonstrates queue and event with locks #Imports import random import threading import multiprocessing import logging from threading import Thread from queue import Queue import time logging.basicConfig(format='%(levelname)s - %(asctime)s.%(msecs)03d: %(message)s',datefmt='%H:%M:%S', lev...
mod_replay_flag_fix102.py
# -*- coding: utf-8 -*- import datetime import re import os import json import codecs import urllib2 import urllib import threading import BattleReplay import BigWorld # noinspection PyProtectedMember from gui.Scaleform.daapi.view.battle.BattleRibbonsPanel import BattleRibbonsPanel, _RIBBON_SOUNDS_ENABLED, _POS_COEFF...
mesos_hpc.py
from mesoshttp.client import MesosClient from hpc_job import mesos_hpc_buildJob from datetime import datetime import uuid import sys import threading # MESOS_MASTER = 'http://146.176.164.62:5050' MESOS_MASTER = 'http://127.0.0.1:5050' jc = 1 pending_jobs = [] class HpcFramework(object): messages = [] to_be_s...
server.py
#!/usr/bin/python3 import socket, threading, sys PORT = 5555 class Server: def __init__(self): self.bitrate = 1024 self.max_clients = 2 self.connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.running = True self.started = False self.token = 0 ...
ensembler.py
#!/usr/bin/env python3.6 # Copyright (c) 2019 Trail of Bits, 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 app...
Network.py
import argparse import socket import threading from time import sleep import random import RDT ## Provides an abstraction for the network layer class NetworkLayer: # configuration parameters prob_pkt_loss = 0 prob_byte_corr = 0 prob_pkt_reorder = 0 # class variables sock = None conn = Non...
allChannels.py
### Script to get all channels from tata sky import threading import requests import json as json API_BASE_URL = "https://kong-tatasky.videoready.tv/" channel_list = [] def getChannelInfo(channelId): url = "{}content-detail/pub/api/v1/channels/{}".format(API_BASE_URL, channelId) x = requests.get(url) ch...
MatrixStressen.py
from multiprocessing import Process, Pipe import numpy as np class MatrixStressen: # mendefinisikan matrix x dan y global x,y,n # matrix 8x8 x = np.array( [[5, 1, 2, 0, 7, 8, 2, 1], [2, 3, 0, 2, 0, 4, 1, 3], [4, 5, 7, 1, 5, 2, 31, 1], [2, 0, 1, 3, 2, 4,...
gtp_20190523092019.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from sys import stderr, stdout, stdin from threading import Thread import numpy as np from board import * from search import Tree cmd_list = [ "protocol_version", "name", "version", "list_commands", "boardsize", "komi", "time_settings", "time_left", "clear_bo...
aim_sep_client.py
#!/usr/bin/env python from argparse import ArgumentParser from threading import Thread import time import os from ServerConfig import Client from ServerConfig import Aim from ServerConfig import TellStore def reduceComma(x, y): return x + ',' + y def addPort(x): return x + ':8715:8716' def startSepClient(p...
pdadmin.py
# # Copyright (c) 2002-2006 ekit.com Inc (http://www.ekit-inc.com) # and Anthony Baxter <anthony@interlink.com.au> # # $Id: pdadmin.py,v 1.22 2006/07/27 06:58:27 anthonybaxter Exp $ # import threading, SocketServer, urlparse, re, urllib from BaseHTTPServer import BaseHTTPRequestHandler import socket, traceback, sys im...
sftpinterface.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import errno import os import paramiko from paramiko.common import WARNING from .sshinterface import transport_keepalive import traceback from django.conf import settings import threading from django.core.cache import cache from webssh.models import TerminalSession import ...
logger_manager.py
#!/usr/bin/env python3 """LoggerManagers get their desired state of the world via a ServerAPI instance and attempt to start/stop loggers with the desired configs by dispatching requests to a local LoggerRunner and/or any remote LoggerRunners connected via websocket. To run the LoggerManager from the command line with ...
kiwa.py
import socket import time import json import sounddevice as sd import numpy as np import os from multiprocessing import Process, Pipe nextUpdate = time.time() def createMessage(intensity): ''' Create bytearray json message for lamp with intensity between 0-100% ''' message = { "op_co...
func.py
import datetime import hashlib import json import os import random import threading import functools import time from time import sleep from types import MethodType def singleton(cls): """ 将一个类作为单例 来自 https://wiki.python.org/moin/PythonDecoratorLibrary#Singleton """ cls.__new_original__ = cls.__...
run_job_core.py
""" This code belongs in run_job.py, but this is split out to avoid circular dependencies """ from __future__ import annotations import abc import asyncio import dataclasses import io import pickle import threading from typing import ( Any, Callable, Coroutine, Dict, Generic, List, Literal,...
motion_arbiter.py
#!/usr/bin/env python # -*- encoding: utf8 -*- import json import operator import Queue import re import os import signal from threading import Thread from matplotlib import pyplot as plt import matplotlib import actionlib import rospy from std_msgs.msg import Bool, Empty, String from mind_msgs.msg import (LogItem, ...
proxy.py
""" Actor proxy for rodario framework """ # stdlib import types import pickle from multiprocessing import Queue from threading import Thread from uuid import uuid4 from time import sleep # local from rodario import get_redis_connection from rodario.future import Future from rodario.exceptions import InvalidActorExcep...
__init__.py
# How do I launch PyMOL? # THE SUPPORTED WAY: # "python pymol/__init__.py" in an environment in which $PYMOL_PATH # points to the main PyMOL directory and $PYTHONPATH includes # $PYMOL_PATH/modules or where the contents of $PYMOL_PATH/modules # have been installed in a standard location such as # /usr/lib/python2.1/s...
7560b.py
import subprocess, json, time, sys, re from multiprocessing import Queue from threading import Thread class Latency: def __init__(self,config="machina.json"): print("Loading",config) with open(config) as handle: self.machina = json.loads(handle.read()) def cmd(self,cmd): p ...
CopyFiles_Threads.py
''' Created on Jul 26, 2015 Recipe: B04829_06 @author: Burkhard ''' #====================== # imports #====================== import tkinter as tk from tkinter import ttk from tkinter import scrolledtext from tkinter import Menu from tkinter import Spinbox import B04829_Ch06_ToolTip as tt import B04829_C...
main.py
import threading from time import sleep import pyautogui DELAY_BETWEEN_COMMANDS = 1.0 def main(): initializedPyAutoGui() countDownTimer() threading.Thread(target=allHeroesStart).start() sleep(420) threading.Thread(target=dontSleepScreen).start() # allHeroesStop() print('Done.') def...
movo_pan_tilt.py
"""-------------------------------------------------------------------- Copyright (c) 2017, Kinova Robotics 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 mus...
context.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...
queue_example.py
from threading import Thread, Lock, current_thread from queue import Queue import time def worker(q, lock): while True: value = q.get() with lock: print(f'in {current_thread().name} got {value}') q.task_done() if __name__ == '__main__': q = Queue() lock = Lock() n...
train_gm.py
from __future__ import print_function, division from keras.layers import Concatenate, RepeatVector, TimeDistributed, Reshape, Permute from keras.layers import Add, Lambda, Flatten, BatchNormalization, Activation from keras.layers import Input, LSTM, Dense, GRU, Bidirectional, CuDNNLSTM from keras.layers.merge import _...
twisterlib.py
#!/usr/bin/env python3 # vim: set syntax=python ts=4 : # # Copyright (c) 2018 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import contextlib import string import mmap import sys import re import subprocess import select import shutil import shlex import signal import threading import concurrent.fu...
test_runner.py
#!/usr/bin/env python3 # Copyright (c) 2014-2016 The Bitcoin Core developers # Copyright (c) 2017 The Bitcoin developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Run regression test suite. This module calls down into ind...
generate_collision.py
import random import numpy as np from itertools import product import multiprocessing as mp import os import cv2 import pybullet as pb from pybullet_utils import bullet_client import pybullet_data from time import time import matplotlib.pyplot as plt import argparse COLORS = ['red', 'green', 'blue', 'yellow'] parser ...
parallel_env_sampling.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = "Christian Heider Nielsen" __doc__ = r""" Created on 01/08/2020 """ import random import time from multiprocessing import Process, Queue, current_process, freeze_support def worker(input, output): """ """ for func, args in it...
client.py
""" sentry.nodestore.riak.client ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2015 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import import six import sys import socket from random import shuffle from six.moves.queue import ...
SentenceTransformer.py
import json import logging import os import shutil from collections import OrderedDict from typing import List, Dict, Tuple, Iterable, Type, Union, Callable from zipfile import ZipFile import requests import numpy as np from numpy import ndarray import transformers import torch from torch import nn, Tensor, device from...
ci.py
#!/usr/bin/env python """module docstring here""" # System modules from queue import Queue from threading import Thread import time import subprocess import os from os import listdir from os.path import isfile, join import sys import json import logging from multiprocessing import Lock import requests from datetime im...
processes.py
import logging import multiprocessing as mp import bigchaindb from bigchaindb import config_utils from bigchaindb.pipelines import vote, block, election, stale from bigchaindb.events import Exchange, EventTypes from bigchaindb.web import server, websocket_server logger = logging.getLogger(__name__) BANNER = """ ***...
dp_client.py
# encoding:utf-8 # date:2021-01-16 # author: eric # function: dp client import os import requests import base64 import cv2 import json import numpy as np import time import traceback import random from multiprocessing import Process from multiprocessing import Manager from draw_utils.draw_utils import draw_bbox,draw_f...
shr.py
from threading import Thread from time import sleep, time from audioplayer import AudioPlayer from keyboard import on_press_key, add_hotkey, on_release_key from tkinter import Label, Tk, Frame from os import kill from winregistry import WinRegistry import psutil from win32gui import GetWindowText, GetForeground...
gt_maya_to_discord.py
""" GT Maya to Discord - Send images and videos (playblasts) from Maya to Discord using a Discord Webhook to bridge the two programs. @Guilherme Trevisan - TrevisanGMW@gmail.com - 2020-06-28 - github.com/TrevisanGMW Tested on Maya 2018, 2019, 2020 - Windows 10 1.1 - 2020-07-04 Added playblast and desktop...
servers.py
""" Starting in CherryPy 3.1, cherrypy.server is implemented as an :ref:`Engine Plugin<plugins>`. It's an instance of :class:`cherrypy._cpserver.Server`, which is a subclass of :class:`cherrypy.process.servers.ServerAdapter`. The ``ServerAdapter`` class is designed to control other servers, as well. Multiple servers/p...
remote.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 copy import time import torch import torch.multiprocessing as mp from salina import Agent from salina.workspace import Workspace,...
main.py
import threading import queue import http.client import time import struct import argparse from math import isnan import numpy as np from scipy.fft import fft from scipy.signal import hann from bokeh.models import ColumnDataSource from bokeh.plotting import curdoc, figure from bokeh.layouts import column, row from b...
series.py
import cPickle as pickle from threading import Thread import os from fito import DictDataStore from fito.data_store.mongo import MongoHashMap import numpy as np from collections import namedtuple from fito.specs.fields import CollectionField, SpecCollection, KwargsField from pandas_datareader import data, wb from fi...
prepare_data.py
import os __file__ = os.path.realpath(__file__) os.chdir(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))) import sys sys.path.insert(0, os.getcwd()) from core.tokenizer import tokenize import gzip # Prepare all files def prepare(): global vocab, written_lines # Files to be prepared files = {...
Pro-Con.py
from multiprocessing import Process,Queue import random,time,os def procducer(q): for i in range(50): res = '视频%s' %i time.sleep(0.1) q.put(res) print('%s 读取 %s' %(os.getpid(),res)) def consumerPost(q,q2): while True: res = q.get() if res is None: ...
tests.py
""" Unit tests for reverse URL lookups. """ import sys import threading from admin_scripts.tests import AdminScriptTestCase from django.conf import settings from django.contrib.auth.models import User from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist from django.http import ( HttpRequest, ...
threads_demo.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ py3practice.loggerdemo.threads_demo ~~~~~~~~~~~~~~~~~~~ A dummy main for demo the logging in multiple threads :copyright: © 2018 by zenanswer. :license: MIT, see LICENSE for more details. """ import logging import threading import time def wor...
test_utils_test.py
from __future__ import print_function, division, absolute_import from contextlib import contextmanager import socket import sys import threading from time import sleep import pytest from tornado import gen from distributed import Scheduler, Worker, Client, config, default_client from distributed.core import rpc from...
mqtt_publisher_test.py
import time import json import threading import sys sys.path.append("../") from IoTPy.helper_functions.print_stream import print_stream from IoTPy.core.stream import Stream, run from IoTPy.concurrency.MQTT_Publisher import MQTT_Publisher # multicore imports from IoTPy.concurrency.multicore import get_processes_and_pr...
tests.py
import time import traceback from datetime import date, datetime, timedelta from threading import Thread from django.core.exceptions import FieldError from django.db import DatabaseError, IntegrityError, connection from django.test import TestCase, TransactionTestCase, skipUnlessDBFeature from django.utils.fun...
__init__.py
# -*- coding: utf-8 -*- ''' Set up the Salt integration test suite ''' # Import Python libs import os import sys import time import errno import shutil import pprint import logging import tempfile import subprocess import multiprocessing from hashlib import md5 from datetime import datetime, timedelta try: import...
fetch-video-stat.py
import requests import argparse import schedule import threading import logging import time import json from collections import namedtuple from utils import a2b, b2a, is_valid_bvid, now_ts, ts2str Record = namedtuple('Record', ['added', 'aid', 'bvid', 'view', 'danmaku', 'reply', 'favorite', 'coin', 'share', 'like']) ...
base.py
# Copyright (c) 2016, Intel Corporation. # # SPDX-License-Identifier: GPL-2.0-only # """Build performance test base classes and functionality""" import json import logging import os import re import resource import socket import shutil import time import unittest import xml.etree.ElementTree as ET from collections impo...
twitter.py
from __future__ import annotations from typing import TYPE_CHECKING, List, Optional, Union import datetime import json import logging import threading from pajbot.managers.db import DBManager from pajbot.models.twitter import TwitterUser from pajbot.utils import now, stringify_tweet, time_since, tweet_provider_strin...
tissue_segmentation_V1.py
# -*- coding: utf-8 -*- """ Created on 30/09/2020 @author: yhagos """ import multiprocessing as mp import os from skimage.morphology import dilation, erosion, disk from skimage import io from skimage.color import rgb2gray from skimage import measure import numpy as np import pandas as pd # import seaborn as sns # fro...
test_fork1.py
"""This test checks for correct fork() behavior. """ import _imp as imp import os import signal import sys import threading import time import unittest from test.fork_wait import ForkWait from test.support import reap_children, get_attribute, verbose # Skip test if fork does not exist. get_attribute...
threads.py
#!/usr/bin/env python2.5 """ ############################################################################# ## ## file : threads.py ## ## description : see below ## ## project : Tango Control System ## ## $Author: Sergi Rubio Manrique, srubio@cells.es $ ## ## $Revision: 2011 $ ## ## copyleft : ALBA Synchrot...
multithread.py
from queue import Queue from threading import Thread import random import time def Depan(output_depan): Depan=0 while Depan<60: data = {1:random.randrange(10,100)} output_depan.put(data) Depan+=1 def InputDepan(input_depan): i=0 while i<10: data = input_depan.get() ...
_refdaemon.py
# ***************************************************************************** # Copyright 2004-2008 Steve Menard # # 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:...
lisp-core.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...
test_external_step.py
import os import time import uuid from threading import Thread import pytest from dagster import ( Field, ModeDefinition, RetryRequested, String, execute_pipeline, execute_pipeline_iterator, pipeline, reconstructable, resource, seven, solid, ) from dagster.core.definitions.n...
sensor.py
"""Sensor definitions.""" from datetime import datetime import logging from threading import Event, Thread import time LOGGER = logging.getLogger(__name__) class Sensor: """ A sensor is a basic event source. Each sensor is started in its own thread and is free to what ever it needs to r...
coqtop.py
# -*- coding: utf8 -*- # Author: Wolf Honore """Coqtop interface with functions to send commands and parse responses.""" from __future__ import absolute_import, division, print_function import datetime import logging import os import signal import subprocess import threading import time from tempfile import NamedTemp...
runtests.py
# -*- coding: utf-8 -*- ''' :codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)` ===================== Salt CLI Tests Runner ===================== :command:`salt-runtests` is a unit tests runner similar to `pytest`_ or `nose`_ but specially tailored for Salt's needs. Since testing Sa...
utility.py
from multiprocessing import Process, Queue from src.pi_to_pi import publisher, subscriber def set_up_pub_sub(prefix: str, pub_suffix: str, sub_suffix: str): """ Utility function to set up pub and sub, using 'prefix/pub_suffix' as the topic for publishing, and 'prefix/sub_suffix' as the topic for subscrip...
synthPatchGrabber.py
#!/bin/env python3 import logging import time import rtmidi import sys import re import os import asyncio import threading import json from pathlib import Path from shutil import copyfile, move, rmtree from synthPatchGrabber.AudioProcessing import * from synthPatchGrabber.AudioWaveform import * from synthPatchGrab...
worker.py
import copy import os import shutil import sys import threading import _thread import time import channelpy import configparser from aga import Agave from auth import get_tenant_verify from channels import ActorMsgChannel, ClientsChannel, CommandChannel, WorkerChannel, SpawnerWorkerChannel from codes import SHUTDOWN_...
replay.py
import json import os import time from multiprocessing import Process import pickle from config import DIC_AGENTS, DIC_ENVS import sys def check_all_workers_working(list_cur_p): for i in range(len(list_cur_p)): if not list_cur_p[i].is_alive(): return i return -1 def downsample(path_to_l...
server.py
#!/usr/bin/env python ################################################################################## #Copyright (c) 2016, Intel Corporation #All rights reserved. # #Redistribution and use in source and binary forms, with or without #modification, are permitted provided that the following conditions are met: # #1. ...
qt.py
#!/usr/bin/env python # # 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...
CtsThread.py
import threading import time class CtsThread: def __init__(self, output): self._output = output self._cts_magic = [0xef, 0xbe, 0xad, 0xde] self._count = 0 self.cts_state = False self._cts_thread = threading.Thread(target=self._check_cts, name="CtsThread") self._cts...
test_pickle.py
import sys import types import unittest import gc import inspect import copy import contextlib import threading import contextvars import ctypes import importlib.util import struct import warnings import subprocess import numbers import stackless from textwrap import dedent from stackless import schedule, tasklet fro...
test_io.py
import sys import gc import gzip import os import threading import time import warnings import io import re import pytest from pathlib import Path from tempfile import NamedTemporaryFile from io import BytesIO, StringIO from datetime import datetime import locale from multiprocessing import Process, Value from ctypes i...
Python multiprocessing example- Process.py
import multiprocessing as mp import math import os #---------------------------------------------------------------------------------------------------------------------- #This is a VERY SIMPLE example of parallel processing in Python using the multiprocessing library using the Process object. # Details of implementat...
metrics.py
from __future__ import absolute_import __all__ = ['timing', 'incr'] import logging import functools from contextlib import contextmanager from django.conf import settings from random import random from time import time from threading import Thread from six.moves.queue import Queue metrics_skip_internal_prefixes = ...
download_data.py
from basketball_reference_scraper.drafts import get_draft_class from threading import Thread import os def save_draft_class(year): data = get_draft_class(year) data.to_csv(os.path.join("data", f"draft_{year}.csv")) if __name__ == "__main__": for year in range(1950, 2022): t = Thread(target=save_...
cisd.py
#!/usr/bin/env python # Copyright 2014-2019 The PySCF Developers. 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 # # U...
utility.py
# coding=utf-8 # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -----------------------------------------------------...
autostep_node.py
#!/usr/bin/env python from __future__ import print_function import json import threading import roslib import rospy import std_msgs.msg import scipy import scipy.interpolate from autostep import Autostep from autostep import AutostepException from autostep_ros.msg import MotionData from autostep_ros.msg import Trac...
lane_steam_test.py
from RobotRaconteur.Client import * import time import numpy as np import cv2 import sys import threading import logging import keyboard import Queue sys.path.append("..") import lane_finder import laneDriver def nd_arr_transform(ros_frame): _shape = (ros_frame.height,ros_frame.width,3) _dtype = np.uint8 _...
play_treads.py
import threading import queue import time def do_work(item): time.sleep(5) def worker(): while True: item = q.get() if item is None: break print(item) do_work(item) q.task_done() q = queue.Queue() num_worker_threads = 5 threads = [] for i in range(num_worke...
online_yumi_interface.py
"""Interface to communicate with YuMi robot through RWS.""" # Copyright (c) 2022, ABB # 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 # ...