source
stringlengths
3
86
python
stringlengths
75
1.04M
queues.py
import cloudpickle import json import rabbitpy import threading import time from config import Config class ChannelClosedException(Exception): pass class RabbitConnection(object): def __init__(self, retries=100): self._uri = Config.get('rabbit', 'uri') tries = 0 connected = False ...
test_model.py
from multiprocessing import Process from time import sleep from typing import List import numpy as np import rx from rx.subject import Subject from colliflow.model import Model from colliflow.modules import * from colliflow.modules.tcp_server_subgraph import ( StreamingServerSubgraph, TcpServerSubgraph, ) fro...
helloworld_threads.py
#!/usr/bin/env python # This is an example multithreaded program that is used # by different examples and tests. import os import sys import time import socket import threading # ------------------------------------------------------------------------------ # if __name__ == '__main__': import socket host =...
process.py
"""Widgets to work with processes.""" # pylint: disable=no-self-use # Built-in imports import os import warnings from inspect import isclass from inspect import signature from threading import Event from threading import Lock from threading import Thread from time import sleep # External imports import ipywidgets as i...
Util.py
import logging class ApplicationDispatcher(object): def __init__(self): self.events = {} self.args = {'trace':False} self.flag = True from queue import Queue self.queue = Queue() from threading import Thread, Event self.lock = Event() self.thread = Th...
dhcpdoctor.py
import argparse import binascii import sys import threading import time from random import randint from scapy.all import ( BOOTP, DHCP, DHCP6, DUID_LL, IP, UDP, AnsweringMachine, DHCP6_Advertise, DHCP6_RelayForward, DHCP6_Reply, DHCP6_Solicit, DHCP6OptClientId, DHCP6...
network.py
""" Created on 27 Sep 2020 @author: Bruno Beloff (bruno.beloff@southcoastscience.com) """ import os import time from abc import ABC from multiprocessing import Process from subprocess import Popen # --------------------------------------------------------------------------------------------------------------------...
google_ip.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # based on checkgoogleip 'moonshawdo@gmail.com' import threading import operator import time import Queue import os current_path = os.path.dirname(os.path.abspath(__file__)) import check_ip import google_ip_range from proxy import xlog from config import config import co...
task.py
""" * Copyright (C) Caleb Marshall and others... - All Rights Reserved * Written by Caleb Marshall <anythingtechpro@gmail.com>, May 27th, 2017 * Licensing information can found in 'LICENSE', which is part of this source code package. """ import time import threading class TaskResult(object): """ A enum for...
semaphore_palyground.py
# import time # import threading # import random # # data = {"banana7": False, # "banana1": False, # "banana2": False, # "banana3": False, # "banana4": False, # "banana5": False, # "banana6": False} # semaphore = threading.Semaphore(0) # class LockHelpTest(): # def __...
old_boopsniff_gui.py
#!/usr/bin/env python __year__ = [2016, 2017] __status__ = "Testing" __contact__ = "jacobsin1996@gmail.com" import argparse import logging import string import pyric import pyric.pyw as pyw logging.getLogger("scapy.runtime").setLevel(logging.ERROR) from tkinter import * import tkMessageBox from getpass import...
tkgpio.py
import os from .base import TkDevice, SingletonMeta from .base import PreciseMockTriggerPin, PreciseMockFactory, PreciseMockChargingPin, MockMCP3002 from gpiozero import Device from gpiozero.pins.mock import MockPWMPin from PIL import ImageEnhance, Image, ImageTk from sounddevice import play, stop import numpy import ...
swarmlib.py
#!/usr/bin/python2.7 from __future__ import division import rospy import tf from geometry_msgs.msg import PoseStamped, TransformStamped, Twist from nav_msgs.msg import Path from math import * import math import time from time import sleep from std_srvs.srv import Empty from tf2_msgs.msg import TFMessage import messag...
socket-server.py
#!/usr/bin/python3 from socket import AF_INET, SOCK_STREAM, socket from threading import Thread from GroupChat import GroupChat class SocketServer: def __init__(self, port): self.current_port = 9999 self.group_list = {} self.client_list = [] self.server_socket = socket(A...
flask_app.py
import os import typing from http import HTTPStatus import threading import hashlib import flask import pymongo from energuide import database from energuide import cli from energuide import logger LOGGER = logger.get_logger(__name__) App = flask.Flask(__name__) DEFAULT_ETL_SECRET_KEY = 'no key' App.config.updat...
track.py
import uuid from six.moves.urllib.parse import quote # python 2/3 compatible urllib import import requests from threading import Thread from django.conf import settings GOOGLE_ANALYTICS_BASE_URL = "https://www.google-analytics.com" GOOGLE_ANALYTICS_COLLECT_URL = GOOGLE_ANALYTICS_BASE_URL + "/collect" GOOGLE_ANALYTI...
manager.py
#!/usr/bin/env python2.7 import os import sys import fcntl import errno import signal import subprocess from common.basedir import BASEDIR sys.path.append(os.path.join(BASEDIR, "pyextra")) os.environ['BASEDIR'] = BASEDIR if __name__ == "__main__": if os.path.isfile("/init.qcom.rc") \ and (not os.path.isfile("...
input_pull_socket_unittest.py
#!/usr/bin/env python3 # # Copyright 2017 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Unittests for input socket plugin.""" import logging import socket import threading import time import unittest from unittest...
binary_test.py
import argparse import time import pdb import numpy as np from load_binary_score import BinaryDataSet from binary_model import BinaryClassifier from transforms import * from torch import multiprocessing from torch.utils import model_zoo from ops.utils import get_actionness_configs, get_reference_model_url global arg...
Startup.py
__builtins__.iOS = 'iOS' __builtins__.macOS = 'macOS' __builtins__.__platform__ = __builtins__.iOS __builtins__.widget = 'widget' __builtins__.app = 'app' __builtins__.__host__ = None import sys import console as Pyto import pyto from importlib.machinery import SourceFileLoader import importlib import threading from ...
mainGUI.py
import math import tkinter as tk from random import randint from threading import Thread, Event from time import sleep from tkinter import Tk, ttk, messagebox from highscoreHandler import HighscoreHandler from testInfo import kana_hiragana, kana_katakana score = 0 timer = 0 timer_term = Event() correctAnsw...
distributed_rake.py
# -*- coding: utf-8 -*- """Implementation of Rapid Automatic Keyword Extraction algorithm. As described in the paper `Automatic keyword extraction from individual documents` by Stuart Rose, Dave Engel, Nick Cramer and Wendy Cowley. """ import string from collections import Counter, defaultdict from itertools import c...
alsa.py
import threading import subprocess import socket import time from . import base class AlsaOutput(base.Object): def __init__(self, name, device, nchannels=2, quality=None, rate=48000, period=256, extra_parms=None): self.name = name self.device = device self.nchannels = nchannels self...
traybar.py
import os from .win32_adapter import * import threading import uuid class SysTrayIcon(object): """ menu_options: tuple of tuples (menu text, menu icon path or None, function name) menu text and tray hover text should be Unicode hover_text length is limited to 128; longer text will be truncat...
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...
loop.py
import sys import time import json import threading import traceback import collections try: import Queue as queue except ImportError: import queue from . import exception from . import _find_first_key, flavor_router class RunForeverAsThread(object): def run_as_thread(self, *args, **kwargs): t =...
multiproc.py
# Copyright 2020 The Chromium OS 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 logging import os import select import threading """Zmake multiprocessing utility module. This module is used to aid in zmake's multiprocessing. I...
test_pocs.py
import os import pytest import time import threading from astropy import units as u from pocs import hardware from pocs.core import POCS from pocs.observatory import Observatory from pocs.utils import CountdownTimer from pocs.utils.messaging import PanMessaging from pocs.utils import error from pocs.utils import curr...
test_utils_test.py
import asyncio from contextlib import contextmanager import socket import threading from time import sleep import pytest from distributed import Scheduler, Worker, Client, config, default_client from distributed.core import rpc from distributed.metrics import time from distributed.utils_test import ( # noqa: F401 ...
HttpEndpoint.py
# -*- coding: utf-8 -*- """ pip_services3_rpc.services.HttpEndpoint ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Http endpoint implementation :copyright: Conceptual Vision Consulting LLC 2018-2019, see AUTHORS for more details. :license: MIT, see LICENSE for more details. """ import json import re import tim...
ninja.py
# Copyright 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. # A copy of the License is located at # # http://www.apache.org/licenses/LICENSE-2.0 # # or in the "license" fil...
sema_signal.py
# sema_signal.py # # An example of using a semaphore to signal import threading import time done = threading.Semaphore(0) # Max: unlimit threads item = None def producer(): global item print("I'm the producer and I produce data.") print("Producer is going to sleep.") time.sleep(2) item = "Hello" ...
helpers.py
""" Helper functions file for OCS QE """ import base64 import random import datetime import hashlib import json import logging import os import re import statistics import tempfile import threading import time import inspect from concurrent.futures import ThreadPoolExecutor from itertools import cycle from subprocess i...
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...
app.py
""" author: Jerry Wu all tasks to run are included in this file """ import os import time import threading from cv2 import cuda_BufferPool import RPi.GPIO as GPIO from flask import Flask, render_template, redirect import go_to_bed ### constants ### MIN_DELAY = 10 # delay for tasks need to u...
instance_model.py
# coding: utf-8 import time import threading class Singleton(object): _instance_lock = threading.Lock() def __init__(self): time.sleep(1) @classmethod def instance(cls, *args, **kwargs): with Singleton._instance_lock: if not hasattr(Singleton, "_instance"): ...
multiprocess.py
from __future__ import absolute_import import logging import time from multiprocessing import Process, Queue as MPQueue, Event, Value try: from Queue import Empty except ImportError: # python 2 from queue import Empty from .base import ( AUTO_COMMIT_MSG_COUNT, AUTO_COMMIT_INTERVAL, NO_MESSAGES_WAIT_...
mirror.py
import requests from telegram.ext import CommandHandler, run_async from telegram import InlineKeyboardMarkup from bot import Interval, INDEX_URL, BUTTON_THREE_NAME, BUTTON_THREE_URL, BUTTON_FOUR_NAME, BUTTON_FOUR_URL, BUTTON_FIVE_NAME, BUTTON_FIVE_URL, BLOCK_MEGA_LINKS from bot import dispatcher, DOWNLOAD_DIR, D...
messenger.py
import datetime import time import threading import requests from PyQt5 import QtWidgets import design class MessengerApp(QtWidgets.QMainWindow, design.Ui_MainWindow): def __init__(self): super().__init__() self.setupUi(self) self.pushButton.clicked.connect(self.send) receive_thr...
demo_landmarks_mp.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import _init_paths import caffe import cv2 import numpy as np from python_wrapper import * import os from timeit import default_timer as timer from picamera.array import PiRGBArray from picamera import PiCamera from threading import Thread import imutils from imutils.video...
video_stage_manager.py
# =============================================================================== # Copyright 2011 Jake Ross # # 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/licens...
keylogger.pyw
#start from pynput.keyboard import Listener import os import logging from shutil import copyfile import threading from threading import Thread import sys, glob import time # autostarts username = os.getlogin() copyfile('keylogger.py', f"C:\\Users\\{username}\\AppData\\Roaming\\Microsoft\\Windows\\Start Men...
client.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 app...
model copy.py
import ctypes import json import threading from datasets.utils.filelock import logger from torch import nn import torch import os import asyncio from transformers import AutoTokenizer, AutoConfig from tritonclient.utils import np_to_triton_dtype from watchdog.events import EVENT_TYPE_MODIFIED import triton_python_bac...
ThreadedGenerators.py
# Copyright 2021, Kay Hayen, mailto:kay.hayen@gmail.com # # Python tests originally created or extracted from other peoples work. The # parts were too small to be protected. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the ...
server.py
""" Utilities for creating bokeh Server instances. """ import datetime as dt import html import inspect import logging import os import pathlib import signal import sys import traceback import threading import uuid from collections import OrderedDict from contextlib import contextmanager from functools import partial,...
example_checkpointing_serial.py
""" .. module:: example_checkpointing_serial :synopsis: Example Checkpointing Serial .. moduleauthor:: David Eriksson <dme65@cornell.edu> """ from pySOT.experimental_design import SymmetricLatinHypercube from pySOT.strategy import SRBFStrategy from pySOT.surrogate import RBFInterpolant, CubicKernel, LinearTail from ...
maint.py
# -*- coding: utf-8 -*- ''' Define the behaviors used in the maintinance process ''' # Import python libs import multiprocessing import os # Import ioflo libs import ioflo.base.deeding # Import salt libs import salt.fileserver import salt.loader import salt.utils.minions import salt.daemons.masterapi class SaltRaet...
approvals_test.py
#!/usr/bin/env python """Tests for API client and approvals-related API calls.""" import threading import time from absl import app from grr_response_core.lib.util import compatibility from grr_response_server.gui import api_auth_manager from grr_response_server.gui import api_call_router_with_approval_checks from g...
stratum.py
# coding=utf-8 # # Copyright 2018-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...
test_pdb.py
# A test suite for pdb; not very comprehensive at the moment. import doctest import os import pdb import sys import types import codecs import unittest import subprocess import textwrap from contextlib import ExitStack from io import StringIO from test.support import os_helper # This little helper class is essential ...
__init__.py
import logging import os import signal import sys import time from .daemon import AbstractPatroniDaemon, abstract_main from .version import __version__ logger = logging.getLogger(__name__) PATRONI_ENV_PREFIX = 'PATRONI_' KUBERNETES_ENV_PREFIX = 'KUBERNETES_' class Patroni(AbstractPatroniDaemon): def __init__(...
ping.py
from flask import Flask from threading import Thread import random app = Flask('') @app.route('/') def home(): return "OK THIS IS HOW YOU KEEP YOUR BOT ONLINE !" def run(): app.run(host='0.0.0.0',port=random.randint(2000,9000)) def awake(): t = Thread(target=run) t.start()
8.py
import threading #http://codingpy.com/article/python-201-a-tutorial-on-threads/ total = 0 lock = threading.Lock() def update_total(amount): """ Updates the total by the given amount """ global total lock.acquire() try: total += amount finally: lock.release() print (total...
tumblrdownloader.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Tumblr photo downloader """ import sys, os, errno import urllib2 import threading import Queue import time import signal import argparse from xml.dom import minidom __version__ = 0.1 URL_FORMAT = 'http://%s.tumblr.com/api/read?type=photo&num=%d&start=%d' def images...
main.py
import tkinter import cv2 # pip install opencv-python import PIL.Image, PIL.ImageTk # pip install pillow from functools import partial import threading import time import imutils stream = cv2.VideoCapture("clip.mp4") flag = True def play(speed): global flag print(f"You clicked on play. Speed is {speed}") ...
lisp-itr.py
# ----------------------------------------------------------------------------- # # Copyright 2013-2019 lispers.net - Dino Farinacci <farinacci@gmail.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...
client.py
import threading import socket apelido = input('Escolha seu apelido: ') client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) client.connect(('127.0.0.1', 5555)) def receive_client(): while True: try: data = client.recv(1024).decode('utf-8') if data == 'NICK': ...
raspiCam.py
#!/usr/bin/python import socket import sys import struct import os import string import threading import time import select import fcntl import datetime import picamera from Queue import Queue from message import Message global INIT_DELAY global LOCAL_DIR global myIP global sendQ global instructQueue global myIP ...
picarTcpService.py
#!/usr/bin/python3 # File name : picarTcpService.py # Description : handles commands for PiCar import os import socket import time import threading import argparse from collections import deque import cv2 import base64 import zmq from piServices.piUtils import timePrint import picarCommandHandler import picarConst ...
models.py
""" A2C, IA2C, MA2C models @author: Tianshu Chu """ import os from agents.utils import * from agents.policies import * import logging import multiprocessing as mp import numpy as np import tensorflow as tf class A2C: def __init__(self, n_s, n_a, total_step, model_config, seed=0, n_f=None): # load paramet...
CameraStreamerProcess.py
# Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC organizers # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the above copyright notice, ...
ServiceWorker.py
# Copyright 2018 Braxton Mckee # # 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 t...
windows.py
import os import queue import threading import time from dusted.config import config watcher = None stdout = queue.Queue() class LogfileWatcher: def __init__(self, path): self.path = path self.size = 0 self.file = None def start(self): while 1: try: ...
tab_base_classes.py
##################################################################### # # # /tab_base_classes.py # # # # Copyright 2013, Monash University ...
main.py
import pdb import time import os import subprocess import re import random import json import numpy as np import glob from tensorboard.backend.event_processing.event_accumulator import EventAccumulator import socket import argparse import threading import _thread import signal from datetime import datetime import csv ...
botCore.py
#! /usr/bin/env python3 import os import sys import time import json import os.path import hashlib import logging import threading from decimal import Decimal from flask_socketio import SocketIO from flask import Flask, render_template, url_for, request from binance_api import api_master_rest_caller from binance_api i...
env_player.py
# -*- coding: utf-8 -*- """This module defines a player class exposing the Open AI Gym API. """ from abc import ABC, abstractmethod, abstractproperty from gym.core import Env # pyre-ignore from queue import Queue from threading import Thread from typing import Any, Callable, List, Optional, Tuple, Union from poke_...
__main__.py
import signal import sys import argparse import mimetypes import os import threading from . import console from . import img from . import snd from . import vid from . import yt def get_args(): doc = """ View images and videos without leaving the console.\n Requires a terminal that supports truecolor and utf-8\n...
__init__.py
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2018-2019 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the ...
conv2d_energy_profiling.py
import os from threading import Thread import time import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F from torch.autograd import Variable import torch.utils.data as Data import numpy as np from multiprocessing import Process from numpy import * import torch.multiprocessing as...
test_html.py
from functools import partial from importlib import reload from io import ( BytesIO, StringIO, ) import os from pathlib import Path import re import threading from urllib.error import URLError import numpy as np import pytest from pandas.compat import is_platform_windows from pandas.errors imp...
test_caproto_interoperability.py
import sys; sys.path.append("..") try: from .. import CA except ValueError: import CA caget = CA.caget caput = CA.caput def install(module_name): from logging import warning try: try: from pip import main as pipmain except ImportError: from pip._internal.main import main as pipmain pip...
imcombine.py
#============================================================ # PYTHON SCRIPT FOR MEDIAN COMBINE WITH IRAF # Usage : # python imcombine.py # OR JUST RUN AND WRITE INPUT & REF IMAGE # 2019.05.08 GREGORY S.H. PAEK #============================================================ from astropy.io import fits import astropy.un...
amp_actichamp.py
#!/usr/bin/env python #-*- coding:utf-8 -*- #Copyright (C) 2018, Nudt, JingshengTang, All Rights Reserved #Author: Jingsheng Tang #Email: mrtang@nudt.edu.cn import numpy as np import socket import multiprocessing # import platform import mmap import sys import struct import platform if platform.system()=='Linux': ...
core.py
# -*- coding: utf-8 -*- u"""SecureTea. Project: โ•”โ•โ•—โ”Œโ”€โ”โ”Œโ”€โ”โ”ฌ โ”ฌโ”ฌโ”€โ”โ”Œโ”€โ”โ•”โ•ฆโ•—โ”Œโ”€โ”โ”Œโ”€โ” โ•šโ•โ•—โ”œโ”ค โ”‚ โ”‚ โ”‚โ”œโ”ฌโ”˜โ”œโ”ค โ•‘ โ”œโ”ค โ”œโ”€โ”ค โ•šโ•โ•โ””โ”€โ”˜โ””โ”€โ”˜โ””โ”€โ”˜โ”ดโ””โ”€โ””โ”€โ”˜ โ•ฉ โ””โ”€โ”˜โ”ด โ”ด Version: 1.1 Module: SecureTea """ # To share mouse gestures and post on Twitter import struct import sys import time import json import platform import pyudev import...
_server.py
# Copyright 2016 gRPC 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...
dumb_micro_ros.py
#!/usr/bin/env python # Software License Agreement (BSD License) # # 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 # notice, this list of conditi...
task_manager.py
''' Vortex OpenSplice This software and documentation are Copyright 2006 to TO_YEAR ADLINK Technology Limited, its affiliated companies and licensors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the Lice...
monasca.py
# # Copyright 2015 Hewlett Packard # (c) Copyright 2018 SUSE 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 app...
JDBCConnectionWrapper.py
"""This module holds a ConnectionWrapper that is used with a JDBC Connection. The module should only be used when running Jython. """ # Copyright (c) 2009-2014, Aalborg University (chr@cs.aau.dk) # All rights reserved. # Redistribution and use in source anqd binary forms, with or without # modification, are permit...
BackgroundWorker.py
# # BackgroundWorker.py # # (c) 2020 by Andreas Kraft # License: BSD 3-Clause License. See the LICENSE file for further details. # # This class implements a background process. # from __future__ import annotations from Logging import Logging import time, random, sys from threading import Thread from typing import Call...
pyminer.py
#!/usr/bin/python # # Copyright (c) 2011 The EmpireCoin 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 imp...
streamconn_on_and_off.py
""" In this example code we will show how to shut the streamconn websocket connection down and then up again. it's the ability to stop/start the connection """ import logging import threading import asyncio import time from alpaca_trade_api import StreamConn from alpaca_trade_api.common import URL ALPACA_API_KEY = "<Y...
event.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import threading import time def order(): print('็‚นๅฎŒ่œ๏ผŒ็ญ‰ๅพ…ไธŠ่œโ€ฆโ€ฆ') while not event.is_set(): time.sleep(0.6) print('่œๅฅฝไบ†ๆฒก๏ผŸ') if not event.is_set() else print('็œŸ็š„ๆฅไบ†') # event.wait() print('ๅผ€ๅƒ๏ผ') def serve(): time.sleep(2) event.set() ...
regrtest.py
#! /usr/bin/env python3 """ Script to run Python regression tests. Run this script przy -h albo --help dla documentation. """ USAGE = """\ python -m test [options] [test_name1 [test_name2 ...]] python path/to/Lib/test/regrtest.py [options] [test_name1 [test_name2 ...]] """ DESCRIPTION = """\ Run Python regression t...
data_store_test.py
#!/usr/bin/env python # -*- mode: python; encoding: utf-8 -*- """These are basic tests for the data store abstraction. Implementations should be able to pass these tests to be conformant. """ import csv import functools import hashlib import logging import operator import os import random import string import tempf...
nameMiddleware.py
#Middleware para organizar os servidores de nomes replicados # -*- coding: utf-8 -*- import os import socket, string import sys import threading import heapq import time server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ip = 'localhost' porta = 12388 server.bind((ip,porta)) server.listen(10) #a heap รฉ mini...
test_multitask.py
import sys import threading from niveristand import nivs_rt_sequence, NivsParam from niveristand import realtimesequencetools from niveristand.clientapi import I32Value from niveristand.clientapi import RealTimeSequence from niveristand.errors import TranslateError, VeristandError from niveristand.library import multit...
animator.py
import multiprocessing import os from giraphics.utilities.utils import listlike from giraphics.utilities import convert import sys from giraphics.graphing.fancygraphs import FancyGraphs from giraphics.utilities.timer import Timer ''' TODO: Fix grid issue, too bold : Quality control : Create work spaces : D...
tkgpio.py
from .base import TkDevice, SingletonMeta from .base import PreciseMockTriggerPin, PreciseMockFactory, PreciseMockChargingPin from gpiozero import Device from gpiozero.pins.mock import MockPWMPin from PIL import ImageEnhance, Image, ImageDraw, ImageFont, ImageTk from sounddevice import play, stop import numpy import sc...
alooma_pysdk.py
# -*- coding: utf8 -*- # This module contains the Alooma Python SDK, used to report events to the # Alooma server from __future__ import absolute_import import datetime import decimal import inspect import json import logging import random import requests import threading import time import uuid try: from OpenSS...
prefetcher.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...
stream_layered_image.py
""" This script generates a Docker image from a set of store paths. Uses Docker Image Specification v1.2 as reference [1]. It expects a JSON file with the following properties and writes the image as an uncompressed tarball to stdout: * "architecture", "config", "os", "created", "repo_tag" correspond to the fields ...
test_client.py
import asyncio import functools import gc import inspect import logging import os import pickle import random import subprocess import sys import threading import traceback import warnings import weakref import zipfile from collections import deque from contextlib import suppress from functools import partial from oper...
base.py
#!/usr/bin/env python # Copyright 2012 Hewlett-Packard Development Company, L.P. # # 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 # # Unles...
pkb.py
# Copyright 2019 PerfKitBenchmarker 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...
tcp_server.py
import socket import threading bind_ip = "0.0.0.0" bind_port = 9999 server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.bind((bind_ip, bind_port)) server.listen(5) print "[*] Listening on %s:%d" % (bind_ip, bind_port) # This is our client-handling thread def handle_client(client_socket): #...
sample_fake_binaries.py
from multiprocessing import Process, Manager from imageio import imread import pickle import numpy as np import os import cv2 fake_path = 'dataset-dist/phase-01/training/fake/' pristine_path = 'dataset-dist/phase-01/training/pristine/' mask_path = fake_path + 'masks/' def count_255(mask): i=0 for...
IrcBot.py
#!/usr/bin/env python # -โป- coding: UTF-8 -*- #Modules import socket, threading, sys, gc, time, json from colorama import init as ColoramaInit, Fore, Back, Style import util as util from commands import onCommand, onModCommand #Colorama Config ColoramaInit() COLOR = { 'black': Fore.BLACK, 'red': Fore.RED, 'green': Fo...