source
stringlengths
3
86
python
stringlengths
75
1.04M
app.py
#!/usr/bin/pyton # encoding: utf-8 from flask import Flask from flask import render_template, redirect, url_for, request from threading import Thread import subprocess,os # Initialise the flask application app = Flask(__name__) # Index route @app.route("/", methods=['GET','POST']) def index(): ...
localshell.py
from subprocess import Popen, PIPE from .abstractshell import AbstractShell from .shellresult import ShellResult from .streamreader import StandardStreamReader from .queue import Queue from threading import Thread from shutil import copyfile from os import chmod, stat, environ class LocalShell(AbstractShell): de...
main_window.py
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2012 thomasv@gitorious # # 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 witho...
test.py
import json import os.path as p import random import socket import subprocess import threading import time import logging import io import string import avro.schema import avro.io import avro.datafile from confluent_kafka.avro.cached_schema_registry_client import CachedSchemaRegistryClient from confluent_kafka.avro.se...
web_api.py
# A bit of a mess, but mostly does API endpoints and a couple compatability fixes from flask import request, jsonify from jellyfin_accounts.jf_api import Jellyfin import json import datetime import secrets import time import threading import os import sys import psutil from jellyfin_accounts import ( config, co...
solve.py
from time import sleep from event2019.day13.computer_v4 import Computer_v4 from queue import Queue from threading import Thread ######## # PART 1 computer = Computer_v4() computer.load_code("event2019/day13/input.txt") computer.run() output = computer.get_output() screen = {(x, y): t for x, y, t in (zip(*(iter(output...
ocs_start_of_night_thread.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # + # import(s) # - from OcsCameraEntity import * from OcsSequencerEntity import * import threading import os # + # function: worker_code() # - def worker_code(entity='', entobj=None): # debug output print('name: {0:s}'.format(threading.currentThread().getName(...
io.py
# -*- coding: utf-8 -*- # Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import absolute_import, division, print_function, unicode_literals from collections import defaultdict from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor, Executor, Future, _base, as_c...
pid_tuner.py
from __future__ import print_function from __future__ import division from curtsies import Input from easygopigo3 import EasyGoPiGo3 from di_sensors.easy_line_follower import EasyLineFollower from threading import Thread, Event import signal from time import sleep, time def drawLogo(): print(" _____ ____...
driver.py
# Copyright 2020 Uber Technologies, 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 applica...
plugin.py
import threading from binascii import hexlify, unhexlify from electrum_nyc.util import bfh, bh2u from electrum_nyc.bitcoin import (b58_address_to_hash160, xpub_from_pubkey, TYPE_ADDRESS, TYPE_SCRIPT, NetworkConstants, is_segwit_address) from electrum...
xla_client_test.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 applica...
oled_thread.py
import threading from threading import Lock,Thread import time,os from PIL import Image from PIL import ImageDraw from PIL import ImageFont from io import BytesIO from ctypes import * import time import platform from oled import * #import numba as nb from bme680 import * import globalvar oled_lock = Lock() OLED_Size...
flask_gdrive.py
from __future__ import print_function import pickle import os.path import threading import time from googleapiclient.discovery import build from google_auth_oauthlib.flow import InstalledAppFlow from google.auth.transport.requests import Request from flask import current_app, _app_ctx_stack, Response, url_for...
inputhook.py
""" Similar to `PyOS_InputHook` of the Python API, we can plug in an input hook in the asyncio event loop. The way this works is by using a custom 'selector' that runs the other event loop until the real selector is ready. It's the responsibility of this event hook to return when there is input ready. There are two w...
infolog.py
import atexit import json from datetime import datetime from threading import Thread from urllib.request import Request, urlopen _format = '%Y-%m-%d %H:%M:%S.%f' _file = None _run_name = None _slack_url = None def init(filename, run_name, slack_url=None): global _file, _run_name, _slack_url _close_logfile() ...
__init__.py
""" Copyright (c) 2015 Michael Bright and Bamboo HR 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...
pyminer.py
#!/usr/bin/python # # Copyright (c) 2011 The Girauno 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...
inference_slide.py
import os import sys import numpy as np import argparse from datetime import datetime #torch related import torch from torch.utils.data import DataLoader import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.autograd import Variable from torchvision import datasets, transforms i...
heartbeat.py
# # (C) Copyright 2012 Enthought, Inc., Austin, TX # All right reserved. # # This file is open source software distributed according to the terms in # LICENSE.txt # import sys import time import threading from .abstract_event_manager import BaseEvent from .package_globals import get_event_manager if sys.platform == ...
test_util.py
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
process_communication_with_queue.py
import multiprocessing #SENTINEL = object() # no! SENTINEL = 'STOP' # not empty obj instance, bacuse id's get messed up def producer(q, n): a, b = 0, 1 while a <= n: q.put(a) a, b = b, a + b q.put(SENTINEL) def consumer(q): while True: num = q.get() if num == SENTI...
server.py
#!/usr/bin/env python """ SecureChat server: starts a server that routes chat messages. """ import socket import threading import sys import binascii import argparse from M2Crypto import DH as M2DH from dhke import DH, DH_SIZE, LEN_PK from cipher import Message __author__ = "spec" __license__ = "MIT" __version__ = "0...
utils.py
import jwtoken as jwt import threading m3ustr = '#EXTM3U x-tvg-url="https://github.com/Shra1V32/epg/raw/master/epg.xml.gz" \n\n' kodiPropLicenseType = "#KODIPROP:inputstream.adaptive.license_type=com.widevine.alpha" def processTokenChunks(channelList): global m3ustr kodiPropLicenseUrl = "" if not chann...
test___init__.py
#!/usr/bin/env python3 """Testing pattoo/db/db.py.""" import os import unittest import sys from random import random, randint import multiprocessing from collections import namedtuple # Try to create a working PYTHONPATH EXEC_DIR = os.path.dirname(os.path.realpath(__file__)) ROOT_DIR = os.path.abspath(os.path.join( ...
meterpreter.py
#!/usr/bin/python # vim: tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab import binascii import code import os import platform import random import re import select import socket import struct import subprocess import sys import threading import time import traceback try: import ctypes except ImportError: has_windl...
test_daemon.py
# Copyright 2021-2022 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 # import functools import logging import pprint import re import sys import time import attr import psutil import pytest from pytestskipmarkers.utils import platform from pytestshellutils.exceptions import FactoryNotRunning from pytestshellutils...
oase_apply.py
# Copyright 2019 NEC Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
servidor.py
#!/usr/bin/env python3 ''' Trabalho Pratico 0: Redes de Computadores DCC023 Autor: Hugo Araujo de Sousa (2013007463) servidor.py: Receives a string from each client, decodes it and sends it back to client. ''' import argparse as ap import socket import struct import threading import sys # Add command line arguments....
command.py
# Copyright 2020 Katteli Inc. # TestFlows.com Open-Source Software Testing Framework (http://testflows.com) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/lice...
compressed_vipc.py
#!/usr/bin/env python3 import av import os import sys import argparse import numpy as np import multiprocessing import time import cereal.messaging as messaging from cereal.visionipc.visionipc_pyx import VisionIpcServer, VisionStreamType # pylint: disable=no-name-in-module, import-error W, H = 1928, 1208 V4L2_BUF_FL...
main_window.py
import re import os import sys import time import datetime import traceback from decimal import Decimal import threading import electrum from electrum.bitcoin import TYPE_ADDRESS from electrum import WalletStorage, Wallet from electrum_gui.kivy.i18n import _ from electrum.paymentrequest import InvoiceStore from electr...
__init__.py
# -*- coding: utf-8 -*- __author__ = 'matth' import threading import traceback import sys import subprocess import time import uuid import logging import json import argparse import shlex import os import jsonrpc import Queue import pkgutil from processfamily.threads import stop_threads from processfamily.processes im...
PyRosetta-PMV.py
# Eric Kim # script to communicate between PyRosetta and PyMol # run rosetta libraries and this script inside PyMol command-line window # PyRosetta and PyMol must be built with matching Python versions # March 2009 # (c) Copyright Rosetta Commons Member Institutions. # (c) This file is part of the Rosetta software suit...
pagerank.py
import os import sys import pika import time import struct import platform import threading import warnings import flatbuffers from functools import partial from datetime import timedelta warnings.filterwarnings('ignore', category=RuntimeWarning) from loguru import logger from sparqlforhumans.PageRankItem import Pag...
dhcpl2relayTest.py
# Copyright 2017-present Open Networking Foundation # # 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...
test_operator.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
remote_executor.py
# Copyright 2019, The TensorFlow Federated Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
keyboard_ctrl.py
import sys import termios import time from termios import (BRKINT, CS8, CSIZE, ECHO, ICANON, ICRNL, IEXTEN, INPCK, ISIG, ISTRIP, IXON, PARENB, VMIN, VTIME) from typing import Any import cereal.messaging as messaging # Indexes for termios list. IFLAG = 0 OFLAG = 1 CFLAG = 2 LFLAG = 3 ISPEED = 4 OSPE...
test_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 u...
piglowui.py
#!/usr/bin/python # # Copyright 2016 Deany Dean # # 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 ...
Magma.py
''' Created on Mar 29, 2020 @author: riteshagarwal ''' import random from BucketLib.BucketOperations import BucketHelper from BucketLib.bucket import Bucket from TestInput import TestInputSingleton from basetestcase import BaseTestCase from couchbase_helper.documentgenerator import doc_generator from error_simulatio...
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_put.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2021 4Paradigm # # 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 ...
test_sync_clients.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- import py...
gui.py
import tkinter as tk from tkinter import * import tkinter.ttk as ttk from tkinter.ttk import * from tkinter.messagebox import showerror import serial import threading import time import queue import os if os.name == 'nt': # sys.platform == 'win32': from serial.tools.list_ports_windows import comports elif os.name...
threading_test.py
#! /usr/bin/python """ Test by Karen Tracey for threading problem reported in http://www.mail-archive.com/matplotlib-devel@lists.sourceforge.net/msg04819.html and solved by JDH in git commit 175e3ec5bed9144. """ from __future__ import print_function import os import threading import traceback import numpy as np from...
multiproc_pydl.py
__copyright__ = """ Copyright 2019 Samapriya Roy 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 applicabl...
wifiscan.py
from wifipumpkin3.core.common.terminal import ModuleUI from wifipumpkin3.core.config.globalimport import * from wifipumpkin3.core.utility.printer import ( display_messages, setcolor, display_tabulate, ) from random import randrange import time, signal, sys from multiprocessing import Process from scapy.all ...
logging.py
"""Logging utilities.""" import asyncio import logging import threading from .async import run_coroutine_threadsafe class HideSensitiveDataFilter(logging.Filter): """Filter API password calls.""" def __init__(self, text): """Initialize sensitive data filter.""" super().__init__() sel...
bamprocess_regression.py
# Functions used by AcroPoly algorithm to process the bam file, scan the genomic region, get EM dosages and report them in the desired format. # Written by Ehsan Motazedi, Wageningen UR, 21-01-2018. # Last mofified: 08-09-2018. import copy import itertools import math import multiprocessing as mpthread import numpy as...
git_command.py
""" Define a base command class that: 1) provides a consistent interface with `git`, 2) implements common git operations in one place, and 3) tracks file- and repo- specific data the is necessary for Git operations. """ import os import subprocess import shutil import re import threading import traceback i...
plotter.py
import multiprocessing as mp import time import matplotlib.pyplot as plt import numpy as np # Sample code from: # https://matplotlib.org/3.3.3/gallery/misc/multiprocess_sgskip.html#sphx-glr-gallery-misc-multiprocess-sgskip-py class ProcessPlotter: def __init__(self): self.x = [] self.y = [] ...
run.py
import os # To Perform OS level works. import six import cv2 # OpenCV for Computer Vision import labelcolors # It has a dictionary that...
test_operator.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
main.py
print("Started <Pycraft_main>") class Startup: def __init__(Class_Startup_variables): try: import tkinter as tk Class_Startup_variables.mod_Tkinter__tk = tk # [Class_Startup_variables] mod (module) (module name) (subsection of module) (name references) import tkinte...
mp_tasks.py
# ActivitySim # See full license in LICENSE.txt. import sys import os import time import logging import multiprocessing import traceback from collections import OrderedDict import yaml import numpy as np import pandas as pd from activitysim.core import config from activitysim.core import inject from activitysim.core...
w_recog.py
# # Copyright (c) 2021 Takeshi Yamazaki # This software is released under the MIT License, see LICENSE. # from collections import deque, Counter import cv2 from decimal import Decimal, ROUND_HALF_UP import numpy as np import os import PIL.Image, PIL.ImageTk from playsound import playsound import threading import tkint...
init.py
import threading import logging import os import os.path import sys import time logging.basicConfig(level=logging.INFO, format='%(asctime)s.%(msecs)03d %(module)s %(levelname)s: %(message)s', datefmt="%Y-%m-%d %H:%M:%S") def main(): logging.info("start init process ...") logging.info("start training thread ..."...
test_socket.py
import unittest from test import support from test.support import socket_helper import errno import io import itertools import socket import select import tempfile import time import traceback import queue import sys import os import platform import array import contextlib from weakref import proxy import signal impor...
test_security.py
"""Test libzmq security (libzmq >= 3.3.0)""" # -*- coding: utf8 -*- # Copyright (C) PyZMQ Developers # Distributed under the terms of the Modified BSD License. import os import contextlib import time from threading import Thread import zmq from zmq.tests import ( BaseZMQTestCase, SkipTest, PYPY ) from zmq.utils ...
__init__.py
# -*- coding: utf8 -*- # Copyright (c) 2010-2017, Jamaludin Ahmad # Released subject to the MIT License. # Please see http://en.wikipedia.org/wiki/MIT_License import os import re import sys from collections import namedtuple from queue import Queue from threading import Semaphore, Thread from urllib.parse import urlj...
util.py
"""Test utilities.""" import logging from multiprocessing import Event from multiprocessing import Process import shutil import sys import tempfile import unittest import warnings from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import serialization import josepy as jose try...
folderapp.py
#!/usr/bin/python3 """ simple module to manage the video files generated by the camera app """ from pootlestuff import watchables as wv import os, pathlib, time, threading, queue class fileManager(wv.watchablesmart): def __init__(self, **kwargs): self.diskfree=wv.floatWatch(app=self, value=float('nan')) ...
search.py
"""Python wrapper for easily making calls to Pipl's Search API. Pipl's Search API allows you to query with the information you have about a person (his name, address, email, phone, username and more) and in response get all the data available on him on the web. The classes contained in this module are: - Sear...
stl_capture_test.py
#!/router/bin/python from .stl_general_test import CStlGeneral_Test, CTRexScenario from trex_stl_lib.api import * import os, sys import pprint import zmq import threading import time import tempfile import socket from scapy.utils import RawPcapReader from nose.tools import assert_raises, nottest def ip2num (ip_str): ...
thread-lock.py
### # Thread lock test. # # License - MIT. ### import os import threading # Global var value. tmp_value = 0 # change_value - Change global value. def change_value(id): # { global tmp_value tmp_value += id print('id: %d, Value: %d' % (id, tmp_value)) # } # thread_function - Thread test function. de...
index.py
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Vinay Sajip. # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # import hashlib import logging import os import shutil import subprocess import tempfile try: from threading import Thread except ImportErr...
CocoPanoptic_Reader.py
#Reader for the coco panoptic data set for pointer based image segmentation import numpy as np import os import scipy.misc as misc import random import cv2 import json import threading ############################################################################################################ def rgb2id(color): # Conv...
udpchat.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Sep 25 19:34:11 2019 @author: mrich """ import argparse import socket import threading import queue import sys import random import os import re import random import string import time def get_ip(): s = socket.socket(socket.AF_INET, socket.SOCK_DG...
video2chars.py
# -*- coding:utf-8 -*- import numpy as np import pickle import os import invoke from threading import Thread # 用于生成字符画的像素,越往后视觉上越明显。。这是我自己按感觉排的,你可以随意调整。写函数里效率太低,所以只好放全局了 # pixels = " .,-'`:!1+*abcdefghijklmnopqrstuvwxyz<>()\/{}[]?234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ%&@#$" # pixels = "$@B%8&WM#wmhkbdpqaozcvunxrt*+1!;:`...
socket_server.py
#!/usr/bin/python # -*- coding: utf-8 -*- # @File : socket_server.py # @Time : 2019/2/28 23:19 # @Author : MaiXiaochai # @Site : https://github.com/MaiXiaochai import socket import threading # socket.AF_INET IPV4 server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # 参数为数组 server.bind(('0.0.0.0', 8...
SatadishaModule_final_trie.py
# coding: utf-8 # In[298]: import sys import re import string import csv import random import time #import binascii #import shlex import numpy as np import pandas as pd from itertools import groupby from operator import itemgetter from collections import Iterable, OrderedDict from nltk.tokenize import sent_tokenize...
test_fileobj.py
# MIT License # # Copyright (c) 2018-2020 Tskit Developers # # 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 use, copy, modif...
tickergram.py
#!/usr/bin/env python3 import time, sys, os, uuid, tempfile, re, subprocess, json, logging, datetime, multiprocessing, threading, argparse, shutil import requests import yfinance as yf import mplfinance as mpf import redis import requests import pandas as pd #import talib import locale locale.setlocale(locale.LC_ALL...
locust.py
import gevent.monkey gevent.monkey.patch_all() import sys import time import multiprocessing import socket # import gevent from locust import runners # from locust import events, web from locust import events from locust.main import version, load_locustfile from locust.stats import print_percentile_stats, print_error_...
loader.py
#!/usr/bin/env python3 # # MIT License # # Copyright (c) 2020-2021 EntySec # # 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...
multithread.py
# Multi-threaded (subject to GIL) sum of factorials import math import threading INPUT_FILE_COUNT = 10 INPUT_FILE_DIR = 'data/' INTERMEDIATE_RESULTS_PATH = 'results/thread' REDUCED_OUTPUT_FILE = 'results/multithread.txt' def main(): # Create and launch threads threads = [] for i in xrange(0, INPUT_FILE_COUNT...
test_heterograph.py
import dgl import dgl.function as fn from collections import Counter import numpy as np import scipy.sparse as ssp import itertools import backend as F import networkx as nx import unittest, pytest from dgl import DGLError import test_utils from test_utils import parametrize_dtype, get_cases from utils import assert_is...
pyshell.py
#! /usr/bin/env python3 import sys if __name__ == "__main__": sys.modules['idlelib.pyshell'] = sys.modules['__main__'] try: from tkinter import * except ImportError: print("** IDLE can't import Tkinter.\n" "Your Python may not be configured for Tk. **", file=sys.__stderr__) raise SystemExit(...
batch.py
#! /usr/bin/env python3 # -*- coding: utf-8 -*- # File : batch.py # Author : Jiayuan Mao # Email : maojiayuan@gmail.com # Date : 01/22/2018 # # This file is part of Jacinle. # Distributed under terms of the MIT license. from copy import deepcopy from threading import Thread, Event import traceback from jacinle.c...
_wdapy.py
# coding: utf-8 import atexit import base64 import io import json import logging import queue import subprocess import sys import threading import time import typing import requests from cached_property import cached_property from logzero import setup_logger from PIL import Image from ._alert import Alert from ._bas...
miner_patch.py
#A stratum compatible miniminer #based in the documentation #https://slushpool.com/help/#!/manual/stratum-protocol #2017-2019 Martin Nadal https://martinnadal.eu import socket import json import random import traceback import multiprocessing import tdc_mine import time from multiprocessing import Process, Queue, cpu_c...
Multi-Threading.py
from threading import Thread import threading from time import sleep def Numbers(): print(threading.current_thread().getName(),"Has started") for x in range(10): print(x) print(threading.current_thread().getName(),"Has stopped") print("\nYou can see that both the functions ran parallely")...
datasets.py
# flake8: noqa import glob import math import os import random import shutil import time from pathlib import Path from threading import Thread import cv2 import numpy as np import torch from PIL import Image, ExifTags from torch.utils.data import Dataset from tqdm import tqdm from utils.general import xyxy2xywh, xywh...
server.py
"""RPC server implementation. Note ---- Server is TCP based with the following protocol: - Initial handshake to the peer - [RPC_MAGIC, keysize(int32), key-bytes] - The key is in format - {server|client}:device-type[:random-key] [-timeout=timeout] """ from __future__ import absolute_import import os import ctypes...
bot_cmds.py
""" @ Harris Christiansen (code@HarrisChristiansen.com) Generals.io Automated Client - https://github.com/harrischristiansen/generals-bot Generals.io Bot Commands """ import random import threading import time from .constants import * from . import generals_api class BotCommands(object): def __init_...
NGINXApiModule.py
import demistomock as demisto from CommonServerPython import * from CommonServerUserPython import * from multiprocessing import Process from gevent.pywsgi import WSGIServer import subprocess import gevent from signal import SIGUSR1 import requests from flask.logging import default_handler from typing import Any, Dict...
optimization_checks.py
# Copyright 2019 WebPageTest LLC. # Copyright 2017 Google Inc. # Use of this source code is governed by the Apache 2.0 license that can be # found in the LICENSE file. """Run the various optimization checks""" import binascii import gzip import logging import multiprocessing import os import re import shutil import str...
generate-runtime-tests.py
#!/usr/bin/env python # Copyright 2014 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import itertools import js2c import multiprocessing import optparse import os import random import re import shutil import signal imp...
TCP_echo_client.py
#!/usr/bin/env python # # 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 # ...
cloudburst.py
import logging from time import time, sleep from threading import Thread from multiprocessing import Process import os import sys from os import kill, getpid import traceback from timeit import default_timer as timer from math import ceil from ast import literal_eval from msgpack import Unpacker from sqlalchemy.sql im...
helpers.py
""" :copyright: Copyright 2013-2017 by the SaltStack Team, see AUTHORS for more details. :license: Apache 2.0, see LICENSE for more details. tests.support.helpers ~~~~~~~~~~~~~~~~~~~~~ Test support helpers """ import base64 import builtins import errno import fnmatch import functools import inspe...
fastTradeV1.py
import logging import asyncio from binance.client import Client from binance_f import RequestClient from binance_f import SubscriptionClient from binance_f.constant.test import * from binance_f.model import * from binance_f.exception.binanceapiexception import BinanceApiException from binance_f.base.printobject import ...
engine.py
""" Main BZT classes Copyright 2015 BlazeMeter Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in...
stream_price_event.py
import logging import queue import threading from src.event import TickEvent from src.pricing.stream import StreamingPrices logger = logging.getLogger(__name__) class StreamPriceEvent: def __init__(self, instruments: list, events: queue.Queue, max_rec: int = None, account: str = 'mt4'): self.instruments...
crawler.py
""" Crawl the 25w data again to find the 上映时间,电影名称(含不同版本),导演,演员,类别, comments """ import time import random import threading from fake_useragent import UserAgent from bs4 import BeautifulSoup import redis import urllib3 import requests urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) ua = User...
__init__.py
# std lib imports import logging import os import sys import signal import threading # tornado imports import tornado.ioloop from tornado.options import options # module imports from modules.base.tornadoql.tornadoql import TornadoQL # import modules # noqa E402 from modules.api.mavros import MAVROSConnection from m...
main_window.py
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2012 thomasv@gitorious # # 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 witho...
task_running_resources_test.py
# -*- coding: utf-8 -*- # # Copyright 2012-2015 Spotify AB # # 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...