source
stringlengths
3
86
python
stringlengths
75
1.04M
commands.py
import os import threading import queue commands = queue.Queue() def starter (): while True: print ("Starter waiting for command") cmd = commands.get () print ("Executing command {}".format (cmd)) pid = os.fork () if pid == 0: os.execvp (cmd[0], cmd) else: os.waitpid (pid, 0) commands.task_done(...
plugin.py
from contextlib import contextmanager from contextvars import ContextVar import multiprocessing import collections from _pytest import main import psutil import pytest def pytest_addoption(parser): group = parser.getgroup('pytest-mp') mp_help = 'Distribute test groups via multiprocessing.' group.addopti...
post_processing.py
import argparse import json import multiprocessing as mp import os import threading import numpy as np import pandas as pd import tqdm parser = argparse.ArgumentParser() parser.add_argument('input_dir', type=str) parser.add_argument('output_file', type=str) parser.add_argument('top_number', type=int, nargs='?', defau...
braille.py
# -*- coding: UTF-8 -*- #braille.py #A part of NonVisual Desktop Access (NVDA) #This file is covered by the GNU General Public License. #See the file COPYING for more details. #Copyright (C) 2008-2017 NV Access Limited, Joseph Lee, Babbage B.V., Davy Kager import sys import itertools import os import pkgutil...
trigger_word_detector_thread.py
""" This program is meant to represent the simplest way to make a trigger word detector. The approach is simple and involves a loop of listening to audio and then processing it. Threading is used in order to asynchronously process the read data in order to cut down on any missed chunks of audio which would ...
log.py
# # MythBox for XBMC - http://mythbox.googlecode.com # Copyright (C) 2011 analogue@yahoo.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at yo...
train_sampling.py
"""Training GCMC model on the MovieLens data set by mini-batch sampling. The script loads the full graph in CPU and samples subgraphs for computing gradients on the training device. The script also supports multi-GPU for further acceleration. """ import os, time import argparse import logging import random import stri...
01_start_stop_thread.py
import time def countdown(n): while n > 0: print('T-minus', n) n -= 1 time.sleep(1) from threading import Thread t = Thread(target=countdown, args=(10,), daemon=True) t.start()
keep_alive.py
from threading import Thread from flask import Flask ab = Flask('') @ab.route('/') def main(): return "Your bot is alive!" def run(): ab.run(host = "0.0.0.0", port = 5001) def keep_alive(): server = Thread(target = run) server.start()
lanGhost.py
#!/usr/bin/env python3 # -.- coding: utf-8 -.- # lanGhost.py # author: xdavidhu try: import logging logging.getLogger("scapy.runtime").setLevel(logging.ERROR) # Shut up scapy! from telegram.ext import Updater, CommandHandler, MessageHandler, Filters from netaddr import IPAddress from time import ...
server.py
import logging import os import socket import threading from time import sleep from typing import Optional from flask import Flask, jsonify, render_template, request from torch import Tensor app = Flask( __name__, static_folder="frontend/build/static", template_folder="frontend/build" ) visualizer = None port = N...
r_rprj_mt.py
# -*- coding: utf-8 -*- __author__ = 'medvedev.ivan@mail.ru' import os,sys,datetime,argparse,threading,time,shutil from osgeo import gdal from gdalconst import * from Queue import Queue queue = Queue() LOCK = threading.RLock() # CONSTs folders = { 0.5: '0_5', # subfolder for raster with 0.5 pixel size 1.0: '1_0', ...
translate.py
#!/usr/bin/env python3 import json import logging from multiprocessing import Process, Queue, current_process from collections import OrderedDict from copy import copy import numpy as np import click from params import load_params logging.basicConfig(level=logging.INFO, format="%(asctime)s - %...
roonapi.py
from __future__ import unicode_literals import os import threading import time from .constants import ( LOGGER, PAGE_SIZE, SERVICE_BROWSE, SERVICE_REGISTRY, SERVICE_TRANSPORT, ) from .discovery import RoonDiscovery from .roonapisocket import RoonApiWebSocket def split_media_path(path): """Sp...
fileserverclient.py
# fileserverclient.py - client for communicating with the cache process # # Copyright 2013 Facebook, Inc. # # 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 io import os import threading...
networked_node.py
import json from threading import Thread import zmq from .CONFIG import KEY_SERVER_PORT, HOP_DESTINATION_PORT, SUCCESSOR_PREDECESSOR_PORT, NOTIFY_PORT, TIMEOUT from typing import Callable, TypedDict from ..node.stabilizing_node import StabilizingNode from ..node_data.networked_node_data import NetworkedNodeData, NodeTy...
test_network.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) 2020-2021 tecnovert # Distributed under the MIT software license, see the accompanying # file LICENSE or http://www.opensource.org/licenses/mit-license.php. import os import json import time import shutil import signal import logging import unittest impor...
offlineQueue.py
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------# # Copyright © 2015-2016 VMware, Inc. All Rights Reserved. # # # # Licensed under the BSD 2-Clause License (the “License...
evaluate.py
#! /usr/bin/env python3 import argparse import concurrent.futures import glob import itertools import os import signal import subprocess import sys import threading import time import traceback MODEL = "A3C" def monitor_process(cmd, timeout, output_file, error_file, max_retries=3): last_write = time.time() ...
test_dota_base_sota_quad.py
# -*- coding:utf-8 -*- # Author: Xue Yang <yangxue-2019-sjtu@sjtu.edu.cn> # # License: Apache-2.0 license from __future__ import absolute_import from __future__ import print_function from __future__ import division import os import sys import tensorflow as tf import cv2 import numpy as np import math from tqdm import...
spinner.py
# -*- coding: utf-8 -*- """ Created on Wed May 30 12:15:28 2018 @author: imranparuk Stolen From: https://stackoverflow.com/a/39504463 """ import sys import time import threading class Spinner: busy = False delay = 0.1 @staticmethod def spinning_cursor(): while 1: for cursor ...
test_deleter.py
import os import time import threading from collections import namedtuple import selfdrive.loggerd.deleter as deleter from common.timeout import Timeout, TimeoutException from loggerd_tests_common import UploaderTestCase Stats = namedtuple("Stats", ['f_bavail', 'f_blocks']) fake_stats = Stats(f_bavail=0, f_blocks=1...
similarity.py
import os from queue import Queue from threading import Thread import pandas as pd import tensorflow as tf import collections import args import tokenization import modeling import optimization # os.environ['CUDA_VISIBLE_DEVICES'] = '1' class InputExample(object): """A single training/test example for simple s...
voting.py
import datetime import json import logging import re import threading import uuid import pymongo import praw from flask import Blueprint, render_template, jsonify, request, make_response from reddit_utils import create_reddit_api, edit_post voting_app = Blueprint('voting',__name__) BASE_PATH = '/wayr' VOTING_COOKIE ...
peer.py
import socket import sys import threading import time from datetime import datetime def connect(conn): user =False pass_ = False authenticated = False floods = {} while True: if authenticated == False: received = conn.recv(1024) if received == ' ': pa...
baidu_keyword.py
# -*- coding: UTF-8 -*- __author__ = 'Joynice' import requests from lxml import etree import re import csv from datetime import datetime import queue import threading import os import sys class BaiduKeyword(object): def __init__(self, thread=20, filename=None, number=1000): self.baseUrl = 'http://www.baid...
TCPDataSocket.py
from threading import Event, Thread, Lock from socket import socket, AF_INET, SOCK_STREAM, IPPROTO_TCP, TCP_NODELAY, SOL_SOCKET, SO_REUSEADDR, error import time from io import BytesIO import numpy as np import os import struct import json import h5py NUMPY = 1 JSON = 2 HDF = 3 RAW = 4 def _get_socket(): new_sock...
title.py
# pylint: disable=C0111,R0903 """Displays focused i3 window title. Requirements: * i3ipc Parameters: * title.max : Maximum character length for title before truncating. Defaults to 64. * title.placeholder : Placeholder text to be placed if title was truncated. Defaults to '...'. * title.scroll : Bool...
joy_detection_demo.py
#!/usr/bin/env python3 # Copyright 2017 Google 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...
test_fcntl.py
"""Test program for the fcntl C module. """ import platform import os import struct import sys import unittest from multiprocessing import Process from test.support import (verbose, TESTFN, unlink, run_unittest, import_module, cpython_only) # Skip test if no fcntl module. fcntl = ...
test_filelock.py
from __future__ import unicode_literals import logging import sys import threading from contextlib import contextmanager from stat import S_IWGRP, S_IWOTH, S_IWUSR import pytest from filelock import FileLock, SoftFileLock, Timeout from filelock._util import PermissionError @pytest.mark.parametrize("lock_type", [Fi...
threaded_loader.py
import mxnet as mx import numpy as np from Queue import Queue from threading import Thread from ..config import config from ..io.rpn import get_rpn_batch, assign_anchor_fpn from ..io.rcnn import get_fpn_maskrcnn_batch class ThreadedMaskROIIter(mx.io.DataIter): def __init__(self, roidb, batch_size=2, shuffle=Fals...
getloc.py
from __future__ import print_function from hotqueue import HotQueue import redis import multiprocessing import requests import logging import urllib import usaddress class GetLoc(object): census_reporter = 'http://api.censusreporter.org/1.0/geo/elasticsearch?' sentinel = 'Xksm3k443209sfjxjzkz -- end --' ...
lisp.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...
test_image_embedding.py
# coding : UTF-8 import sys sys.path.append("../../tests") import time import threading from towhee import pipeline from common import common_func as cf embedding_size = 1000 class TestImageEmbeddingInvalid: """ Test case of invalid embedding interface """ def test_embedding_no_parameter(self, pipeline_name)...
read sav file_multiple_threading.py
import multiprocessing as mp from time import time import pandas as pd import pyreadstat import math import threading def worker(inpt): print(inpt) offset, chunksize, path = inpt df, meta = pyreadstat.read_sav(path, row_offset=offset, row_limit=chunksize) # df, meta = pyreadstat.read_file_in_chunks(p...
u_run.py
#!/usr/bin/env python '''Run an instance of ubxlib automation and report results.''' import sys # For exit() and stdout import argparse from os import environ from multiprocessing import Process, freeze_support # Needed to make Windows behave # when doing multiproce...
autoSubmitter.py
from __future__ import print_function import ConfigParser import argparse import shelve import sys import os import subprocess import threading import shutil import time import re import ROOT from helpers import * sys.path.append("../plottingTools") shelve_name = "dump.shelve" # contains all the measurement objects an...
robot.py
# -*-coding:utf-8-*- # Copyright (c) 2020 DJI. # # 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 in the file LICENSE.txt or at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
thread_.py
import threading from threading import Thread def get_current_thread(): return threading.current_thread() def get_current_thread_name(): return get_current_thread().getName() def is_alive(t): return t.is_alive() def create_and_start(name, target, daemon = True): t = Thread(target= target) ...
device_thread.py
# Copyright 2018 Jetperch LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
session.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright 2020 Alibaba Group Holding Limited. 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...
test_nmc.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) 2019-2021 tecnovert # Distributed under the MIT software license, see the accompanying # file LICENSE or http://www.opensource.org/licenses/mit-license.php. """ basicswap]$ python tests/basicswap/extended/test_nmc.py """ import os import sys import json...
siddmain.py
import cv2 import os import numpy as np import time from tqdm import tqdm from threading import Thread from sidd import siddcompares, siddcolors dupe_list = [] '''A list of duplicate images.''' prob_threshold = .1 '''Delta threshold to use when performing probablistic matching.''' #list_of_colors = [[255,0,0],[150,33...
login.py
import asyncio import os, time, re, io import threading import json import random import traceback import logging try: from httplib import BadStatusLine except ImportError: from http.client import BadStatusLine import requests # type: ignore from pyqrcode import QRCode from .. import config, utils from ..ret...
p187.py
import numpy as np import threading import time import tensorflow as tf def MyLoop(coord, work_id): while not coord.should_stop(): if np.random.rand() < 0.1: print 'Stop from id: %d\n' % work_id coord.request_stop() else: print 'Working on id: %d\n' % work_id ...
agent_a3c_2000ep.py
#!/usr/bin/env python from __future__ import print_function import numpy as np import cv2 import tensorflow as tf import threading import sys import time import os def MakeDir(path): try: os.makedirs(path) except: pass lab = False load_model = False train = True test_display = False test_wri...
TFCluster.py
# Copyright 2017 Yahoo Inc. # Licensed under the terms of the Apache 2.0 license. # Please see LICENSE file in the project root for terms. """ This module provides a high-level API to manage the TensorFlowOnSpark cluster. There are three main phases of operation: 1. **Reservation/Startup** - reserves a port for the T...
simple_sample.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ ------------------------------------------------- @ Author : Max_Pengjb @ date : 2018/9/23 22:37 @ IDE : PyCharm @ GitHub : https://github.com/JackyPJB @ Contact : pengjianbiao@hotmail.com -----------...
util.py
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2011 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 without...
watchdog.py
# Lint as: python3 # Copyright 2021 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 requ...
bot.py
# ----------------------------------------------------------- # A discord bot that has every features you want in a discord server ! # # (C) 2022 TheophileDiot # Released under MIT License (MIT) # email theophile.diot900@gmail.com # linting: black # ----------------------------------------------------------- from async...
pa-mixer-mk3.py
#!/usr/bin/env python3 import itertools as it, operator as op, functools as ft from collections import OrderedDict, defaultdict, deque, namedtuple from contextlib import contextmanager import os, sys, io, re, time, logging, configparser import base64, hashlib, unicodedata, math import signal, threading from pulsectl ...
env_wrappers.py
""" Modified from OpenAI Baselines code to work with multi-agent envs """ import numpy as np import torch from multiprocessing import Process, Pipe from abc import ABC, abstractmethod # from baselines.common.vec_env import VecEnv, CloudpickleWrapper import pdb class CloudpickleWrapper(object): """ Uses cloudpi...
containers.py
#!/usr/bin/env python ############################################################################# ## # This file is part of Taurus ## # http://taurus-scada.org ## # Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain ## # Taurus is free software: you can redistribute it and/or modify # it under the terms of t...
multiprocess_basic.py
from multiprocessing import Process from time import sleep def worker(identifier): print(f"The process for:{identifier}") sleep(5) if __name__ == '__main__': p1 = Process(target=worker, args=("p1", )) p2 = Process(target=worker, args=("p2", )) p3 = Process(target=worker, args=("p3", )) p4 =...
test_ftplib.py
"""Test script for ftplib module.""" # Modified by Giampaolo Rodola' to test FTP class, IPv6 and TLS # environment import ftplib import asyncore import asynchat import socket import StringIO import errno import os try: import ssl except ImportError: ssl = None from unittest import TestCase, SkipTest, skipUnl...
pehash.py
import sys, threading, multiprocessing from . __main__ import HashAlgorithm allfiles = [] results = [] def run(): cpu = multiprocessing.cpu_count() def _run(): while True: try: file = allfiles.pop() except: break try: ...
test_recreation.py
"""InVEST Recreation model tests.""" import datetime import glob import zipfile import socket import threading import unittest import tempfile import shutil import os import functools import logging import json import queue import multiprocessing import Pyro4 import numpy import pandas from osgeo im...
main.py
import multiprocessing as mp import os from threading import Thread from human_tracker import camera_capture from database import ImageDB from absl import app, flags, logging from absl.flags import FLAGS import numpy as np import pandas as pd import signal, sys import datetime flags.DEFINE_string('framework', 'tf', '(...
migrate.py
#!/usr/bin/env python3 # Copyright 2020 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
tests.py
# Unit tests for cache framework # Uses whatever cache backend is set in the test settings file. import copy import io import os import pickle import re import shutil import sys import tempfile import threading import time import unittest from pathlib import Path from unittest import mock, skipIf from django.conf impo...
master.py
# -*- coding: utf-8 -*- ''' This module contains all of the routines needed to set up a master server, this involves preparing the three listeners and the workers needed by the master. ''' # Import python libs import os import re import time import errno import fnmatch import signal import shutil import stat import lo...
client.py
"""A semi-synchronous Client for the ZMQ cluster Authors: * MinRK """ from __future__ import print_function #----------------------------------------------------------------------------- # Copyright (C) 2010-2011 The IPython Development Team # # Distributed under the terms of the BSD License. The full license is ...
__init__.py
# -*- coding: utf-8 -*- """ Implements context management so that nested/scoped contexts and threaded contexts work properly and as expected. """ from __future__ import absolute_import from __future__ import division import collections import functools import logging import os import platform import six import socket ...
regtest.py
#!/usr/local/bin/python # /* # * Copyright (C) 2019 Atos Spain SA. All rights reserved. # * # * This file is part of pCEP. # * # * pCEP is free software: you can redistribute it and/or modify it under the # * terms of the Apache License, Version 2.0 (the License); # * # * http://www.apache.org/licenses/LICENS...
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 inspect import logging import operator import os import random import stri...
ch05_listing_source.py
import bisect import contextlib import csv from datetime import datetime import functools import json import logging import random import threading import time import unittest import uuid import redis def to_bytes(x): return x.encode() if isinstance(x, str) else x def to_str(x): return x.decode() if isinst...
gsi_alter_index_replicas.py
from .gsi_index_partitioning import GSIIndexPartitioningTests from lib.remote.remote_util import RemoteMachineShellConnection from membase.api.rest_client import RestConnection, RestHelper from lib.memcached.helper.data_helper import MemcachedClientHelper from membase.helper.bucket_helper import BucketOperationHelper i...
gui.py
# -*- coding: utf-8 -*- """ Graphical User interface for the SNN conversion toolbox. Features -------- - Allows setting parameters and what tools to use during an experiment. - Performs basic checks that specified parameters are valid. - Preferences can be saved and reloaded. - Tooltips explain the fu...
wi_tests_manage.py
#!/usr/bin/env python2.7 # -*- coding: utf-8 -*- # @COPYRIGHT_begin # # Copyright [2010-2014] Institute of Nuclear Physics PAN, Krakow, Poland # # 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 Licen...
feature_shutdown.py
#!/usr/bin/env python3 # Copyright (c) 2018 The Bitcoin Core developers # Copyright (c) 2017-2020 The Qtum Core developers # Copyright (c) 2020 The BCS Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test bitco...
repository.py
import atexit import os import re import subprocess import tempfile import threading import time from contextlib import contextmanager from pathlib import Path from typing import Callable, Dict, Iterator, List, Optional, Tuple, Union from tqdm.auto import tqdm from huggingface_hub.constants import REPO_TYPES_URL_PREF...
worker.py
from multiprocessing import Process, Queue from urllib.parse import urlparse import requests import pandas as pd import sqlalchemy as s from sqlalchemy.ext.automap import automap_base from sqlalchemy import MetaData import statistics import logging import json import numpy as np import scipy.stats import datetime loggi...
AVR_Miner.py
#!/usr/bin/env python3 ########################################## # Duino-Coin Python AVR Miner (v2.5.1) # https://github.com/revoxhere/duino-coin # Distributed under MIT license # © Duino-Coin Community 2019-2021 ########################################## # Import libraries import sys from configparser import ConfigPa...
test_s3.py
import multiprocessing as mp import pytest from moto import mock_s3 from pfio.v2 import S3, from_url from pfio.v2.fs import ForkedError @mock_s3 def test_s3(): bucket = "test-dummy-bucket" key = "it's me!deadbeef" secret = "asedf;lkjdf;a'lksjd" with S3(bucket, create_bucket=True): with from_...
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...
sensor.py
"""Sensor to monitor incoming/outgoing phone calls on a Fritz!Box router.""" from __future__ import annotations from collections.abc import Mapping from datetime import datetime, timedelta import logging import queue from threading import Event as ThreadingEvent, Thread from time import sleep from typing import Any, c...
driver.py
# Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # Copyright (c) 2010 Citrix Systems, Inc. # Copyright (c) 2011 Piston Cloud Computing, Inc # Copyright (c) 2012 University Of Minho # (c) Copyright 2013 Hewlett-Pa...
10bot.kris.py
# -*- coding: utf-8 -*- import LINETCR from LINETCR.lib.curve.ttypes import * from datetime import datetime from bs4 import BeautifulSoup import time, random, sys, re, os, json, subprocess, threading, string, codecs, requests, tweepy, ctypes, urllib, urllib2, wikipedia,tempfile,glob,shutil,unicodedata,goslate from gtt...
Unsafe.py
######################### # 线程共享变量问题 ######################### from threading import Thread import time g_num = 100 def work1(): global g_num for i in range(1, 100): g_num += 1 time.sleep(0.1) print("----in work1, g_num is %d---" % g_num) print("---线程创建之前g_num is %d---" % g_num) ...
snippet.py
#!/usr/bin/env python import subprocess import itertools import sys from south.migration import all_migrations from south.models import MigrationHistory def get_migrations(): from multiprocessing import Process, Queue queue = Queue() p = Process(target=get_migrations_task, args=(queue,)) p.start() p.join() re...
webapi.py
''' ****************************************************************** File name : webapi.py Description : Flask based API to work with webwhatsapi Called from wsgi.py. Can be run as a standalone file to (cmd: python WebAPI.py) The API use chrome a...
compute_contacts.py
############################################################################ # Copyright 2018 Anthony Ma & Stanford University # # # # Licensed under the Apache License, Version 2.0 (the "License"); # # you may no...
ServoKontrol.py
from time import sleep import RPi.GPIO as GPIO from threading import Thread class ServoKontrol: def __init__(self, pin=35, GPIOSetup = GPIO.BOARD): GPIO.setmode(GPIOSetup) GPIO.setup(pin, GPIO.OUT) self.pwm = GPIO.PWM(pin, 50) self.pwm.start(0) self.pin = pin ...
server.py
#!/usr/bin/env python3 import tornado.ioloop import tornado.web from tornado.escape import json_decode from multiprocessing import Process, Queue import json import notes from scanners import * from scrapers import * from results import * import re from os.path import join import collections import ipaddress from log i...
nevergrad_parallel_utils.py
from contextlib import redirect_stdout, redirect_stderr from enum import Enum import io import math import multiprocessing as mp import numpy as np import os from prwlock import RWLock import queue import signal import sys import threading import time import traceback import typing as tp from mlir.sandbox.harness impo...
FreqGen.py
#!/usr/bin/python """Frequency generator uses pulse width modulation for signal periods < 0.013 s optional Arguments: $1: GPIO pin $2: signal period $3: duty cycle of signal """ from __future__ import print_function, division, unicode_literals from __future__ import absolute_import import ...
erad_submission.py
import argparse import os import threading import time from clint.textui import colored import settings from dal.mysql.ae_autosubs.experiments import retrieve_experiment_status from dal.oracle.conan.conan_tasks import retrieve_task, update_task_status_by_id from models.conan import CONAN_PIPELINES from utils.conan.cona...
server.py
# Copyright 2014 OpenStack Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
__init__.py
""" Plugin for Pyramid apps to submit errors to Rollbar """ from __future__ import absolute_import from __future__ import unicode_literals import copy import functools import inspect import json import logging import os import socket import sys import threading import time import traceback import types import uuid imp...
ifit_strava.py
#!/usr/bin/env python3 import bisect import click import collections import dateutil.parser from flask import Flask, request import glob import http.cookiejar import logging import os import re import requests import stravalib import sys import tcxparser import threading import time import yaml _AUTH_TIMEOUT = 60 _MA...
build_package.py
#!/bin/env python #### ## build package for hudson ## used to build nightly packages for ohwidget ## and upload to upstream package repository ## will only work on hudson and our network - not supposed to be called externally ### ## usage: set env arg TARGET_ARCH with an arch and set env arg REPOSITORY as nightly & s...
Ex2.py
#!/usr/bin/python # -*- coding: utf-8 -*- import subprocess import os import queue import threading def con_video(): video_list = [] files = os.listdir('./') for f in files: if f == 'test.mp4': # print("Processing", f) video_list.append(f) # 720p at 2Mbps and 30fps ...
tests.py
import os import shutil import sys import tempfile import threading import time import unittest from datetime import datetime, timedelta from io import StringIO from pathlib import Path from urllib.request import urlopen from django.core.cache import cache from django.core.exceptions import SuspiciousFileOperation fro...
io_utils.py
#! /usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright 2020 Alibaba Group Holding 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 License at # # http://www.apache.org/licenses/LICENS...
coinbase_websocket.py
from exchange_sockets.exchange_websocket import ExchangeWebSocket from singletones.custom_logger import MyLogger import websocket import threading from time import sleep from time import time import json logger = MyLogger() class CoinbaseWebsocket(ExchangeWebSocket): def __init__(self, stream_n_pairs): s...
main.py
import os import random import time import threading class Clinic: queue = [] def __init__(self, id, time, peoples=0): super().__init__() self.id = id self.time = time self.peoples = peoples def __str__(self): return "Id: " + str(self.id) + ", time: " + str(self....
stim_server_client.py
# Author: Mainak Jas <mainak@neuro.hut.fi> # License: BSD (3-clause) from ..externals.six.moves import queue import time import socket from ..externals.six.moves import socketserver import threading import numpy as np from ..utils import logger, verbose class _ThreadedTCPServer(socketserver.ThreadingMixIn, sockets...
camera.py
import time import io import threading import picamera import os class Camera(object): thread = None # background thread that reads frames from camera frame = None # current frame is stored here by background thread last_access = 0 # time of last client access to the camera name = "camera/" + os.po...