source
stringlengths
3
86
python
stringlengths
75
1.04M
JBlock.py
import time import threading import config from config import * class JBlock: def __init__(self): self.cells = 4 # Number of cells occupied by the block config.block_count += 1 config.item_id["blocks"][f"{config.block_count}"] = {} # Add a new key to dictionary to add block IDs ...
eventgen_server_api.py
import flask from flask import Response, request import socket import json import configparser import os import time import zipfile import tarfile import glob import shutil import collections import logging import requests import threading from splunk_eventgen.eventgen_api_server import eventgen_core_object INTERNAL_...
optimize_threshold.py
import EncoderFactory from DatasetManager import DatasetManager import pandas as pd import numpy as np from sklearn.metrics import roc_auc_score from sklearn.pipeline import FeatureUnion import time import os import sys from sys import argv import pickle import csv from hyperopt import Trials, STATUS_OK, tpe, fmin,...
env_server.py
import socket import sys import traceback import gym import logging import minerl import struct import argparse import os import tempfile import fcntl import getpass from threading import Thread try: import cPickle as pickle except ImportError: import pickle class EnvServer: def __init__(self, handler,...
test_webpack.py
import json import os import time from subprocess import call from threading import Thread import django from django.conf import settings from django.test import RequestFactory, TestCase from django.views.generic.base import TemplateView from django_jinja.builtins import DEFAULT_EXTENSIONS from unittest2 import skipIf...
encoder_sample.py
# Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
tensor_models.py
# -*- coding: utf-8 -*- # # tensor_models.py # # Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apa...
utils.py
# coding=utf-8 """Some util functions/classes.""" import random import itertools import math import threading import sys import time import os import psutil import operator import cv2 # import commands if sys.version_info > (3, 0): import subprocess as commands else: import commands from operator import mul...
cleaner.py
# Copyright 2013-2018 CERN for the benefit of the ATLAS collaboration. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
single_process.py
# Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from ..args_provider import ArgsProvider import tqdm class SingleProcessRun: def __init__(self): ''' Initi...
Tests.py
#!/usr/bin/python3 import random, string, subprocess from subprocess import check_output from subprocess import Popen, PIPE import random import time import logging import threading import os import datetime import configparser import requests mainProxyHost = "10.11.12.115" mainProxyPort = 80 shortList = [] # Lette...
RoomLightOn.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = "MPZinke" ########################################################################################## # # created by: MPZinke # on 2020.04.05 # # DESCRIPTION: # BUGS: # FUTURE: - Expand such that each light is its own object # ################################...
ContextTest.py
########################################################################## # # Copyright (c) 2012, John Haddon. 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 so...
model.py
import os import re import shutil from pathlib import Path from typing import Callable, Dict, Tuple import threading from elpis.engines.common.objects.command import run from elpis.engines.common.objects.model import Model as BaseModel from elpis.engines.common.objects.dataset import Dataset from elpis.engines.common.o...
0-5. pythonbasic-2.py
# python basic -2 # adding a = 1 b = 2 c = a+b print(c) # if-else sentences if a > 0: print("a>0") else: print("a<0") # import library import math n = math.sqrt(16.0) print(n) # data type print(int(3.5),2e3,float("1.6"),float("inf"),float("-inf"),bool(0),bool(-1),bool("False")) # im...
views.py
from django.conf import settings from django.contrib.auth import logout as logout_func from django.http import HttpResponseRedirect from django.shortcuts import render, redirect from django.contrib import messages, auth from django.contrib.auth.models import User from django.urls import reverse from accounts.models imp...
metrics_export_test.py
""" Copyright 2020 The Magma Authors. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES O...
xyzFieldControl.py
import threading import time import sys import math import uncertainties as u from labjack import ljm # import labjack library # now import the modules that are part of the repo import powercontrol.coil as coil def openPorts(): """Open all the ports including the labjack and the powersupplies"""...
udpScanner.py
#!/usr/bin/env python # coding: utf-8 # In[23]: import socket import time import struct import threading import argparse import logging logger = logging.getLogger() logger.setLevel(logging.INFO) formats = logging.Formatter('%(asctime)s[%(message)]', '%m/%d/%Y %I:%M:%S:%p') console = logging.StreamHandler() console...
skeleton.py
import random import threading import time from datetime import datetime from ppadb.client import Client as AdbClient from ppadb.device import Device from .ocr import find_last_snap client = AdbClient(host="127.0.0.1", port=5037) def sleep_after_exec(func): def wrapper(*args, **kwargs): func(*args, **kw...
training.py
from . import data from . import utils import logging import time import queue import threading import copy class GeneratorEnqueuer(data.BatchGenerator): """Builds a queue out of a data generator. Used in `fit_generator`, `evaluate_generator`, `predict_generator`. # Arguments generator: a generat...
configuration.py
""" This handler, when signaled, queries the DartAPI for updated configuration information for this host. It then updates the supervisord configuration on disk, updates the shared configurations for monitoring and scheduling, and triggers a reread of all configurations. """ from . import BaseHandler from ..configurati...
copy_ocp_aws_azure_data.py
#! /usr/bin/env python3.8 import datetime import json import logging import os import sys from multiprocessing import Process from multiprocessing import Queue import psycopg2 from app_common_python import LoadedConfig from dateutil.relativedelta import relativedelta from psycopg2 import ProgrammingError from psycopg2...
observer.py
# Copyright (c) 2014 Rackspace, 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 writ...
vish_control_drugs.py
#!/usr/bin/python3 """The basic idea is this: the bugs grow for a certain period of time, dt. After this time, if their optical density, OD, (as read by a photodetector) is above a threshhold, OD_thr, and they have grown since the last time point, drug is administered through a pump, P_drug. If OD is less than OD_thr,...
adb.py
#! /usr/bin/env python # encoding: utf-8 # Copyright (c) 2015 Steinwurf ApS # All Rights Reserved # # Distributed under the "BSD License". See the accompanying LICENSE.rst file. import argparse import subprocess import threading import time import os import re BUTTONS = { "soft_right": 2, "home": 3, "bac...
Audit_main_screen.py
#time module import time import datetime start = time.time() #gui module from tkinter import * from tkinter import messagebox from tkinter import ttk #system modules import sys import os import threading from termcolor import colored #data processing and other data receiving modules import sqlit...
_vis.py
import inspect import os from threading import Thread from ._user_namespace import get_user_namespace, UserNamespace, DictNamespace from ._viewer import create_viewer, Viewer from ._vis_base import get_gui, default_gui, Control, display_name, value_range, Action, VisModel, Gui from ..field import SampledField, Scene f...
node.py
# Ant # # Copyright (c) 2012, Gustav Tiger <gustav@tiger.name> # # 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, m...
wxRavenShellLogic.py
''' Created on 13 déc. 2021 @author: slinux ''' import wx.aui #from wxRavenGUI.view import wxRavenDesign from .wxRavenShellDesign import * import wx.py as py import threading import time from wxRavenGUI.application.wxcustom import * import os wildcard = "Python source (*.py)|*.py|" \ "Compiled Python...
Scrypt.py
import PyQt5 import PyQt5.QtWidgets import PyQt5.QtCore import sys import requests import random import string import threading from Crypto.Cipher import AES from Crypto.Util.Padding import pad, unpad import os import shutil btcAdd = "" email = "" discordWebhook = "" fileTypes = ['.txt','.exe','.p...
test_fx.py
import builtins import contextlib import copy import functools import math import numbers import operator import os import pickle import sys import torch import traceback import warnings import unittest from math import sqrt from pathlib import Path from torch.multiprocessing import Process from torch.testing import Fi...
test_menu.py
import signal import threading import unittest import sys if sys.version_info > (3, 0): from queue import Queue else: from Queue import Queue from django.conf import settings from django.template import Template, Context from django.test import TestCase from django.test.client import RequestFactory from menu...
heart_beat.py
# Set up a Message Queue server, which will receive images # every N-minutes, and heart beat signals every N-seconds. # New images will be stored on SD Card for forensics, and old images deleted to remove clutter/save space # Heart beats will be used to determine if camera stream is alive (it may # need to be restarted...
mlbrain.py
# -*- coding: utf-8 -*- from __future__ import print_function import sys reload(sys) sys.setdefaultencoding("utf-8") from core import utils import os import codecs import pickle import threading import logging from time import sleep import hashlib from nltk.tokenize import RegexpTokenizer from stop_words import get_s...
cli.py
# -*- coding: utf-8 -*- """ flask.cli ~~~~~~~~~ A simple command line application to run flask apps. :copyright: © 2010 by the Pallets team. :license: BSD, see LICENSE for more details. """ from __future__ import print_function import ast import inspect import os import re impor...
base_controller.py
#!/usr/bin/env python # coding: utf-8 import time import atexit import weakref import pybullet import threading from qibullet.tools import * from qibullet.controller import Controller class BaseController(Controller): """ Class describing a robot base controller """ # _instances = set() FRAME_WO...
GPIOmay.py
#!/usr/bin/env python3 """ Copyright (c) 2013 Adafruit Original RPi.GPIO Py-Wrapper Author Ben Croston Modified for BBIO Py-Wrapper Author Justin Cooper Authors of Full Python Implementation: Mark Yoder, Joshua Key, and Eric Morse This file incorporates work covered by the following copyright and permission notice, ...
views.py
import json import logging import traceback from datetime import datetime from pathlib import Path from threading import Thread from time import sleep from typing import get_type_hints from uuid import uuid4 import birdseye.server import requests from birdseye import eye from django.conf import settings from django.co...
multiprocessing_hello_world.py
import multiprocessing import time def hello_world(delay): print(f'Hello ...{delay}') time.sleep(delay) return f'...{delay} sec delayed world!' t1 = time.time() p1 = multiprocessing.Process(target=hello_world, args=[1.0]) p2 = multiprocessing.Process(target=hello_world, args=[1.0]) p1.start() p2.start()...
httpd.py
import hashlib import os import threading from http import HTTPStatus from http.server import HTTPServer, SimpleHTTPRequestHandler from RangeHTTPServer import RangeRequestHandler class TestRequestHandler(RangeRequestHandler): checksum_header = None def end_headers(self): # RangeRequestHandler only s...
test_fakeredis.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from time import sleep, time from redis.exceptions import ResponseError import inspect from functools import wraps import os import sys import threading from nose.plugins.skip import SkipTest from nose.plugins.attrib import attr import redis import redis.client import fak...
oandav20feed.py
from __future__ import (absolute_import, division, print_function, unicode_literals) from datetime import datetime, timedelta, timezone import time as _time import threading from backtrader.feed import DataBase from backtrader import TimeFrame, date2num, num2date from backtrader.utils.py3 imp...
base.py
import argparse import base64 import copy import itertools import json import multiprocessing import os import re import sys import threading import time import uuid from collections import OrderedDict from contextlib import ExitStack from typing import ( Optional, Union, Tuple, List, Set, Dict,...
uWServer.py
#!/bin/env python3 ''' ''' # 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 ...
net_shver_proc_queue.py
#!/usr/bin/env python from net_system.models import NetworkDevice, Credentials import django from netmiko import ConnectHandler from datetime import datetime from multiprocessing import Process, current_process, Queue def show_version_queue(a_device, q): output_dict = {} creds = a_device.credentials remo...
unpack.py
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright (c) 2017, Silvio Peroni <essepuntato@gmail.com> # # 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. ...
feature_shutdown.py
#!/usr/bin/env python3 # Copyright (c) 2018-2020 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test flocoind shutdown.""" from test_framework.test_framework import FlocoinTestFramework from test_fr...
runPhyPiDAQ.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """run data acquisition class collects data samples from various sensors, (re-)formats and sends them to a display module, a file, a pipe or a websocket Usage: ./runPhyPiDAQ.py [<PhyPiConf_file>.daq] [Interval] """ from __future__ import print_function, ...
mtping.py
import subprocess import threading def ping(host): rc = subprocess.call( 'ping -c2 %s &> /dev/null' % host, shell=True ) if rc == 0: print('\033[32;1m%s:up\033[0m' % host) else: print('\033[31;1m%s:down\033[0m' % host) if __name__ == '__main__': ips = ['172.40.58.%s...
two_part.py
import random import pyaudio from clear_osc import SineOsc import multiprocessing as mp import time sine_osc = SineOsc() p = pyaudio.PyAudio() stream = p.open(format=pyaudio.paFloat32, channels=1, rate=44100, output=1, ) x = 145 freqs = [ x, ...
processing.py
#!/usr/bin/env python3 import model import threading from IPy import IP import webbrowser as WB from selenium import webdriver class sanity(): def __init__(self, IoC): self.types = ["d_", "u_", "i_"] self.IoC = IoC def check(self): if self.__isIP__(): return self.types[2] ...
vfs.py
# vfs.py - Mercurial 'vfs' classes # # Copyright Matt Mackall <mpm@selenic.com> # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. from __future__ import absolute_import import contextlib import errno import os import shutil import ...
test_PoloniexAPI.py
import time import threading # Hack to get relative imports - probably need to fix the dir structure instead but we need this at the minute for # pytest to work import os import sys import inspect currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) parentdir = os.path.dirname(current...
python_ls.py
# Original work Copyright 2017 Palantir Technologies, Inc. (MIT) # See ThirdPartyNotices.txt in the project root for license information. # All modifications Copyright (c) Robocorp Technologies Inc. # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License") # you may not use this file exc...
contact_mappingServer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import datetime import json import os import random as _random import sys import traceback from getopt import getopt, GetoptError from multiprocessing import Process from os import environ from wsgiref.simple_server import make_server import requests as _requests from json...
scanner.py
import subprocess import re from time import sleep from threading import Thread #pattern = re.compile(r'([0-9a-fA-F]{2}\:){5}[0-9a-fA-F]{2}') pattern = re.compile(r'[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}\:[0-9a-fA-F]{2}') # Function that checks for device presence def check(): ...
views.py
import os import shutil from datetime import datetime from os import path, listdir, makedirs from threading import Thread import requests from django.conf import settings from django.contrib import messages from django.contrib.admin.views.decorators import staff_member_required from django.contrib.auth.mixins import L...
rfc1459.py
''' '' PyIRCIoT (PyLayerIRC class) '' '' Copyright (c) 2018-2020 Alexey Y. Woronov '' '' By using this file, you agree to the terms and conditions set '' forth in the LICENSE file which can be found at the top level '' of this package '' '' Authors: '' Alexey Y. Woronov <alexey@woronov.ru> ''' # Those Global options ...
client.py
# The MIT License (MIT) # # Copyright (c) 2016 Gregorio Di Stefano # # 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, cop...
subclassing_and_waiting.py
# # Simple example which uses a pool of workers to carry out some tasks. # # Notice that the results will probably not come out of the output # queue in the same in the same order as the corresponding tasks were # put on the input queue. If it is important to get the results back # in the original order then consider ...
run.py
import threading import subprocess import os def runTouch(): subprocess.call("python3 " + os.path.dirname(os.path.realpath(__file__)) + "/touch.py", shell=True) def runPage(): subprocess.call("chromium-browser --allow-insecure-localhost --start-fullscreen \"" + os.path.dirname(os.path.realpath(__file__)) + "/...
onsets_frames_transcription_realtime.py
# Copyright 2020 The Magenta 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 or agreed to in ...
xmlstream.py
""" sleekxmpp.xmlstream.xmlstream ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This module provides the module for creating and interacting with generic XML streams, along with the necessary eventing infrastructure. Part of SleekXMPP: The Sleek XMPP Library :copyright: (c) 2011 Nathanael C. Fritz :...
run_tests.py
#!/usr/bin/python # # Copyright (c) 2013-2018, Intel Corporation # 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 must retain the above copyright # ...
supervisor.py
import os import signal import threading from Queue import Queue from urlparse import urlparse import requests from google.cloud import vision from pymongo import MongoClient from crawlers.buzzfeed import BuzzFeedCrawler from crawlers.cheez_burger import CheezBurgerCrawler from crawlers.dopl3r import Dopl3rCrawler f...
honeytrigger.py
import socket import multiprocessing import datetime import atexit import time threads = [] def killthreads(): global threads for t in threads: t.terminate() def log(data2log): with open("logs.txt", "a") as f: f.write(str(datetime.datetime.now()) + " | " + str(data2log) + "\n") def listen...
__init__.py
import socket from threading import Thread from flask_desktop_ui import chromium_browser_wrapper LOCAL_HOST = '127.0.0.1' RANDOM_PORT = 0 class FlaskDesktopUI(object): def __init__(self, app): self.port = _get_random_port() self.flask_job = Thread(target=app.run, args=(LOCAL_HOST, self.port)) ...
utils.py
# -*- coding: utf-8 -*- """ Various function that can be usefull """ # Author: Remi Flamary <remi.flamary@unice.fr> # # License: MIT License import multiprocessing from functools import reduce import time import numpy as np from scipy.spatial.distance import cdist import sys import warnings try: from inspect imp...
DualStepperWeb.py
#!/usr/bin/python #coding=utf-8 # Install in Linux bash # Python3 –m http.server # # sudo pip install simple_http_server #? # sudo pip3 install Adafruit_MotorHAT # # 20190530 update # import os import sys import socket import RPi.GPIO as GPIO # Check it in your windows or Raspbian platform #import...
test_testsetup.py
import contextlib import sys from pathlib import Path from unittest.mock import patch, Mock, call import pytest from threading import Thread from time import sleep from .helpers import build_tree from headlock.testsetup import TestSetup, MethodNotMockedError, \ CProxyDescriptor, CProxyTypeDescriptor, BuildError, C...
tr_ara_simple.py
from flask import Flask, request, url_for, jsonify, abort import requests, sys, threading, time ARS_API = 'http://localhost:8000/ars/api' def setup_app(): DEFAULT_ACTOR = { 'channel': 'general', 'agent': { 'name': 'ara-simple-agent', 'uri': 'http://localhost:5000' }...
email.py
from flask_mail import Message from app import mail from flask import render_template from app import app from threading import Thread def send_async_email(app, msg): with app.app_context(): mail.send(msg) def send_email(subject, sender, recipients, text_body, html_body): msg = Message(subject, sende...
consumers.py
# Copyright: (c) OpenSpug Organization. https://github.com/openspug/spug # Copyright: (c) <spug.dev@gmail.com> # Released under the AGPL-3.0 License. from channels.generic.websocket import WebsocketConsumer from django_redis import get_redis_connection from apps.host.models import Host from threading import Thread impo...
cross_device_ops_test.py
# Copyright 2020 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...
sema_Resource_Control.py
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # sema_signal.py # # An example of using a semaphore for signaling between threads import threading import requests import time sema = threading.Semaphore(2) # Max: 2-threads URL = 'https://stackoverflow.com' def fetch_page(url): sema.acquire() try: ...
tuxchat.py
# MIT License # Copyright (c) 2022 bleach86, tuxprint#5176 # 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...
demo.py
# -*- coding: utf-8 -*- import datetime from onvif2 import ONVIFCamera from zeep.transports import Transport import json import os import sys def getexepath(): """ 返回可执行程序的当前路径。 sys.argv 中保存了可执行程序的全路径 :return: """ return os.path.split(os.path.realpath(sys.argv[0]))[0] class COnvifClient: ...
worker_base.py
#SPDX-License-Identifier: MIT """ Helper methods constant across all workers """ import requests import datetime import time import traceback import json import os import sys import math import logging import numpy import copy import concurrent import multiprocessing import psycopg2 import csv import io from logging im...
plot.py
# # Copyright (c) 2018, Manfred Constapel # This file is licensed under the terms of the MIT license. # # # abstract plot support # import sys, time, threading, json, queue import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import art3d # ------------------------...
SongID.py
print(' _ _ ---==== Music Finder ====--- _ _\n') from SongIDProcessor import SIDProcessor from SongIDCore import * from telegram import ParseMode from telegram.utils.helpers import mention_html import sys, traceback from threading import Thread import urllib.request # Check for internet connectivity os....
cleanser.py
# https://discordapp.com/oauth2/authorize?client_id=703918313880944705&scope=bot&permissions=8 import discord, asyncio, time, datetime, threading, timeago, pytz, os from flask import Flask, render_template, request from hashlib import sha256 from subprocess import check_output TOKEN = "no, go away" GUILD = 6491...
runModel.py
import sys, csv, math, random, os import numpy as np from Cnn3DModel import Cnn3DModel from FaceDataset import FaceDataset from ExtendedFeatureDataset import ExtendedFeatureDataset from FaceDataset_tiny import FaceDataset_tiny from FaceDataset_tiny_classifier import FaceDataset_tiny_classifier from multiprocessing impo...
apiproxy_stub_map_test.py
#!/usr/bin/env python # # Copyright 2007 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...
reader.py
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
swarming_load_test_bot.py
#!/usr/bin/env python # Copyright 2013 The Swarming Authors. All rights reserved. # Use of this source code is governed under the Apache License, Version 2.0 that # can be found in the LICENSE file. """Triggers a ton of fake jobs to test its handling under high load. Generates an histogram with the latencies to proce...
test_threading.py
from threading import Thread from loguru import logger import time def test_safe(capsys): first_thread_initialized = False second_thread_initialized = False entered = False output = "" def non_safe_sink(msg): nonlocal entered nonlocal output assert not entered enter...
timeitTest.py
# timeitTest.py import threading import random import time def myWorker(): for i in range(5): print("Starting wait time") time.sleep(random.randint(1,5)) print("Completed Wait") thread1 = threading.Thread(target=myWorker) thread2 = threading.Thread(target=myWorker) thread3 = threading.Thread(target=myWo...
pio_terminal.py
# !/usr/bin/env python # -*- coding: utf-8 -*- import os import sublime import sublime_plugin from threading import Thread from time import sleep from ..libraries import tools from ..libraries.messages import Messages from ..platformio.command import Command from ..libraries.thread_progress import ThreadProgress from...
video.py
#----------------------------------------------------------------------------- # Copyright (c) 2014, Ryan Volz # All rights reserved. # # Distributed under the terms of the BSD 3-Clause ("BSD New") license. # # The full license is in the LICENSE file, distributed with this software. #-----------------------------------...
cli.py
from __future__ import absolute_import import sys import logging from flask_assistant.utils import get_assistant from .schema_handlers import IntentGenerator, EntityGenerator, TemplateCreator from .api import ApiAi from . import logger from multiprocessing import Process logger.setLevel(logging.INFO) api = ApiAi() r...
imgaug.py
from __future__ import print_function, division, absolute_import import random import numpy as np import copy import numbers import cv2 import math from scipy import misc, ndimage import multiprocessing import threading import traceback import sys import six import six.moves as sm import os import skimage.draw import s...
process_data.py
"""Script to periodically query and process new data. WIP not working yet!""" import time from queue import Queue from threading import Thread from datetime import datetime, timedelta from huntsman.drp.datatable import RawDataTable from huntsman.drp.bulter import TemporaryButlerRepository FILTER_NAMES = ["g_band", "...
utils.py
# Copyright 2012-2019 CERN for the benefit of the ATLAS collaboration. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
colaboratory.py
# coding: utf-8 """Colaboratory: the Jupyter Collaborative Computational Laboratory. """ # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. from __future__ import print_function import errno import json import logging import os import random import select import sign...
windows.py
import collections import ctypes import ctypes.wintypes import os import socket import struct import threading import time import configargparse from pydivert import enum from pydivert import windivert from six.moves import cPickle as pickle from six.moves import socketserver PROXY_API_PORT = 8085 class Resolver(ob...
main.py
import asyncio import datetime import json import logging import queue import threading from typing import List from elasticsearch import Elasticsearch from sqlalchemy import create_engine from sqlalchemy.exc import SQLAlchemyError, DBAPIError from sqlalchemy.orm import sessionmaker import validators import adstxt.f...
justhttpd.py
# Copyright (C) Schrodinger, LLC. # All Rights Reserved # # For more information, see LICENSE in PyMOL's home directory. # # justhttpd.py # # vanilla web server designed for testing multi-origin applications # by serving up content on 127.0.0.1:xxxx instead of localhost:yyyy import BaseHTTPServer, cgi, urlparse, socke...
accumulators.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...
btcc.py
from restful_api_socket import RESTfulApiSocket from exchanges.gateway import ExchangeGateway from market_data import L2Depth, Trade from util import Logger from instrument import Instrument from clients.sql_template import SqlClientTemplate import time import threading from functools import partial from datetime impor...