source
stringlengths
3
86
python
stringlengths
75
1.04M
turingchat.py
#!/usr/bin/python """ The following is a Turing machine with states that communicate with one another using TCP/IP. An Instruction table is identified with a unique hash, which allows the machine to run several Turing programs concurrently. Right now only Turing machines with up to 5 states are supported. """ import s...
util.py
import numpy as np import queue import threading import tensorflow as tf from pm4py.objects.log.log import EventLog, Trace import itertools import random import operator from pm4py.algo.filtering.log.attributes import attributes_filter from pm4py.util import constants import sklearn import pandas from functools import ...
vertiport_node.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import rospy from serial import Serial from struct import unpack, pack from rospy import Publisher, Service from rospy import sleep from std_msgs.msg import Int8MultiArray, ColorRGBA from std_srvs.srv import SetBool, SetBoolResponse from kiberdrom_interfaces.srv import Ve...
saisoku.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """saisoku.py Saisoku is a Python module that helps you build complex pipelines of batch file copying jobs. See README.md or https://github.com/shirosaidev/saisoku for more information. Author: shirosai <cpark16@gmail.com> Copyright (C) Chris Park 2019 saisoku is release...
third_party_ci.py
import argparse import io import json import logging import os import re import sys import threading import time import traceback from queue import Empty, Queue import arrow import boto import coloredlogs import ruamel.yaml as yaml from boto.s3.connection import OrdinaryCallingFormat from jinja2 import Template from p...
run.py
# Copyright (c) 2020 Institution of Parallel and Distributed System, Shanghai Jiao Tong University # ServerlessBench is licensed under the Mulan PSL v1. # You can use this software according to the terms and conditions of the Mulan PSL v1. # You may obtain a copy of Mulan PSL v1 at: # http://license.coscl.org.cn/M...
test_chain_monitor.py
import zmq import time from queue import Queue from threading import Thread, Event, Condition import pytest from teos.chain_monitor import ChainMonitor, ChainMonitorStatus from test.teos.conftest import generate_blocks, generate_blocks_with_delay from test.teos.unit.conftest import get_random_value_hex, bitcoind_feed...
schedule.py
import builtins import threading import sched import time import schedule as _schedule import datetime import pause __all__ = () __version__ = '0.0.1' Inf = float('inf') class SchedJob: def __init__(self, method, amount): self._method = method self._amount = amount def do(self, func, *pargs...
cgo_engine.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import logging import os import random import string import time import threading from typing import Iterable, List, Dict, Tuple from dataclasses import dataclass from nni.common.device import GPUDevice, Device from .interface import AbstractEx...
PyShell.py
#! /usr/bin/env python from __future__ import print_function import os import os.path import sys import string import getopt import re import socket import time import threading import io import linecache from code import InteractiveInterpreter from platform import python_version, system try: from Tkinter import...
database.py
import datetime import json as classic_json import multiprocessing as mp import time from typing import Dict from typing import NoReturn import redis import requests import ujson as json from artemis_utils import get_hash from artemis_utils import get_logger from artemis_utils.constants import CONFIGURATION_HOST from ...
client.py
#(c)2019-2021, karneliuk.com # Modules import grpc from pygnmi.spec.gnmi_pb2_grpc import gNMIStub from pygnmi.spec.gnmi_pb2 import (CapabilityRequest, Encoding, GetRequest, \ SetRequest, Update, TypedValue, SubscribeRequest, Poll, SubscriptionList, \ SubscriptionMode, AliasList, UpdateResult) import re import ...
Pydoku.py
# TIE-02100 Johdatus ohjelmointiin # Timo Hartikainen, timo.hartikainen@student.tut.fi # Tehtävän 13.10 ratkaisu: # Sudoku graafisella käyttöliittymällä """ Sudoku-peli Käyttöliittymä: -Liikkuminen nuolinäppäimillä tai hiirellä klikkaamalla -Numeroiden syöttö numeronäppäimillä (0-9) --Uusi numero korvaa va...
qcasDFVerifier.py
import os import csv import sys import epsig2 import hashlib import hmac import json import random import getpass import difflib from datetime import datetime from threading import Thread PATH_TO_BINIMAGE = 'G:\OLGR-TECHSERV\BINIMAGE' #PATH_TO_BINIMAGE = 'binimage' VALID_HASH_FILE_TYPES = ['BLNK', '...
queue_runner.py
import tensorflow as tf import numpy as np import time import multiprocessing as mp import threading from multiprocessing import Queue class CustomRunner(object): """ This class manages the the background threads needed to fill a queue full of data. # Need to call the following...
test_ssl.py
# Test the support for SSL and sockets import sys import unittest import unittest.mock from test import support from test.support import import_helper from test.support import os_helper from test.support import socket_helper from test.support import threading_helper from test.support import warnings_helper import sock...
test_tracer.py
import opentracing from opentracing import ( child_of, Format, InvalidCarrierException, UnsupportedFormatException, SpanContextCorruptedException, ) import ddtrace from ddtrace.ext.priority import AUTO_KEEP from ddtrace.opentracer import Tracer, set_global_tracer from ddtrace.opentracer.span_contex...
main.py
import threading import logging from .bootp.DHCPServer import DHCPServer import netifaces import time from .state.event_handler import EventHandler from logging.handlers import RotatingFileHandler def wait_for_interface(iface, poll_time, logger, handler): logger.info("Waiting for %s to become available", iface) ...
SRRecorder.py
import cv2 from collections import deque from queue import Queue from threading import Thread from time import sleep from datetime import datetime import logging class SRRecorder(object): fourcc = cv2.VideoWriter_fourcc(*"avc1") def __init__(self, database, settings, clipClass, backlogSize=20): self.b...
__main__.py
#!/usr/bin/env python3 import argparse import io import logging import os import platform import shlex import string import subprocess import sys import threading import time import typing import urllib.parse import urllib.request from concurrent.futures import ThreadPoolExecutor from enum import Enum from pathlib impo...
lfi.py
#!/usr/bin/python # -*- coding: UTF-8 -*- import ninja import argparse import timeit import multiprocessing as mp # save_data의 경우는 함수마다 공격의 결과값을 판단하는 패턴이 다르므로 개별로 정의 class lfi(ninja.web): def save_data(self, method, case, url, payloads, res): self.collection_saving_results = self.db["report"] pr...
local.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 use ...
detector.py
import os import sys from threading import Thread from queue import Queue import cv2 import scipy.misc import numpy as np import torch import torch.multiprocessing as mp from alphapose.utils.presets import SimpleTransform class DetectionLoader(): def __init__(self, input_source, detector, cfg, opt, mode='image...
test_views.py
from __future__ import print_function from __future__ import unicode_literals from threading import Thread from django.core.urlresolvers import reverse from django.conf import settings from django import forms from django.http import HttpRequest, QueryDict from django.test import TestCase from django.utils.six.moves im...
isin_to_wgs84.py
#!/usr/bin/python #------------------------------------------------------------------------------- # # Project: EOxServer <http://eoxserver.org> # Authors: Stephan Krause <stephan.krause@eox.at> # Stephan Meissl <stephan.meissl@eox.at> # #------------------------------------------------------------------------...
test_api_client_factory.py
import unittest from collections import UserString from datetime import datetime from unittest.mock import patch from parameterized import parameterized from threading import Thread from lusid import InstrumentsApi, ResourceListOfInstrumentIdTypeDescriptor from lusid.utilities import ApiClientFactory from utilities im...
main.py
import json import MySQLdb import socket import threading import subprocess import time import os import sys from time import sleep # 全局变量类,用于保存全局变量 class GlobalVar: ROOT_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) FILE_PATH_CODE = os.path.dirname(os.path.abspath(__file__)) + "/Code" ...
zap.py
# ZAP - Zurich Atmosphere Purge # # Copyright (c) 2014-2016 Kurt Soto # Copyright (c) 2015-2019 Simon Conseil # # 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 ...
long-short.py
import alpaca_trade_api as tradeapi import threading import time import datetime API_KEY = "YOUR_API_KEY_HERE" API_SECRET = "YOUR_API_SECRET_HERE" APCA_API_BASE_URL = "https://paper-api.alpaca.markets" COMPARE_VALUE = 100000 class LongShort: def __init__(self): self.alpaca = tradeapi.REST(API_KEY, API_SECRET, A...
lankacnews.py
import tweepy import os import time import threading from elasticsearch import Elasticsearch, helpers from datetime import datetime from dotenv import load_dotenv load_dotenv() consumer_key = os.getenv('consumer_key') consumer_secret = os.getenv('consumer_secret') access_key = os.getenv('access_key') access_secret = ...
Wallet.py
#!/usr/bin/env python3 ########################################## # Duino-Coin Tkinter GUI Wallet (v2.52) # https://github.com/revoxhere/duino-coin # Distributed under MIT license # © Duino-Coin Community 2019-2021 ########################################## import sys from base64 import b64decode, b64encode fr...
fileServer.py
import socket import threading import os def RetrFile(name, sock): filename = sock.recv(5120000000) print(filename.decode('utf-8')) if os.path.isfile(filename.decode('utf-8')): sock.send(str.encode('EXISTS '+ str(os.path.getsize(filename.decode('utf-8'))))) userResponse = sock.recv(51200000...
multiprocess.py
#!/usr/bin/env python from time import time from basic_utils import * from multiprocessing import Queue from multiprocessing import Lock, Process, Semaphore, Value # from multiprocessing.sharedctypes import Array, Value start_time = time() BUFFER_COUNT = 42 # g_buffer = [Block('\0')] * BUFFER_COUNT g_buffer = Queue...
conftest.py
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the 'License'); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
test_agent.py
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2018-2019 Fetch.AI Limited # # 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 ...
store.py
import datetime import json import threading import uuid from collections import defaultdict from copy import deepcopy from dictdiffer import diff from inspect import signature from threading import Lock from pathlib import Path from tzlocal import get_localzone from .logger import logger from .settings import CACHE_...
communications.py
from .odometry_system import VelocityPose import socket, pickle, time, threading from rp1controller import Target, RP1Controller from .trajectory_planners import ControlMode class Command: def __init__(self, command_name, function = None, args = None, expect_response = False, log = False): self.comm...
server.py
import os import time from threading import Thread import rpyc class FileMonitorService(rpyc.Service): class exposed_FileMonitor(object): def __init__(self, filename, callback, interval=1): self.filename = filename self.interval = interval self.last_stat = None ...
database_test.py
# Copyright 2017-2019 object_database 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 ...
main.py
import pandas as pd from openpyxl import Workbook import cx_Oracle import sys from sqlalchemy import create_engine from PyQt6 import QtCore, QtGui, QtWidgets import ctypes import time import threading import qdarktheme import cgitb cgitb.enable(format = 'text') dsn_tns = cx_Oracle.makedsn('ip-banco-oracle', 'porta',...
rdd.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...
bot.py
from queue import Queue import logging import threading from typing import List, Optional from .protocol import Service from .protocol import Message from .protocol import App from .logging import print_json_log logger = logging.getLogger(__file__) class _ProducerClose: """""" class ClosableQueue(Queue): _...
test_operator.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
receiver.py
# Copyright The IETF Trust 2019, All Rights Reserved # Copyright 2018 Cisco and its affiliates # # 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...
wallFollowing.py
# This program demonstrates usage of the servos. # Keep the robot in a safe location before running this program, # as it will immediately begin moving. # See https://learn.adafruit.com/adafruit-16-channel-pwm-servo-hat-for-raspberry-pi/ for more details. from threading import Thread import time import Adafruit_PCA9685...
test_threadtools.py
# # (C) Copyright 2012-13 Enthought, Inc., Austin, TX # All right reserved. # # This file is open source software distributed according to the terms in # LICENSE.txt # # standard library imports import threading import time import unittest # local imports from encore.concurrent.threadtools import synchronized class...
bazel_build.py
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright 2016 The Tulsi 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/LICE...
realtime_webcam.py
from tensorflow_detection import DetectionObj from threading import Thread import cv2 def resize(image, new_width=None, new_height=None): """ Resize an image based on a new width or new height keeping the original ratio """ height, width, depth = image.shape if new_width: new_height = i...
dx_operations.py
#!/usr/bin/env python # Corey Brune - Oct 2016 # This script starts or stops a VDB # requirements # pip install docopt delphixpy # The below doc follows the POSIX compliant standards and allows us to use # this doc to also define our arguments for the script. """List all VDBs or Start, stop, enable, disable a VDB Usag...
framework.py
#!/usr/bin/env python from __future__ import print_function import gc import sys import os import select import unittest import tempfile import time import faulthandler import random import copy import psutil import platform from collections import deque from threading import Thread, Event from inspect import getdoc, ...
train.py
#!/usr/bin/env python # coding: utf-8 # In[1]: from agent_D4PG import train_params, RL_Agents, Learner, GaussianNoiseGenerator, PrioritizedReplayBuffer import numpy as np import random from pathlib import Path import tensorflow as tf import threading from citylearn import CityLearn # In[2]: # Load envi...
predict_system.py
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
main_tr.py
import tia.trad.tools.ipc.processLogger as pl pl.PROCESS_NAME = "main_tr." import zmq import multiprocessing import sys import tia.configuration as conf from tia.trad.market.events import handledEventsD import tia.trad.market.orderManager as orderManager; reload(orderManager) import tia.trad.tools.classOps as classes i...
launcher.py
#!/usr/bin/env python # # Module for launching the Touchscreen module and specific modules required for each pi # # by Peter Juett # References: # # Copyright 2018 # # 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 co...
server.py
#!/usr/bin/env python3 # Quantopian, Inc. licenses this file to you 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 ...
jobmanager.py
# BSD 2-Clause License # # Copyright (c) 2021, Hewlett Packard Enterprise # 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. Redistributions of source code must retain the above copyright noti...
test_local.py
import multiprocessing import os import sys import unittest import threading from descarteslabs.common.threading.local import ThreadLocalWrapper class ThreadLocalWrapperTest(unittest.TestCase): def setUp(self): self.wrapper = ThreadLocalWrapper( lambda: (os.getpid(), threading.current_thread(...
sensor.py
"""Pushbullet platform for sensor component.""" import logging import threading from pushbullet import InvalidKeyError, Listener, PushBullet import voluptuous as vol from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.const import CONF_API_KEY, CONF_MONITORED_CONDITIONS import homeassistant...
SudokuSolver.py
''' This Sudoku-solving algorithm was initially designed and implemented by Peter Norvig at http://norvig.com/sudoku.html. This implementation simply employees the multiprocessing and performs a bi-directional DFS to speed up the search process. ''' import multiprocessing as mp import time class SudokuSolver(object)...
logging.py
import decimal import importlib.util import logging import queue import re import sys import threading import time import typing __all__ = ["EnhancedConsoleHandler", "ColoredFormatter", "IngoreLogFilter"] class EnhancedConsoleHandler(logging.StreamHandler): """A stream handler that could shows progress bar on ta...
_UIAHandler.py
from ctypes import * from ctypes.wintypes import * import comtypes.client from comtypes.automation import VT_EMPTY from comtypes import * import weakref import threading import time import api import appModuleHandler import queueHandler import controlTypes import NVDAHelper import winKernel import winUser...
multithread.py
import threading import time import queue def f(name, timeout, queue): time.sleep(timeout) print('hello', name) queue.put(name + ' done!') q = queue.Queue() # thread-safe queue bob = threading.Thread(target=f, args=('bob', 0.3, q)) bob.start() # start the thread alice = threading.Thread(target=f, arg...
main.py
# -*- coding: utf-8 -*- import copy import datetime import imp from importlib import import_module import inspect import logging from multiprocessing import Process, Queue import operator import os from os.path import abspath, dirname import re import signal import sys import threading import time import traceback try...
OrthancWebsocket.py
import asyncio import websockets import json import multiprocessing import logging import sys from curapacs_python import config from curapacs_python import helpers from curapacs_python.OrthancHost import OrthancHost from curapacs_python.OrthancMWLCreator import Worklist class OrthancMessage: """ Send, Receiv...
main.py
# PeerFS Filesystem Sharing Tool - Node import time import peerfs.nodefinder as nodefinder import peerfs.node import json import requests import keyboard import threading f = open("nodes.json", "r") nodesJson = json.loads(f.read()) nodes = nodesJson["nodes"] fetchedNodes = [] def fetchAndWriteNodes(ip): print(f"...
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 def __init__(self): if self.thread is None: # start background frame thread ...
qt_plotting.py
import logging import os import time from threading import Thread import numpy as np import vtk import vtk.qt from vtki.plotting import BasePlotter, rcParams, run_from_ipython # for display bugs due to older intel integrated GPUs vtk.qt.QVTKRWIBase = 'QGLWidget' log = logging.getLogger(__name__) log.setLevel('DEBUG...
job.py
# Copyright (C) 2018 by eHealth Africa : http://www.eHealthAfrica.org # # See the NOTICE file distributed with this work for additional information # regarding copyright ownership. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with # the License. Y...
main.py
import cv2 import pyfakewebcam import numpy as np import time import threading import video_modes as vmodes quit = False modes = vmodes.modes selected_mode = 0 current_mode_start_time = time.time() def video_processing_thread(): global quit global modes global selected_mode global current_mode_start_time cap =...
A3.py
#!/usr/bin/env python import rvo2 import matplotlib.pyplot as plt import numpy as np import random import rospy import time import threading import math import sys from utils import * from nav_msgs.msg import Odometry import A3easyGo as easyGo rospy.init_node('A3_mvs', anonymous=False) SIMUL_HZ = 10.0 sim = rvo2.P...
real_sensor.py
import time import random from threading import Thread from sensor import Sensor import numpy as np import cv2 from find_gauge_circle import find_gauge_circle from find_needle import find_needle4 class RealSensor(Sensor): def shutdown(self): if self.live_feed: self.cap.release() ...
vec_env.py
''' A wrapper for running multiple environments with multiple processes Reference: https://github.com/openai/baselines/blob/master/baselines/common/vec_env/subproc_vec_env.py ''' import multiprocessing as mp from rlcard.utils import reorganize class VecEnv(object): ''' The wrraper for a vector of environments...
ColdDataRetriever.py
import logging import os import signal import csv import time import shutil import subprocess import datetime import json import sys import schedule import pickle import threading with open('config.json', 'r') as f: config = json.load(f) #Get variables for StoreScp from config.json. storage_folder = config['Stor...
main.py
from variable import GlobalVar # from gstreamer import * from gstreamer_appsink import gst_appsink_init from gstreamer_appsrc import gst_appsrc_init import gi gi.require_version('Gst', '1.0') from gi.repository import Gst, GObject, GLib from yolo import YoloNet from minitouch import TouchStatus, MiniTouch, XY import ...
socket.py
# ============================================================================ # FILE: socket.py # AUTHOR: Rafael Bodill <justRafi at gmail.com> # License: MIT license # ============================================================================ import socket from threading import Thread from queue import Queue from ...
mitm.py
#!/usr/bin/env python3 import socket import argparse import threading import signal import json import requests import sys import time from queue import Queue from contextlib import contextmanager CLIENT2SERVER = 1 SERVER2CLIENT = 2 running = True """ "fast" 3-DES brute-force @author: Hung Nguyen """ MAX_AMOUNT_LEN...
runner.py
#!/usr/bin/env python2 # Copyright 2010 The Emscripten Authors. All rights reserved. # Emscripten is available under two separate licenses, the MIT license and the # University of Illinois/NCSA Open Source License. Both these licenses can be # found in the LICENSE file. """This is the Emscripten test runner. To run ...
subster.py
import praw import json import nltk import string from nltk.corpus import stopwords from nltk.stem.porter import * from sklearn.feature_extraction.text import TfidfVectorizer import operator import sys import threading import copy import sqlite3 stemmer = PorterStemmer() subreddits_main_dict = {} subreddits_large_dic...
BladderTracker.py
################################################## ## BladderTracker Software ## ## Used to track pressure and wall motions during bladder filling. ## Designed to work with Thorlabs DCC1545M ## For additional info see www.vasostracker.com and https://github.com/VasoTracker/BladderTracker ## ##########################...
add_articles_to_db.py
import sys import random import datetime import string import re from threading import Thread import textacy import textblob import newspaper import model def process_article_wait(document_object, punctuation_droplist): thread = Thread(target=process_article, args=(document_object,punctuation_droplist)) th...
teste.py
# -*- coding: utf-8 -*- # Created by DoSun on 2017/5/20 import sys import time from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * from PyQt5.QtNetwork import * from PyQt5.uic import * from drrr_window import * from connect_window import * from create_window import * import network import...
cam.py
# Point-and-shoot camera for Raspberry Pi w/camera and Adafruit PiTFT. # This must run as root (sudo python cam.py) due to framebuffer, etc. # # Adafruit invests time and resources providing this open source code, # please support Adafruit and open-source development by purchasing # products from Adafruit, thanks! # ...
copy_target_folder.py
import os import re from threading import Thread import utils num_worker = 4 def get_all_dirs(cur_path): return [os.path.join(cur_path, p) for p in os.listdir(cur_path) if os.path.isdir(os.path.join(cur_path, p))] def target_accept(cur_path, target_file): print(cur_path) for root, dirs, files in os.wa...
sqlmap-GUI.py
from flask import Flask, render_template,request import os import re import threading app = Flask(__name__) @app.route('/sqlmapGUI') def sqlmapGUI(): return render_template('sqlmap-GUI.html') def send_cmd(new_cmd,number): os.system(new_cmd) @app.route('/wait',methods=['GET']) def wait():...
logger.py
from queue import Queue, Empty import threading # thread safe appending to file class Logger: def __init__(self, *args, **kwargs): self.args = args self.kwargs = kwargs self.queue = Queue() self.finished = False threading.Thread(target=self.internal_writer).start...
trainer.py
# Lint as: python2, python3 # Copyright 2018 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 # ...
Thread_Synchronization_RLock.py
# Thread synchronization RLock from threading import * class Flight: def __init__(self, available_seat): self.available_seat = available_seat self.l = RLock() print("RLock Before: ", self.l) def reserve(self, need_seat): print("Available Seat : ", self.available_seat) ...
cosumer.py
import json import logging.config from _socket import gaierror from time import sleep from typing import Any import pika from pika.adapters.blocking_connection import BlockingChannel from pika.exceptions import AMQPConnectionError, ConnectionClosedByBroker from queue import Queue, Empty from threading import Thread, E...
feature_shutdown.py
#!/usr/bin/env python3 # Copyright (c) 2018 The bitmonkey Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test bitmonkeyd shutdown.""" from test_framework.test_framework import bitmonkeyTestFramework from test_f...
dragging.py
from pymol.wizard import Wizard from pymol import cmd import pymol import types import threading drag_sele = "_drag" #def delayed_disable(name,delay=1.0): # import time # time.sleep(delay) # from pymol import cmd # cmd.disable(name) class Dragging(Wizard): def __init__(self, *arg, _self=cmd): ...
10_Apple_Job_Scheduler.py
''' This problem was asked by Apple. Implement a job scheduler which takes in a function f and an integer n, and calls f after n milliseconds. ''' import time from threading import Thread def scheduler(): ''' Implement a job scheduler which takes in a function f and an integer n, and calls f after n millisec...
store_at_provider.py
# # Copyright (c) 2018, 2022 Oracle and/or its affiliates. All rights reserved. # # Licensed under the Universal Permissive License v 1.0 as shown at # https://oss.oracle.com/licenses/upl/ # import unittest from requests import codes from socket import error from threading import Thread from time import sleep, time t...
openNeuroService.py
""" A command-line service to be run where the where OpenNeuro data is downloaded and cached. This service instantiates a BidsInterface object for serving the data back to the client running in the cloud. It connects to the remote projectServer. Once a connection is established it waits for requets and invokes the Bids...
gui.py
from tkinter import * import rsa import socket import threading import time import os import os.path import socks import urllib.request from zipfile import ZipFile def check_tor(): if 'Tor' in os.listdir(): pass else: urllib.request.urlretrieve("https://www.torproject.org/dist/torbrowser/10.0....
test_generator.py
import mock import operator import os import threading import unittest import numpy import six import cupy from cupy import core from cupy import cuda from cupy.cuda import curand from cupy.random import generator from cupy import testing from cupy.testing import condition from cupy.testing import hypothesis class ...
ip-block_search.py
# Asterisk AMI Scanner, for more Commands to add, look in the CLI under ' manager show command ' # Quick and Dirty tool import sys, os, re, telnetlib, time, pymysql,json, daemon from multiprocessing import Process, Pipe, Queue #Asterisk user Data user = '' ## your User pw = '' # User PW #Mysql data mysql_user = ...
typed_queue_test.py
# Copyright 2017-2019 typed_python 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...
threading.py
import asyncio import threading import datetime from queue import Queue from random import randint import re import sys import traceback import inspect from datetime import timedelta import logging import iso8601 from appdaemon import utils as utils from appdaemon.appdaemon import AppDaemon class Threading: def ...
pid.py
import Queue import sys import threading import time class Limit: def __init__(self, minimum, maximum): self._minimum = minimum self._maximum = maximum def clamp(self, n): if n > self._maximum: return self._maximum elif n < self._minimum: return self._m...
controller.py
"""A pythonic Xbox 360 controller library for Linux. Partly inspired by the following libraries/codes: - https://www.freebasic.net/forum/viewtopic.php?t=18068 (libjoyrumble) - https://gist.github.com/rdb/8864666 """ import os import select import struct import sys import time from array import array from collections ...