source
stringlengths
3
86
python
stringlengths
75
1.04M
screen.py
# This file is modified from the screenutils Python module # https://pypi.org/project/screenutils/ # https://github.com/Christophe31/screenutils # -*- coding:utf-8 -*- # # This program is free software. It comes without any warranty, to # the extent permitted by applicable law. You can redistribute it # and/or modify ...
dlnap.py
#!/usr/bin/python # @file dlnap.py # @author cherezov.pavel@gmail.com # @brief Python over the network media player to playback on DLNA UPnP devices. # Change log: # 0.1 initial version. # 0.2 device renamed to DlnapDevice; DLNAPlayer is disappeared. # 0.3 debug output is added. Extract location url fixed. #...
TestRunnerAgent.py
#!/usr/bin/env python # ---------------------------------------------------------------------------- # Copyright 2010 Orbitz WorldWide # # 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 # # ...
libnetfilter_log.py
# Copyright (c) 2018 Fujitsu Limited # 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 requi...
conftest.py
import collections import contextlib import platform import sys import threading import pytest import trustme from tornado import ioloop, web from dummyserver.handlers import TestingApp from dummyserver.server import HAS_IPV6, run_tornado_app from .tz_stub import stub_timezone_ctx # The Python 3.8+ default loop on...
HiwinRA605_socket_ros_20190530111958.py
#!/usr/bin/env python3 # license removed for brevity #接收策略端命令 用Socket傳輸至控制端電腦 import socket ##多執行序 import threading import time ## import sys import os import numpy as np import rospy import matplotlib as plot from std_msgs.msg import String from ROS_Socket.srv import * from ROS_Socket.msg import * import HiwinRA605_s...
battleship_client.py
import grpc import logging import queue import threading import uuid from battleships_pb2 import Attack, Request, Response, Status from battleships_pb2_grpc import BattleshipsStub from client_interface import ClientInterface logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) class BattleshipClient(...
bot.py
import threading import traceback from threading import Lock import time from tasks.Items import Items from tasks.LostCanyon import LostCanyon from tasks.Task import Task from bot_related.bot_config import BotConfig from bot_related.device_gui_detector import GuiDetector, GuiName from filepath.file_relative_paths imp...
tesseract_controller.py
import threading import time from functools import partial from logging import getLogger from pathlib import Path from kivymd.toast import toast from kivymd.uix.button import MDFlatButton from kivymd.uix.dialog import MDDialog from kivymd.uix.filemanager import MDFileManager from kivymd.uix.menu import MDDropdownMenu ...
imgrec.py
import darknet import cv2 import numpy as np import imutils import random import time #Setup sending of string and receiving of coordinate import socket import threading PORT = 5051 FORMAT = 'utf-8' SERVER = '192.168.32.32' ADDR = (SERVER, PORT) #robot_coord = 'empty' ir_socket = socket.socket(socke...
game.py
import Queue import random import events from events import * from gui import FreeCellGUI from logic import FreeCellLogic from network import FreeCellNetworking class FreeCellGame(object): def __init__(self, seed=None, debug=False, networking=False): """ :param int seed: Seed :param bool ...
main.py
import queue from libs.mongo import Mongo from libs.mqtt import MQTT from libs.configuration import Configuration from queue import Queue from signal import pause import threading if __name__ == "__main__": configuration = Configuration() __queue = Queue() mongo = Mongo( mongoConfig = configura...
teste.py
# -*- coding: utf-8 -*- import Tkinter as tk from Tkinter import * from PIL import Image, ImageTk import threading import os from threading import Thread import time from random import randint class Bomberman(Frame): def __init__(self, parent,numeros, con, nick): Frame.__init__(self, parent) self.fogo=[] numeros...
d_mp_test_2.py
from torch.multiprocessing import Queue, Process def proc_a(queue): data = 1000 queue.put(data) def proc_b(queue): data = queue.get() print(data) if __name__ == '__main__': # b = [(1, 2), (20, 30), (200, 300)] # print(list(zip(*b))) queue = Queue() p1 = Process(target=proc_a, args...
runners.py
# -*- coding: utf-8 -*- import locale import os import struct from subprocess import Popen, PIPE import sys import threading import time # Import some platform-specific things at top level so they can be mocked for # tests. try: import pty except ImportError: pty = None try: import fcntl except ImportErro...
start_multiple_servers.py
#!/bin/python3.6 # -*- coding: utf-8 -*- # # MIT License # # Copyright (c) 2018 Robert Gustafsson # Copyright (c) 2018 Andreas Lindhé # # 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...
fiber_sweep_cores.py
from typing import Optional import subprocess import multiprocessing from functools import partial def run( key: str = "fiber_xposition", value: float = 0, ncores: int = 6, ): command = f"mpirun -np {ncores} python fiber.py --{key}={value}" print(command) subprocess.call(command, shell=True) ...
video_thread.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Aug 22 20:00:06 2021 Idea y código original: https://www.youtube.com/watch?v=sW4CVI51jDY Clayton Darwin https://gitlab.com/duder1966/youtube-projects/-/tree/master/ @author: mherrera """ import time import threading import queue import cv2 i...
Chess-v0.8-threading.py
import multiprocessing import threading import pygame from pygame.locals import * import os import os.path import random import time from tkinter import Tk import math from copy import deepcopy class Board(): def __init__(self): self.dark_square = pygame.image.load(os.path.join("texture...
test_mcrouter_basic.py
# Copyright (c) 2017-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the LICENSE # file in the root directory of this source tree. from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals...
myclient.py
#!/usr/bin/env python3 """Script for Tkinter GUI chat client.""" from socket import AF_INET, socket, SOCK_STREAM from threading import Thread import tkinter from tkinter import filedialog, Tk import os import time def recv_file(): print("file request from ") fname = client_socket.recv(BUFSIZ).decode("utf8") ...
gog_builds_scan.py
#!/usr/bin/env python3 ''' @author: Winter Snowfall @version: 3.00 @date: 20/04/2022 Warning: Built for use with python 3.6+ ''' import json import threading import sqlite3 import signal import requests import logging import argparse import difflib import re import os from sys import argv from shutil import copy2 fro...
__init__.py
# -*- coding: utf-8 -*- import logging as _logging import sys __author__ = 'luckydonald' __all__ = ["logging", "ColoredFormatter", "ColoredStreamHandler", "LevelByNameFilter"] DEFAULT_DATE_FORMAT = "%Y-%m-%d %H:%M:%S" class ColoredFormatter(_logging.Formatter): class Color(object): """ utility...
test_telnetlib.py
import socket import select import telnetlib import time import contextlib from unittest import TestCase from test import support threading = support.import_module('threading') HOST = support.HOST def server(evt, serv): serv.listen(5) evt.set() try: conn, addr = serv.accept() conn.close()...
parallel_requests.py
# This script creates parallel processes to send predict requests import argparse import json import requests import time from multiprocessing import Process, Queue, Pipe _predict_endpoint = "/predict/" _health_endpoint = "/health/" _statsinternal_endpoint = "/statsinternal/" _stats_endpoint = "/stats/" class Sende...
sofa_record.py
import argparse import csv import datetime import glob import json import multiprocessing as mp import os import subprocess from subprocess import DEVNULL from subprocess import PIPE import sys import threading import time from functools import partial from pwd import getpwuid import pandas as pd import numpy as np imp...
dcgm_health_check.py
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
test_p2p_grpform.py
#!/usr/bin/python # # P2P group formation test cases # Copyright (c) 2013, Jouni Malinen <j@w1.fi> # # This software may be distributed under the terms of the BSD license. # See README for more details. import logging logger = logging.getLogger(__name__) import time import threading import Queue import hwsim_utils d...
dmlc_local.py
#!/usr/bin/env python """ DMLC submission script, local machine version """ import argparse import sys import os import subprocess from threading import Thread import tracker import signal import logging parser = argparse.ArgumentParser(description='DMLC script to submit dmlc jobs as local process') parser.add_argume...
robot2.py
# # COPYRIGHT: # The Leginon software is Copyright 2003 # The Scripps Research Institute, La Jolla, CA # For terms of the license agreement # see http://ami.scripps.edu/software/leginon-license # from PIL import Image import sys import threading import time from leginon import leginondata import emailnotifi...
delete_vms.py
import logging import threading from cloud.clouds import Region, Cloud from test_steps.create_vms import env_for_singlecloud_subprocess from util.subprocesses import run_subprocess from util.utils import thread_timeout, Timer def delete_vms(run_id, regions: list[Region]): with Timer("delete_vms"): del_aw...
Knife-autoPWN.py
#!/usr/bin/python3 #============= imports =============== from pwn import * # pip3 install pwn #===================================== def banner(): print(" _ ___ _ ___ _____ _____ _ ______ ___ _ ") print("| | / \ | |_ _| ___| ____| __ _ _ _| |_ ___ | _ \ \ ...
test_dag_serialization.py
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
upnp.py
import logging import threading from queue import Queue from typing import Optional try: import miniupnpc except ImportError: pass log = logging.getLogger(__name__) class UPnP: thread: Optional[threading.Thread] = None queue: Queue = Queue() def __init__(self): def r...
io.py
import os import time import threading from queue import Queue from gi.repository import GObject, GLib class BackgroundIO(GObject.GObject): __gsignals__ = {'data-received': (GObject.SIGNAL_RUN_FIRST, None, (object, )), 'data-sent': (GObject.SIGNAL_RUN_FIR...
app.py
from threading import Thread import sys from flask import Flask, render_template from PyQt5.QtCore import * from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5.QtWebEngineWidgets import * import sys from time import sleep webInstance = Flask(__name__) # webInstance.config['PORT'] = 5000 @webInstance.ro...
test_aio.py
# -*- coding: utf-8 -*- import os import asyncio # import uvloop import threading # asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) import time import pytest import thriftpy thriftpy.install_import_hook() from thriftpy.rpc import make_aio_server, make_aio_client # noqa from thriftpy.transport import TTra...
cleanup_db.py
__author__ = 'anushabala' import sqlite3 import time import atexit import json from argparse import ArgumentParser from cocoa.core.systems.human_system import HumanSystem import multiprocessing class DBCleaner(): SLEEP_TIME = 15 def __init__(self, db_file, chat_timeout, user_timeout): self.db_file =...
screen_diff.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...
tcp_test.py
# -*- coding: utf-8 -*- ''' :codeauthor: :email:`Thomas Jackson <jacksontj.89@gmail.com>` ''' # Import python libs from __future__ import absolute_import import os import threading import tornado.gen import tornado.ioloop from tornado.testing import AsyncTestCase import salt.config import salt.utils import salt....
test_serializer.py
from collections import OrderedDict import math import os import pickle import subprocess import sys from pathlib import Path import pytest import nni import torch import torch.nn as nn from torch.utils.data import DataLoader from torchvision import transforms from torchvision.datasets import MNIST from nni.common.se...
utils.py
"""Utilities for working with influxdb.""" import logging import os import socket from threading import Thread from django.conf import settings from influxdb import InfluxDBClient logger = logging.getLogger(__name__) def build_tags(tags=None): final_tags = {} final_tags.update({ 'host': getattr(s...
server.py
#!/usr/bin/python from __future__ import print_function from pyrad.dictionary import Dictionary from pyrad.server import Server, RemoteHost from pyrad.packet import AccessReject, AccessAccept import logging from okta import OktaAPI, ResponseCodes import os import sys import threading logging.basicConfig(level="INFO", ...
windows.py
from ...third_party import WebsocketServer # type: ignore from .configurations import ConfigManager from .configurations import WindowConfigManager from .diagnostics import ensure_diagnostics_panel from .logging import debug from .logging import exception_log from .message_request_handler import MessageRequestHandler ...
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...
test_gateway.py
import functools import time from threading import Thread import numpy as np import pytest from jina import Document from jina.enums import CompressAlgo from jina import Flow from tests import random_docs @pytest.mark.slow @pytest.mark.parametrize('compress_algo', list(CompressAlgo)) def test_compression(compress_a...
B.py
from flask import Flask from threading import Thread app = Flask('') @app.route('/') def main(): return 'JDBot is up and running!!' def run(): app.run(host='0.0.0.0', port=3000) def b(): server = Thread(target=run) server.start()
shpritz.py
import socket import serial import json import threading thresh = 30 trig = False arduino = serial.Serial('/dev/ttyACM0', 9600) # open serial port udp = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) udp.bind(("127.0.0.1", 3001)) def udp_thread(): global trig while True: data, addr = udp.recvfrom(1024) ...
silent.py
#!/usr/bin/env python ''' ''' __docformat__ = 'restructuredtext' __version__ = '$Id$' import time from pyglet.media import AbstractAudioPlayer, AbstractAudioDriver, \ MediaThread, MediaEvent import pyglet _debug = pyglet.options['debug_media'] class SilentAudioPacket(object): def __in...
helpers.py
"""Supporting functions for polydata and grid objects.""" import collections.abc import enum import logging import signal import sys import warnings from threading import Thread import threading import traceback import numpy as np import scooby import vtk import vtk.util.numpy_support as nps import pyvista from .fil...
NotificationEngine.py
import requests import consulate import json as json import smtplib import string import sys import settings import plugins import utilities from multiprocessing import Process class NotificationEngine(object): """ NotificationEngine, routes given ConsulHealthNodeStruct objects using the plugins availabl...
synctex-katarakt-vim.py
#!/usr/bin/env python3 # Dependencies (Debian/Ubuntu package names): # # python3-gi # python3-dbus # # Thorsten Wißmann, 2015 # in case of bugs, contact: edu _at_ thorsten-wissmann _dot_ de def print_help(): print("""Usage: {0} SESSIONNAME [PDFFILE] A katarakt wrapper for synctex communication between ...
base_worker.py
#!/usr/bin/python # # Copyright 2018-2022 Polyaxon, 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 ...
Demo_Matplotlib_Animated_FuncAnimation.py
import PySimpleGUI as sg import matplotlib.pyplot as plt from matplotlib import style import matplotlib.animation as animation from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg from random import randint import time import threading # Usage of MatPlotLib with matplotlib.animation for better performance ...
cbluepy.py
import logging import re from threading import Thread, Event from bluepy import btle from pylgbst.comms import Connection from pylgbst.utilities import str2hex, queue log = logging.getLogger('comms-bluepy') COMPLETE_LOCAL_NAME_ADTYPE = 9 PROPAGATE_DISPATCHER_EXCEPTION = False def _get_iface_number(controller): ...
numpy_weights_verbose.py
#Contiguity using apply_async import pysal as ps from collections import defaultdict import multiprocessing as mp import time import sys import ctypes import numpy as np from numpy.random import randint def check_contiguity(checks,lock,weight_type='ROOK'): cid = mp.current_process()._name geoms = np.frombuf...
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...
trainer_tf.py
# -*- coding: utf-8 -*- """ Copyright ©2017. The Regents of the University of California (Regents). All Rights Reserved. Permission to use, copy, modify, and distribute this software and its documentation for educational, research, and not-for-profit purposes, without fee and without a signed licensing agreement, is he...
__main__.py
#!/usr/bin/env python3 import sys import os import connexion import asyncio from openapi_server import encoder sys.path.append(os.path.dirname(__file__) + "/../../") from common.settings import CONFIG_PATH from common.settings import MAX_RUNNING_PIPELINES from modules.PipelineManager import PipelineManager from modul...
ThreadedImageGrabber.py
import threading import cv2 import numpy as np class ThreadedImageGrabber: stopped: bool = False __thread: threading.Thread __frame: np.ndarray def __init__(self, src): self.stream = cv2.VideoCapture(src) (self.grabbed, self.__frame) = self.stream.read() def start(self) -> 'Thre...
deskunity.py
"""" DeskUnity 1.0 Starter Class """ import logging import threading from gui import GUI from core.interface import Interface from core.computer import Computer logging.basicConfig( level=logging.DEBUG, format='[%(levelname)s] %(message)s' ) class DeskUnity: this_computer = None app = None ...
guiserv2.py
# guiserv2.py # # Another example of integrating Curio with the Tkinter # event loop using UniversalQueue and threads. import tkinter as tk import threading from curio import * class EchoApp(object): def __init__(self): self.gui_ops = UniversalQueue(withfd=True) self.coro_ops = UniversalQueue() ...
test_networking.py
import contextlib import enum import itertools import json import logging import subprocess import threading import time import uuid from collections import deque import pytest import requests import retrying import test_helpers from dcos_test_utils import marathon from dcos_test_utils.helpers import assert_respons...
identifyingThreads.py
import threading import time def myThread(): print("Thread {} starting".format(threading.currentThread().getName())) time.sleep(10) print("Thread {} ending".format(threading.currentThread().getName())) for i in range(4): threadName = "Thread-" + str(i) thread = threading.Thread(name=threadName, target=myTh...
fanCtrl.server.py
import sys, getopt, serial import threading import time import os import os.path lines = -2 lastRecivedLine = "" logEnabled = False logFile = "" lockFile = "/tmp/fanController.lock" def createRunLock(): outputFileHandler = open(lockFile,"a") outputFileHandler.write("lock\r\n") outputFileHandler.close()...
__init__.py
# -*- coding: utf-8 -*- # # 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 ...
notebookapp.py
"""A tornado based Jupyter notebook server.""" # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import notebook import asyncio import binascii import datetime import errno import functools import gettext import hashlib import hmac import importlib import io import i...
utils.py
import datetime import getpass import subprocess import sys import threading import time from typing import List import azure.batch.models as batch_models from aztk import error, utils from aztk.models import ClusterConfiguration from aztk.spark import models from aztk.spark.models import ApplicationState, JobState f...
test_lib.py
#!/usr/bin/env python """A library for tests.""" from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals import datetime import doctest import email import functools import itertools import logging import os import shutil import threading import time import unitt...
reconscan.py
#!/usr/bin/env python ############################################################################################################### ## [Title]: reconscan.py -- a recon/enumeration script ## [Author]: Mike Czumak (T_v3rn1x) -- @SecuritySift ## [Updates]: Reward1 ##-----------------------------------------------------...
client.py
# -*- coding: utf-8 -*- ################################################################################ # Copyright (c) 2017 McAfee Inc. - All Rights Reserved. ################################################################################ import threading import logging import ssl import traceback import ran...
worker.py
from __future__ import unicode_literals import fnmatch import logging import multiprocessing import signal import sys import threading import time from .exceptions import ChannelSocketException, ConsumeLater, DenyConnection from .message import Message from .signals import consumer_finished, consumer_started, worker_...
code.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 1/8/2020 3:41 PM # @Author : yonnsongLee@163.com # @Site : # @File : app.py # @Software: PyCharm import array import sys import time import serial import serial.tools.list_ports import threading import pyqtgraph as pg from tkinter import * from openpy...
publisher.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...
app.py
# encoding: utf-8 ''' A REST API for Salt =================== .. versionadded:: 2014.7.0 .. py:currentmodule:: salt.netapi.rest_cherrypy.app :depends: - CherryPy Python module (strongly recommend 3.2.x versions due to an as yet unknown SSL error). - salt-api package :optdepends: - ws4p...
data_loader.py
from multiprocessing import Process, SimpleQueue, Value import time import random import numpy as np __all__ = ["DataLoader"] class StopGenerator: def __init__(self, pid=None): self.pid = pid def default_collate(batch): if not batch or not isinstance(batch, list): return batch if isins...
__init__.py
import os import re import subprocess import sys import time from threading import Thread, Event import psutil import streamlink import youtube_dl from common import logger from common.timer import Timer class DownloadBase: url_list = None def __init__(self, fname, url, suffix=None): ...
sf_demo.py
import socket from socket import * from threading import Thread from pyftpdlib.authorizers import DummyAuthorizer from pyftpdlib.handlers import FTPHandler from pyftpdlib.servers import FTPServer import random import argparse import os import time from loguru import logger import cv2 import torch from yolox.data.data_a...
installwizard.py
# -*- mode: python3 -*- import os import sys import threading import traceback from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * from electroncash import Wallet, WalletStorage from electroncash.util import UserCancelled, InvalidPassword, finalization_print_error from electroncash.base...
py_utils.py
# Lint as: python2, python3 # -*- coding: utf-8 -*- # 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...
test.py
import logging import random import string import time import threading import os import pytest from helpers.cluster import ClickHouseCluster, get_instances_dir # By default the exceptions that was throwed in threads will be ignored # (they will not mark the test as failed, only printed to stderr). # # Wrap thrading...
async.py
def run_async(func): """ CODE FROM: http://code.activestate.com/recipes/576684-simple-threading-decorator/ run_async(func) function decorator, intended to make "func" run in a separate thread (asynchronously). Returns the created Thread object E.g.: @run_async ...
tunnel.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
drEngine.py
# encoding: UTF-8 ''' 本文件中实现了行情数据记录引擎,用于汇总TICK数据,并生成K线插入数据库。 使用DR_setting.json来配置需要收集的合约,以及主力合约代码。 ''' import json import os import copy from collections import OrderedDict from datetime import datetime, timedelta from Queue import Queue from threading import Thread from eventEngine import * from vtGateway import V...
ex2_nolock.py
import multiprocessing # python -m timeit -s "import ex2_nolock" "ex2_nolock.run_workers()" # 12ms def work(value, max_count): for n in range(max_count): value.value += 1 def run_workers(): NBR_PROCESSES = 4 MAX_COUNT_PER_PROCESS = 1000 total_expected_count = NBR_PROCESSES * MAX_COUNT_PER_PR...
PreHandler.py
import json import time import threading import os # from Ipc import Ipc from lib import Ipc class PreHandler: def __init__(self): self.end_thread = False self.redis = Ipc(name='XCP') self.redis_publisher = None self.redis_dict_raw = dict() self.redis_dict = dict() ...
generic_pipe.py
import collections import copy import hashlib import itertools import multiprocessing import os import random import sys import threading import time import unittest from buffered_pipe import Generic_Pipe as Pipe Testing_Types = "LO" if len(sys.argv) > 1: try: Testing_Types = sys.argv[1] except: ...
lichess_bot.py
import argparse import chess from chess.variant import find_variant import chess.polyglot import engine_wrapper import model import json import lichess import logging import multiprocessing import traceback import logging_pool import signal import sys import time import backoff import threading from config import load_...
test.py
import threading import os import time import wallet_random import requests import json from bit import Key from bit.format import bytes_to_wif import traceback maxPage = pow(2,256) / 128 #maxPage = 904625697166532776746648320380374280100293470930272690489102837043110636675 def getRandPage(): return...
service.py
# Copyright (c) 2010-2013 OpenStack, 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 ...
config_server.py
import BaseHTTPServer, SimpleHTTPServer import ssl import patch_hosts import threading BLOG_URL = "README.md" class ConfigHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): def do_GET(self): if self.path.strip() == "/sync.conf": SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self) ...
entities.py
import os import game import config import pygame import threading import pypboy.data from random import choice class Map(game.Entity): _mapper = None _transposed = None _size = 0 _fetching = None _map_surface = None _loading_size = 0 _render_rect = None def __init__(self, width, render_rect=None, *args, *...
WebGLExport.py
from __main__ import vtk, qt, ctk, slicer import sys import os import shutil import time import uuid import webbrowser useWebserver = True try: # webserver support for easy display of local WebGL content # on Windows it might not work, so catch any exceptions import socket import SimpleHTTPServer import So...
ui-tests.py
from selenium import webdriver from selenium.common.exceptions import TimeoutException from webdriver_manager.chrome import ChromeDriverManager def wait_for(driver, xpath): from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium...
applicationv2.py
import tkinter from tkinter import * import matplotlib.pyplot as plt import cvlib as cv from cvlib.object_detection import draw_bbox from motorisedcameratracking import * import threading import sys import time import cv2 from PIL import Image, ImageTk import webbrowser import json def calibrate(): if not x.isRun...
dmb_graph_mp.py
""" Script for extracting an analyzing a SynGraphMCF from an oriented pairs of membranes (like a synapse) Input: - A STAR file with a list of (sub-)tomograms to process: + Density map tomogram + Segmentation tomogram - Graph input parameters Output: - A STAR file with th...
cfbridge.py
#!/usr/bin/env python """ Bridge a Crazyflie connected to a Crazyradio to a local MAVLink port Requires 'pip install cflib' As the ESB protocol works using PTX and PRX (Primary Transmitter/Reciever) modes. Thus, data is only recieved as a response to a sent packet. So, we need to constantly poll the receivers for bidi...
vsearch4web.not.slow.with.threads.but.broken.py
from flask import Flask, render_template, request, escape, session from vsearch import search4letters from DBcm import UseDatabase, ConnectionError, CredentialsError, SQLError from checker import check_logged_in from threading import Thread from time import sleep app = Flask(__name__) app.config['dbconfig'] = {'hos...
testnd.py
'''Statistical tests for NDVars Common Attributes ----------------- The following attributes are always present. For ANOVA, they are lists with the corresponding items for different effects. t/f/... : NDVar Map of the statistical parameter. p_uncorrected : NDVar Map of uncorrected p values. p : NDVar | None ...
pcan.py
""" Wrapper for PeakCAN USB device """ # # pip install python-can # https://python-can.readthedocs.io/en/2.1.0/interfaces/pcan.html # # https://www.peak-system.com/ # https://www.peak-system.com/fileadmin/media/files/pcan-basic.zip # http://www.peak-system.com/quick/BasicLinux # # https://en.wikipedia.org/wiki/CAN_bu...