source
stringlengths
3
86
python
stringlengths
75
1.04M
ratelimiter.py
# Original work Copyright 2013 Arnaud Porterie # Modified work Copyright 2016 Frazer McLean # # 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 # ...
main_window.py
from threading import Thread from PySide2 import QtWidgets, QtGui from PySide2.QtCore import Slot, Qt, QRegExp from ui.ui_main_window import Ui_MainWindow from ui.import_dialog import ImportDialog from anime import Anime from animelist import AnimeList from anisong import AnisongStatusNamespace import dat...
ruuvi_gw_http_server.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from socketserver import ThreadingMixIn from http.server import BaseHTTPRequestHandler, HTTPServer import socketserver import threading import argparse import re import json import time import os import sys import shutil import io import select SIMULATION_MODE_NO_CONNECTI...
test_wsgi.py
#! /usr/bin/env python import cgi import io import json import logging import optparse import os.path import random import shutil import tempfile import threading import time import unittest from pyslet import html401 as html from pyslet import iso8601 as iso from pyslet import wsgi from pyslet.http import ( clie...
start_pipelined.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...
scheduler.py
# -*- coding: utf-8 -*- # @Author : AaronJny # @LastEditTime : 2021-03-16 # @FilePath : /LuWu/luwu/scripts/scheduler.py # @Desc : import multiprocessing import os import subprocess import time from loguru import logger from luwu.scripts.utils import ( delete_project_by_id, read_train_projects...
test_dummyaccount_demo.py
import asyncio from threading import Thread import pytest from tests.utils import connect from .dummy_account_node import DummyAccountNode def create_setup_in_new_thread_func(dummy_node): def setup_in_new_thread(): asyncio.ensure_future(dummy_node.setup_crypto_networking()) return setup_in_new_thr...
devicecontroller.py
import datetime import logging import threading import time from flask_restful import fields from core.handler import CSVLogger, AsyncHandler from core.interface import RecordingDeviceStatus, DATETIME_FORMAT, API_PREFIX logger = logging.getLogger('analyser.devicecontroller') deviceFields = { 'deviceId': fields....
spaces_finder.py
#!/usr/bin/env python # "Spaces finder" is a tool to quickly enumerate DigitalOcean Spaces to look for loot. # It's similar to a subdomain bruteforcer but is made specifically to DigitalOcean # Spaces and also has some extra features that allow you to grep for # delicous files as well as download interesting files if ...
ThreadClient.py
from socket import * import threading sevip = '127.0.0.1' sevport = 62581 address = (sevip, sevport) mysock = socket(AF_INET, SOCK_STREAM) print('connecting to server {} on port {}...'.format(sevip, sevport)) mysock.connect(address) print('connection complete') print('If you want to leave chat, just type !quit\n') d...
movietwit.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import os import time import termios import tty import socket import threading import tweepy import json import string import re import HTMLParser import tempfile from tweepy import OAuthHandler from tweepy import Stream from tweepy.streaming import StreamListen...
_threads.py
import threading import queue as stdlib_queue from itertools import count import attr import outcome import trio from ._sync import CapacityLimiter from ._core import enable_ki_protection, disable_ki_protection, RunVar, TrioToken # Global due to Threading API, thread local storage for trio token TOKEN_LOCAL = threa...
test_detect_vitis_pp.py
#!/usr/bin/env python # # // SPDX-License-Identifier: BSD-3-CLAUSE # # (C) Copyright 2019, Xilinx, Inc. # from __future__ import print_function import os, sys from six import itervalues, iteritems from ctypes import * import numpy as np import timeit import waa_rt import cv2 sys.path.append("../../yolo") from vai.dp...
test_api.py
#!/usr/bin/python ############################################################################## # Copyright 2016-2017 Rigetti Computing # # 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 ...
Item55.py
""" Item 55: Use Queue to Coordinate Work Between Threads """ """ Pipelines are useful for concurrent work especially I/O-bound programs. They can run concurrently using Python threads. There are many problems with building concurrent pipelines like: busy waiting, how to tell workers to stop, and potential memo...
OctoprintStatus.py
import json from threading import Thread import websocket from eventlet import sleep from octoclient import WebSocketEventHandler from octoprint_dashboard.app import socketio from octoprint_dashboard.model import Printer class OctoprintDashboardEventHandler(WebSocketEventHandler): def run_with_id(self, printer_...
_threads.py
import threading import queue as stdlib_queue from itertools import count import attr import outcome import trio from ._sync import CapacityLimiter from ._core import enable_ki_protection, disable_ki_protection, RunVar, TrioToken # Global due to Threading API, thread local storage for trio token TOKEN_LOCAL = threa...
test_speed.py
import rpyc import time import threading import unittest import logging from rpyc.utils.server import ThreadedServer from rpyc.core.service import SlaveService BIG = SMALL = connection = bgsrv = None TARGET_HOSTNAME = "localhost" server = None # import pushy # def setup_pushy(): # ''' connect and import the mod...
game.py
# -*- coding: UTF-8 -*- from math import fabs import tkinter from tkinter.constants import ALL from tetris.config import * from tetris.tetris import Tetris from tetris.nexTetris import NexTetris from tetris.nextBlock import NextBlock import random from threading import Timer import threading import time from tetris.db...
mail_service.py
# # BEST-GEESE/backend/services/mail_service.py # from threading import Thread # from flask_mail import Message # from app import app # from app import mail # def send_async_email(app,msg): # with app.app_context(): # try: # mail.send(msg) # except ConnectionRefusedError: # ...
dual_tor_io.py
import datetime import threading import time import socket import random import struct import ipaddress import logging import json import scapy.all as scapyall import ptf.testutils as testutils from operator import itemgetter from itertools import groupby from tests.common.utilities import InterruptableThread from nat...
test_tracer.py
import time import opentracing from opentracing import ( child_of, Format, InvalidCarrierException, UnsupportedFormatException, SpanContextCorruptedException, ) import ddtrace from ddtrace.ext.priority import AUTO_KEEP from ddtrace.opentracer import Tracer, set_global_tracer from ddtrace.opentrace...
main.py
""" TODO """ import os, urllib.parse, requests, ftplib, logging, time, threading, shutil from flask import Flask, request, send_file, jsonify, render_template import downloader logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', datefmt='%d-%b-%y %H:%M:%S') logger = ...
timer.py
''' Created on 30 Aug 2016 @author: tim ''' import time import threading class Countdown_Timer(): def __init__(self,length, signals, display): self.length = length #Length and signals currently in senconds self.signals = signals[:] if 0 not in self.signals: self.signals.append(0) ...
miniterm_mod.py
#!/usr/bin/env python # Very simple serial terminal # This file is part of pySerial. https://github.com/pyserial/pyserial # (C)2002-2015 Chris Liechti <cliechti@gmx.net> # # SPDX-License-Identifier: BSD-3-Clause # Input characters are sent directly (only LF -> CR/LF/CRLF translation is # done), received characters...
__init__.py
import json import sys import re import os import stat import fcntl import shutil import hashlib import tempfile import subprocess import base64 import threading import pipes import uuid import codecs import atexit import signal from distutils.spawn import find_executable from ansible_runner.exceptions import Config...
behave_steps.py
import os from tempfile import mkdtemp from allure_commons_test.report import AllureReport from behave.parser import Parser from behave.runner import ModelRunner from behave.configuration import Configuration from behave.formatter._registry import make_formatters from behave.formatter.base import StreamOpener import th...
worker.py
#!/usr/bin/env python """ Author: Shashank Kotyan Email: shashankkotyan@gmail.com """ import os, random, traceback, pickle, numpy as np from time import time import build from process import Process class Worker: def __init__(self, args, data): self.test = args...
scheduler_command.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...
test_worker.py
import unittest import time import multiprocessing as mp from batch_processor import Worker from util_queue import Queue class TestWorker(unittest.TestCase): def batch_func(self, batch): # do nothing return batch def clean_queues(self): while not self.input_queue.empty(): ...
sass.py
import os import glob import time import sass import logging import threading from django.conf import settings from watchdog.observers import Observer from watchdog.events import FileModifiedEvent def compiler(): BASE_DIR = str(settings.BASE_DIR) staticFolders = settings.STATICFILES_DIRS staticFolders += ...
store.py
from os import unlink, path, mkdir import json import uuid as uuid_builder from threading import Lock from copy import deepcopy import logging import time import threading # Is there an existing library to ensure some data store (JSON etc) is in sync with CRUD methods? # Open a github issue if you know something :) ...
safaribooks.py
#!/usr/bin/env python3 # coding: utf-8 import os import sys import json import shutil import logging import argparse import requests import traceback from lxml import html, etree from html import escape from random import random from multiprocessing import Process, Queue, Value from urllib.parse import urljoin, urlspli...
proxy.py
#!/usr/bin/env python3 import base64 import copy import datetime import json import math import re import socket import shlex import threading from collections import namedtuple from urllib.parse import urlparse, ParseResult, parse_qs, urlencode from subprocess import Popen, PIPE, TimeoutExpired from http import cook...
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(...
helper.py
# # SPDX-License-Identifier: Apache-2.0 # # Copyright 2020 Andrey Pleshakov # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
tarea2.py
from threading import Semaphore, Thread from time import sleep import random ###--El servidor web--### #Lista donde se almacenarán los trabajadores trabajadores = [] conexion = Semaphore(0) #Se empieza con 8 trabajadores disponibles = noTrabajadores = 8 mutexDisponibles = Semaphore(1) def jefe(): global conexio...
test_admission_controller.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...
bazelci.py
#!/usr/bin/env python3 # # Copyright 2018 The Bazel 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 ...
test_pubsub.py
# -*- coding: utf-8 -*- # python std lib from __future__ import with_statement import threading import time # rediscluster imports from rediscluster.client import StrictRedisCluster # 3rd party imports import pytest # import redis from redis import StrictRedis, Redis from redis.exceptions import ConnectionError fro...
analyze_gui.py
#!/bin/python import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk from gi.repository import Pango import os import mimetypes import bliss import csv import sys import threading def analyze(url_lib, url_csv, self): if self.recursive: file_list = [os.path.join(dp, f) for dp, dn, fn in os...
test01.py
import threading import time import logging logging.basicConfig(level=logging.DEBUG, format='(%(threadName)-9s) %(message)s',) def consumer(cv): logging.debug('Consumer thread started ...') with cv: logging.debug('Consumer waiting ...') cv.wait() logging.debug('Consum...
_common.py
""" Common code for all runtimes. Desktop runtimes provide a way to load a page as desktop application. To do so, we may cache or link to an existing runtime (like Firefox) or even keep a local copy of a runtime (like NW.js). Some runtimes (e.g. Firefox) needs a whole directory structure as its app definition. Others ...
get_current_url.py
import webview import threading """ This example demonstrates creating a save file dialog. """ def get_current_url(): import time time.sleep(5) print(webview.get_current_url()) if __name__ == '__main__': t = threading.Thread(target=get_current_url) t.start() webview.create_window("Get curre...
montyhallsim_threaded.py
# Monty Hall Simulator - Threaded ####################################### # Author: Dave Auld # Version: 1.0 # Date: 11th September 2018 # Description: Monty Hall Simulation # using threading and lock for # coordinating any print output. # Demonstrates threading does not help # performance in cpu intensive programs #...
etcd_test.py
# -*- coding: utf-8 -*- """This script tests etcd clients. """ from __future__ import print_function import os.path import shutil import subprocess import sys import tempfile import threading import time import unittest import glog as log from .etcd import get, put, watch class ETCD(threading.Thread): """wrap...
conftest.py
import fcntl import inspect import json import os import platform import re import shutil import signal import stat import subprocess import sys import tempfile import time from multiprocessing import Process import pytest from unit.check.chroot import check_chroot from unit.check.go import check_go from unit.check.is...
example_binance_futures.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # File: example_binance_futures.py # # Part of ‘UNICORN Binance WebSocket API’ # Project website: https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api # Documentation: https://oliver-zehentleitner.github.io/unicorn-binance-websocket-api # PyPI: https://p...
kademlia_v04.py
"""An upgrade of the previous to provide support for a naive broadcast message type.""" from __future__ import annotations import socket from concurrent.futures import Future from functools import partial from hashlib import sha1 from itertools import chain from logging import getLogger from os import urandom from q...
pool.py
import multiprocessing import multiprocessing.pool import multiprocessing.util as util from .queue import SimpleQueue def clean_worker(*args, **kwargs): import gc multiprocessing.pool.worker(*args, **kwargs) # Regular multiprocessing workers don't fully clean up after themselves, # so we h...
common.py
# Copyright (c) 2015 Ansible, Inc. # All Rights Reserved. # Python import json import yaml import logging import os import re import subprocess import stat import urllib.parse import threading import contextlib import tempfile import psutil from functools import reduce, wraps from decimal import Decimal # Django fro...
qt.py
#!/usr/bin/env python # # Electrum - Lightweight Futurocoin Client # Copyright (C) 2015 Thomas Voegtlin # # 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 with...
test_html.py
from functools import partial from importlib import reload from io import BytesIO, StringIO import os import re import threading from urllib.error import URLError import numpy as np from numpy.random import rand import pytest from pandas.compat import is_platform_windows from pandas.errors import ParserError import p...
orte_lib.py
__copyright__ = "Copyright 2016, http://radical.rutgers.edu" __license__ = "MIT" import os import time import threading as mt import subprocess as mp import radical.utils as ru from .base import LaunchMethod # ------------------------------------------------------------------------------ # # NOTE: This r...
judge.py
import os import config import tools from subprocess import (run, PIPE, TimeoutExpired) from multiprocessing import Queue from threading import Thread def __thread_worker__(): global job_queue while True: attempt = job_queue.get() if not attempt['evaluated']: attid = attempt['attem...
main.py
''' Copyright 2016 Nathan Povo 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 writing, software di...
hrg-nm.py
#!/usr/bin/env python __version__="0.1.0" __author__ = 'tweninge' __author__ = 'saguinag' # Version: 0.1.0 Forked from cikm_experiments.py # # ToDo: # import cPickle import subprocess import traceback import argparse import os import sys reload(sys) sys.setdefaultencoding('utf-8') import networkx as nx import panda...
dist_abs.py
# coding: utf-8 ### # @file dist_run.py # @author Arsany Guirguis <arsany.guirguis@epfl.ch> # # @section LICENSE # # Copyright (c) 2019 Arsany Guirguis. # # @section DESCRIPTION # # Distributed setup code. Just for trying basic constructs of distributed learning in PyTorch. Based on: https://pytorch.org/tu...
detector_utils.py
# Utilities for object detector. import numpy as np import sys #import tensorflow as tf import tensorflow.compat.v1 as tf tf.disable_v2_behavior() import os from threading import Thread from datetime import datetime import cv2 from utils import label_map_util from collections import defaultdict detectio...
idf_monitor.py
#!/usr/bin/env python # # esp-idf serial output monitor tool. Does some helpful things: # - Looks up hex addresses in ELF file with addr2line # - Reset ESP32 via serial RTS line (Ctrl-T Ctrl-R) # - Run "make flash" (Ctrl-T Ctrl-F) # - Run "make app-flash" (Ctrl-T Ctrl-A) # - If gdbstub output is detected, gdb is automa...
futures.py
# The MIT License (MIT) # # Copyright (c) 2018 Niklas Rosenstein # # 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,...
CryptoAI.py
import yfinance as yf #Not used in this program import cryptocompare import talib as ta from binance.client import Client from binance.websockets import BinanceSocketManager from twisted.internet import reactor from sklearn.svm import SVR import pandas as pd import numpy as np import os, json, requests, threading fro...
Bojokuq.py
# -*- coding: utf-8 -*- import LINETCR from LINETCR.lib.curve.ttypes import * from datetime import datetime import time, random, sys, ast, re, os, io, json, subprocess, threading, string, codecs, requests, tweepy, ctypes, urllib, urllib2, wikipedia, goslate import timeit from bs4 import BeautifulSoup from urllib impor...
tests.py
''' Usage ----- To execute these tests, we need to have two servers serving the eduid-signup app, both configured to use the same MongoDB databases. The URLs at which these server listen for HTTP requests must be set below as ``SIGNUP_SERVER_1`` and ``SIGNUP_SERVER_1``. We must also configure ``SMTP_SERVER`` with an a...
test.py
''' @ 版权所有:Copyright (c) 2020 @ 授权类型:MIT License @ 文件名:test.py @ 文件功能描述:基于树莓派的电子墨水屏智能终端设计主程序部分 @ 创建日期:2020年10月20日 @ 创建人:Yellow_feces ''' #encoding: utf8 #### 导入函数库 #### import argparse # 导入命令行接口库 import time # 导入时间库 import cv2 # 导入opencv图像处理库 import numpy as np # 导入数据处理库 import datetime # 导入日期处理库 import t...
PySight3.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Script to pull indicators from the FireEye intelligence APIv3 and collect them as MISP events. # # See CHANGELOG.md for history import _thread import datetime import email.utils import hashlib import hmac import json import os import pymisp from pymisp import ExpandedPy...
__main__.py
from __future__ import division, unicode_literals, print_function, absolute_import # Ease the transition to Python 3 # stdlib imports import os import sys import socket import logging import threading import signal import subprocess import time import traceback import pprint import ast # Turn on our...
view.py
from kivy.uix.screenmanager import ScreenManager, Screen from kivy.core.window import Window from kivy.animation import Animation from kivy.clock import Clock, mainthread from kivy.uix.screenmanager import FadeTransition from kivy.uix.label import Label from kivy.uix.anchorlayout import AnchorLayout from kivy.propertie...
server.py
import socket import time import threading s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind(('127.0.0.1', 9999)) def tcplink(sock, addr): print 'Accept new connection from %s:%s...' % addr sock.send('Welcome!') while True: data = sock.recv(11024) time.sleep(1) if data...
test_Future.py
# # Unit Tests for the Future class # # Rajul Srivastava (rajul09@gmail.com) # import unittest import logging import threading import time import sys from ginga.misc.Future import Future, TimeoutError class TestError(Exception): pass class TestFuture(unittest.TestCase): def setUp(self): self.futu...
main_nao.py
import os import threading from naoqi import ALProxy import time import sys def intro(subject_id=0, nao_ip='192.168.0.104'): start_working(subject_id, nao_ip) time.sleep(60) def start_working(subject_id, nao_ip): def worker1(): os.system('roslaunch multi_camera_affdex multi_camera_affdex.launc...
thread_Demo.py
''' Created on 2016年8月9日 @author: Administrator ''' import time, threading # 新线程执行的代码: def loop(): print('thread %s is running...' % threading.current_thread().name) n = 0 while n < 5: n = n + 1 print('thread %s >>> %s' % (threading.current_thread().name, n)) time.sleep(1) prin...
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...
iperf.py
import sys import json import time import socket import functools from multiprocessing import Process, Event from multiprocessing.sharedctypes import Value from collections import defaultdict from lib.membase.api import httplib2 from lib.membase.api.rest_client import RestConnection from lib.membase.helper.rebalance_h...
argononed.py
#!/usr/bin/env python import smbus import RPi.GPIO as GPIO import os import time from threading import Thread rev = GPIO.RPI_REVISION if rev == 2 or rev == 3: bus = smbus.SMBus(1) else: bus = smbus.SMBus(0) GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) shutdown_pin = 4 GPIO.setup(shutdown_pin, GPIO.IN, pull...
ex6 (2).py
import os import threading,time l=[] i=0 while i<3: x=input("enter the ip address=") l.append(x) i=i+1 def ping(ip): res = os.popen("ping "+ip).read() print(res) i=0 while i<len(l): t=threading.Thread(target=ping,args=(l[i],)) t.start() i=i+1 time.sl...
test_ssl.py
# Test the support for SSL and sockets import sys import unittest import unittest.mock from test import support from test.support import socket_helper import socket import select import time import datetime import gc import os import errno import pprint import urllib.request import threading import traceback import as...
test_new_kvstore.py
import os import time import numpy as np import socket from scipy import sparse as spsp import dgl import backend as F import unittest, pytest from dgl.graph_index import create_graph_index import multiprocessing as mp from numpy.testing import assert_array_equal if os.name != 'nt': import fcntl import struct ...
test_promise.py
# Copyright 1999-2020 Alibaba Group Holding Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
globalKmeansThread.py
import numpy as np import math from threading import Thread import randomKmeans globalDictionary = {} def globalKmeansThread(samples, k, tolerance): global globalDictionary tempCLusterList = [] tempCLusterList.append(np.array(samples[0])); curClustError, centroid, clusterList = randomKmeans.randomKmeans(sample...
pluginhandler.py
# -*- coding: utf-8 -*- # vim: ts=2 sw=2 et ai ############################################################################### # Copyright (c) 2012,2021 Andreas Vogel andreas@wellenvogel.net # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentatio...
test_runner.py
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Runs perf tests. Our buildbot infrastructure requires each slave to run steps serially. This is sub-optimal for android, where these steps can run indepe...
inference.py
# -*- coding: utf-8 -*- {{{ # vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et: # # Copyright (2021) Battelle Memorial Institute # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions #...
test_api_actions.py
import json import string import random import shutil import os import pika from subprocess import call from .api_util import create_user, create_repo, delete_all_repos_from_db, get_repo_resource_dir, clone_if_not from .api_util import delete_all_users, prepare_resource_dir import logging from multiprocessing import P...
agg_query.py
#!/bin/python3 import datetime import time import multiprocessing import random import sys import argparse from memsql.common import database STATE = ["AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "DC", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE"...
ZMQUtils.py
import argparse import multiprocessing import numpy as np import os import time import zmq class cd: def __init__(self,newPath): self.newPath=os.path.expanduser(newPath) def __enter__(self): self.savedPath=os.getcwd() os.chdir(self.newPath) def __exit__(self,etype,value,traceback): os.chdir(self.savedPath) d...
control.py
# -*- coding: utf-8 -*- from config import aria2, BOT_name import sys from pyrogram.types import InlineKeyboardMarkup,InlineKeyboardButton import os import time import threading import asyncio import subprocess import re import nest_asyncio nest_asyncio.apply() os.system("df -lh") task=[] def check_upload(api, gid)...
fake_bulb.py
"""Start up a fake bulb to test features without a real bulb.""" import json import socketserver import threading BULB_INIT_PILOT = json.loads( '{\ "method":"getPilot",\ "env":"pro",\ "result":{\ "mac":"ABCABCABCABC",\ "rssi":-62,\ "src":"",\ "state":false,\ "sceneId":0,\ ...
07_deploy_gevent.py
from gevent.pywsgi import WSGIServer from multiprocessing import cpu_count, Process import luckyweb.blocks as B from luckyweb import LuckyWeb def helloserver(request, response): if request.method == 'POST': return response.jsonify(request.params) html = B.HtmlBlock(title='luckyweb deploy') grid = ...
Dataset.py
""" This module defines the tools to perform and manage several calculations. The usage of this module aims to simplify the approach to an ensemble calculations using both QuantumESPRESSO and Yambo, and to deal with parallel executions of multiple instances of the code. """ from mppi.Calculators.Runner import Runner ...
regen.py
#!/usr/bin/env python3 import bz2 import os import time import multiprocessing from tqdm import tqdm import argparse # run DM procs os.environ["USE_WEBCAM"] = "1" import cereal.messaging as messaging from cereal import car from cereal.services import service_list from cereal.visionipc.visionipc_pyx import VisionIpcSer...
Merlin.py
from .Detector import Detector, SoftwareLiveDetector, TriggeredDetector, BurstDetector from ..recorders.Hdf5Recorder import Link from ..environment import env import time import numpy as np import os import requests import json import zmq from threading import Thread TRIG_MODES = {'internal': 0, 'rising_ttl': 1, 'sof...
app.py
# encoding: utf-8 ''' A REST API for Salt =================== .. py:currentmodule:: salt.netapi.rest_cherrypy.app :depends: - CherryPy Python module. Note: there is a `known SSL traceback for CherryPy versions 3.2.5 through 3.7.x <https://github.com/cherrypy/cherrypy/issues/1298>`_. Please use ...
eSSP.py
# !/usr/bin/env python3 import threading from ctypes import * from time import sleep from six.moves import queue from .constants import Status, FailureStatus, Actions class Ssp6ChannelData(Structure): _fields_ = [("security", c_ubyte), ("value", c_uint), ("cc", c_char * 4)] cla...
orderbook.py
"""The websocket feed provides real-time updates on orders and trades. These updates can be applied on to a level 2 or 3 order book snapshot to maintain an accurate and up-to-date copy of the exchange order book. Find more here: `<https://docs.exchange.coinbase.com/#real-time-order-book>`_ .. module:: orderbook :...
fn_api_runner.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...
testing_utils.py
""" weasyprint.tests.testing_utils ------------------------------ Helpers for tests. """ import contextlib import functools import logging import os.path import sys import threading import wsgiref.simple_server from weasyprint import CSS, HTML, images from weasyprint.css import get_all_computed_styles f...
battleship_client.py
import grpc import logging import queue import threading import uuid from battleships_pb2 import Attack, Request, Response, Status from battleships_pb2_grpc import BattleshipsStub from client_interface import ClientInterface logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) class BattleshipClient(...
patcher_test.py
import os import shutil import sys import tempfile from eventlet.support import six import tests base_module_contents = """ import socket import urllib print("base {0} {1}".format(socket, urllib)) """ patching_module_contents = """ from eventlet.green import socket from eventlet.green import urllib from eventlet im...
__main__.py
"""isort:skip_file""" # first, logging level lower import os os.environ["KCFG_KIVY_LOG_LEVEL"] = os.environ.get("KCFG_KIVY_LOG_LEVEL", "warning") if "KIVY_AUDIO" not in os.environ: os.environ["KIVY_AUDIO"] = "sdl2" # seems to be most stable / some players hard crash # next, icon from katrain.core.utils import fi...