source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
gen_sample_v4.py | #!/usr/bin/env python
#-*- coding:utf-8 -*-
import os
import sys
import re
import time
import json
import urllib
import urllib2
import time
import pickle
from text_feature import TextFeature
from get_label_words import LabelWords
import hashlib
import datetime
from multiprocessing import Process, Pool, Queue
import re... |
protocol_test.py | # Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os
from contextlib import contextmanager
from dataclasses import dataclass
from threading import Thread
from typing import BinaryIO
import pytest
from pylsp_jsonrpc.endpoint import ... |
XXZ_edge_driven.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
A demonstration of simulating open system dynamics by sampling
over randomized pure state trajectories.
This simulates the dynamics of an edge-driven XXZ chain,
which has an analytic solution for lam = 1.0, eps = 2.0.
See: T. Prosen, Phys. Rev. Lett. 107, 137201 (2011... |
test_mainwindow.py | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright © Spyder Project Contributors
#
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
# -----------------------------------------------------------------------------
"""
Te... |
test_emr.py | import copy
import gzip
import io
import threading
import time
import boto3
import pytest
from dagster_aws.emr import EmrClusterState, EmrError, EmrJobRunner
from dagster_aws.utils.mrjob.utils import _boto3_now
from moto import mock_emr, mock_s3
from dagster.seven import mock
from dagster.utils.test import create_tes... |
engine.py | import sys
import importlib
import traceback
from types import ModuleType
from typing import Optional, Sequence, Any, List
from pathlib import Path
from datetime import datetime
from threading import Thread
from pandas import DataFrame
from vnpy.event import Event, EventEngine
from vnpy.trader.engine import BaseEngin... |
main.py | from datetime import datetime
from threading import Thread
import psycopg2 as pg
import sys
from ais import nmea_queue
from json import dumps
counter = 0
def read_file():
for line in open('values.csv'):
yield line
def decode():
global ais_queue, cursor, counter
while ais_queue.qsize():
... |
test_sys.py | # -*- coding: iso-8859-1 -*-
import unittest, test.test_support
from test.script_helper import assert_python_ok, assert_python_failure
import sys, os, cStringIO
import struct
import operator
class SysModuleTest(unittest.TestCase):
def tearDown(self):
test.test_support.reap_children()
def ... |
test_capture.py | import contextlib
import io
import os
import subprocess
import sys
import textwrap
from io import UnsupportedOperation
from typing import BinaryIO
from typing import cast
from typing import Generator
from typing import TextIO
import pytest
from _pytest import capture
from _pytest.capture import _get_multicapture
from ... |
thermistor_simulated.py | # -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------#
# Copyright © 2015-2016 VMware, Inc. All Rights Reserved. #
# #
# Licensed under the BSD 2-Clause License (the “License... |
httpsvr.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# httpsvr - HTTP server
#
# Copyright (c) 2018 ColoradoFourWheeler / EPS
#
import indigo
import linecache # exception reporting
import sys # exception reporting
import logging # logging
import ext
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from Socke... |
complete_script_small.py | import json
import os
import sys
import threading
ref_directory = "/ebio/ecnv_projects/common_resourses/data/reference_genome/GRCz11/"
cmd_picard = "/ebio/ecnv_projects/common_resourses/data/software/picard-tools-1.130/picard.jar"
cmd_picard2 = "/ebio/ecnv_projects/common_resourses/data/software/picard-tools-1.130/pi... |
stopwatch.py | # coding=utf-8
import sys
import time
import adafruit_ads1x15.ads1115 as ads
import csv
import json
import logging
import queue
import threading
import tkinter as tk
from PIL import ImageTk
from adafruit_ads1x15.ads1x15 import Mode
from adafruit_ads1x15.analog_in import AnalogIn
from collections import deque
from date... |
display_manager.py | # Copyright 2017 Mycroft AI Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
broker.py | # -*- coding: utf-8 -*-
"""----------------------------------------------------------------------------
Author:
fengfan
fengfan@corp.netease.com
Date:
2017/1/10
Description:
转发的中心节点
History:
2017/1/10, create file.
----------------------------------------------------------------------------"""
import random
import... |
client.py | from __future__ import print_function, division
__version__ = '0.0.1'
import datetime as dt
import logging
import os.path
from threading import Thread, RLock
from zeep.client import Client, CachingClient, Settings
from zeep.wsse.username import UsernameToken
import zeep.helpers
from onvif.exceptions import ONVIFError... |
manager.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2015 clowwindy
#
# 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 b... |
index.py | """Routines related to PyPI, indexes"""
import sys
import os
import re
import gzip
import mimetypes
import posixpath
import pkg_resources
import random
import socket
import ssl
import string
import zlib
try:
import threading
except ImportError:
import dummy_threading as threading
from pip.log import logger
f... |
utils.py | import contextlib
import errno
import importlib
import itertools
import json
import os
import queue
import sys
import click
import click_threading
from atomicwrites import atomic_write
from . import cli_logger
from .. import BUGTRACKER_HOME
from .. import DOCS_HOME
from .. import exceptions
from ..sync.exceptions imp... |
start_radare.py | import gc
import logging
import signal
import tempfile
from multiprocessing import Process, Manager, Value
from pathlib import Path
from queue import Empty
from subprocess import Popen, PIPE
from time import sleep, time
from config import RADARE_PORTS, RADARE_TIMEOUT, QUEUE_BLOCK_TIMEOUT
class OutOfPortsError(Except... |
webserver.py | from http import server
from flask import Flask
from werkzeug import serving
import threading
config, Manager, log, lock = 0,0,0,0 #保存宿主传递的环境 分别为配置文件, 模块管理器,日志,全局线程锁
def _default_config(root, name): #返回默认配置文件 载入时被调用 root为数据文件根目录 name为当前模块名称
return {
'modInformation':{ #该模块的信息
'Name': 'BaseMod we... |
config_titanium.py | #!/usr/bin/env python3
# scripts/config_titanium.py
#
# Import/Export script for vIOS.
#
# @author Andrea Dainese <andrea.dainese@gmail.com>
# @copyright 2014-2016 Andrea Dainese
# @license BSD-3-Clause https://github.com/dainok/unetlab/blob/master/LICENSE
# @link http://www.unetlab.com/
# @version 20160719
import ge... |
runner.py | #!/usr/bin/env python2
# This Python file uses the following encoding: utf-8
'''
Simple test runner
These tests can be run in parallel using nose, for example
nosetests --processes=4 -v -s tests/runner.py
will use 4 processes. To install nose do something like
|pip install nose| or |sudo apt-get install python-no... |
CoreClient.py | import socket
from threading import Thread
from VectorMessenger.MessengerCore.Helpers import Global as h
from VectorMessenger.MessengerCore.MessengerBase import VMUDPBase
from VectorMessenger.MessengerCore.Encryption import VMCrypt
class MessengerClient(VMUDPBase):
def __init__(self, vm_client_ui=None):
... |
viscapi.py | #!/usr/bin/env python
import pygame
from os import environ
from pygame.locals import *
from pysca import pysca
from numpy import clip
import threading
from subprocess import call
JOYSTICKS = []
axis_x_value = 0.0
axis_y_value = 0.0
axis_z_value = 0.0
throttle_y_value = 0.0
hat_y_value = 0
hat_x_value = 0
buttons_value... |
Test_Output.py | from subprocess import call
from Checker import this_file_exists
from Checker import file_modified
import Select_15_min
from Select_15_min import process_stop
import threading
import time
import os
import csv
import numpy as np
from multiprocessing.pool import ThreadPool
def llamada(programa,parametros):
i = 0
... |
data_flow.py | # -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
import numpy as np
import threading
try:
# Python 2
import Queue as queue
except Exception:
# Python 3
import queue
import tensorflow as tf
from . import utils
class DataFlow(object):
""" Data Flow.
Bas... |
Server.py | import ssl
import threading
from http.server import HTTPServer
from gw_proxy.local_proxy.Handle_Request import Handle_Request
from osbot_utils.utils.Http import GET
from osbot_utils.utils.Misc import random_port
class Server():
def __init__(self, port=None, target=None, host=None): # todo: make ... |
mp_tutorial_3_main.py | '''
Due to the way the new processes are started, the child process needs to be able to import the script containing the target function. Wrapping the main part of the application in a check for __main__ ensures that it is not run recursively in each child as the module is imported. Another approach is to import the t... |
arqueo.py | # -*- coding: utf-8 -*-
# @Author: Manuel Rodriguez <valle>
# @Date: 10-May-2017
# @Email: valle.mrv@gmail.com
# @Last modified by: valle
# @Last modified time: 23-Feb-2018
# @License: Apache license vesion 2.0
from kivy.uix.anchorlayout import AnchorLayout
from kivy.properties import ObjectProperty, StringProp... |
graphicsCrawlerDisplay.py | # graphicsCrawlerDisplay.py
# -------------------------
# Licensing Information: Please do not distribute or publish solutions to this
# project. You are free to use and extend these projects for educational
# purposes. The Pacman AI projects were developed at UC Berkeley, primarily by
# John DeNero (denero@cs.berkeley... |
sc_runner.py | import math
import sc2
import random
from sc2 import Race, Difficulty
import os
import sys
from sc2.constants import *
from sc2.position import Pointlike, Point2
from sc2.player import Bot, Computer
from sc2.unit import Unit as sc2Unit
sys.path.insert(0, os.path.abspath('../'))
import torch
from agents.prolonet_agent i... |
_channel.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 writing... |
model.py | from threading import Thread
from typing import Iterable
from common import Printable
from distributions import DistributionGenerator
from models.client import ClientGenerator, ClientListener
from models.manager import ServerManager
from models.server import Server
from utils import Stopwatch, delay
class ImitationM... |
hello-world.py | # Standard python imports
import sys, os, logging, threading, argparse
import numpy as np
# Gstreamer related
import gi
gi.require_version('Gst', '1.0')
gi.require_version('GstBase', '1.0')
gi.require_version('Gtk', '3.0')
from gi.repository import GLib, Gst, Gtk
from gstreamer import GstPipeline, Gst
import gstreame... |
nvr.py | #!/usr/bin/env python3
"""
Copyright (c) 2015 - present Marco Hinz
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modif... |
local_elastic_agent_test.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import multiprocessing
import os
import time
import unittest
import uuid
import torch
imp... |
base_crash_reporter.py | # Electrum - lightweight Bitcoin client
#
# 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, modify, merge,
# publish... |
nanny.py | import asyncio
import errno
import logging
import os
import shutil
import threading
import uuid
import warnings
import weakref
from contextlib import suppress
from multiprocessing.queues import Empty
from time import sleep as sync_sleep
import psutil
from tornado import gen
from tornado.ioloop import IOLoop, PeriodicC... |
test.py | import os
import sys
sys.path.append(os.path.abspath(os.path.dirname(__file__)))
import copy
from functools import partial
import hook
import json
import requests
import sync
from sync import process_and_run_steps, UPSTREAMABLE_PATH, _upstream, git
from test_api_server import start_server
import threading
import time
... |
multi_webcam.py | import multiprocessing as mp
import subprocess
import shlex
import argparse
import os
# function to execute command in shell
def run_command(command):
process = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE)
while True:
output = process.stdout.readline()
if process.poll() is not... |
wmiirc.py | import datetime
import operator
import os
import re
import sys
import traceback
from threading import Thread, Timer
import pygmi
from pygmi import *
from pygmi import event
identity = lambda k: k
# Begin Configuration
#
# Note: This file loads ~/.wmii/wmiirc_local.py if it exists.
# Configuration should be placed in... |
context.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... |
wrapper_utils.py | # Copyright (c) 2016 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.
"""Helper functions for gcc_toolchain.gni wrappers."""
import gzip
import os
import re
import subprocess
import shlex
import shutil
import sys
import th... |
server.py | from config import *
import re
import os
import cv2
import time
import json
import base64
import shutil
import datetime
import threading
import numpy as np
from bottle import route, run, static_file, request, BaseRequest, response
from ai import *
from tricks import *
BaseRequest.MEMFILE_MAX = 10000 * 1000
def g... |
test_threading.py | import os
import threading
import uuid
import pytest
from ddtrace.internal import nogevent
from ddtrace.profiling import recorder
from ddtrace.profiling.collector import threading as collector_threading
from . import test_collector
TESTING_GEVENT = os.getenv("DD_PROFILE_TEST_GEVENT", False)
def test_repr():
... |
websockets.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... |
00.scan_ref_proteomes.py | # -*- coding: utf-8 -*-
import pandas
import numpy
import os
import multiprocessing
import sys
sys.path.append('../')
from core_functions import construct_graph_from_mongo
from core_functions import invert_mapping
from core_functions import uniprot_query
from core_functions import correct_uniprot_dataframe
from core_f... |
receiver.py | """Module for receiving data and hosting receiving servers."""
from aiohttp import web
import asyncio
import humanize
from multiprocessing import Process
import os
import pkgutil
import platform
import requests
import socket
import sys
from time import sleep, strftime
from tqdm import tqdm
from zipfile import is_zipf... |
multiprocessing_exitcode.py | #!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2009 Doug Hellmann All rights reserved.
#
"""
"""
#end_pymotw_header
import multiprocessing
import sys
import time
def exit_error():
sys.exit(1)
def exit_ok():
return
def return_value():
return 1
def raises():
raise RuntimeError('There was a... |
gui.py | import os
import glob
import requests
import threading
import tkinter as tk
from tkinter import Label, filedialog, Text
import cv2
import numpy as np
import torch
from utils import util_calculate_psnr_ssim as util
from models_config import MODLES
from models.network_swinir import SwinIR as net
from PIL import Image, Im... |
nanny.py | import asyncio
from contextlib import suppress
import errno
import logging
from multiprocessing.queues import Empty
import os
import psutil
import shutil
import threading
import uuid
import warnings
import weakref
import dask
from dask.system import CPU_COUNT
from tornado.ioloop import IOLoop, PeriodicCallback
from to... |
vnlhang.py | # encoding: utf-8
import urllib.request, urllib.parse, urllib.error
import hashlib
import requests
from queue import Queue, Empty
from threading import Thread
from time import sleep
LHANG_API_ROOT ="https://api.lhang.com/v1/"
FUNCTION_TICKER = ('ticker.do', 'get')
FUNCTION_DEPTH = ('depth.do', 'get... |
installwizard.py | # Copyright (C) 2018 The Electrum developers
# Distributed under the MIT software license, see the accompanying
# file LICENCE or http://www.opensource.org/licenses/mit-license.php
import os
import json
import sys
import threading
import traceback
from typing import Tuple, List, Callable, NamedTuple, Optional, TYPE_CH... |
RobotControlModule.py | #!/usr/bin/python3
import serial
import time
import threading
import sys
import traceback
from Communicate import *
# TODO fix the threading
def TryParseInt(val):
try:
return int(val)
except ValueError:
return False
class Controller(object):
def __init__(self, port):
self.tcp... |
manager.py | import logging
import signal
import threading
import time
from .worker import Worker
log = logging.getLogger(__name__)
class Manager(object):
"""Class managing workers"""
def __init__(self,
task_handler,
number_of_workers=10,
maximum_requests_per_thread=50... |
pyth_publisher.py | #!/usr/bin/env python3
from pyth_utils import *
from http.server import HTTPServer, BaseHTTPRequestHandler
import json
import random
import sys
import threading
import time
class PythAccEndpoint(BaseHTTPRequestHandler):
"""
A dumb endpoint to respond with a JSON containing Pyth account addresses
"""
... |
pdfca.py | import glob
import os
import re
import sys
from pathlib import Path
from threading import Thread
import click
import pandas as pd
import pyarrow as pa
import pyarrow.feather as feather
import pyarrow.parquet as pq
import PyPDF2
def checkIndex(dataframe):
key = int(click.prompt('Please enter item to explore'))
... |
Automatix.py | # Copyright 2013-2018 CERN for the benefit of the ATLAS collaboration.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... |
reciever_rs232.py | import serial
import multiprocessing
from time import sleep
### FREI.media ###
### www.frei.media ###
RECIEVER_OFF_WAIT = 120 # seconds to wait before turning off reciever
countdown_threads = list()
CONNECTION = serial.Serial() # RS232-Connection
def openConnection():
global CONNECTION
if CONNECTION.isOp... |
presenter_agent.py | # !/usr/bin/env python
# -*- coding:utf-8 -*-
from .socket_client import *
from .presenter_types import *
from . import presenter_message as pm
from threading import Thread
class PresenterAgent():
def __init__(self, server_ip, port):
self.socket = AgentSocket(server_ip, port)
self.exit = False
... |
duplexPipes.py | #Import built-in functions for multiprocessing and timing
import multiprocessing as mp
import time
#Import custom functions to process primes and encrypt
import primes
import encrypt
#Store the number of cores in the CPU to control number of processes to spawn
cpus = int(mp.cpu_count())
#Pass in the minimum and maxi... |
send_moesif.py | # Import Libraries
from moesifapi.exceptions.api_exception import APIException
from .. import global_variables as gv
from datetime import datetime, timedelta
import threading
import random
import math
class SendMoesif():
# Function to send event to Moesif
def send_event(self, event_model):
try:
... |
event.py | import threading
import time
def myThread(myEvent):
while not myEvent.is_set():
print('Waiting for Event to be set')
time.sleep(1)
print('myEvent has been set')
def main():
myEvent = threading.Event()
thread1 = threading.Thread(target=myThread, args=(myEvent,))
thread1.start()
... |
collector.py | import ast
import logging
import threading
from flask import Flask
from flask_restful import Api, Resource, reqparse
from gevent.pywsgi import WSGIServer
from lib.appformix_collector import AppformixCollector
from lib.junos_collector import JunosCollector
# Constants
HOST = '0.0.0.0'
COLLECTOR_PORT = 5002
DEVICE_CON... |
examplecreate.py | import time
from threading import Thread
import rxbp
from rxbp.acknowledgement.continueack import continue_ack
from rxbp.schedulers.asyncioscheduler import AsyncIOScheduler
from rxbp.schedulers.threadpoolscheduler import ThreadPoolScheduler
from rxbp.testing.tobserver import TObserver
def demo1():
def work(o, sk... |
conftest.py | import json
import attr
import socket
import threading
import pytest
import select
import queue
from django.conf import settings
def pytest_configure():
settings.configure(
MIDDLEWARE=[
'django_aws_xray.middleware.XRayMiddleware'
],
INSTALLED_APPS=[
'django_aws_xra... |
run_integration_tests.py | import os
import socket
import sys
import tempfile
import time
from multiprocessing import Process
import pytest
import settings
from cockatiel.server import run
sys.path.insert(0, os.path.abspath('..'))
port = os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings')
def waitfor(func, timeout=10, interval=0.5):... |
pyminer.py | #!/usr/bin/python
#
# Copyright 2011 Jeff Garzik
#
# 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.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY;... |
threaded_app.py | """
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
distributed ... |
trezor-t-emu.py | import os
import subprocess
import sys
import logging
import time
import threading
import PyQt5.QtWidgets as qwi
def execute_trezor_emu(emulator_base_dir: str, profile_dir: str):
env = os.environ
env['BROWSER'] = 'chromium'
env['TREZOR_PROFILE'] = profile_dir
start_sh = 'emu.sh'
try:
p = ... |
test_fork1.py | """This test checks for correct fork() behavior.
"""
import _imp as imp
import os
import signal
import sys
import threading
import time
import unittest
from test.fork_wait import ForkWait
from test.support import (reap_children, get_attribute,
import_module, verbose)
# Skip test if fork do... |
interactive.py | import asyncio
import logging
import os
import tempfile
import textwrap
import uuid
from functools import partial
from multiprocessing import Process
from typing import Any, Callable, Dict, List, Optional, Text, Tuple, Union
import numpy as np
from aiohttp import ClientError
from colorclass import Color
from sanic imp... |
UCS-IMC-FirmwareUpdater-1.5.py | import multiprocessing
from multiprocessing import Pool
from multiprocessing import Process
from imcsdk.utils.imcfirmwareinstall import firmware_huu_update
from imcsdk.utils.imcfirmwareinstall import firmware_huu_update_monitor
from imcsdk.imchandle import ImcHandle
import time
import datetime
import imcsdk.imchandle
i... |
fn.py | import warnings
from typing import List
import os
import re
import random
import time
import multiprocessing as mp
import psutil
import pynvml
import numpy as np
import torch
from prettytable import PrettyTable
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
def seed_everything(seed... |
pyminer.py | #!/usr/bin/python
#
# Copyright (c) 2011 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
import... |
datasets.py | # Copyright 2019-2021 Huawei Technologies Co., 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 agre... |
helper.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 22 11:53:52 2017
@author: GustavZ
"""
import datetime
import cv2
from threading import Thread
class FPS:
def __init__(self):
# store the start time, end time, and total number of frames
# that were examined between the start and... |
CaptureClass.py | import re
from getpass import getpass
from requests import session
import time
import threading
t = time.localtime(time.time())
xuenian = (str(t.tm_year) + '-' + str(t.tm_year + 1)) if t.tm_mon > 6 or (t.tm_mon == 6 and t.tm_mday > 15) else (
str(t.tm_year - 1) + '-' + str(t.tm_year))
xueqi = 1 if t.tm_mon > 6... |
parallel_start_test.py | #!/usr/bin/env python3
"""
Usage: time python3 util/test/parallel_start_test.py -d `pwd`/test
"""
import optparse
import os
import os.path
import subprocess
import sys
SLOTS = 4
def process_dir(test_dir):
"""
Process a directory containing Chapel unit tests
Parameters
----------
test_dir : Dire... |
common.py | """Test the helper method for writing tests."""
from __future__ import annotations
import asyncio
import collections
from collections import OrderedDict
from collections.abc import Awaitable, Collection
from contextlib import contextmanager
from datetime import datetime, timedelta
import functools as ft
from io import... |
bot.py | ###########################################
# Poop Array V2.0
# This is a re-tweeter that responds to the hashtag #pooparray
# could interact directly w/ ParticleIO or maybe w/ AdafruitIO.
# Depends, really. Will tinker around with both options.
# Some Limitations:
# --> This only works if your account is public
#... |
test_threadable.py | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.python.threadable}.
"""
import pickle
import sys
from unittest import skipIf
try:
import threading
except ImportError:
threadingSkip = True
else:
threadingSkip = False
from twisted.python import threadable
f... |
stoppable_flask.py | """
Simple wrapper, that adds stop method to Flask app.
It allows for the flask application to be run and stopped any times.
That can be sometimes helpful.
"""
import multiprocessing as mp
import time
import flask
class StoppableFlask(flask.Flask):
def __init__(self, name):
super().__init__(name)
... |
TSG_SRV_v0.3.py | #!/usr/bin/env python
"""TSG_SRV_v3.py: Management server for crypto_bridge from TSG projet"""
__author__ = "Titouan Mesot"
__copyright__ = "Copyright 2015 - Titouan Mesot"
__license__ = "APACHE2"
__version__ = "0.3"
__maintainer__ = "Titouan Mesot"
__email__ = "titouan.mesot@edu.hefr.ch"
__status__ = "Alpha"
import... |
serialhandler.py | # Serial handler class.
import time
import threading
import logging
import serial
import serial.threaded
import uuid
import Adafruit_BluefruitLE
from Adafruit_BluefruitLE.services import UART
# Define service and characteristic UUIDs used by the UART service.
UART_SERVICE_UUID = uuid.UUID('6E400001-B5A3-F393-E0A9-E50E... |
test_debugger_json.py | # coding: utf-8
from collections import namedtuple
import json
from os.path import normcase
import os.path
import sys
import time
import pytest
from _pydev_bundle.pydev_localhost import get_socket_name
from _pydevd_bundle._debug_adapter import pydevd_schema, pydevd_base_schema
from _pydevd_bundle._debug_adapter.pydev... |
benchmark.py | # SPDX-FileCopyrightText: 2015 Eric Larson
#
# SPDX-License-Identifier: Apache-2.0
import argparse
import sys
from datetime import datetime
from multiprocessing import Process
from wsgiref.simple_server import make_server
import requests
from cachecontrol import CacheControl
HOST = "localhost"
PORT = 8050
URL = "ht... |
sock.py | from typing import Any, Callable, Optional
import json
import logging
import threading
from pajbot.managers.redis import RedisManager
log = logging.getLogger(__name__)
HandlerParam = dict[str, Any]
Handler = Callable[[HandlerParam], None]
class SocketManager:
def __init__(self, streamer_name: str, callback: C... |
__Watcher.py | from multiprocessing import Lock, Process, Value
from .base import Base
'''
The base Watcher class.
Code running in a Watcher may be stopped at anytime.
To trigger this Watcher run:
with self.event.get_lock():
self.event.value = True
'''
class Watcher(Base):
'''
name: the name of the Watcher used in logging
'''
... |
jana-control.py | #!/usr/bin/env python
#
# GUI for monitoring and controlling a running JANA process
# via ZMQ messages.
#
# This is only useful if the process was started with the janacontrol
# plugin attached.
#
# By default, this uses port 11238 (defined in janacontrol.cc), but
# can use a different port number if specified by the J... |
server.py | import http.server, time, threading, asyncio, cgi, os,urllib.parse,posixpath,json
from urllib.parse import urlparse
from concurrent.futures import ThreadPoolExecutor
import multiprocessing as mp
from sys import platform
from .logging import getLogger
from .router import handle, getContext, PathNotFoundError
logger =... |
zuul_swift_upload.py | #!/usr/bin/env python3
#
# Copyright 2014 Rackspace Australia
# Copyright 2018 Red Hat, 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
#
# ... |
main copy.py | from joystick import Joystick
from threading import Thread
import sys, time
#import paho.mqtt.client as mqtt
#import paho.mqtt.publish as publish
from soundEnvelope import SoundEnvelope, Envelope
sys.path.append('/home/pi/dev/mavlink/')
from pymavlink import mavutil
import pymavlink.dialects.v10.ardupilotmega as mavli... |
restservice.py | import uuid
from fedn.clients.reducer.interfaces import CombinerInterface
from fedn.clients.reducer.state import ReducerState, ReducerStateToString
from idna import check_initial_combiner
from tenacity import retry
from werkzeug.utils import secure_filename
from flask import Flask, jsonify, render_template, request
fr... |
Server.py | from threading import Thread
from time import sleep
import ctypes, socket, sys
import platform, signal
from random import choice
from typing import Union, Tuple
class Colours:
def __init__(self):
if platform.system() == 'Windows':
kernel32 = ctypes.windll.kernel32
kernel32.SetConsoleMode(kernel3... |
code90.py | #!/usr/bin/env python2
import socket
import threading
import time
import SocketServer
import random
import tree
HOST = "0.0.0.0"
PORT = 11491
WELCOME_MSG = "I'm lost in a forest. Can you invert the path?\n"
ERROR_MSG = "Ooops, something went wrong here. Please check your input!\n"
CORRECT_MSG = "Yay, that's right!\n"... |
xml.py | from lxml import etree
from xml.sax.saxutils import quoteattr, escape
from functools import partial
from typing import Callable, IO
Matcher = Callable[[str], bool]
Transformer = Callable[[etree.ElementBase], etree.ElementBase]
def eq_matcher(tag_name: str) -> Matcher:
def inner(other: str) -> bool:
retur... |
UI.py | from MVNScrapper import MVNScrapper
from Addons import Addons
import os
import time
import threading
import configparser
import tkinter as tk
import tkinter.filedialog
class Home:
def __init__(self, root):
self._root = root
self._root.title("Deps Ahoy")
description_frame = tk.Frame(self._r... |
poolfileuploadServer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import json
import os
import random as _random
import sys
import traceback
from getopt import getopt, GetoptError
from multiprocessing import Process
from os import environ
from wsgiref.simple_server import make_server
import requests as _requests
from json... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.