source
stringlengths
3
86
python
stringlengths
75
1.04M
Joueur.py
__author__ = "reza0310" import os import time import pygame import sys from math import sqrt import threading def aff_total(*args): global blanc, map, mode, zoom, zioum effacer_texte() blanc = pygame.transform.scale(blanc, (1400, 1100)) fenetre.blit(blanc, (0, 0)) if args[0] == "menu":...
test_multicore.py
""" This module makes processes for a multicore application. It uses multiprocessing.Array to enable multiple processes to share access to streams efficiently. """ # Check whether the Python version is 2.x or 3.x # If it is 2.x import Queue. If 3.x then import queue. import sys is_py2 = sys.version[0] == '2' if is_py2...
tests.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import errno import os import shutil import sys import tempfile import threading import time import unittest from datetime import datetime, timedelta from django.core.cache import cache from django.core.exceptions import SuspiciousFileOperation, Suspicio...
core.py
# -*- 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 Apache License, Version 2.0 (the #...
mp_queue.py
from multiprocessing import Process, Queue import os, time, random # 写数据进程执行的代码: def write(q): for value in ['A', 'B', 'C']: print('Put %s to queue...' % value) q.put(value) time.sleep(random.random()) # 读数据进程执行的代码: def read(q): while True: value = q.get(True) print('...
xvfb.py
#!/usr/bin/env python # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Runs tests with Xvfb and Openbox on Linux and normally on other platforms.""" import os import platform import signal import su...
threading.py
from __future__ import annotations from threading import Lock, Thread from typing import Any import cv2.cv2 as cv2 from cv2.cv2 import VideoCapture from cv2.mat_wrapper import Mat from loguru import logger class VideoCaptureThreading: """ Class to capture video from a camera or a video file by Python thread...
test_browser_credential.py
# ------------------------------------ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ import functools import random import socket import threading import time from azure.core.exceptions import ClientAuthenticationError from azure.core.pipeline.policies ...
cli.py
import argparse import os import subprocess import sys import psutil import threading import time from ipaddress import IPv4Network from dht import utils from dht.dht import DHT # constants PORT = 9789 # setup arguments parser = argparse.ArgumentParser() parser.add_argument("--bootstrap", help="an established node...
display_manager.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...
app.py
from __future__ import print_function from __future__ import unicode_literals import mimetypes import os import socket import sys import threading import uuid from functools import wraps from os.path import splitext import six from six.moves.urllib.parse import urlparse import requests import ruamel.yaml as yaml fro...
http.py
#!/usr/bin/env python3 # MIT License # # Copyright (C) 2019-2020, Entynetproject. All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including withou...
rasprinter.py
# -*- coding: utf-8 -*- import sys import io import os import threading from PyQt5 import QtWidgets, Qt import time sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__)))) from python_raspberry import stt import display import tts # import docxread # 1: print_ui # 2: recording_file_ui # 3: docum...
train_and_eval_runner.py
# 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 # # Unless required by applica...
run_agent.py
import sys import os import numpy as np import copy from flask import Flask, request, jsonify from queue import PriorityQueue from threading import Thread # Agent from convlab2.dialog_agent import PipelineAgent, BiSession from convlab2.nlu.milu.multiwoz import MILU from convlab2.dst.rule.multiwoz import RuleDST from...
kernel.py
from queue import Queue from threading import Thread from ipykernel.kernelbase import Kernel import re import subprocess import tempfile import os import os.path as path class RealTimeSubprocess(subprocess.Popen): """ A subprocess that allows to read its stdout and stderr in real time """ inputReque...
testLepSplitSFProducer.py
from __future__ import division, print_function import os, sys import ROOT from PhysicsTools.NanoAODTools.postprocessing.framework.postprocessor import PostProcessor from PhysicsTools.NanoAODTools.postprocessing.framework.datamodel import Collection, Object from PhysicsTools.NanoAODTools.postprocessing.framework.event...
bot.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import base64 import json import os import sys import threading import time import uuid from collections import deque import websocket from rich import pretty from rich.console import Console from websocket import WebSocketAddressException from configs import ConfigBuil...
dokku-installer.py
#!/usr/bin/env python3 import cgi import json import os import re import shutil try: import SimpleHTTPServer import SocketServer except ImportError: import http.server as SimpleHTTPServer import socketserver as SocketServer import subprocess import sys import threading VERSION = 'v0.24.8' def bytes_t...
LedRunner.py
import threading class LedRunner: def __init__(self): self.thread = None self.running = False def __repeat(self, func, args): """Will run the given function until the running variable is at False""" while self.running: func(*args) def start(self, func, *args): ...
rm_pdb.py
#!/usr/bin/env python import socket import sys import threading from types import * import pdb as _pdb # get sting format value of variable def stringify(thing): try: typ = type(thing) if hasattr(thing, '__name__'): return thing.__name__ #if hasattr(typ, '__name__'): ...
watchdog.py
#!/usr/bin/python # Copyright (c) Microsoft Corporation # All rights reserved. # # MIT License # # 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 limitatio...
process_executor.py
############################################################################### # Re-implementation of the ProcessPoolExecutor more robust to faults # # author: Thomas Moreau and Olivier Grisel # # adapted from concurrent/futures/process_pool_executor.py (17/02/2017) # * Backport for python2.7/3.3, # * Add an extra m...
utils.py
import logging from time import sleep from threading import Thread import pytest import websocket # websocket-client import _bootstrap_ from websocket_server import WebsocketServer class TestClient(): def __init__(self, port, threaded=True): self.received_messages = [] self.closes = [] s...
test_client.py
from base64 import b64encode, b64decode import copy import io import os import re import threading import nbformat import sys import pytest import functools import xmltodict from .base import NBClientTestsBase from .. import NotebookClient, execute from ..exceptions import CellExecutionError import IPython from trai...
stress_test_core.py
"Stress test diskcache.core.Cache." import collections as co from diskcache import Cache, UnknownFileWarning, EmptyDirWarning, Timeout import multiprocessing as mp import os import pickle import queue import random import shutil import sys import threading import time import warnings from .utils import display OPERA...
compare_Walternating_sgd_5layers.py
import qiskit import numpy as np import sys sys.path.insert(1, '../') import qtm.base, qtm.constant, qtm.ansatz, qtm.fubini_study, qtm.encoding import importlib import multiprocessing importlib.reload(qtm.base) importlib.reload(qtm.constant) importlib.reload(qtm.ansatz) importlib.reload(qtm.fubini_study) def run_walt...
thread_stdin_manager.py
""" A manager to send to stdin of a subprocess.Popen objects in another thread. There can be several ReadingProcs attached to ThreadStdinManager. """ from time import sleep from threading import Thread try: # python 3 from queue import Queue, Full, Empty except ImportError: # python 2 from Queue import ...
filemanager.py
from modules import logger log = logger.logger_class() from os import walk import time, json, threading from urllib2 import unquote class filemanager_class(): REPORTS_DONE = [] # SAVE REPORTS def save_settings_data(self): try: log.info("filemanager_class|save_settings_data", "Sav...
test_scale.py
import os import time import multiprocessing from functools import partial import pytest from jina import Flow, Executor, Document, DocumentArray, requests, Client from jina.excepts import RuntimeFailToStart, ScalingFails cur_dir = os.path.dirname(os.path.abspath(__file__)) IMG_NAME = 'jina/scale-executor' NUM_CONC...
preprocess_embed.py
""" Usage: preprocess_embed.py <File> [<File2>] [<File3>] preprocess_embed.py <File> [<File2>] [<File3>] [--max=<x>] preprocess_embed.py <File> [<File2>] [<File3>] [--cuda=<y>] preprocess_embed.py <File> [<File2>] [<File3>] [--max=<x>] [--cuda=<y>] Options: -h --help Show this screen. --max...
factorio.py
import asyncio import dotenv as de import multiprocessing as mp import multiprocessing.connection as mpc import os import re import subprocess as sp import threading import time __all__ = ['Factorio'] # Consts DISCORD_MSG_LEN_MAX = 1990 # Leave a little room for error # Load Env de.load_dotenv() SECRET = str.encode(...
qsconsole.py
import socket import sys import json from threading import Thread import time from quickspy.color import * import quickspy.cmd as cmd import console_ui as ui from quickspy.util import better_print bprint = better_print('line') # class QSChat: # def init(self, key, value): # key = str(key) # value...
DeadlockAvoid.py
from threading import * import time file = "Sudhanwa Kaveeshwar" s = 1 r = 1 reader_count = 0 def waitc(): global s while s == 0: pass s = 0 def goc(): global s s = 1 def wait_reader(): global r while r == 0: pass r = 0 def go_reader(): global r r = 1 ...
test_mod.py
import wandb import multiprocessing def mp_func(): """This needs to be defined at the module level to be picklable and sendable to the spawned process via multiprocessing""" print("hello from the other side") def main(): wandb.init() context = multiprocessing.get_context("spawn") p = context...
StreamingScraper.py
__author__ = "Adam Klekowski" import yaml import time from kafka import KafkaProducer import cv2 import pickle import logging import pafy import pymongo import numpy as np import sys import threading import os logging.basicConfig(level=logging.INFO, format='%(message)s') path_of_script = os.path.dirname(os.path.rea...
index.py
# -*- encoding:utf-8 -*- import tornado.web import tornado.websocket import tornado.httpserver import tornado.ioloop from minicap import Stream from queue import Queue import threading class IndexPageHandler(tornado.web.RequestHandler): def get(self): self.render('templates/index.html') class WebSocketHa...
seperate.py
import multiprocessing as multi import hashlib # Function to determine if a number is prime def is_prime(n): if n <=1: return False for i in range(2, n): if n % i == 0: return False return True # Function to perform encryption def encrypt(x): return hashlib.sha256(str(x)...
__init__.py
""" objectstore package, abstraction for storing blobs of data for use in Galaxy. all providers ensure that data can be accessed on the filesystem for running tools """ import logging import os import random import shutil import threading import time from collections import OrderedDict from xml.etree import ElementTr...
tune_nvcc.py
#!/usr/bin/env python from __future__ import division from __future__ import print_function from builtins import map from builtins import filter from builtins import range from past.utils import old_div # import adddeps # fix sys.path import math import argparse import ast import collections import json import loggin...
test_callbacks.py
import os import multiprocessing import numpy as np import pytest from csv import reader from csv import Sniffer import shutil from keras import optimizers from keras import initializers from keras import callbacks from keras.models import Sequential, Model from keras.layers import Input, Dense, Dropout, add from kera...
test_sys.py
# -*- coding: iso-8859-1 -*- import unittest, test.test_support from test.script_helper import assert_python_ok, assert_python_failure import cStringIO import gc import operator import os import struct import sys class SysModuleTest(unittest.TestCase): def tearDown(self): test.test_support.reap_children()...
test_app.py
import unittest from assertpy import assert_that import threading import tempfile import shutil import os from cron_tools.common.rpc_client import RPCClient from cron_tools.agent.config import AgentConfiguration from cron_tools.agent.app import build_app, agent_argument_parser class CronToolsAgentApplicationUnitTest...
parallelsource.py
from __future__ import print_function import numpy as np #import torch #from torch.multiprocessing import Process, Event, Queue from multiprocessing import Process, Event, Queue from neuralnilm.data.source import Source, Sequence import logging logger = logging.getLogger(__name__) #torch.multiprocessing...
timeline.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See LICENSE in the project root # for license information. from __future__ import absolute_import, division, print_function, unicode_literals import collections import contextlib import itertools import threading from ptvsd...
mosaic.py
import sys import os from PIL import Image, ImageOps from multiprocessing import Process, Queue, cpu_count # Change these 3 config parameters to suit your needs... TILE_SIZE = 30# 50 # height/width of mosaic tiles in pixels TILE_MATCH_RES = 10# 5 # tile matching resolution (higher values give better fit but req...
SearchEngineGUI_RadioButton.py
import glob import os import os.path import sys from ScrapeGoogle import fetch_results, parse_results, scrape_google import tkinter import tkinter.scrolledtext as tkst #import threading def searchEngineModule(wordCheck, lineNumCheck="y", lineShowCheck="n", sensitiveCheck="n", googleSearchCheck = "n...
AwsDeployer.py
import sys import io import subprocess import threading import time import uuid import os.path from datetime import datetime from random import randint from Deployer import Deployer from UniqueConfiguration import UniqueConfiguration from CommonConfiguration import CommonConfiguration from printer import console_out, c...
test_fx.py
import builtins import contextlib import copy import functools import inspect import math import numbers import operator import os import pickle import sys import torch import traceback import typing import types import warnings import unittest from math import sqrt from torch.multiprocessing import Process from torch....
models.py
# -*- coding: utf-8 -*- import time from threading import Thread import base64 import redis import redisco import unittest from datetime import date from redisco import models from redisco.models.base import Mutex class Person(models.Model): first_name = models.CharField() last_name = models.CharField() d...
tiny_yolo_processor.py
#! /usr/bin/env python3 # Copyright(c) 2017 Intel Corporation. # License: MIT See LICENSE file in root directory. # NPS # processes images via tiny yolo from mvnc import mvncapi as mvnc import numpy as np import cv2 import queue import threading class tiny_yolo_processor: # Tiny Yolo assumes input images are ...
account.py
# Copyright 2014-2018 CERN for the benefit of the ATLAS collaboration. # # 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...
image_build.py
""" Copyright (c) 2017 Cyberhaven Copyright (c) 2017 Dependable Systems Laboratory, EPFL 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 right...
text_client.py
# Copyright 2017 Mycroft AI 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...
tether_task_runner.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...
driver_v2.py
#!/usr/bin/env python # Version 2 of the driving node for the basic rover. # In this, the script will be able to accept upto 5 successive driving commands # that could be sent without waiting for each driving command to execute. # The driving commands are stored in a buffer and executed by order of arrival from basic...
fauxmo_mqtt.py
import fauxmo, threading, logging, time import paho.mqtt.client as mqtt from debounce_handler import debounce_handler logging.basicConfig(level=logging.DEBUG) # Network constants ECHO_LIVINGROOM = "192.168.1.53" ECHO_KITCHEN = "192.168.1.243" MQTT_HOST = "jarvis" MQTT_PORT = 1883 # Device callback functions class l...
manager.py
#!/usr/bin/env python3 import datetime import os import signal import subprocess import sys import traceback from multiprocessing import Process from typing import List, Tuple, Union import cereal.messaging as messaging import selfdrive.sentry as sentry from common.basedir import BASEDIR from common.params import Para...
jumpcutter.py
import numpy as np import subprocess import threading import datetime import fnmatch import random import shutil import time import math import os import re from audiotsm.io.wav import WavReader, WavWriter from shutil import copyfile, rmtree from audiotsm import phasevocoder from contextlib import closing from scipy.i...
webscraper-NBA-ADV-v1.py
from selenium import webdriver from bs4 import BeautifulSoup as bs from bs4 import SoupStrainer import threading import pandas as pd import time def call_selenium_bs4(driver ,next = False, main_call = False, get_years = False): if next == True: next_page = driver.find_element_by_xpath('/html/body/main...
pull-sr-api.py
#! /usr/bin/env python import requests from threading import Thread, Event from queue import Queue import json import logging import time import argparse # Argument Parsing parser = argparse.ArgumentParser() parser.add_argument( "-n", "--num-of-threads", action="store", type=int, default=4, he...
test_bg_color.py
import threading import pytest from .util import destroy_window, run_test def bg_color(): import webview def _bg_color(webview): assert webview.webview_ready(10) destroy_event.set() t = threading.Thread(target=_bg_color, args=(webview,)) t.start() destroy_event = destroy_window(w...
ServerWithAuthentication.py
import socket,hashlib,threading s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) host = socket.gethostbyname(socket.gethostname()) port = 1234 s.bind((host,port)) ip_list = [] conn_list = [] logged_in_users = [] print(f"\n[+] Server hosted on IP: {host}") print(f"[+] Server hosted on Port: {port}") print("\n[+] Se...
pd_corp.py
#!/usr/bin/python3 import sys from multiprocessing import Lock, Process, Value from ctypes import c_byte import os import time class BlockingConcurrentPdcorpCommunicator(): """ Communicator that provides methods for get and put element. Class implements communicating protocol with pd_corp application thr...
multicapconverter.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = "Abdelhafidh Belalia (s77rt)" __credits__ = ['Jens Steube <jens.steube@gmail.com>', 'Philipp "philsmd" Schmidt <philsmd@hashcat.net>', 'ZerBea (https://github.com/ZerBea)', 'RealEnder (https://github.com/RealEnder)...
mcbtsilimigrasContigFilter2Server.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from wsgiref.simple_server import make_server import sys import json import traceback import datetime from multiprocessing import Process from getopt import getopt, GetoptError from jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError,\ JSONRPCError, Inva...
basic_threading_example.py
from threading import Thread def print_range(): for i in range(1,100): print(f"Printing {i} in first thread!") t1 = Thread(target=print_range) t1.name = "one" t2 = Thread(target=print_range) t2.name = "two" t1.start() t2.start()
CrayTag.pyw
class ver: sion="2.2" # Version number of program. # ver.sion """ ############################## CrayTag. ############################## Coded by: Dalton Overlin ########################################################## Last Code Revision Date: Jul. 11th, 2020 #################################...
networkMCFA.py
#!/usr/bin/env python3.7 """ Router class is part of a dissertation work about WSNs """ __author__ = "Bruno Chianca Ferreira" __license__ = "MIT" __version__ = "0.1" __maintainer__ = "Bruno Chianca Ferreira" __email__ = "brunobcf@gmail.com" import socket, os, math, struct, sys, json, traceback, zlib, fcntl, threadi...
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 ...
07_pendulum_ddpg_main.py
# https://github.com/openai/gym/blob/master/gym/envs/classic_control/pendulum.py # https://mspries.github.io/jimmy_pendulum.html #!/usr/bin/env python3 import time import torch import torch.multiprocessing as mp import os, sys current_path = os.path.dirname(os.path.realpath(__file__)) PROJECT_HOME = os.path.abspath(os...
utils.py
from django.utils.encoding import force_text from django.test.utils import override_settings from django.conf import settings from django.test import TransactionTestCase from tastypie.test import ResourceTestCase, TestApiClient from api.serializers import MultipartSerializer from perma import models import socket impo...
TWCManager.py
#! /usr/bin/python3 ################################################################################ # Code and TWC protocol reverse engineering by Chris Dragon. # # Additional logs and hints provided by Teslamotorsclub.com users: # TheNoOne, IanAmber, and twc. # Thank you! # # For support and information, please re...
test_fx.py
import builtins import contextlib import copy import functools import inspect import math import numbers import operator import os import pickle import sys import torch import traceback import warnings import unittest from math import sqrt from torch.multiprocessing import Process from torch.testing import FileCheck fr...
main_solo12_ISAE.py
# coding: utf8 import numpy as np import argparse import math import threading from time import clock, sleep from solo12_ISAE import Solo12 data = np.load("traj.npz") t_traj = data['t'] q_traj = data['q'] v_traj = data['q_dot'] kp_traj = data['gains'][:, 0] kd_traj = data['gains'][:, 1] key_pressed = False def get_...
util.py
# Electrum - lightweight Bitcoin client # Copyright (C) 2011 Thomas Voegtlin # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including without limitation the rights t...
test_event_log.py
import os import sys import time import traceback from contextlib import contextmanager import pytest import sqlalchemy from dagster import seven from dagster.core.definitions import AssetMaterialization, ExpectationResult from dagster.core.errors import DagsterEventLogInvalidForRun from dagster.core.events import ( ...
coordinator_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...
utils.py
# Copyright 2012 10gen, 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 writing, soft...
mongotracer.py
from fedn.common.tracer.tracer import Tracer from fedn.common.storage.db.mongo import connect_to_mongodb import time import threading import psutil from datetime import datetime class MongoTracer(Tracer): def __init__(self): try: self.mdb = connect_to_mongodb() self.collection = sel...
cmu_graphics.py
from cmu_graphics.shape_logic import TRANSLATED_KEY_NAMES EPSILON = 10e-7 def almostEqual(x, y, epsilon=EPSILON): return abs(x - y) <= epsilon def rounded(d): sign = 1 if (d >= 0) else -1 d = abs(d) n = int(d) if (d - n >= 0.5): n += 1 return sign * n def round(*args): raise Exception(t("...
cli.py
import ast import inspect import os import platform import re import sys import traceback import warnings from functools import update_wrapper from operator import attrgetter from threading import Lock from threading import Thread import click from werkzeug.utils import import_string from .globals import current_app ...
ronda1.py
import threading import time mutex = threading.Semaphore(1) procesos = [['A', 'B', 'C', 'D', 'E'], [6, 10, 4, 9, 8], [0, 1, 4, 9, 12], [0, 0, 0, 0, 0], [6, 10, 4, 9, 8],] resultados = [['T', 'E', 'P'], [0, 0, 0], [0, 0, 0]] cola_ejecucion = [] tiempo_espera = procesos[2][0] tiempo_total = 0 quantum = 1 def proceso(pr...
betterNMS.py
import pickle from evaluate import write_results import numpy as np from tqdm import tqdm import json from matplotlib import pyplot as plt import copy from threading import Thread from widerface_evaluate import evaluation from evaluate import write_results from multiprocessing import Process resultDir = 'newNMS/' JSO...
pydgt.py
from Queue import Queue import serial import sys import time from threading import Thread from threading import RLock from threading import Condition from struct import unpack import signal import glob from itertools import cycle clock_blink_iterator = cycle(range(2)) BOARD = "Board" FEN = "FEN" CLOCK_BUTTON_PRESSED...
test_data.py
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 # For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt """Tests for coverage.data""" import glob import os import os.path import re import sqlite3 import threading import mock from coverage.data import CoverageData, ...
test_tcp_relay.py
#!/usr/bin/env python PKG = 'lg_common' NAME = 'test_tcp_relay' import unittest import socket import threading import time from lg_common.tcp_relay import TCPRelay MAGIC = 'MAGIC\n' def get_ephemeral_port(): import socket sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.bind(('', 0)) p...
dataset.py
import os, sys, json, pickle, io, time, random, copy import h5py import pprint import threading, queue from tqdm import tqdm from collections import Counter from transformers import MobileBertTokenizer import cv2 from PIL import Image import numpy as np import revtok import torch sys.path.append(os.path.join(os.envir...
my_async.py
from threading import Thread def async_call(f): def wrapper(*args, **kwargs): Thread(target=f, args=args, kwargs=kwargs).start() return wrapper
ib_core.py
from ibapi.wrapper import EWrapper from ibapi.client import EClient from ibapi.ticktype import * from ibapi.common import * from ibapi.contract import Contract from threading import Thread import datetime class IBApp(EWrapper, EClient): def __init__(self, ipaddress="127.0.0.1", portid=7496, clientid=1): ...
testing.py
"""Testing utilities.""" import os import re import threading import functools from tempfile import NamedTemporaryFile from numpy import testing import numpy as np from ._warnings import expected_warnings import warnings from .. import data, io, img_as_uint, img_as_float, img_as_int, img_as_ubyte SKIP_RE = re.com...
Tab3.py
# coding: utf-8 import tkinter as tk from tkinter import ttk import sys from PIL.FontFile import WIDTH sys.path.append('../') from Fun.vert import verticalPrint from tkinter import messagebox as mBox from tkinter import scrolledtext from threading import Thread class Tab3(): def __init__(self,tab,i18n): s...
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...
easyVector.py
#! /usr/bin/env python # Name : EasyVector # HOWTO # easyVector.main(speed, desiredAngle) # First Angle set by IMU # REMARK : easyVector must be loaded on high hierachy procedure # Dependencies : imu2angle # 0517 0444 : add thread, heierachy add # 0524 Pose ODOM ADDED, variable Name : PoseX, PoseY # Chagle ma...
slim_client_video.py
# -*- coding: utf-8 -*- import os import threading import gc from time import time, sleep import numpy as np import cv2 import wx from slim_anywhere_v2 import SlimFace global_fps = 24 os.environ["UBUNTU_MENUPROXY"]="0" class ImagePanel(wx.Panel): def __init__(self, parent, size): super(ImagePanel, sel...
astrodenoisepygui.py
import kivy kivy.require('2.1.0') from kivy.app import App from kivy.uix.floatlayout import FloatLayout from kivy.uix.anchorlayout import AnchorLayout from kivy.uix.actionbar import ActionToggleButton from kivy.uix.slider import Slider from kivy.uix.popup import Popup from kivy.factory import Factory from kivy.clock im...
multiprocessing.py
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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. # A copy of the License is located at # # http://www.apache.org/licenses/LICENSE-2.0 # # or in the "license...
multi-server.py
""" ########################################################################################### Same as fork-server.py, but use multiprocessing instead of os.fork; this works on Cygwin, and probably works on other Unix-likes, because multiprocessing forks and descriptors are inherited, but it fails on Windows (socket...
console.py
#!/usr/bin/env python import socket import threading import sbs TCP_IP = '10.0.0.184' TCP_PORT = 10001 BUFFER_SIZE = 1024 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((TCP_IP, TCP_PORT)) pipeaway = {'kern.alert': None, 'daemon.warn': None, 'CMS MDM': None} for key in pipeaway: pipeaway[key] ...
dataloader_iter.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...