source
stringlengths
3
86
python
stringlengths
75
1.04M
message_bus.py
#! /usr/bin/env python3 # _*_coding:utf-8 -*_ from queue import Queue, Empty from threading import * def singleton(cls): _instance = {} def _singleton(*args, **kargs): if cls not in _instance: _instance[cls] = cls(*args, **kargs) return _instance[cls] return _singleton @sin...
base.py
"""A library to store common functions and protocol definitions""" from __future__ import absolute_import from __future__ import print_function from __future__ import with_statement import inspect from hashlib import (sha256, sha384) from itertools import chain from logging import (getLogger, DEBUG) from ...
test_responder.py
import time import pytest import random from uuid import uuid4 from queue import Queue from copy import deepcopy from threading import Thread from teos.gatekeeper import UserInfo, Gatekeeper as RealGatekeeper from teos.responder import Responder, TransactionTracker, CONFIRMATIONS_BEFORE_RETRY from common.constants im...
installwizard.py
import os import sys import threading import traceback from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * from electrum_ltc import Wallet, WalletStorage from electrum_ltc.util import UserCancelled, InvalidPassword from electrum_ltc.base_wizard import BaseWizard, HWD_SETUP_DECRYPT_WALL...
movo_pan_tilt.py
"""-------------------------------------------------------------------- Copyright (c) 2017, Kinova Robotics inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code mus...
iterators.py
"""Various helpful iterators""" from queue import Queue, Empty from threading import Thread class IteratorWithAggregation: """ An iterable over an iterable which also makes an aggregate of the values available asap It iterates over the iterable in a separate thread. A use case is a generator which ...
main.py
"""main.py: Base.""" __author__ = "Muhammad Umer Farooq" __license__ = "MIT" __version__ = "1.0.0" __maintainer__ = "Muhammad Umer Farooq" __email__ = "contact@muhammadumerfarooq.me" __status__ = "Production" from .__config import get_config import os import threading from queue import Queue from .helper import * from...
addon.py
# Author: Jakub Zalas # License: MIT https://opensource.org/licenses/MIT import sys,os sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'resources', 'lib')) from urlparse import parse_qsl from tvseriesonlinepl import list from threading import Thread import urllib import xbmcgui import xbmcplugin import urlr...
power_monitoring.py
import random import threading import time from statistics import mean from cereal import log from common.params import Params, put_nonblocking from common.realtime import sec_since_boot from selfdrive.hardware import HARDWARE from selfdrive.swaglog import cloudlog PANDA_OUTPUT_VOLTAGE = 5.28 CAR_VOLTAGE_LOW_PASS_K =...
utils.py
import math import pickle import random import threading from collections import namedtuple from enum import Enum import numpy as np import torch Transition = namedtuple( 'Transition', ('state', 'action', 'reward', 'state_next', 'done') ) PPO_Transition = namedtuple( 'Transition', ('state', 'action', 'reward'...
util.py
#!/usr/bin/env python # encoding: utf-8 """Common utilities.""" from contextlib import contextmanager from shutil import rmtree from six.moves.queue import Queue from tempfile import mkstemp from threading import Thread import logging as lg import os import os.path as osp _logger = lg.getLogger(__name__) class Hd...
CntlrWinMain.py
''' Created on Oct 3, 2010 This module is Arelle's controller in windowing interactive UI mode @author: Mark V Systems Limited (c) Copyright 2010 Mark V Systems Limited, All rights reserved. ''' from arelle import PythonUtil # define 2.x or 3.x string types import os, sys, subprocess, pickle, time, locale, re, fnmatc...
ars.py
# AI 2018 import os import inspect currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) parentdir = os.path.dirname(os.path.dirname(currentdir)) os.sys.path.insert(0, parentdir) # Importing the libraries import os import numpy as np import gym from gym import wrappers import pybullet...
main.py
""" This is the main file that runs the OpenEEW code package """ # import modules import time import pickle from threading import Thread from params import tt_params, det_params, ev_params from src import ( data_holders, receive_traces, receive_devices, detection, event, travel_time, ) __auth...
test_failure.py
import json import logging import os import sys import tempfile import threading import time import numpy as np import pytest import redis import ray import ray.ray_constants as ray_constants from ray.cluster_utils import Cluster from ray.test_utils import ( relevant_errors, wait_for_condition, wait_for_e...
mysos_scheduler.py
import os import tempfile from mysos.common import pkgutil, zookeeper from .http import MysosServer from .scheduler import MysosScheduler from .state import LocalStateProvider, Scheduler, StateProvider from .zk_state import ZooKeeperStateProvider from kazoo.client import KazooClient import mesos.interface from meso...
mainwindow.py
"""The Qt MainWindow for the QtConsole This is a tabbed pseudo-terminal of IPython sessions, with a menu bar for common actions. Authors: * Evan Patterson * Min RK * Erik Tollerud * Fernando Perez * Bussonnier Matthias * Thomas Kluyver * Paul Ivanov """ #------------------------------------------------------------...
MaBoSS_specific_Linux.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on November 24 2017 @author: Jonas BÉAL jonas.beal@curie.fr """ #%% Imports #This script is an old version. Should be replaced by MaBoSS_specific.py, both for Mac and Linux users. # Imports and tests import sys import os import re import argparse import pand...
VMPropertiesCollector.py
from BaseCollector import BaseCollector from tools.Resources import Resources from threading import Thread import os class VMPropertiesCollector(BaseCollector): def __init__(self): super().__init__() self.wait_for_inventory_data() self.name = self.__class__.__name__ self.vrops_ent...
dbapi.py
# pysqlite2/test/dbapi.py: tests for DB-API compliance # # Copyright (C) 2004-2010 Gerhard Häring <gh@ghaering.de> # # This file is part of pysqlite. # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages # arising from the use of t...
test_functools.py
import abc import collections import copy from itertools import permutations import pickle from random import choice import sys from test import support import unittest from weakref import proxy import contextlib try: import threading except ImportError: threading = None import functools py_functools = suppor...
android_ctrl_bar.py
# # Android control bar # import configparser import re import subprocess import threading from datetime import datetime import PySimpleGUI as sg from version import __version__ EXEC_ADB_DEFAULT = str('adb.exe') mExecAdbPath = EXEC_ADB_DEFAULT mExecAdbPathVerified = bool(False) EXEC_FASTBOOT_DEFAULT = str('fastboot....
ThreadPool.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Run multiple threads at once # # Copyright (c) Honda Research Institute Europe GmbH # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # 1. Redistributions of sou...
test_arrow_eager.py
# Copyright 2017 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 applic...
proxy.py
from log import log from subprocess import PIPE, Popen from threading import Thread from queue import Queue, Empty import sys engine = "C:\\git\\kaissa64\\engines\\" + sys.argv[1] depth = sys.argv[2] cmd = [ engine ] def inProcess(stdin, queue): while True: msg = queue.get() # Hacking Arena...
main.py
#!./venv/bin/python3 # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
loaders_pool.py
from sources.loader import Loader from threading import Thread from time import sleep class LoadersPool: actualize_period_seconds = 1 def __init__(self): self._loaders_paths = dict() self._loaders = set() self._loaders_actualize_thread = Thread(target=self._actualize, daemon=True) ...
UdpComms.py
# Created by Youssef Elashry to allow two-way communication between Python3 and Unity to send and receive strings # Feel free to use this in your individual or commercial projects BUT make sure to reference me as: Two-way communication between Python 3 and Unity (C#) - Y. T. Elashry # It would be appreciated if you se...
main.py
#imports from re import sub import utils import cv2 import numpy as np import contours as ct import threading #import menu # Using display instead of menu. import display import chess_manager as chess import insults import time from dataclasses import dataclass #Colors lower_blue = np.array([100,128,0]) upper_blue = ...
one_plus_one_torch.py
# /****************************************** # *MIT License # * # *Copyright (c) [2021] [Eleonora D'Arnese, Emanuele Del Sozzo, Davide Conficconi, Marco Domenico Santambrogio] # * # *Permission is hereby granted, free of charge, to any person obtaining a copy # *of this software and associated documentation files (th...
main.py
import argparse import os import sys import gym import torch import torch.optim as optim import torch.multiprocessing as mp import torch.nn as nn import torch.nn.functional as F from model import Model, Shared_grad_buffers, Shared_obs_stats from train import train from test import test from chief import chief from ut...
data_import.py
from flask import Blueprint, jsonify, request, send_file, session, Response from tsx.util import next_path, local_iso_datetime from tsx.api.util import db_session, get_user, get_roles from tsx.api.upload import get_upload_path, get_upload_name from tsx.importer import Importer from tsx.config import data_dir from tsx.d...
__init__.py
#!/usr/bin/env python3 """Library for performing speech recognition, with support for several engines and APIs, online and offline.""" import io import os import sys import subprocess import wave import aifc import math import audioop import collections import json import base64 import threading import platform impor...
emails.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # emails.py - 2021/11/4 # from threading import Thread from flask import current_app, url_for from flask_mail import Message from blog.extensions import mail def _send_async_mail(app, message): with app.app_context(): mail.send(message) # noinspection PyUn...
bruno.py
import argparse import os import queue import threading import time import coloredlogs import cv2 as cv import numpy as np import tensorflow as tf from datasources import Video, Webcam from models import ELG import util.gaze if __name__ == '__main__': # args parser = argparse.ArgumentParse...
app.py
import os ## # REDIS SETUP from redis import Redis rediscli = Redis(host=os.environ['REDIS_HOST'], port=os.environ['REDIS_PORT'], password=os.environ['REDIS_PASSWORD']) ## # LOGGING SETUP import json import re from logging import StreamHandler class MyLogHandler(StreamHandler): def __init__(self, filename, *args...
test_unix_events.py
"""Tests for unix_events.py.""" import contextlib import errno import io import os import pathlib import signal import socket import stat import sys import tempfile import threading import unittest from unittest import mock from test.support import os_helper from test.support import socket_helper if sys.platform == '...
controlPanel.py
import nidaqmx import numpy as np import scipy.signal import matplotlib.pyplot as plt import time import compress_pickle as pickle from json import (load as jsonload, dump as jsondump) import os import PySimpleGUI as sg import threading SETTINGS_FILE = os.path.join(os.getcwd(), r'settings_file.cfg') #os.path.dirname(...
net04_global_variables.py
"""进程间不共享全局变量""" ''' @Time : 2018/1/22 下午4:32 @Author : scrappy_zhang @File : net04_global_variables.py ''' import multiprocessing import time global_num = 0 def sing(): global global_num print('开始:全局变量sing global_num= ', global_num) for i in range(5): print('正在唱歌呢 %d' % i) global_...
views.py
import logging import threading import time import re from collections import defaultdict from typing import Optional, Union from utils.response import status_response from django.db.utils import IntegrityError from utils.data_verification import as_model, data_parse import simplejson as json import yaml from django....
frontend.py
from __future__ import absolute_import, unicode_literals from threading import Thread import traceback import logging import pykka from mopidy import core from .readnfctag import ReadTag logger = logging.getLogger(__name__) __logprefix__ = 'NFCread: ' class NFCread(pykka.ThreadingActor, core.CoreListener): def...
client.py
import json import base64 import time import requests import threading import base64 from uuid import UUID from os import urandom from time import timezone, sleep from typing import BinaryIO, Union from binascii import hexlify from time import time as timestamp from locale import getdefaultlocale as locale from .lib....
sqlite.py
import os import json import sqlite3 import datetime, time import itertools from common import util import queue import threading from threading import Thread import logging import sqlite3 import datetime, time import itertools from common import util class IDEBenchDriver: def init(self, options, schema, driver...
arduinoToPi.py
try: import serial except: print(""" To install pyserial: sudo apt-get install python3-pip sudo pip3 install pyserial This program will now hang until force-quit, to ensure you see this message. """) while True: pass import signal import datetime import fcntl import re import traceback import subproces...
client.py
# -*- coding: utf-8 -*- # @Author: TD21forever # @Date: 2019-12-07 15:08:19 # @Last Modified by: TD21forever # @Last Modified time: 2019-12-07 15:08:20 #!/usr/bin/env python3 """Script for Tkinter GUI chat client.""" from socket import AF_INET, socket, SOCK_STREAM from threading import Thread import tkinte...
Pipe_test.py
# coding: utf-8 ######################################################################### # 网站: <a href="http://www.crazyit.org">疯狂Java联盟</a> # # author yeeku.H.lee kongyeeku@163.com # # # # version 1.0 ...
steps_base.py
import json import os from os import path as osp from random import choice import re import shutil from subprocess import PIPE, Popen, check_call, check_output import time import threading import urllib2 import sys from behave import given, when, then # pylint: disable=E0611 from pyvs import helpers from pyvs.helpers...
test_InfoExtractor.py
#!/usr/bin/env python from __future__ import unicode_literals # Allow direct execution import io import os import sys import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from test.helper import FakeHDL, expect_dict, expect_value, http_server_port from haruhi_dl.compat impo...
process.py
# -*- coding:utf-8 -*- # Process Connection, Communication # 多进程通信 """ >>> 队列消息:Queue >>> 管道通信:Pipe (send , recv) 两个函数 >>> """ from multiprocessing import Process, Queue import os import time import random # 写数据进程执行的代码: def write(q): print('Process to write: %s' % os.getpid()) for value in ['A', 'B', 'C']: ...
api.py
import threading import jesse.helpers as jh class API: def __init__(self): self.drivers = {} if not jh.is_live(): self.initiate_drivers() def initiate_drivers(self): for e in jh.get_config('app.considering_exchanges'): if jh.is_live(): def init...
tsproxy.py
#!/usr/bin/env python """ Copyright 2016 Google Inc. 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 applicab...
popen.py
#!/usr/bin/env python # ~ Copyright 2014 Sjoerd Cranen, Wieger Wesselink #~ Distributed under the Boost Software License, Version 1.0. #~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) import time import psutil import threading import subprocess class TimeExceededError(Exception): ...
test_error.py
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2018-2019 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the ...
get-panw-config.py
#!/usr/bin/env python3 ''' Remove nargs='*' from firewalls arg and split to make compatible with Golang calls and Comment out stdin.isatty() code block ''' '''Get firewall configuration get_panw_config.py Author: David Cruz (davidcruz72@gmail.com) Python version >= 3.6 Required Python packages: Netmiko F...
manage.py
# Copyright 2020 University of New South Wales, University of Sydney, Ingham Institute # 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 # Unle...
text4.py
#4.现有两个进程,1号进程向文件写入10个"hello" # 2号进程向文件写入10个"world",两个进程并发执行 #如何使得文件中的内容一定是 # "hellohellohellohellohello.....worldworldworld......." from multiprocessing import Process,Lock,Pool def jobs(arg): with mylock: f = open('./zz.txt','a') f.write(arg*10) f.close() if __name__ =='__main__': f...
vsphere_vcenter.py
# # Copyright (c) 2015 Nutanix Inc. All rights reserved. # # Thread-safety: this class is not thread-safe. # # Example: # # with VsphereVcenter(...) as vcenter: # datacenter = vcenter.lookup_datacenter("Foo-DC") # cluster = vcenter.lookup_cluster(datacenter, "Foo-cluster") # < do something with 'cluster' ...
downloader.py
from crawler.config import Config from concurrent.futures import ThreadPoolExecutor, wait, ALL_COMPLETED import time from crawler.url_manager import UrlManager import requests from requests.exceptions import ConnectTimeout, ReadTimeout from multiprocessing import Process, SimpleQueue, Manager from tqdm import tqdm impo...
YoutubeDLGUI.py
from tkinter import ttk from tkinter import filedialog import youtube_dl from ttkthemes import ThemedTk import tkinter as tk import threading filename = "" progress = "" def browse_button(): global folder_path global filename filename = filedialog.askdirectory() folder_path.set(filename) def threa...
receiver.py
""" The Ouch Team TCP/IP Input Receiver Use with, uh, "with" block, similar to how its used in file manipulation: >>> with receiver() as r: ... r.getBytestream() ... # insert code here With this, excess port bandwidth is not taken up, as connection cleanly closes once it is out of scope. THERE IS PROBABLY ...
bot.py
import datetime as dt import logging import os import sys from threading import Thread from dotenv import load_dotenv from logbook import Logger, StreamHandler from logbook.compat import redirect_logging from telegram import ( ForceReply, InlineKeyboardButton, InlineKeyboardMarkup, MessageEntity, P...
neo-pubsub.py
#!/usr/bin/env python3 """ neo-pubsub.py MIT License Copyright 2017 Splyse Inc. 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 to u...
joomla_killer.py
import urllib2 import urllib import cookielib import threading import sys import Queue from HTMLParser import HTMLParser # general settings user_thread = 10 username = "admin" wordlist_file = "/tmp/cain.txt" resume = None # target specific settings target_url = "http://192.168.112.131/administrator...
worker_pool_main.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...
py_ad_1_4.py
""" Section 1 Multithreading - Thread (2) - Daemon, Join Keyword - DaemonThread, Join """ """ DaemonThread(데몬스레드) (1). 백그라운드에서 실행 (2). 메인스레드 종료시 즉시 종료 (서브 스레드의 경우는 메인 스레드와 상관없이 자기 작업을 끝까지 수행함.) (3). 주로 백그라운드 무한 대기 이벤트 발생 실행하는 부분 담당 -> JVM(가비지 컬렉션), 자동 저장 (4). 일반 스레드는 작업 종료시까지 실행 """ import logging import threading # 스...
notes_db.py
# nvPY: cross-platform note-taking app with simplenote syncing # copyright 2012 by Charl P. Botha <cpbotha@vxlabs.com> # new BSD license import codecs import copy import glob import os import sys import json import logging from Queue import Queue, Empty import re import simplenote simplenote.NOTE_FETCH_LENGTH = 100 fr...
gui.py
import Tkinter as Tk import Tkconstants, tkFileDialog import os import ttk # spawning child processes import subprocess from threading import Thread, Timer import time from sys import platform as _platform class VerticalScrolledFrame(Tk.Frame): """A pure Tkinter scrollable frame that actually works! * Use the...
serve.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT license. """ Creates server for streamed game state """ import os import json from os.path import join as pjoin from multiprocessing import Process, Pipe from multiprocessing.connection import Connection from threading import Thread...
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 ...
CARAE_cla.py
import numpy as np import tensorflow as tf import numpy as np import threading from itertools import compress class ARAE(): def __init__(self, vocab_size, batch_size=20, latent_size=100, sample_size=100, property_task=1): ...
ReadSensorData.py
from sense_hat import SenseHat from time import sleep, time from multiprocessing import Process from pubnub.pubnub import PubNub, SubscribeListener, SubscribeCallback, PNStatusCategory from pubnub.pnconfiguration import PNConfiguration from pubnub.exceptions import PubNubException import uuid, os, pyrebase, pubnub, sy...
measure_methods.py
# pylint: disable=invalid-name,too-many-function-args,too-many-nested-blocks """ Functions that run on executor for measurement. These functions are responsible for building the tvm module, uploading it to remote devices, recording the running time costs, and checking the correctness of the output. """ import logging...
multiproc_data.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...
main.py
import threading, time def core_worker(): from core import kuma def webui_worker(): from webui import flask if __name__ == '__main__': threading.Thread(target = core_worker).start() threading.Thread(target = webui_worker).start()
long_dump_thread.py
from __future__ import absolute_import # Copyright (c) 2010-2017 openpyxl import threading from io import BytesIO from openpyxl.workbook import Workbook def test_thread_safe_dump(): def dump_workbook(): wb = Workbook(optimized_write=True) ws = wb.create_sheet() ws.append(range(30)) ...
server.py
# -*- coding: utf-8 -*- import threading from fastapi import FastAPI import uvicorn class Server(uvicorn.Server): """Class wrapper for the uvicron server. The idea behind building the wrapper is to be able to launch the uvicorn server in a separate thread. The purpose is to not block the main thread. The...
util.py
import os import uuid import asyncio import contextlib import threading import inflection import logging from typing import ( Tuple, Callable, Union, Any, Iterable ) from functools import reduce import kubernetes from kubernetes import config from kubernetes.client.rest import ApiException import kopf from kopf.r...
smtio.py
# # yosys -- Yosys Open SYnthesis Suite # # Copyright (C) 2012 Clifford Wolf <clifford@clifford.at> # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. #...
challenge_test.py
from logging import getLogger from dataclasses import dataclass, field from datetime import datetime from drivebuildclient.AIExchangeService import AIExchangeService from drivebuildclient.aiExchangeMessages_pb2 import SimulationID, VehicleID from drivebuildclient import static_vars from lxml.etree import _ElementTree ...
mapd.py
#!/usr/bin/env python # Add phonelibs openblas to LD_LIBRARY_PATH if import fails try: from scipy import spatial except ImportError as e: import os import sys from common.basedir import BASEDIR openblas_path = os.path.join(BASEDIR, "phonelibs/openblas/") os.environ['LD_LIBRARY_PATH'] += ':' + openblas_pat...
power_monitoring.py
import random import threading import time from statistics import mean from cereal import log from common.params import Params, put_nonblocking from common.realtime import sec_since_boot from selfdrive.hardware import HARDWARE from selfdrive.swaglog import cloudlog CAR_VOLTAGE_LOW_PASS_K = 0.091 # LPF gain for 5s tau...
account.py
#!/usr/bin/python3 import json import threading import time from getpass import getpass from pathlib import Path from typing import Any, Dict, Iterator, List, Optional, Tuple, Union import eth_account import eth_keys from hexbytes import HexBytes from brownie._config import CONFIG, _get_data_folder from brownie._sin...
testServer.py
#!/usr/bin/env python 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, ServerError, InvalidRequestE...
test_functools.py
import abc import builtins import collections import collections.abc import copy from itertools import permutations import pickle from random import choice import sys from test import support import threading import time import typing import unittest import unittest.mock import os import weakref import gc from weakref ...
test_s3.py
import os import sys import threading import time from collections import namedtuple from functools import partial from io import BytesIO from pathlib import Path from typing import Iterable, List, Tuple import boto3 import botocore import pytest from moto import mock_s3 from megfile import s3, smart from megfile.err...
lifo_queues.py
import queue import threading import time def do_work(item): print(f'{threading.current_thread()} removed {item} from the queue') def worker(queue): while not queue.empty(): item = queue.get() if item is None: print('item is none') break do_work(item) ...
Video.py
import cv2 import threading import numpy as np class VideoLoader(object): """ Load the video frame and return the paired consecutive frames for Face Detection DSFD Model""" def __init__(self, path, batch_size, frame_cache_size): self.video = cv2.VideoCapture(str(path)) self.cache_size = frame_...
test_linsolve.py
from __future__ import division, print_function, absolute_import import sys import threading import numpy as np from numpy import array, finfo, arange, eye, all, unique, ones, dot import numpy.random as random from numpy.testing import ( assert_array_almost_equal, assert_almost_equal, assert_equal, as...
flowAcc3s.py
import os import sys import zipfile import requests import shutil from shapely.geometry.polygon import Polygon from shapely.ops import transform import pyproj from osgeo import gdal from pandas import DataFrame import pandas as pd import numpy as np from osgeo import gdal import pickle from tqdm import tqdm import clic...
game.py
import pickle from bigboard import * from os import environ from random import choice from string import ascii_letters as letters from socket import socket from threading import Thread class Game(object): def __init__(self): self.board = BigBoard() self.winner = 0 self.turn = 1 sel...
lab9_b.py
from sys import setrecursionlimit import threading setrecursionlimit(10 ** 9) threading.stack_size(2 * 67108864) def main(): file_input, file_output = open('cycle.in', 'r'), open('cycle.out','w') #dfs for each vertex in V #if we can reach grey(1) vertex, cycle exists cycle = [] def dfs(index): ...
binance_adapter.py
import math from builtins import print from itertools import count from binance.client import Client from binance.websockets import BinanceSocketManager from binance.exceptions import BinanceAPIException import parameters from adapter import Adapter import time import csv from decimal import Decimal import datetime imp...
run.py
#!/usr/bin/env python3 # This script is run on a target machine. It expects to be in the "./run" # directory. It uses the config from run_config.yml to run a vasaplaten node. import yaml import pathlib import subprocess import threading import time import tempfile class Validate: def __init__(self, parsed_toml)...
operation.py
import logging.config, six, uuid, time, datetime, pytz, urllib, urllib.request, json, socket, re, struct from threading import Thread from abc import ABCMeta, abstractmethod import config, constant from util import toValue as _v from util import toString as _s logger = logging.getLogger(__name__) #### @six.add_meta...
turtle.py
#!/bin/env python3 ########################################## import os import sys import subprocess import random import argparse from colorama import init, Fore, Style init() ######################################### from lib.stagergen import * ######################################### def success(message): print(f...
controller.py
# Electron Cash - lightweight Bitcoin client # Copyright (C) 2019 Axel Gembe <derago@gmail.com> # # 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 limi...
app.py
from flask import Flask, flash, redirect, url_for, render_template, request from flask_mail import Mail, Message from flask_wtf import FlaskForm from wtforms import SubmitField, StringField, TextAreaField from wtforms.validators import DataRequired, Email import os from sendgrid import SendGridAPIClient from sendgrid.h...
queue_adapter.py
""" This module contains contracts for defining adapters to various queueing systems, e.g. PBS/SLURM/SGE. """ import abc import collections import os import shlex import string import subprocess import threading import traceback import warnings from fireworks.utilities.fw_serializers import FWSerializable, serialize_...
server3.py
################################################################################ # # 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 ...
13n_edf_wound_wait_NS.py
from functools import reduce from sys import * import numpy as np import random as r import ping_code as pc import socket import struct import subprocess as sp from threading import Thread import paramiko import ast import time import os import getpass as gp hosts = {} # {hostname: ip} multicast_group = '224.3.29.71...