source
stringlengths
3
86
python
stringlengths
75
1.04M
test_serial.py
# # DAPLink Interface Firmware # Copyright (c) 2009-2016, ARM Limited, All Rights Reserved # SPDX-License-Identifier: Apache-2.0 # # 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...
work_sources.py
#!/usr/bin/env python3 #-*- coding: iso-8859-1 -*- ################################################################################ # # This module implements an interlocked thread-safe structure for tracking # incoming work from multiple sources and allocating processing of the work. # # wss = WorkSources(number_of_so...
nntrain_fingerprint.py
import tensorflow as tf from utils.nn import linearND import math, sys, random, os from optparse import OptionParser import threading from multiprocessing import Queue, Process import numpy as np from Queue import Empty import time import h5py from itertools import chain import os project_root = os.path.dirname(os.pat...
communications.py
"""communications: communications classes and programs for librarian In addition to defining various communication classes, some functions are intended to be run as in separate standalone programs, with an appropriate "__main__" clause. See CLI_chat.py as an example. Copyright (c) 2018 by Jeff Bass. License: MIT, see...
test__xxsubinterpreters.py
from collections import namedtuple import contextlib import itertools import os import pickle import sys from textwrap import dedent import threading import time import unittest from test import support from test.support import script_helper interpreters = support.import_module('_xxsubinterpreters') ##############...
app.py
import os import io import uuid import shutil import sys import threading import time from queue import Empty, Queue import cv2 from flask import Flask, render_template, flash, send_file, request, jsonify, url_for from PIL import Image import numpy as np from u2net_test import U_2net from werkzeug.utils import secur...
Hiwin_RT605_ArmCommand_Socket_20190627192924.py
#!/usr/bin/env python3 # license removed for brevity import rospy import os import socket ##多執行序 import threading import time import sys import matplotlib as plot import HiwinRA605_socket_TCPcmd as TCP import HiwinRA605_socket_Taskcmd as Taskcmd import numpy as np from std_msgs.msg import String from ROS_Socket.srv imp...
test_issue_701.py
import asyncio import collections import logging import os import threading import time import unittest import pytest from integration_tests.env_variable_names import SLACK_SDK_TEST_CLASSIC_APP_BOT_TOKEN from integration_tests.helpers import async_test, is_not_specified from slack import RTMClient, WebClient class ...
scheduler.py
import time from multiprocessing import Process from proxypool.api import app from proxypool.getter import Getter from proxypool.tester import Tester from proxypool.setting import * from proxypool.db import RedisClient class Scheduler(): def schedule_tester(self, cycle=TESTER_CYCLE): """ 定时测试代理 ...
pre_train.py
import torch import torch.distributed as dist import torch.multiprocessing as mp import argparse, os, random from parser.data import Vocab, DataLoader, SRLDataLoader, DUM, END, CLS, NIL, DynamicDataLoader from parser.parser import Parser from parser.work import show_progress from parser.extract import LexicalMap from ...
accounts_view.py
import csv from functools import partial import json import os import threading import time from typing import List, Optional, Sequence import weakref from PyQt5.QtCore import QEvent, QItemSelectionModel, QModelIndex, pyqtSignal, QSize, Qt from PyQt5.QtGui import QPainter, QPaintEvent from PyQt5.QtWidgets import (QLab...
mem.py
" Memory profiling callbacks " import tracemalloc, threading, torch, time, pynvml from ..utils.mem import * from ..vision import * #from ..basic_train import Learner, LearnerCallback def preload_pytorch(): torch.ones((1, 1)).cuda() def gpu_mem_get_used_no_cache(): torch.cuda.empty_cache() return gpu_mem...
mtsleepD3.py
#!/usr/bin/env python import threading from time import sleep, ctime loops = [4, 2] class ThreadFunc(object): def __init__(self, func, args, name=''): self.name = name self.func = func self.args = args def __call__(self): self.func(*self.args) def loop(nloop,...
conftest.py
import logging import os import random import time import tempfile import threading from concurrent.futures.thread import ThreadPoolExecutor from datetime import datetime from math import floor from shutil import copyfile from functools import partial from botocore.exceptions import ClientError import pytest from coll...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
widget.py
import base64 import json import logging import threading import time import uuid import ipywidgets as widgets import ipywidgets.embed import numpy as np from IPython.display import display from ipywidgets import (Image, Box, DOMWidget, HBox, VBox, IntSlider, Output, Play, Widget, jslink) from ...
mtsleepD.py
import threading from time import sleep, ctime loops = [4, 2] class ThreadFunc(object): def __init__(self, func, args, name=''): print(name) self.name = name self.func = func self.args = args def __call__(self): self.func(*self.args) def loop(nloop, nesc): print("start loop", nloop, 'at:', ctime()) s...
tkXianYu.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ __author__ = 'AJay' __mtime__ = '2019/4/15 0015' """ # ! /usr/bin/env python # -*- coding: utf-8 -*- import re import time import threading from datetime import datetime import tkinter as tk import os from multiprocessing import Process from dingding import DingMsg fro...
multiple_instances.py
#!/usr/bin/env python from __future__ import print_function from random import choice from vizdoom import * # For multiplayer game use process (ZDoom's multiplayer sync mechanism prevents threads to work as expected). from multiprocessing import Process # For singleplayer games threads can also be used. # from threa...
data_utils.py
""" Miscellaneous functions manage data. Date: September 2018 Author: Ignacio Heredia Email: iheredia@ifca.unican.es Github: ignacioheredia """ import os import threading from multiprocessing import Pool import queue import subprocess import warnings import base64 import numpy as np import requests from tqdm import ...
test_subprocess.py
import unittest from unittest import mock from test import support from test.support import import_helper from test.support import os_helper from test.support import warnings_helper import subprocess import sys import signal import io import itertools import os import errno import tempfile import time import traceback ...
fast_solver_utils.py
import gauss import log import tools import numpy as np import functools import operator from multiprocessing import SimpleQueue, Process __all__ = ['solve'] def func(i, obj, b_i, A, q): if obj.U.shape[0] > obj.U.shape[1]: q_i, tmpU = tools.ql(obj.get_U()) n_i = tmpU.shape[1] new_U =...
test_models.py
import fcntl from multiprocessing import Process from pathlib import Path import shutil import mock from django.core import mail from django.utils.encoding import force_bytes, force_text from django_celery_beat.models import PeriodicTask from mayan.apps.common.serialization import yaml_dump from mayan.apps.document...
main.py
from Tkinter import * from threading import Thread from record import record_to_file from features import mfcc from anntester_single import * import scipy.io.wavfile as wav class Application(Frame): def createWidgets(self): self.button_image = PhotoImage(file="button.gif") self.RECORD = Button(sel...
rocket.py
# -*- coding: utf-8 -*- # This file is part of the Rocket Web Server # Copyright (c) 2011 Timothy Farrell # Modified by Massimo Di Pierro # Import System Modules import sys import errno import socket import logging import platform # Define Constants VERSION = '1.2.6' SERVER_NAME = socket.gethostname() SERVER_SOFTWAR...
demo.py
import multiprocessing import time import numpy as np import redis from tests import common from tests.common import * ack_client = AckClient() master_client = MasterClient() head_client = GetHeadFromMaster(master_client) act_pubsub = None # Put() ops can be ignored when failures occur on the servers. Try a few ti...
scheduler_job.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 #...
init.py
""" Application specific code. """ import logging import threading from sen.exceptions import NotifyError from sen.tui.commands.base import Commander, SameThreadPriority from sen.tui.commands.display import DisplayListingCommand from sen.tui.ui import get_app_in_loop from sen.tui.constants import PALLETE from sen.doc...
_threads.py
import threading import queue as stdlib_queue from itertools import count import attr import outcome import trio from ._sync import CapacityLimiter from ._core import enable_ki_protection, disable_ki_protection, RunVar, TrioToken # Global due to Threading API, thread local storage for trio token TOKEN_LOCAL = threa...
detection.py
import cv2 import numpy as np import matplotlib.path as mplPath import time from datetime import datetime import os import threading import requests # --------------------- GLOBAL --------------- # poly_ne = np.array([[793,351],[920,466],[1102,420],[961,329]]) tl = (1106,100) br = (1153,203) cap = cv2.VideoCapture("te...
xtscr.py
# # Spinal Cord Recovery XTension # # Copyright (c) 2016 Keith Schulze (keith.schulze@monash.edu) # MIT-style copyright and disclaimer apply # # <CustomTools> # <Menu> # <Item name="SCR" icon="Python" tooltip="Spinal Cord Recovery"> # <Command>PythonXT::xtscr(%i)</Command> # </Item> # ...
ROXXANE4.py
from json import loads from math import pow from os import getlogin, listdir from os.path import exists from pickle import load, dump from random import randint from sys import exit import threading import webbrowser from subprocess import check_output from datetime import datetime, date # from time import sleep from t...
topology.py
import logging from threading import Thread import kibra.database as db from kitools import kiserial PRATE = 5 TIMEOUT = 240 def _get_devices(br_serial): logging.info('Looking for devices...') ncps = [] brouter = kiserial.find_devices(has_br=True, has_snum=br_serial)[0] brouter = kiserial.KiSerial(b...
server.py
#!/usr/bin/env python3 import socket import re import threading import time import select import subprocess from _thread import * print("#################") print("Welcome to SERVER") print("#################") start = time.time() end = 20 old_packet = "" start_time = 0 name = "Server" RSSI = 0 Online_Users = [] ...
bam.py
#!/usr/bin/env python # coding=utf-8 """Module Description Copyright (c) 2017 Jianfeng Li <lee_jianfeng@sjtu.edu.cn> This code is free software; you can redistribute it and/or modify it under the terms of the MIT License. @bam: Bam File Class @status: experimental @version: 0.1.0 @author: Jianfeng Li @contact: lee_jian...
common.py
"""Test the helper method for writing tests.""" import asyncio from collections import OrderedDict from datetime import timedelta import functools as ft import json import os import sys from unittest.mock import patch, MagicMock, Mock from io import StringIO import logging import threading from contextlib import contex...
download.py
#!/usr/local/bin/python3 # encoding: utf-8 """ download.py Created by Zach Schumacher on 2019-08-14. Modified by Patrick Shaner on 2019-08-14. Copyright (c) 2019 Patrick Shaner Downloads data files from S3 file to local storage Version 2019-08-14 Initial file creation Version 2019-08-14 Updated to write to...
learner.py
# Copyright 2020 DeepMind Technologies 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 required by ...
player.py
""" The MIT License (MIT) Copyright (c) 2015-2021 Rapptz Copyright (c) 2021-present Pycord Development 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 limit...
test_io.py
"""Unit tests for the io module.""" # Tests of io are scattered over the test suite: # * test_bufio - tests file buffering # * test_memoryio - tests BytesIO and StringIO # * test_fileio - tests FileIO # * test_file - tests the file interface # * test_io - tests everything else in the io module # * test_univnewlines - ...
test.py
#!/usr/bin/env python # This is free and unencumbered software released into the public domain. # # Anyone is free to copy, modify, publish, use, compile, sell, or # distribute this software, either in source code form or as a compiled # binary, for any purpose, commercial or non-commercial, and by any # means. # # In...
process_worker.py
# coding=utf-8 import multiprocessing import serial import socket import os import fuckargs # 感应到了就输出1 # 没感应到就输出0 # 串口通讯 # 频率的决定者以硬件的串口通讯频率决定 def get_serial_info( whether ): os.system( "echo %d >>pid_repo" % os.getpid() ) # store the pid while True: whether.value = ser.readline()[0] # socket server ...
spider_handlers.py
"""爬虫模型库""" import re, time, logging, uuid, pymysql from sqlalchemy import text from app.models.base import Base2 import threading import urllib.request from bs4 import BeautifulSoup logging.basicConfig(level=logging.DEBUG) __author__ = "带土" class Spider(Base2): def __init__(self): self.count = 0 ...
dynamodump.py
#!/usr/bin/env python """ Simple backup and restore script for Amazon DynamoDB using boto to work similarly to mysqldump. Suitable for DynamoDB usages of smaller data volume which do not warrant the usage of AWS Data Pipeline for backup/restores/empty. dynamodump supports local DynamoDB instances as w...
ancillary.py
from filedes.test.base import BaseFDTestCase from filedes.socket.unix import make_unix_stream_socket, connect_unix_stream_socket from filedes import FD import unittest2 import _ancillary import os import warnings import time import threading import multiprocessing class TestAncillary(BaseFDTestCase): def tempnam(...
load_db.py
import src.mongoDBI as mongoDBI import os import src.constants as constants import src.utils as utils import glob import src.parse_grb_files as parse_grb_files from multiprocessing import Process from datetime import datetime, timedelta, date # ---------------------------------------------------------------# class ...
VideoQueryProcessor.py
# -*- coding: utf-8 -*- """ Created on Sat Mar 14 16:45:29 2020 @author: ajink / manivs """ import cv2 import csv import argparse from DetectColour import DetectColour from DetectCar import DetectCar # Begin Mani from datetime import datetime import time from DetectCartype import DetectCartype from multiprocessing im...
pyminer.py
#!/usr/bin/python # # Copyright (c) 2011 The Bitcoin developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # import time import json import pprint import hashlib import struct import re import base64 import httplib import...
test_mclag.py
import csv import json import logging import re import random import sys import time import threading import Queue import ipaddr as ipaddress import pytest from ansible_host import AnsibleHost from common.devices import SonicHost from common.utilities import wait_until from natsort import natsorted from ptf_runner im...
functions.py
from math import sin from math import cos import math from tkinter import * from time import sleep import time # import sched, time import threading import GUI act = False alpha = 0 def lines_move(tk, canvas1, line1, line2, line3): global alpha x2 = 100 * sin(math.radians(alpha)) y2 = 100 * cos(math.radi...
main.py
# Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE file in the project root for # full license information. import time import os import sys import asyncio from six.moves import input import threading from azure.iot.device import IoTHubModuleClient, MethodResponse, Message fr...
yoda_vim.py
### import {{{1 import re, os, sys, threading, collections import vimpy import config_manager import snippet_manager ### compatibility of python 2 and 3 ### {{{1 if vimpy.py_version >= 3: # we must add module dir in system paths in python3. yoda_dir = os.path.join( os.path.dirname(__file__), 'yoda' ) assert os...
bangabandhu.py
from expression import * import multiprocessing def talk(): say("bangabandhu sheikh mujibur rahman is our father of nation.") say("he is the most hounarable person for our nation") p2.start() time.sleep(0.1) say("i salute him") time.sleep(1) say("i respect him from core of my heart") ti...
multiprogress.py
import time from multiprocessing import Process,Manager def subPrcess(name,d): for j in range(100): time.sleep(0.2) d['process%d'%name] = j def showmsg(d): while 1: time.sleep(1) for k in range(5): print 'Process%d:%d%%' % (k,d['process%d'%k]) if __name__ == '__main_...
playIT_client.py
#!/usr/bin/python3 """ The client controller for the playIT backend by Horv and Eda - 2013, 2014 To add a new type of playback. Add a function called _play_TYPE(media_item) and define how it's handled. It will be called automatically based on the type parameter specified in the downloaded json Requires Python >= 3.3 ...
robot_msg_push.py
from . import logger import threading class RobotMsgPush(object): """ 信息推送接收器 监听40924端口上的推送信息 若接到信息,则将不同信息处理加入对应模块的属性中 信息推送可以通过robot.[robot_module].set_push()设置 Example: # 获取机器人的底盘的位置信息推送 rm = rmepy.Robot(ip='127.0.0.1') ... rm.push.start() # 激活推送接收线程 ...
dimmer.py
import threading import time import logging class Dimmer(object): def __init__(self, screen_manager, keyboard_manager, dim_after, off_after, pass_through_buttons): self._dim_after = dim_after self._off_after = off_after self._smgr = screen_manager self._pass_through_buttons = pass_...
monobeast.py
# Copyright (c) Facebook, Inc. 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.0 # # Unless required by applicable law or ...
parallel.py
import os import sys from collections import OrderedDict, deque from threading import Event, Semaphore, Thread from tox import reporter from tox.config.parallel import ENV_VAR_KEY as PARALLEL_ENV_VAR_KEY from tox.exception import InvocationError from tox.util.main import MAIN_FILE from tox.util.spinner import Spinner ...
Core.py
from src.core.service.Mongo import Mongo from src.core.service.Configuration import Configuration from src.core.clone.Collection import Collection from src.core.clone.BasicCollectionPart import BasicCollectionPart from src.core.clone.OplogCollectionPart import OplogCollectionPart import multiprocessing as mp from queu...
watcher.py
import logging import re import threading from html import escape from pathlib import Path from time import time, sleep from typing import List from filelock import FileLock # type: ignore from antarest.core.config import Config from antarest.core.utils.fastapi_sqlalchemy import db from antarest.login.model import G...
tcp.py
import logging log = logging.getLogger(__name__) import asyncio from functools import partial import json from threading import Thread import websockets async def handle_connection(video, websocket): # The response is a two-tuple of error, result. If error is not None, # result should be discarded by client...
main.py
# https://github.com/palantir/python-jsonrpc-server/blob/develop/examples/langserver_ext.py import json import logging import subprocess import threading from tornado import ioloop, process, web, websocket from pyls_jsonrpc import streams log = logging.getLogger(__name__) class LanguageServerWebSocketHandler(webso...
utils.py
from bitcoin.core import COIN # type: ignore from bitcoin.rpc import RawProxy as BitcoinProxy # type: ignore from bitcoin.rpc import JSONRPCError from contextlib import contextmanager from pathlib import Path from pyln.client import RpcError from pyln.testing.btcproxy import BitcoinRpcProxy from collections import Or...
test_cuda.py
from itertools import repeat, chain, product from typing import NamedTuple import collections import contextlib import ctypes import gc import io import pickle import queue import sys import tempfile import threading import unittest import torch import torch.cuda import torch.cuda.comm as comm from torch.nn.parallel i...
example_binance_jex.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # File: example_binance_jex.py # # Part of ‘UNICORN Binance WebSocket API’ # Project website: https://www.lucit.tech/unicorn-binance-websocket-api.html # Github: https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api # Documentation: https://unico...
bank_account_test.py
import sys import threading import time import unittest from bank_account import BankAccount class BankAccountTest(unittest.TestCase): def setUp(self): self.account = BankAccount() def test_newly_opened_account_has_zero_balance(self): self.account.open() self.assertEqual(self.accoun...
tree-orders.py
import sys, threading class TreeOrders: def read(self): self.n = int(sys.stdin.readline()) self.key = [0 for i in range(self.n)] self.left = [0 for i in range(self.n)] self.right = [0 for i in range(self.n)] for i in range(self.n): [a, b, c] = map(int, sys.stdin.readline().split()) se...
acl_compressor.py
import multiprocessing import numpy import os import platform import queue import threading import time import signal import sys # This script depends on a SJSON parsing package: # https://pypi.python.org/pypi/SJSON/1.1.0 # https://shelter13.net/projects/SJSON/ # https://bitbucket.org/Anteru/sjson/src import sjson d...
test_backend.py
import base64 import copy import datetime import threading import time import unittest from datetime import timedelta from unittest.mock import Mock, patch from django import VERSION from django.conf import settings from django.contrib.sessions.backends.cache import SessionStore as CacheSession from django.core.cache ...
autopwn.py
#!/usr/bin/python3 #coding: utf-8 #---------------------------------------------------------- #Made by: WizzzStark #Remember to change your attacker IP in request function. #----------------------------------------------------------- import requests import pdb import threading import signal import sys import time im...
mqtt_ws_example_test.py
from __future__ import print_function from __future__ import unicode_literals from builtins import str import re import os import sys import paho.mqtt.client as mqtt from threading import Thread, Event try: import IDF except Exception: # this is a test case write with tiny-test-fw. # to run test cases out...
mbl_gui_window.py
import time from PyQt5.QtCore import QTimer, pyqtSignal from PyQt5.QtGui import QPixmap, QFont from PyQt5.QtWidgets import QMainWindow, QDialog, QApplication, QLabel from lsl.mbl_lsl_receiver import MBL_LSLReceiver from visuals.gui import Ui_MainWindow from threading import Thread class MBL_GuiWindow(QMainWindow): ...
chrome_driver_manage_benchmark.py
# coding=utf-8 from threading import Thread, Semaphore from collections import deque from selenium.webdriver import Chrome, ChromeOptions from benchmarks.utils import log_time TEST_URL = 'https://www.baidu.com/' def make_chrome_options(): chrome_options = ChromeOptions() chrome_options.add_argument('--hea...
symbols.py
import os import sys import praw import spacy nlp = spacy.load('en_core_web_sm',disable=['ner','textcat']) import nltk from nltk.tokenize import word_tokenize import glob import pandas as pd import re from datetime import datetime import threading dev_mode = False def fix_path(name): if dev_mode == True: retur...
pat.py
import re import subprocess import threading import time # from time import time from config import * from utils import * def pat(test_data_in, class_path, jar, prt=False): inputfile = open(test_data_in).readlines() # print("@@@", test_data_in) basetime, maxtime = datacheck(test_data_in) # input = pa...
app.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """provide a webfrontend to set 12V LED light strips""" ################################################################################ # MIT License # # Copyright (c) 2017 Stefan Venz # # Permission is hereby granted, free of charge, to any person obtaining a copy # of ...
test_spawn.py
from __future__ import absolute_import from billiard import get_context class test_spawn: def test_start(self): ctx = get_context('spawn') p = ctx.Process(target=task_from_process, args=('opa',)) p.start() p.join() return p.exitcode def task_from_process(name): print(...
run_rl.py
from __future__ import print_function, division import os os.environ["OMP_NUM_THREADS"] = "1" import argparse import torch import torch.multiprocessing as mp from rl.environment import atari_env from baselines.sam.utils import read_config from baselines.sam.a3c import A3CSAM from rl.train_sam import train from rl.test_...
python0811_threadLocal.py
# -*- coding: utf-8 -*- global_dict = {} def std_thread(name): std = Student(name) # 把std放到全局变量global_dict中: global_dict[threading.current_thread()] = std do_task_1() do_task_2() def do_task_1(): # 不传入std,而是根据当前线程查找: std = global_dict[threading.current_thread()] def do_task_2(): ...
index.py
# -*- coding: utf8 -*- import time from threading import Thread from activity.unicom.dailySign import SigninApp from activity.unicom.integralTask import IntegralTask from activity.unicom.watchAddFlow import WatchAddFlow from activity.unicom.superSimpleTask import SuperSimpleTask from activity.unicom.unicomTurnCard impo...
TimingStability.py
""" Analyzes Lauecollect logfiles and generates a chart of the history of the timing error. Author: Friedrich Schotte, NIH, 7 Jun 2010 - 4 Feb 2017 """ from numpy import * import wx from logging import debug,info,warn,error __version__ = "2.5" # separate timing logfile class TimingStabilityChart (wx.Frame): def _...
heartbeat.py
import time import requests import json from threading import Thread from metaflow.sidecar_messages import MessageTypes, Message from metaflow.metaflow_config import METADATA_SERVICE_HEADERS from metaflow.exception import MetaflowException HB_URL_KEY = 'hb_url' class HeartBeatException(MetaflowException): headl...
elevador.py
#!/usr/bin/python3 from threading import Semaphore, Thread from time import sleep from random import random, choice from termcolor import cprint, colored freq_elev = 1 # Frecuencia (en segundos) de avance del elevador) freq_alum = 0.1 # Frecuencia (en segundos) de llegada de un nuevo alumno de...
caching.py
""" CherryPy implements a simple caching system as a pluggable Tool. This tool tries to be an (in-process) HTTP/1.1-compliant cache. It's not quite there yet, but it's probably good enough for most sites. In general, GET responses are cached (along with selecting headers) and, if another request arrives for the same r...
utils.py
import asyncio from asyncio import TimeoutError import atexit import click from collections import deque, OrderedDict, UserDict from concurrent.futures import ThreadPoolExecutor, CancelledError # noqa: F401 from contextlib import contextmanager, suppress import functools from hashlib import md5 import html import json...
test_sql_lock.py
import pytest import time import threading from memsql.common import database from memsql.common import sql_lock from memsql.common import exceptions @pytest.fixture(scope="module") def manager_setup(request, test_db_args, test_db_database): with database.connect(**test_db_args) as conn: conn.execute('CREA...
__init__.py
__author__ = "Johannes Köster" __copyright__ = "Copyright 2022, Johannes Köster" __email__ = "johannes.koester@uni-due.de" __license__ = "MIT" import os import sys import contextlib import time import datetime import json import textwrap import stat import shutil import shlex import threading import concurrent.futures...
vnhuobi.py
# encoding: utf-8 import sys import json import zlib import urllib import urllib.parse import hmac import base64 import hashlib import requests import traceback from copy import copy from datetime import datetime from threading import Thread from queue import Queue, Empty from multiprocessing.dummy import Pool from t...
helpers.py
""" This file contains various helpers and basic variables for the test suite. Defining them here rather than in conftest.py avoids issues with circular imports between test/conftest.py and test/backend/<backend>/conftest.py files. """ import functools import logging import multiprocessing import os import subprocess...
test_local.py
# Copyright 1999-2021 Alibaba Group Holding Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
zmqRouter.py
import zmq from threading import Thread import json import argparse import os from zmqtest.asyncsrv import tprint CONFIG_ERROR="Config file error. " def generateDefaultConfig(configPath): """ 如果没有router.json的配置文件的话就生成默认zmq代理模块的配置 :param configPath: :return: """ routerConfig = {} rou...
safe_t.py
from binascii import hexlify, unhexlify import traceback import sys from typing import NamedTuple, Any, Optional, Dict, Union, List, Tuple, TYPE_CHECKING from electrum.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException from electrum.bip32 import BIP32Node from electrum import constants from electr...
TCPsocket.py
AF_INET = 2 SOCK_STREAM = 1 RECEIVED_BUFFER_SIZE = 1048576 # todo discuss the buffer size, currently 1GMb import os import random import threading import time from pprint import pprint import IP from Exceptions import * from TCP import * buffer_list = { 'listening': {}, # when server is listening, the key of th...
geoparser.py
# Getting GEO information from Nginx access.log by IP's. # Alexey Nizhegolenko 2018 # Parts added by Remko Lodder, 2019. # Added: IPv6 matching, make query based on geoip2 instead of # geoip, which is going away r.s.n. import os import re import sys import time import geohash import logging import logging.handlers imp...
signaler.py
#!/usr/bin/env python # encoding: utf-8 import Queue import threading import time import zmq from api import SIGNALS from certificates import get_frontend_certificates from utils import get_log_handler logger = get_log_handler(__name__) class Signaler(object): """ Signaler client. Receives signals from ...
eyeguard.py
import schedule import time import threading from playsound import playsound import sys minutes=20 seconds=20 if len(sys.argv)==3: if int(sys.argv[2])>seconds: seconds=int(sys.argv[2]) if int(sys.argv[1])>2: minutes=int(sys.argv[1]) else: minutes=2 elif len(sys.argv)==2: if int(sys.argv[1])>2: minutes=in...
test_mongoexp.py
import six.moves.cPickle as pickle import os import signal import subprocess import sys import traceback import threading import time import unittest import numpy as np import nose import nose.plugins.skip from hyperopt.base import JOB_STATE_DONE, STATUS_OK from hyperopt.mongoexp import parse_url from hyperopt.mongoe...
京东.py
# coding:utf-8 from __future__ import absolute_import try: from .SDK基类 import Base except ImportError: from SDK基类 import Base from time import time,sleep from threading import Thread import json import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np from io import BytesIO fr...
test_bugs.py
# -*- coding: utf-8 -*- # Copyright (c) 2009, 2020, Oracle and/or its affiliates. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2.0, as # published by the Free Software Foundation. # # This program is also distributed with certa...