source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
backend.py | #!/usr/bin/env python3
# This script supports autocompletion with argcomplete: PYTHON_ARGCOMPLETE_OK
from pyspimosim.base_model import create_parser_from_data_class, namespace_to_dataclass
from pyspimosim import spimosim_server
from dataclasses import dataclass
import http.server
import importlib
import multiprocessi... |
__init__.py | # YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
Logging utils
"""
import os
import warnings
from threading import Thread
import pkg_resources as pkg
import torch
from torch.utils.tensorboard import SummaryWriter
from utils.general import colorstr, emojis
from utils.loggers.wandb.wandb_utils import WandbLogger
from u... |
test_io.py | import sys
import gc
import gzip
import os
import threading
import time
import warnings
import io
import re
import pytest
from pathlib import Path
from tempfile import NamedTemporaryFile
from io import BytesIO, StringIO
from datetime import datetime
import locale
from multiprocessing import Process, Valu... |
train_script.py | """
Train script for a single file
Need to set the TPU address first:
export XRT_TPU_CONFIG="localservice;0;localhost:51011"
"""
import torch.multiprocessing as mp
import threading
import time
import random
import sys
import argparse
import gzip
import json
import logging
import tqdm
import torch
from torch import nn... |
__init__.py | import contextlib
import copy
import hashlib
import itertools
import json
import tqdm
import torchvision
import pprint
import os
import pickle
import shlex
import subprocess
import threading
import time
import numpy as np
import pylab as plt
import torch
import pandas as pd
from .. import haven_img as hi
from .image_u... |
python_instance.py | #!/usr/bin/env python
#
# 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
# "... |
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... |
cli.py | # encoding: utf-8
from __future__ import print_function
import collections
import csv
import multiprocessing as mp
import os
import datetime
import sys
from pprint import pprint
import re
import itertools
import json
import logging
from optparse import OptionConflictError
import traceback
from six import text_type
f... |
htcondor_utils.py |
#=== Imports ===================================================
import re
import time
import threading
import random
import multiprocessing
import tempfile
import functools
import traceback
import xml.etree.ElementTree as ET
try:
import subprocess32 as subprocess
except Exception:
import subprocess
try:
... |
ping-aggregator-E16-server.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import logging
import psutil
import subprocess
import os
import yaml
from threading import Thread
import srvdb
import requests as orig_requests
import time
from flask import Flask
from flask import request
from two1.commands.config import Config
from two1.wa... |
bak.client.py | #!/usr/bin/env python
#
# Copyright 2014 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 ... |
run.py | import os
import time
import torch
import numpy as np
import numpy.random as rd
import multiprocessing as mp
# from elegantrl.env import build_env
from elegantrl.env import build_isaac_gym_env as build_env # todo isaac
from elegantrl.replay import ReplayBuffer, ReplayBufferMP
from elegantrl.evaluator import Evaluato... |
slack.py | from slackclient import SlackClient
import json
import requests
from threading import Thread
from utils import*
slack_token = 'YOUR-SLACK-TOKEN-HERE'
slack_client = SlackClient(slack_token)
#just for example
allowedChannels = ['G7N3MRCCS','G7P2M4CCS']
#slack common utils
def isIntenedMessage(event):
try:
j = eve... |
executor.py | import functools
import json
import logging
import signal
import time
from threading import Event, Lock, Thread, Timer
import os
import pymesos as pm
import cook
import cook.io_helper as cio
import cook.progress as cp
import cook.subprocess as cs
import cook.util as cu
def get_task_id(task):
"""Retrieves the id... |
stress_test.py | # USAGE
# python stress_test.py
# import the necessary packages
from threading import Thread
import requests
import time
# initialize the Keras REST API endpoint URL along with the input
# image path
KERAS_REST_API_URL = "http://localhost:5000/predict"
IMAGE_PATH = "jemma.jpg"
# initialize the number of requests ... |
gen_cleaned_megaface.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import traceback
from easydict import EasyDict as edict
import time
import sys
import numpy as np
import argparse
import struct
import cv2
import multiprocessing
import skle... |
app.py | # -*- coding: utf-8 -*-
from flask import Flask, render_template, request,session,abort
from revisit_sayat import fayat
# from flask_sslify import SSLify
import uuid
from threading import Thread
from check import checkAll
app = Flask(__name__)
app.secret_key = 'hellowordl1'
# sslify = SSLify(app, permanent=True)
d... |
semglenny.py | # Copyright (c) Lenny Varghese and Unlock contributors.
# 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,
# this ... |
SwitchHelper.py | #!/usr/bin/env python
# encoding: utf-8
# Copyright 2014 Xinyu, He <legendmohe@foxmail.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 a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
... |
logger_test.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... |
_simple_stubs_test.py | # Copyright 2020 The 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 wri... |
build_imagenet_data.py | # Copyright 2016 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 applicable law or a... |
data.py | # THIS FILE IS FOR EXPERIMENTS, USE image_iter.py FOR NORMAL IMAGE LOADING.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import random
import logging
import sys
import numbers
import math
import sklearn
import datetime
import numpy as np
import ... |
test_channel.py | #!/usr/bin/env python
#
# Server that will accept connections from a Vim channel.
# Used by test_channel.vim.
#
# This requires Python 2.6 or later.
from __future__ import print_function
import json
import socket
import sys
import time
import threading
try:
# Python 3
import socketserver
except ImportError:
... |
multiProcess.py | from scripts import camShow as cvShow, utilities as init, tesseract as runner
from multiprocessing import process
cvShow.defaultCam = init.getCamera()
lang = init.pickLanguage()
tesseractProcess = process.Process(target=runner.main(lang, cvShow.defaultCam))
tesseractProcess.daemon = True
cameraProcess = process.Proc... |
main.py | import discord
import os
import random
import requests
import sys
import threading
import time
import yaml
from flask import Flask
from threading import Thread
app = Flask('')
@app.route('/')
def main():
return "Your Bot Is Ready"
sys.path.append("./objection_engine")
from deletion import Deletion
from discord.ext... |
receiverPubSubMultiprocessing_T1.py | """pub_sub_receive.py -- receive OpenCV stream using PUB SUB."""
from parameters import ParticipantData
from parameters import Parameters
from parameters import OutsourceContract
from parameters import Helperfunctions
import json
from merkletools import MerkleTools
import sys
import videoStramSubscriber as vss
from n... |
api_image_test.py | import contextlib
import json
import shutil
import socket
import tarfile
import tempfile
import threading
import pytest
import six
from six.moves import BaseHTTPServer
from six.moves import socketserver
import docker
from .base import BaseAPIIntegrationTest, BUSYBOX
class ListImagesTest(BaseAPIIntegrationTest):
... |
old_startracker.py | # startracker.py
# by Umair Khan, from the Portland State Aerospace Society
# based on OpenStarTracker from Andrew Tennenbaum at the University of Buffalo
# openstartracker.org
# Imports - built-ins
import sys
import time
import threading
import glob
import random
import logging
# Imports - external
import numpy as n... |
demo3.py | """
【多线程】多线程共享全局变量以及锁机制 2019/11/03 23:50
"""
# TODO: 多线程共享全局变量的问题
"""
多线程都是在同一个进程中运行的。因此在进程中的全局变量所有线程都是可共享的。
这就造成了一个问题,因为线程执行的顺序是无序的。有可能会造成数据错误。
"""
# TODO: 锁机制
"""
为了解决以上使用共享全局变量的问题。threading提供了一个Lock类,
这个类可以在某个线程访问某个变量的时候加锁,其他线程此时就不能进来,
直到当前线程处理完后,把锁释放了,其他线程才能进来处理。
加锁: gLock.acquire()
释放锁: gLock.release()
"""
import... |
task_queue.py | import sys
import time
import traceback
import threading
class TaskQueue:
# ---------------------------------------- Task -----------------------------------------
class Task:
def __init__(self, name: str):
self.__name = name
def __str__(self):
return 'Task %s [%s]' ... |
main.py |
#libraraies
from pytube import *
import os
from tkinter import *
from tkinter.filedialog import *
from tkinter.messagebox import *
from threading import *
file_size = 0
q= input("")
if a == "shutdown":
os.system("shutdown -s")
#function progress to keep check of progress of function.
def progress(stream=None, ch... |
ftx.py | import os
apikey = os.environ['key']#'IO7okj6AU7sgEKq4M_T2Ld-KO1VTXpSuq3WkfUF0'
apisecret = os.environ['secret']#'1DMOnLSW3fk3SF8KVCbsKTTgqxSdl78tRZja_zQo'
divisor=1000
abc = -937.0961358420444
abc = abc / 28 / 10
print(abc)
import requests
import math
from datetime import timedelta
import datetime
import sys
from th... |
test_dag_serialization.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... |
resubmit.py | import threading
import time
from automation.ena.ena_brokering import ENASubmission
__author__ = 'Ahmed G. Ali'
experiments = '''ahmed_a7a E-MTAB-3851'''
# MAGE_8337 E-MTAB-94848373'''
def reload_experiment(dir_name, accession):
# conan = ConanPage(url=settings.CONAN_URL)
# conan.login(login_email=settings.C... |
manager.py | #!/usr/bin/env python3
import datetime
import importlib
import os
import sys
import fcntl
import errno
import signal
import shutil
import subprocess
import textwrap
import time
import traceback
from multiprocessing import Process
from typing import Dict, List
from common.basedir import BASEDIR
from common.spinner imp... |
dewertokin.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#----------------------------------------------------------------------------
# Created By : https://github.com/mishnz
# Created Date: 14/01/2022
# version ='1.0'
# ---------------------------------------------------------------------------
""" DewertOkin HE150 controller... |
bbox_regression.py | """
This file has functions about generating bounding box regression targets
"""
from __future__ import print_function
import numpy as np
import cv2
import threading
import multiprocessing as mp
from six.moves import queue
from bbox_transform import bbox_overlaps, nonlinear_transform
from rcnn.config import config
b... |
test_request_safety.py | import threading
import asyncio
import aiohttp_jinja2
from urllib import request
from aiohttp.test_utils import unittest_run_loop
from ddtrace.pin import Pin
from ddtrace.provider import DefaultContextProvider
from ddtrace.contrib.aiohttp.patch import patch, unpatch
from ddtrace.contrib.aiohttp.middlewares import tra... |
feature_computation.py | import networkx as nx
import pandas as pd
import numpy as np
import os
import json
import h5py
import multiprocessing
import pdb
from sklearn import preprocessing
# Oth Order Features
def feature_matrix_0(disease_row, fold, disease_analyze, coexp_sim_matrix, go_genes_normalize):
disease_prob = disease_score_matrix[f... |
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... |
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... |
sporf.py | #!/usr/bin/env python3
# Copyright (c) 2019, Richard Hughes All rights reserved.
# Released under the BSD license. Please see LICENSE.md for more information.
import sys
import os
import argparse
import glob
import threading
import subprocess
import urllib.parse
from queue import Queue
from datetime import datetime
... |
test_dialect_detection.py | # -*- coding: utf-8 -*-
"""
Integration tests for dialect detection.
Author: G.J.J. van den Burg
"""
import argparse
import chardet
import clevercsv
import gzip
import json
import multiprocessing
import os
import termcolor
import warnings
THIS_DIR = os.path.abspath(os.path.dirname(__file__))
SOURCE_DIR = os.path.j... |
backsec.py | import os
import stat
import hashlib
import ConfigParser
import sqlite3
import shutil
import time
import datetime
import gzip
import json
import sys
import time
import datetime
import threading
import argparse
# RSA
from Crypto.PublicKey import RSA
# AES
from hashlib import md5
from Crypto.Cipher import AES
from Crypto... |
socket_server.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable = line-too-long
"""
@FIle:socket_server.py
~~~~~~~~~~~
:copyright: (c) 2020 by the Niyuhang.
:license: BSD, see LICENSE for more details.
"""
import os
import logging
import re
from socket import *
from multiprocessing import Process... |
check_mongodb.bak.py | #!/usr/bin/env python
#coding:utf-8
import os
import sys
import string
import time
import datetime
import MySQLdb
import pymongo
import bson
import logging
import logging.config
logging.config.fileConfig("etc/logger.ini")
logger = logging.getLogger("wlblazers")
path='./include'
sys.path.insert(0,path)
import functions ... |
server.py |
from arduinoToPi import *
from piToDb import *
import os
def main():
print("Starting pi server...")
print("Current directory: " + str(os.getcwd()))
master_queue = Queue()
# Note: we need a comma after the queue to indicate that we want a tuple,
# rather than just an expression with parentheses around it.
a... |
handlers.py | # Copyright 2001-2015 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permissio... |
test_tune_restore.py | # coding: utf-8
import signal
from collections import Counter
import os
import shutil
import tempfile
import time
import unittest
import skopt
import numpy as np
from hyperopt import hp
from nevergrad.optimization import optimizerlib
from zoopt import ValueType
from hebo.design_space.design_space import DesignSpace as... |
runtests.py | #!/usr/bin/env python
from __future__ import print_function
import atexit
import base64
import os
import sys
import re
import gc
import heapq
import locale
import shutil
import time
import unittest
import doctest
import operator
import subprocess
import tempfile
import traceback
import warnings
import zlib
import glo... |
basic_ops.py | import json
from random import choice, randint
from threading import Thread
from BucketLib.BucketOperations import BucketHelper
from BucketLib.bucket import Bucket
from Cb_constants import constants, CbServer, DocLoading
from basetestcase import ClusterSetup
from cb_tools.cbepctl import Cbepctl
from cb_tools.cbstats i... |
test_arduino.py | import json
import socket
import threading
import traceback
from contextlib import ExitStack
from time import sleep
from typing import Dict
import pytest
from afancontrol.arduino import (
ArduinoConnection,
ArduinoName,
ArduinoPin,
SetPWMCommand,
pyserial_available,
)
from afancontrol.pwmfan impor... |
c3po.py | # Copyright 2015-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... |
server.py | from socket import *
from threading import Thread
debug = False
# Global user list
# Contains instances of the registered users
registeredUsers = []
# USER CLASS
# Defines an user
# ip and username must be unique
class User:
username = ""
ip = ""
state = "busy"
connectionStatus = False
connection... |
hilo.py | import threading
def worker():
print ('Estoy trabajando')
threads = list()
for i in range(3):
t = threading.Thread(target=worker)
threads.append(t) """Agrega el hilo a threads"""
t.start()
|
foo.py | # Python 3.3.3 and 2.7.6
# python fo.py
#
# Edited by Eilif Sommer Øyre
# 17.01.2020
from threading import Thread
# Potentially useful thing:
# In Python you "import" a global variable, instead of "export"ing it when you declare it
# (This is probably an effort to make you feel bad about typing the word "global"... |
main.py | import sys
import time
from threading import Thread
import pygame
from pygame.sprite import Sprite
from random import randint, choice
from baby.graphics.Panel import Color, Panel
_HORIZONTAL_OFFSET = 0
_VERTICAL_OFFSET = 0
def ms_to_sec(milliseconds) -> float:
return milliseconds / 1000
def should_draw_shape... |
s20.py | """ Orbivo S20. """
import binascii
import struct
import logging
import socket
import threading
import time
_LOGGER = logging.getLogger(__name__)
# S20 UDP port
PORT = 10000
# UDP best-effort.
RETRIES = 3
TIMEOUT = 1.0
DISCOVERY_TIMEOUT = 1.0
# Timeout after which to renew device subscriptions
SUBSCRIPTION_TIMEOUT... |
zlp_connections.py | # Copyright (c) 2020, FADA-CATEC
# 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,... |
amazon.py | """
femagtools.amazon
~~~~~~~~~~~~~~~~~
Running FEMAG on Amazon Cloud EC2
.. note: To use this engine you have to install the boto3 module from amazon
"""
import os
import threading
import time
import logging
import femagtools.job
from .config import Config
logger = logging.getLogger(__name__)
c... |
runrun.py | import subprocess, time, os, sys, re, socket
from blessings import Terminal
bless_term = Terminal()
MAXLINES=100
def print_red(s, **kw):
print (bless_term.red(s), **kw)
def run(*args, **kw):
# print ("DBG", args, kw)
if 'showoutput' in kw:
showoutput = kw['showoutput']
# print("showoutpu... |
microservice.py | import socket
import threading
from ..default import ArchNetClientHandler
from functools import update_wrapper
from multiprocessing import Process
def setupmethod(f):
def wrapper_func(self, *args, **kwargs):
return f(self, *args, **kwargs)
return update_wrapper(wrapper_func, f)
class Microservice(obj... |
debug_eval_mini_srcgame_add_map_bn.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
USED_DEVICES = "-1"
import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = USED_DEVICES
import sys
import threading
import time
import tensorflow as tf
from absl import ... |
acc_threshold_detector.py | #***************************************************************************************************
# Imports
#***************************************************************************************************
# Global imports
import os
import threading
import math
import time
import traceback
# Project imports
impo... |
dashboard.py | import collections
import threading
import time
from typing import Any
from typing import DefaultDict
from typing import Dict
from typing import List
from typing import Optional
import numpy as np
from packaging import version
from optuna._imports import try_import
from optuna._study_direction import StudyDirection
i... |
test_server.py | import asyncio
import json
import os
import time
import urllib.parse
import uuid
from contextlib import ExitStack
from http import HTTPStatus
from multiprocessing import Process, Manager
from multiprocessing.managers import DictProxy
from pathlib import Path
from typing import List, Text, Type, Generator, NoReturn, Dic... |
multistart_solvers.py | """
This module defines solvers that use multiple starting points in order to have a higher chance at finding the global minimum.
"""
from . import utils, logging
from .solvers import Solver, default_solver
import numpy as np
import scipy as sp
import scipy.optimize
from qsrs import native_from_object
import time
from ... |
test_sys.py | import unittest, test.support
from test.script_helper import assert_python_ok, assert_python_failure
import sys, io, os
import struct
import subprocess
import textwrap
import warnings
import operator
import codecs
import gc
import sysconfig
import platform
# count the number of test runs, used to create unique
# strin... |
bazelci.py | #!/usr/bin/env python3
#
# Copyright 2018 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... |
web.py | from flask import (
Flask,
g,
redirect,
render_template,
request,
session,
url_for
)
import asyncio
from threading import Thread
import json
import discord
from discord.ext import commands
class User:
def __init__(self, id, username, password):
self.id = id
self.username ... |
dataloader_webcam.py | import os
import torch
from torch.autograd import Variable
import torch.utils.data as data
import torchvision.transforms as transforms
from PIL import Image, ImageDraw
from SPPE.src.utils.img import load_image, cropBox, im_to_torch
from opt import opt
from yolo.preprocess import prep_image, prep_frame, inp_to_image
fro... |
data_getter.py | from collections import Counter
from concurrent.futures import ThreadPoolExecutor
from datetime import datetime
from os import mkdir, path
from sys import platform as sys_platform
from threading import Thread
from time import sleep
from typing import Dict, List
import jieba
import jieba.posseg as pseg
from httpx impor... |
lxm32_modbus.py | from __future__ import print_function
from threading import Thread
from time import sleep, time
import atexit
import sys
import signal
if sys.version_info.major == 2:
from pymodbus.client.sync import ModbusTcpClient as ModbusClient
from pymodbus.pdu import ExceptionResponse
else:
from pymodbus3.client.syn... |
EventLoop.py | ##########################################################################
#
# Copyright (c) 2011-2012, John Haddon. All rights reserved.
# Copyright (c) 2011-2015, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted prov... |
conftest.py | import os
import sys
import threading
import time
from typing import Iterator
import pytest
import uvicorn
from .utils import Server
os.environ["DEBUG"] = "true"
def serve_in_thread(server: Server) -> Iterator[Server]:
thread = threading.Thread(target=server.run)
thread.start()
try:
while not s... |
machine_unit.py | #!/usr/bin/env python
#
# provide host/guest conatainer manager
#
import os
import abc
import time
import shutil
import pathlib
import difflib
import threading
from dataclasses import dataclass
from arkon_config import host_user
from arkon_config import has_ci_azure
from arkon_config import project_repo
from arkon_c... |
client_threads_coroutines.py | # -*- coding: utf-8 -*-
import sys
import logging
import gevent
import time
import traceback
from multiprocessing import Process
from tutorial import TutorialService
from bfd.harpc import client
from bfd.harpc.common import config
from bfd.harpc.common import monkey
# 协程调用的时候要进行打入package,替换掉线程的一些库
monkey.patch_all()
... |
printer.py | from threading import Thread,Lock
import sys,time
class Printer:
def __init__(self):
self.message = None
self.stopped = False
self.lock = Lock()
def keep_printing(self):
while not self.stopped:
if self.message is not None:
self.lock.acquire()
... |
repeated_timer.py | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import threading
import time
import weakref
class RepeatedTimer:
class State:
Stopped=0
Paused=1
Running=2
def __init__(self, secs, callback, count=None):
self.secs = secs
self.callback = weakref.... |
main.py | import os
import curses
from curses import textpad
import time
import random
import pickle
from pathlib import Path
from pytube import YouTube, Playlist
import re
import urllib.request
import threading
import vlc
os.environ['VLC_VERBOSE'] = '-1'
RES_FOLDER = Path(__file__).parent / "res"
QUOTE_FOLDER = Path(__file__)... |
main.py | from spotify import DOWNLOADMP3 as SONGDOWNLOADER
import telepot
import spotify
import requests
import threading
import os
if 'BOT_TOKEN' in os.environ:
token = os.environ.get('BOT_TOKEN')
else:
token = 'token bot'
bot = telepot.Bot(token)
sort = {}
def txtfinder(txt):
a = txt.find("https://open.spotify... |
python_production_server.py | import flask
import sys
import inspect
import uuid
import numpy as np
import collections
import threading
import importlib
import pkgutil
_archives = {}
_type_map = {
str: 'char',
float: 'double',
int: 'int32',
bool: 'logical',
'bool': 'logical',
'float64': 'double',
'float32': 'single',
... |
generate_train_5.py | import json
import os
from multiprocessing import Process
def chunks(lst, n):
"""Yield successive n-sized chunks from lst."""
for i in range(0, len(lst), n):
yield lst[i:i + n]
def cut_videos(cmds, i):
for i in range(len(cmds)):
cmd = cmds[i]
print(i, cmd)
os.system(cmd)
... |
multiprocess1.py | '''
使用Process类创建多个进程
'''
# 通过下面程序的执行结果可以验证 父进程在创建子进程时复制了进程及其数据结构
# 每个进程都有自己独立的内存空间 所以进程之间共享数据只能通过IPC的方式
from multiprocessing import Process, Queue
from time import sleep
def sub_task(string, q):
number = q.get()
while number:
print('%d: %s' % (number, string))
sleep(0.001)
number = ... |
train.py | #!/usr/bin/env python
"""
Main training workflow
"""
from __future__ import division
import argparse
import glob
import os
import random
import signal
import time
import torch
#from pytorch_pretrained_bert import BertConfig
from transformers import BertConfig
import distributed
from models import data_loader, mo... |
_cancel_many_calls_test.py | # Copyright 2016, Google 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:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... |
app.py | import nighttimeParenting as infra
import time
from threading import Thread, Lock, Event
from datetime import datetime
import smtplib, ssl
# TODO:
# have to figure out stuff for analytics
######################## global variables ############################
# taken from parenting.firstcry.com
messages = ["Yo... |
test_queue.py | # Some simple queue module tests, plus some failure conditions
# to ensure the Queue locks remain stable.
import itertools
import random
import threading
import time
import unittest
import weakref
from test import support
py_queue = support.import_fresh_module('queue', blocked=['_queue'])
c_queue = support.import_fres... |
data_handler.py | from influxdb import InfluxDBClient
from source.device_manager.device_layer.sila_device import SilaDevice
from source.device_manager.device_layer.device_interface import DeviceInterface
from typing import List, Dict
import threading, time
import json
from threading import Thread
class DataHandler:
def __init__(se... |
multientityInterface_Tests.py | # Copyright 2010-2012 Institut Mines-Telecom
#
# 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... |
ci_build.py | from optparse import OptionParser
from dependencies import read_json_dependencies_from_filename
import dependencies
import os
import platform
import threading
import sys
import subprocess
import shutil
import getpass
from userlocks import userlock
from default_platform import default_platform as _default_platform
from ... |
network_execution.py | # Copyright 2012 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditi... |
multiprocesses.py | from multiprocessing import Process
from multiprocessing import Pool
from subprocess import check_output
from itertools import product
from functools import partial
import os
import time
def info(title):
#print title
#print 'module name:', __name__
#if hasattr(os, 'getppid'): # only available on Unix
... |
main.py | '''
PyCxClient
Python-based all in one Chaoxing learning helper,put to test
by mos9527 @ mos9527.tooo.top
'''
import json
import logging
import os
import sys
import threading
import time
import coloredlogs
import math
import io
from apis import session,behaviorlogging, captchas, general, mooclearning, regis... |
train.py | import pdb
import os
import torch
import torch.distributed as dist
from math import ceil
from random import Random
from torch.multiprocessing import Process
from torch.autograd import Variable
from torchvision import datasets, transforms
class Partition(object):
""" Dataset-like object, but only access a subset o... |
custom.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
load_html.py | import webview
import threading
"""
This example demonstrates how to load HTML in a web view window
"""
def load_html():
webview.load_html("<h1>This is dynamically loaded HTML</h1>")
if __name__ == '__main__':
t = threading.Thread(target=load_html)
t.start()
# Create a non-resizable webview window ... |
chunk_chek.py | """
Maintainer: Giovanni Lopez
Mail: giovannt_92@hotmail.com / gioipez92@gmail.com
Build a class to get Manifest, sub-manifest, video and
audio chunks
"""
import re
import os
import platform
import threading
from random import randint
from basic import (
# head_request,
get_request,
post_request,
load_s... |
HiwinRA605_socket_ros_test_20190625191532.py | #!/usr/bin/env python3
# license removed for brevity
#接收策略端命令 用Socket傳輸至控制端電腦
import socket
##多執行序
import threading
import time
##
import sys
import os
import numpy as np
import rospy
import matplotlib as plot
from std_msgs.msg import String
from ROS_Socket.srv import *
from ROS_Socket.msg import *
import HiwinRA605_s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.