source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
money.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
from multiprocessing import Process, Queue
import os, time, random
# 写数据进程执行的代码:
def write(q):
print('Process to write: %s' % os.getpid())
for value in ['A', 'B', 'C']:
print('Put %s to queue...' % value)
q.put(value)
time.sl... |
sampler.py | import time
import numpy as np
from multiprocessing import Process, Queue, cpu_count
import dataset.utils as utils
class ParallelSampler():
def __init__(self, data, args, sampled_classes, source_classes, num_episodes=None):
self.data = data
self.args = args
self.num_episodes = num_episod... |
lab5old.py | import random, time
from threading import BoundedSemaphore, Thread
max_itens = 5
count=0
itens=[]
#container = 0
#container = BoundedSemaphore(max_itens)
def producer(qtd):
global count
global itens
for i in range(qtd):
item = random.randrange(1, 10)
if count<max_itens:
... |
cmdserver.py | """
*azcam.tools.cmdserver* contains the CommandServer class for azcam's socket command interface.
"""
import json
import os
import socket
import socketserver
import threading
import time
import azcam
class CommandServer(socketserver.ThreadingTCPServer):
"""
Main class for cmdserver tool.
CommandServer... |
test_threading_local.py | import sys
import unittest
from doctest import DocTestSuite
from test import support
import weakref
import gc
# Modules under test
import _thread
import threading
import _threading_local
class Weak(object):
pass
def target(local, weaklist):
weak = Weak()
local.weak = weak
weaklist.append(weakref.ref... |
pyshell.py | #! /usr/bin/env python3
import sys
try:
from tkinter import *
except ImportError:
print("** IDLE can't import Tkinter.\n"
"Your Python may not be configured for Tk. **", file=sys.__stderr__)
raise SystemExit(1)
# Valid arguments for the ...Awareness call below are defined in the following.
# ht... |
__init__.py | """
https://github.com/tarantool/test-run/issues/265
Scenario:
The function '_target_function' cannot be work anymore in Python 3.9 up.
Code:
@wraps(target)
@ParallelStrategy.save_return_value
def _target_function(*_args, **_kwargs):
result_value = target(*_args, **_kwargs)
... |
client.py | import xmlrpc.client
import threading
from http import client as http_client
import functools
from sys import hexversion
OPTIONS = {'CONFIGURED': False, 'TIMEOUT': 20}
def configure(opts):
if not OPTIONS['CONFIGURED']:
try: # support for django
import django.conf
OPTIONS.update(django.conf.settings.... |
graph.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... |
framework_helpers.py | # Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is govered by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
"""Helper functions and classes used throughout Monorail."""
import logging
import random
impor... |
main.py | import cv2
import imutils
import time
import threading
import serial
import RPi.GPIO as GPIO
from bluetooth import *
from serial.serialutil import SerialException
# -------------------변수 선언 부분-------------------
port = "/dev/ttyACM0"
reset_timer_seconds = -1
angles = [150, 120, 130]
arduino = serial.Serial(port, 11520... |
trader.py | # 0.00257886 BTC @ 210817
from __future__ import print_function
from time import time
from time import sleep
import logging
from operator import itemgetter
from pymongo import MongoClient
import pandas as pd
import numpy as np
import json, requests, re, multiprocessing, subprocess
from decimal import *
global buystr
gl... |
app.py | # encoding: utf-8
'''
A REST API for Salt
===================
.. versionadded:: 2014.7.0
.. py:currentmodule:: salt.netapi.rest_cherrypy.app
:depends:
- CherryPy Python module. Version 3.2.3 is currently recommended when
SSL is enabled, since this version worked the best with SSL in
internal testing.... |
rpc_test.py | import concurrent.futures
import contextlib
import json
import os
import sys
import threading
import time
from collections import namedtuple
from functools import partial
from threading import Event
from threading import Lock
from unittest import mock
import torch
import torch.nn as nn
import torch.distributed as dis... |
yahoo_weather.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from .. import bar
import base
import urllib
import urllib2
from xml.dom import minidom
import gobject
import threading
try:
import json
except ImportError:
import simplejson as json
QUERY_URL = 'http://query.yahooapis.com/v1/public/yql?'
WEATHER_URL = 'http://we... |
daemon_thread.py | import threading
import time
def standard_thread():
print("Starting my Standard Thread")
time.sleep(20)
print("Ending my standard thread")
def daemon_thread():
while True:
print("Sending Out Heartbeat Signal")
time.sleep(2)
if __name__ == '__main__':
standardThread = threading.... |
app.py | # -*- coding: utf-8 -*-
import json
import logging
import os
import signal
import subprocess
import threading
import traceback
from typing import Dict
from flask import Flask, jsonify, make_response, request
import redis
from .RLPopThread import RLPopThread
logging.basicConfig(level=logging.DEBUG,
... |
Binance Detect Moonings.py | """
Olorin Sledge Fork
Version: 1.18
Disclaimer
All investment strategies and investments involve risk of loss.
Nothing contained in this program, scripts, code or repositoy should be
construed as investment advice.Any reference to an investment's past or
potential performance is not, and should not be construed as, ... |
ea_players_game.py | import argparse
import sys
from multiprocessing import JoinableQueue, Process, Value
import numpy as np
from ai.EAPlayer import EAPlayer
from game.Game import game_process, Game
from gui.Gui import gui_process
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('players', help="number o... |
Crawler.py | import requests
# import scrapy
import re
import time
import datetime
import pickle
import threading
from threading import Timer
from tornado import ioloop, httpclient
import os.path
from bs4 import BeautifulSoup
# import _thread
# from parser import Parser
"""
This file consists of crawler class which is mainly respo... |
gorun.py | #!/usr/bin/env python
#
# Wrapper on pyinotify for running commands
# (c) 2009 Peter Bengtsson, peter@fry-it.com
#
# TODO: Ok, now it does not start a command while another is runnnig
# But! then what if you actually wanted to test a modification you
# saved while running another test
# Yes, w... |
test_remote_account.py | # Copyright 2015 Confluent 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 writing, s... |
fxcmpy.py | #
# fxcmpy -- A Python Wrapper Class for the
# RESTful API as provided by FXCM Forex Capital Markets Ltd.
#
# The codes contained herein come without warranties or representations,
# to the extent permitted by applicable law.
#
# Read the RISK DISCLAIMER carefully.
#
# (c) FXCM Forex Capital Markets Ltd.
#
import requ... |
test_util.py | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
Subscription.py | import yaml, utils, parameters, time, os
from multiprocessing import Process, Pipe
class Subscription():
def __init__(self, socket):
(self.receiver, self.sender) = Pipe(False) # Open unidirectionnal pipe
self.callback = utils.default_notifcation_callback
self.s = socket
def setCallbac... |
dag_processing.py | # -*- coding: utf-8 -*-
#
# 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
#... |
multi_inference_20200804110857.py | # coding=utf-8
import os
import cv2
import sys
import pdb
import subprocess
import multiprocessing
import inference_utils
import common
def single_process(index, task, gpu):
print(("任务%d处理%d张图片" % (index, len(task))))
# 写文件
filename = inference_utils.dump_testfile(task, index)
out_str = subproces... |
test_end2end.py | """End to end tests for Selenium Wire."""
import json
import os
import shutil
import tempfile
import threading
from contextlib import contextmanager
from glob import glob
from pathlib import Path
from unittest.mock import patch
import pytest
from selenium.common.exceptions import TimeoutException
import seleniumwire... |
progress.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Progression module
------------------
This module provides the (so far) four variants to display progress information:
* :py:class:`.ProgressBar`
This class monitors one or multiple processes showing the total elapsed time (TET), the current speed
... |
sensor.py | """Pushbullet platform for sensor component."""
import logging
import voluptuous as vol
from homeassistant.const import CONF_API_KEY, CONF_MONITORED_CONDITIONS
from homeassistant.components.sensor import PLATFORM_SCHEMA
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Enti... |
monitor.py | import sched
import time
from multiprocessing import Queue
from threading import Thread
def clear_queue(queue: Queue):
with queue.mutex:
queue.queue.clear()
def monitor_queue(cls):
class QueueMonitor:
def __init__(self, *args, **kwargs):
self.oInstance = cls(*args, **kwargs)
... |
pytest_dut_monitor.py | import pytest
import paramiko
import threading
import logging
import time
import os
import yaml
from collections import OrderedDict
from datetime import datetime
from errors import HDDThresholdExceeded, RAMThresholdExceeded, CPUThresholdExceeded
logger = logging.getLogger(__name__)
DUT_MONITOR = "/tmp/dut_monitor.p... |
test_marathon.py | import ast
import contextlib
import json
import os
import re
import sys
import threading
from datetime import timedelta
import pytest
import retrying
from six.moves.BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from dcos import constants
from dcoscli.test.common import (assert_command, assert_lines, exec... |
vnrpc.py | # encoding: UTF-8
import threading
import traceback
import signal
import zmq
from msgpack import packb, unpackb
from json import dumps, loads
import cPickle
pDumps = cPickle.dumps
pLoads = cPickle.loads
# 实现Ctrl-c中断recv
signal.signal(signal.SIGINT, signal.SIG_DFL)
################################################... |
flipcam.py | import cv2
import time
import threading
import queue
import fire
class StreamCameraReader:
def __init__(self, camera_id):
self._stream_buffer = queue.LifoQueue(1)
self._camera_id = camera_id
self.stop_flag = False
def start(self):
def read_frames():
cap = cv2.Vide... |
monitor_all_redis.py | import datetime
import threading
import redis
import config
class Monitor():
def __init__(self, connection_pool):
self.connection_pool = connection_pool
self.connection = None
def __del__(self):
try:
self.reset()
except:
pass
def reset(self):
... |
__init__.py | import inspect
import socket
import json
import requests
import multiprocessing
__version__ = "0.0.6"
def get_class_that_defined_method(method):
"""
Returns the class that defined the method
Got implementation from stackoverflow
http://stackoverflow.com/a/25959545/3903832
"""
# for bound meth... |
task.py | """ Backend task management support """
import itertools
import logging
import os
import re
from enum import Enum
from tempfile import gettempdir
from multiprocessing import RLock
from threading import Thread
try:
from collections.abc import Iterable
except ImportError:
from collections import Iterable
import... |
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... |
example.py | import threading
import time
from dmxnet import ESP
node = ESP(bind_address=('', 1234), node_data='foobar')
client = ESP(send_port=1234)
def mk_handle_poll_reply(name):
def handle_poll_reply(addr, type_, args, data):
print(f"[{name}] Poll reply from {addr}: {args}, {data}")
return handle_poll_reply... |
linkcheck.py | """
sphinx.builders.linkcheck
~~~~~~~~~~~~~~~~~~~~~~~~~
The CheckExternalLinksBuilder class.
:copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import json
import queue
import re
import socket
import threading
import time
import warnings
f... |
worker_handlers.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... |
example0.py | #!/usr/bin/env python
import multiprocessing
def worker():
print('new worker')
for i in range(8):
multiprocessing.Process(target = worker).start()
|
_gui.py | import logging
from wse_investor._best_companies import get
from tkinter import *
from threading import *
logger = logging.getLogger()
class StdoutDirector:
def __init__(self, text_area):
self.text_area = text_area
def write(self, msg):
self.text_area.insert(END, msg)
self.text_are... |
timing.py | """
Team Neural Net of IoT Devices
Test Script for Collecting Neural Net runtime Data on Raspberry Pi
2018 SIUE Senior Project
"""
import subprocess
import sys
import threading
import time
import os
minTime = 1000
bestNumLayers = 0
bestLayerWidth = 0
sleepTime = 3
def javakill():
time.sleep(sleepTime)
os.sy... |
test_track_sensors.py | #----------------------------------------------------------------------
# This programme provides a simple test programme for the track sensors
# using the Raspberry Pi GPIO inputs
# ---------------------------------------------------------------------
from tkinter import *
from model_railway_signals import *
from mod... |
send_order_demo.py | from threading import Thread
from time import sleep
from ctpbee import CtpbeeApi, helper, CtpBee
from ctpbee.constant import ContractData, LogData, TickData, BarData, OrderType, Offset, OrderData, SharedData, \
TradeData, PositionData, Direction, AccountData
class Demo(CtpbeeApi):
contract_set = set(["rb1910... |
callback_api.py | from app import mythic
import app
from sanic.response import json, raw
from app.database_models.model import (
Callback,
Task,
LoadedCommands,
PayloadCommand,
)
from sanic_jwt.decorators import scoped, inject_user
import app.database_models.model as db_model
from sanic.exceptions import abort... |
CourierService.py | '''
Created on Jan 17, 2015
@author: owwlo
'''
from PyQt5 import QtGui, QtCore, QtQml, QtQuick
from PyQt5.QtCore import QObject, QUrl, Qt, QVariant, QMetaObject, Q_ARG
import threading
import websocket
import json
import logging
from time import sleep
import coloredlogs
WS_URL = "ws://localhost:88... |
test_url_cost.py | import requests
import json
import csv
import time
import aiohttp
import asyncio
import threading
import queue
import uuid
import urllib.request
test_num = 100
url = 'https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&tn=baiduadv&wd=05782212292&rqlang=cn&rsv_enter=1&rsv_sug3=2'
query_header = {
"Accept": "text... |
im2rec.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 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 Licens... |
__init__.py | from robothor_challenge.startx import startx
import ai2thor.controller
import ai2thor.util.metrics
import json
import threading
import yaml
import os
import sys
import logging
logger = logging.getLogger(__name__)
ch = logging.StreamHandler(sys.stdout)
ch.flush = sys.stdout.flush
ch.setLevel(logging.INFO)
formatter = l... |
GUI_output_redirection.py | from __future__ import print_function, unicode_literals
import sys
import os
if 'pythonw.exe' in sys.executable.lower():
import subprocess
# Re-launch with python.exe and hidden console window:
CREATE_NO_WINDOW = 1 << 27
cmd = [sys.executable.lower().replace('pythonw.exe', 'python.exe')] + sys.argv
... |
flair.py | import platform
import time
from http.client import HTTPConnection
from threading import Thread
import webview
from apis.input_methods.mouse_and_keyboard_listener import start_listeners
from app import run_app
error = False
status = False
port = 43968
operating_system = str(platform.system()).lower()
def get_user... |
pput.py | """Multipart parallel s3 upload.
usage
pput bucket_name/filename
"""
from queue import Queue
from io import StringIO
from collections import namedtuple
from threading import Thread
import argparse
import base64
import binascii
import functools
import hashlib
import logging
import json
import os
import sys
import bot... |
timeout.py | from threading import Thread
import functools
def timeout(timeout_length, message=None):
""" Creates timeout decorator to be attached to functions """
def deco(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
default_message = 'function [%s] timeout [%s seconds] exceeded... |
app.py | # Run this before anything else: checks for command line arguments
# Default: no arguments, liked when using Makefile (normal API backend running)
import argparse
parser = argparse.ArgumentParser()
# To turn option into flag, use action= parameter: calls a predefined function
# store_true is one of many default functio... |
xla_device_utils.py | # Copyright The PyTorch Lightning team.
#
# 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 i... |
LoginFaceManual.py | from tkinter import Tk, PhotoImage, Button, Label, StringVar, Entry
from threading import Thread as Process
import cv2
import time
from face_recognition import face_encodings, compare_faces, load_image_file
import os
from PIL import ImageTk, Image
import pickle
def pascheck(idt, past):
if idt == "StartCode@@@" and ... |
uhdtodrf.py | #!python
# ----------------------------------------------------------------------------
# Copyright (c) 2020 Massachusetts Institute of Technology (MIT)
# All rights reserved.
#
# Distributed under the terms of the BSD 3-clause license.
#
# The full license is in the LICENSE file, distributed with this software.
# ----... |
views.py | '''
Copyright (C) 2013 TopCoder Inc., All Rights Reserved.
'''
'''
This is the module that defines all the views which will respond to client requests.
Thread Safety:
The implementation is not thread safe but it will be used in a thread-safe manner.
v1.1 - Healthcare Fraud Prevention Release Assembly v1.0
- upda... |
io_wrap.py | #!/usr/bin/env python
from __future__ import print_function
"""Utilities for capturing output from the current process and processes it
starts.
This file is also a test harness for I/O wrapping: run it as a script with a
shell command in the commandline arguments to see how PTY redirection behaves
for that command.
... |
environment.py | import abc
import consul
import datetime
import etcd
import kazoo.client
import kazoo.exceptions
import os
import psutil
import psycopg2
import json
import shutil
import signal
import six
import subprocess
import tempfile
import threading
import time
import yaml
@six.add_metaclass(abc.ABCMeta)
class AbstractControlle... |
main.py | from kivy.config import Config
import os
from os import listdir
from os.path import isfile, join
from kivy.core.window import Window
from kivymd.app import MDApp
import sqlite3
from kivy.uix.widget import Widget
from kivy.properties import ObjectProperty
from GUI.popups import show_message_popup
from kivy.uix.modalview... |
ultrasound.py | import sys
import RPi.GPIO as GPIO
import relay
import time
from threading import Thread
import datetime
starting = 0
ending = 0
current_distance = 0
down = 0
# relay.cleanup(True)
def calculate_distance(pin):
global ending
global current_distance
global down
ending = time.time()
now = datetim... |
conftest.py | import http.server
import os
import threading
from typing import Generator
import pytest
from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
from sylenium import driver_manager
from tests.integration.webserver.tcp_server import IntegrationTCPServer
@pytest.fixture
def default_driver(defaul... |
collectinfotest.py | import subprocess, time, os
from subprocess import call
from threading import Thread
from clitest.cli_base import CliBaseTest
from remote.remote_util import RemoteMachineHelper,\
RemoteMachineShellConnection
from couchbase_helper.documentgenerator import BlobGenerator
from membase.api.res... |
run_micro_service.py | from threading import Thread
import base64
import flask
import redis
import uuid
import time
import json
import sys
import io
import algorithm
import numpy
IMAGE_QUEUE = "image_queue"
BATCH_SIZE = 32
DTYPE = numpy.float32
SERVER_SLEEP = 0.25
CLIENT_SLEEP = 0.25
# initialize our Flask application, Redis ser... |
test_events.py | """Tests for events.py."""
import collections.abc
import concurrent.futures
import functools
import io
import os
import platform
import re
import signal
import socket
try:
import ssl
except ImportError:
ssl = None
import subprocess
import sys
import threading
import time
import errno
import unittest
from unitt... |
linkcheck.py | # -*- coding: utf-8 -*-
"""
sphinx.builders.linkcheck
~~~~~~~~~~~~~~~~~~~~~~~~~
The CheckExternalLinksBuilder class.
:copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
import socket
import codecs
import threading
from os import p... |
RAE.py | __author__ = 'patras'
from actors.RAE.RAE1Stack import RAE1
from shared.timer import globalTimer
import threading
from shared import GLOBALS
from learning.learningData import WriteTrainingData
import multiprocessing as mp
import importlib
#****************************************************************
#To control P... |
utilities.py | #!/bin/env python
# -*coding: UTF-8 -*-
#
# Disclaimer:
# Functions get_sys_info, netcdf_and_hdf5_versions and show_versions are from:
# xarray/util/print_versions.py
#
import os
import sys
import warnings
import urllib
import json
import collections
import copy
from functools import reduce
from packaging import ver... |
source_worker.py |
import time
import threading
import zmq
import os
import signal
import pickle
from Heron.communication.socket_for_serialization import Socket
from Heron import constants as ct
from Heron.communication.ssh_com import SSHCom
from Heron.gui.relic import HeronRelic
class SourceWorker:
def __init__(self... |
datamunging.py | import logging
import time
import threading
class DataMunging:
mongo = None
def __init__(self, mongo, replicator_queue):
self.mongo = mongo
self.logger = logging.getLogger(__name__)
self.replicator_queue = replicator_queue
self.lock = threading.Lock()
self.last_seqnum ... |
edge_betweenness_filter.py | from libary.result import Result
import networkx
import threading
class EdgeBetweennessFilter:
def __init__(self):
pass
def get_name(self):
return 'Filter:EdgeBetweeness'
def apply(self, input: Result, parameters: dict, old_results: list):
input_undirected_knn_graph = input.get_u... |
simple_http_server_batch.py | from http.server import BaseHTTPRequestHandler, HTTPServer
from socketserver import ThreadingMixIn
from urllib.parse import urlparse
import json
import sys
import datetime
import plyvel
import requests
import threading
rec = False
zero_t = "0000-00-00 00:00:00.000000"
v_ph = "++++-++-++ ++:++:++.++++++"
t_ph = "----... |
stim_server_client.py | # Author: Mainak Jas <mainak@neuro.hut.fi>
# License: BSD (3-clause)
import queue
import time
import socket
import socketserver
import threading
import numpy as np
from mne.utils import logger, verbose, fill_doc
class _ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
"""Create a threaded... |
pyto_ui.py | """
UI for scripts
The ``pyto_ui`` module contains classes for building and presenting a native UI, in app or in the Today Widget.
This library's API is very similar to UIKit.
.. warning::
This library requires iOS / iPadOS 13.
This library may have a lot of similarities with ``UIKit``, but subclassing isn't supp... |
app.py | #! /usr/bin/env python3
from threading import Thread
from flask import Flask, render_template
from selenium import webdriver
from driver import getPath, profile
from rss import pickup
from reddit import pickup_reddit
def banda_server():
app = Flask(__name__)
@app.route("/")
def index():
return r... |
service.py | '''
Created on Nov 8, 2012
@author: mdickson
'''
### Run Python scripts as a service example (ryrobes.com)
### Usage : python aservice.py install (or / then start, stop, remove)
import os
import sys
from threading import Thread
import win32service
import win32serviceutil
import win32event
from inworldz.util.filesys... |
dcom.py | """
Copyright 2021-2021 The jdh99 Authors. All rights reserved.
Device Communication Protocol(DCOM):设备间通信协议。 DCOM协议可用于物联网设备之间RPC通信。
Authors: jdh99 <jdh821@163.com>
"""
from dcompy.rx import *
from dcompy.common import *
import threading
import asyncio
def load(param: LoadParam):
set_load_param(param)
rx_loa... |
service_spending_logger.py | #!/usr/bin/env python3
# Imports
from telegram.ext import Updater, CommandHandler, CallbackContext, Filters
from telegram import ChatAction
import os, sys, threading, logging
import pytz
from functools import wraps
from datetime import datetime
import sql_adapter_spending_logger as sql_adapter
import config
# Loggi... |
segment_all.py | import argparse
import json
import logging
import os
import threading
from os.path import exists, join, split, dirname
import time
import numpy as np
import shutil
import sys
from PIL import Image
import torch
import torch.utils.data
from torch import nn
import torch.backends.cudnn as cudnn
from torch.autograd impor... |
translate.py | import argparse
import hashlib
import itertools
import multiprocessing
import os
import subprocess
import sys
import time
import traceback
from collections import OrderedDict, deque
def count_lines(f):
i = 0
if not os.path.exists(f):
return i
with open(f) as r:
for _ in r:
i +... |
server.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... |
progress.py | # -*- coding: utf-8 -*-
#
# Copyright (c) 2015, ParaTools, Inc.
# 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,
# t... |
main_window.py | import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
import asyncio
from typing import TYPE_CHECKING, Optional, Union, Callable, Sequence
from electrum.storage import WalletStorage, StorageReadWriteError
from electrum.wallet_db import WalletDB
from el... |
pjit_test.py | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
run_all.py | import logging.config
import multiprocessing
import runpy
# create these targets so we can get structural and functional data in parallel
def get_content_store_data():
runpy.run_module('src.data_preprocessing.get_content_store_data', run_name='__main__')
def make_functional_edges_and_weights():
runpy.run_mo... |
infunction.py | import random
import time
import boto3
from multiprocessing import Process, Pipe
def parallel_handler(event, context):
startTime = GetTime()
if 'n' in event:
times = event['n']
parallelIndex = event['parallelIndex']
temp = alu(times,parallelIndex)
return{
'result': ... |
test_interrupt.py | import os
import signal
import time
from threading import Thread
import pytest
from dagster import (
DagsterEventType,
Field,
ModeDefinition,
String,
execute_pipeline_iterator,
pipeline,
reconstructable,
resource,
seven,
solid,
)
from dagster.core.errors import DagsterExecutionI... |
streaming.py | """Sender--Receiver pairs for socket communication."""
from __future__ import absolute_import, division, print_function
from builtins import str
from builtins import object
import sys
import queue
import threading
import time
import socket
from socketserver import TCPServer, BaseRequestHandler
from .tools import Qui... |
test_app.py | import unittest
import os
import flask
from flask_mab import BanditMiddleware,add_bandit,choose_arm,reward_endpt
import flask_mab.storage
from flask_mab.bandits import EpsilonGreedyBandit
from werkzeug.http import parse_cookie
import json
from utils import makeBandit
from threading import Thread
from multiprocessing ... |
rbacCollectionTest.py | from membase.api.rest_client import RestConnection
import urllib.request, urllib.parse, urllib.error
import json
from remote.remote_util import RemoteMachineShellConnection
import subprocess
import socket
import fileinput
import sys
from subprocess import Popen, PIPE
from basetestcase import BaseTestCase
from couchbase... |
process.py | from __future__ import print_function
import signal
import subprocess
import sys
import logging
from datetime import datetime
from threading import Thread
from Queue import Queue, Empty
#
# This code comes from Honcho. Didn't need the whole Honcho
# setup, so I just swiped this part which is what the build
# pa... |
test_all.py | #!/usr/bin/python
from functions import *
now = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%p")
# Get header file.
with open(os.path.join(scriptDir,headerHtml), 'r') as content_file:
dashboard = content_file.read()
dashboard = dashboard + "\n<p>Last updated: " + now + " UTC</p><br>"
# Table opening and co... |
session.py | import os
import random
import threading
import time
from keras.models import load_model
from sklearn.cluster import KMeans
import librosa
import numpy as np
import tensorflow as tf
from tomomibot.audio import (AudioIO, slice_audio, detect_onsets,
is_silent, mfcc_features, get_db)
from to... |
producer_consumer.py | #Simple Producer and Consumer Problem
# demonstrates queues and events with locks
import random
import threading
from threading import Thread
import multiprocessing
from queue import Queue
import time
import logging
logging.basicConfig(format='%(asctime)s.%(msecs)03d - %(levelname)s - %(message)s', datefmt... |
session_test.py | """Tests for tensorflow.python.client.session.Session."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import threading
import time
import tensorflow.python.platform
import numpy as np
from six.moves import xrange # pylint: disable=redefined-builtin
f... |
code_rater.py | import os
import re
from threading import Thread
from threading import BoundedSemaphore
from threading import Lock
from pylint import epylint as linter
import file_handling
files_to_lint = list(file_handling.find_files(".", file_extensions=["py"]))
score_regex = r"(?<=Your code has been rated at ).+(?=\s\(previous)"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.