source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
study.py | #!/usr/bin/python
# -*- coding: UTF-8 -*-
import tkinter as tk
from tkinter import scrolledtext
import configparser
import time
import requests
import threading
import json
import os
# 账户配置文件
account_file_name = 'account.conf'
# 接口配置文件
api_file_name = 'api.conf'
# tk操作
class Tk(object):
def ... |
NativeMessagingHost.py | #!/usr/bin/env python3
from subprocess import Popen, PIPE
import argparse
import datetime
import logging
import os
import struct
import sys
import threading
import time
import traceback
def postmessage(message):
""" Send message to the Chrome extension """
if isinstance(message, str):
message = f'"{m... |
mcserver.py | import subprocess, threading, time, bisect
from subprocess import PIPE
class PollPipe:
def __init__(self, pipe, line_buffer_size=1024):
self.pipe = pipe
self.line_buffer_size = line_buffer_size
self.poll_thread = threading.Thread(target=lambda: self.poll())
self.line_buffer = []
... |
helpers.py | import os
import shutil
import pandas as pd
import json
import sys
from random import shuffle
from queue import Queue
from threading import Thread
from pathlib import Path
from colorama import Fore
from ravenml.utils.question import cli_spinner, user_selects, user_confirms, user_input
from ravenml.utils.config import g... |
menu.py | import os
import logging
import commands
from plugins.track_scheduler import commands as track_scheduler_commands
import gi
gi.require_version('AppIndicator3', '0.1')
from gi.repository import AppIndicator3 # noqa: E402
from gi.repository import Gtk # noqa: E402
logger = logging.getLogger('tray-menu')
def pause(... |
version_utils.py | import json
import urllib2
from directories import userCachePath
import os
import time
from PIL import Image
import atexit
import threading
import logging
from uuid import UUID
import httplib
import base64
import datetime
log = logging.getLogger(__name__)
#@Singleton
class PlayerCache:
'''
Used to cache Playe... |
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... |
SentenceTransformer.py | import json
import logging
import os
import shutil
import stat
from collections import OrderedDict
from typing import List, Dict, Tuple, Iterable, Type, Union, Callable, Optional
import requests
import numpy as np
from numpy import ndarray
import transformers
from huggingface_hub import HfApi, HfFolder, Repository, hf_... |
GatosRatones.py | from threading import Thread,Semaphore
from time import sleep
from random import randint
def conta(self):
self.plato = Semaphore(5)
self.mutContador = Semaphore(1)
self.gatosComiendo = 0
self.ratonesComiendo = 0
self.atrapado = 0
def comerGato(self):
print("Aparece un gato\n")
c.plato.acqu... |
RPC.py | import rpyc
from rpyc.utils.teleportation import import_function
from rpyc.utils.helpers import BgServingThread
from multiprocessing import cpu_count, Manager, Process
#sys.path.append(sys.path[0][:-7])
def main():
#logging.basicConfig(format="%(asctime)s %(levelname)s | %(message)s", level=logging.DEBUG)
... |
batching.py | # Copyright 2021 Cortex Labs, 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 wri... |
manager.py | #!/usr/bin/env python3
import os
import time
import sys
import fcntl
import errno
import signal
import shutil
import subprocess
import datetime
import textwrap
from typing import Dict, List
from selfdrive.swaglog import cloudlog, add_logentries_handler
from common.basedir import BASEDIR, PARAMS
from common.android im... |
KugouBot.py | #!/usr/bin/python
# -*- coding:utf-8 -*-
# KugouBot.py
# Created by Henry on 2017/11/6
# Description :
from threading import Thread
from wxbot import *
class KugouBot(WXBot):
_instance = None
def __new__(cls, *args, **kw):
if not cls._instance:
cls._instance = super(KugouBot, cls).__new_... |
main.py | import os
from datetime import datetime
import time as tm
import subprocess
import requests
import threading
import json as js
auth_url = ''
adwsd = ''
def get_id():
hwid = str(subprocess.check_output(
'wmic csproduct get uuid')).split('\\r\\n')[1].strip('\\r').strip()
return hwid
if... |
controller.py | import time
from datetime import datetime
from threading import Thread
from typing import List, Set, Type
from bauh.api.abstract.controller import SoftwareManager, SearchResult, ApplicationContext
from bauh.api.abstract.disk import DiskCacheLoader
from bauh.api.abstract.handler import ProcessWatcher
from bauh.api.abst... |
custom_input_ops.py | import Queue
import threading
import h5py
import numpy as np
from time import time
from IPython import embed
from hickle import load
from tensorflow import flags
FLAGS = flags.FLAGS
class LTM_Queue(object):
def __init__(self, story_filename, qa_filelist, capacity, batch_size, num_threads):
self.qa_data = {... |
test_from_thread.py | import threading
import time
from concurrent.futures import CancelledError
from contextlib import suppress
import pytest
from anyio import (
Event, from_thread, get_cancelled_exc_class, get_current_task, run, sleep, to_thread,
wait_all_tasks_blocked)
from anyio.from_thread import BlockingPortal, start_blockin... |
runner.py | #!/usr/bin/env python2
# This Python file uses the following encoding: utf-8
'''
Simple test runner. Consider using parallel_test_core.py for faster iteration times.
'''
# XXX Use EM_ALL_ENGINES=1 in the env to test all engines!
from subprocess import Popen, PIPE, STDOUT
import os, unittest, tempfile, shutil, time,... |
OF_m_circles.py | import cv2
from tkinter import Tk
from tkinter.filedialog import askopenfilename
import numpy as np
import imutils
import math
import threading
def main():
cap = cv2.VideoCapture(vid_path)
status1, previous_frame = cap.read()
total_frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
copy_frame = ... |
reptile2.py | # -*- coding:utf-8 -*-
import requests
from bs4 import BeautifulSoup
import os
import time
import threading
from multiprocessing import Process
import threadpool
# 程序运行开始提示
print("程序于 {} 开始启动,请等待...".format(time.ctime()))
# 美女图片类型和对应的页面序列位置,图片类型为键,位置为 值
# 这个位置用于图集的链接,如list_6_3.html,6即为性感美女的序列位置
girls_images_type = {'x... |
test_binarydevice.py | from zaber.serial import BinaryCommand, BinaryDevice, BinaryReply, UnexpectedReplyError
import pytest, struct, threading
@pytest.fixture(scope="module")
def device(binaryserial):
return BinaryDevice(binaryserial, 1)
def test_constructor(binaryserial):
bd1 = BinaryDevice(binaryserial, 1)
bd2 = BinaryDevic... |
_image_feature_extractor.py | # -*- coding: utf-8 -*-
# Copyright © 2017 Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can
# be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
from __future__ import print_function as _
from __future__ import division as _
from... |
app.py | from flask import Flask
import logging
from multiprocessing import Process
import kafkawrapper
from configs.configs import app_host, app_port,ENABLE_CORS,context_path, MAIL_SETTINGS
from flask.blueprints import Blueprint
from flask_cors import CORS
import routes
log = logging.getLogger('file')
from flask_mail import Ma... |
train.py | #!/usr/bin/env python
"""Train models."""
import os
import signal
import torch
import onmt.opts as opts
import onmt.utils.distributed
from onmt.utils.misc import set_random_seed
from onmt.utils.logging import init_logger, logger
from onmt.train_single import main as single_main
from onmt.utils.parse import ArgumentPa... |
diagnostic.py | #!/usr/bin/env python
#
# Azure Linux extension
#
# Linux Azure Diagnostic Extension (Current version is specified in manifest.xml)
# Copyright (c) Microsoft Corporation All rights reserved.
# MIT License
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated do... |
data_websocket.py | import websocket
import threading
from time import sleep
class DataWebSocket:
def on_message(self, message):
print('[*] Message received')
print(message)
# TODO: use the JSON object
def on_error(self, error):
print(error)
def on_close(self):
self.ws.close()
... |
test_clients_streaming.py | import os
import time, asyncio
from typing import List
from datetime import datetime
from functools import partial
from multiprocessing import Process, current_process
import pytest
from jina import Flow, Document, DocumentArray, Executor, requests, Client
INPUT_LEN = 4
INPUT_GEN_SLEEP_TIME = 1
SLOW_EXECUTOR_SLEEP_TI... |
email.py | from threading import Thread
from flask import render_template
from flask_mail import Message
from app import app, mail
def send_async_email(app, msg):
with app.app_context():
mail.send(msg)
def send_email(subject, sender, recipients, text_body, html_body):
msg = Message(subject, sender=sender, reci... |
example_test.py | import http.server
import os
import random
import re
import socket
import ssl
import struct
import subprocess
from threading import Thread
import ttfw_idf
from RangeHTTPServer import RangeRequestHandler
from tiny_test_fw import DUT, Utility
server_cert = '-----BEGIN CERTIFICATE-----\n' \
'MIIDWDCCAkACCQ... |
mock_distribute.py | # Copyright 2019 The Keras Tuner 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
train.py | #!/usr/bin/env python
# This script is for training opennmt original rnn models.
"""Train models."""
import os
import signal
import torch
import onmt.opts as opts
import onmt.utils.distributed
from onmt.utils.misc import set_random_seed
from onmt.utils.logging import init_logger, logger
from onmt.train_single impor... |
test.py | import configparser
import serial
config = configparser.ConfigParser()
config.read('config.ini')
PORT = config['SERIAL']['PORT']
try:
s = serial.Serial(PORT)
except serial.serialutil.SerialException:
exit("Serieller Port nicht angeschlossen")
try:
while True:
serial_message = s.readline()
... |
vfs_test.py | #!/usr/bin/env python
# Lint as: python3
# -*- encoding: utf-8 -*-
"""Tests for API client and VFS-related API calls."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import io
import os
import threading
import time
from unittest import mock
import zipfi... |
run.py | from OnlineHeart import OnlineHeart
from Silver import Silver
from LotteryResult import LotteryResult
from Tasks import Tasks
from connect import connect
from rafflehandler import Rafflehandler
import asyncio
from login import login
from printer import Printer
from statistics import Statistics
from bilibili import bili... |
pi_camera.py | """The Raspberry Pi camera module."""
import io
import time
import threading
import picamera
from ..base_camera import BaseCamera
class Frame(object):
def __init__(self):
self.stream = io.BytesIO()
self.frame = None
class Camera(BaseCamera):
def __init__(self):
self.resolution = (640... |
logic.py | import json
import threading
import time
import os
from time import sleep
from PyQt5 import QtCore, QtWidgets
import Ui_tab_heb
import Ui_main_heb
from scrapper import *
from Ui_main_eng import Ui_MainWindow
from Ui_progress import ProgressWindowForm
from Ui_findDialog import Ui_course_search
from Ui_tab_eng import T... |
sh.py | #===============================================================================
# Copyright (C) 2011-2012 by Andrew Moffat
#
# 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 res... |
fcnet.py | """TensorFlow implementation of fully connected networks.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import time
import numpy as np
import tensorflow as tf
import threading
import deepchem as dc
from deepchem.nn import model_ops
from deepchem.util... |
pokeslack.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import flask
from flask import Flask, render_template
from flask_googlemaps import GoogleMaps
from flask_googlemaps import Map
from flask_googlemaps import icons
import os
import codecs
import re
import sys
import struct
import json
import requests
import argparse
import getpa... |
caching.py | """
CherryPy implements a simple caching system as a pluggable Tool. This tool
tries to be an (in-process) HTTP/1.1-compliant cache. It's not quite there
yet, but it's probably good enough for most sites.
In general, GET responses are cached (along with selecting headers) and, if
another request arrives for the same r... |
video_writer.py | # coding=utf-8
""" Write stream of frames to file using OpenCV """
import logging
import os
import datetime
import time
from queue import Queue
from threading import Thread
import cv2
import numpy as np
LOGGER = logging.getLogger(__name__)
# pylint:disable=useless-object-inheritance
class VideoWriter(object):
... |
main.py | import numpy
import requests
import json
import psycopg2
import os
import random
import sys
import threading
import datetime
import traceback
import queue
import asyncio
keys = os.environ['API_KEY'].split('|')
cores = 1
timescale_queue = queue.Queue()
chunk_size = 50
def connect():
return psycopg2.connect(user=... |
core.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
#... |
basic_mt.py | import threading
import time
def calc_square(numbers):
print("\nCalculating Square of numbers:\n")
for n in numbers:
time.sleep(0.2)
print('Square of %i : %i' %(n, (n*n)))
def calc_cube(numbers):
print("\nCalculating Cube of numbers:\n")
for n in numbers:
time.sleep(0.2)
... |
wspbus.py | """An implementation of the Web Site Process Bus.
This module is completely standalone, depending only on the stdlib.
Web Site Process Bus
--------------------
A Bus object is used to contain and manage site-wide behavior:
daemonization, HTTP server start/stop, process reload, signal handling,
drop privileges, PID f... |
parallel_gif.py | # -*- coding: utf-8 -*-
# load
import supereeg as se
import numpy as np
import glob
import matplotlib.pyplot as plt
from PIL import Image
from nilearn import plotting as ni_plt
from nilearn import _utils
from nilearn import image
import io
import os
import sys
import cProfile, pstats
import multiprocessing as mp
impor... |
jboss_finder.py | import os
from queue import Queue
from urllib.parse import urlparse
from threading import Thread
import requests
import threading
from requests import get
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
lock = threading.Lock()
... |
tagging_common_parallel.py | import multiprocessing
from functools import partial
def tag_document(document,tagger,tagger_function,args,kwargs,input_annotation,output_annotation):
if document.features['contentType'] == "Text":
if not document.text:
pass
for annotation,subtext in document.get_annotations_with_text... |
server.py | #!/usr/bin/env python
from __future__ import absolute_import, print_function
import wave
import datetime
import argparse
import io
import logging
import os
import sys
import time
from logging import debug, info
import uuid
import cgi
import audioop
import asyncio
import aiofile
from pprint import pprint
from threading ... |
grader_mysql.py | #!/usr/bin/python\
import MySQLdb
import cx_Oracle
import sys
import os
from multiprocessing import Process
import time
import threading
db_kunci = MySQLdb.connect(str(sys.argv[4]), str(sys.argv[2]), str(sys.argv[3]), str(sys.argv[5]))
cursor_kunci = db_kunci.cursor()
def check(submission_id):
#print "masuk"
... |
padding_fifo_queue_test.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... |
upload_proto_test.py | import base64
import json
import time
import zlib
import requests
from RLBotServer import start_server
from backend.database.objects import GameVisibilitySetting
from tests.utils.killable_thread import KillableThread
from tests.utils.replay_utils import get_test_file, clear_dir, write_proto_pandas_to_file
LOCAL_URL ... |
worker.py | from contextlib import contextmanager
import atexit
import faulthandler
import hashlib
import inspect
import io
import json
import logging
import os
import redis
import sys
import threading
import time
import traceback
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union
# Ray modules
from ra... |
client.py | #!/usr/bin/env python
import tornado_msgpack
import tornado.ioloop
import threading
if __name__=="__main__":
port=8070
def starter(target):
def func():
print("{0} start".format(target))
target.start()
print("{0} finished".format(target))
return func
#... |
view_example.py | #!/usr/bin/python
import dweed
import sys
import time
import bokeh
import random
from threading import Thread
from tornado.ioloop import IOLoop
from bokeh.models import ColumnDataSource
from bokeh.plotting import curdoc, figure
from bokeh.application import Application
from bokeh.application.handlers import Functio... |
main_test.py | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
admin.py | import threading
from django.db import transaction
from django.contrib import admin, messages
from BruteScan.views import start_scan, debug
from ApolloScanner.dingtalk import dingtalker
from Configuration.models import Configuration
from BruteScan.models import BruteRegister, BruteTasks, BruteResult
# Register your m... |
telescope-pi.py | import os
import signal
import socket
import sys
from os import _exit as bye
from threading import Thread
from time import sleep
from time import time as uptime
import RPi.GPIO as GPIO
from bluetooth import BluetoothSocket, RFCOMM, PORT_ANY, advertise_service, SERIAL_PORT_CLASS, SERIAL_PORT_PROFILE, \
BluetoothErr... |
k8s.py | from __future__ import unicode_literals
from __future__ import absolute_import
import fnmatch
import hashlib
import os
import random
import re
import warnings
from string import Template
import sys
import threading
import time
from time import strftime, gmtime
import traceback
from io import open
import six
import si... |
Decompile.py | import multiprocessing
import os
import sys
import threading
import typing
from multiprocessing import connection
#from uncompyle6 import main as Uncompyle6Main
from unpyc37 import unpyc3
# noinspection SpellCheckingInspection
from decompyle3 import main as Decompyle3Main
_decompileProcess = None # type: typing.Opti... |
utils.py | #!/usr/bin/env python
import os
import re
import glob
import fnmatch
import subprocess as sp
import sys
import shutil
import contextlib
from collections import defaultdict, Iterable
from itertools import product, chain, groupby
import logging
import pkg_resources
import networkx as nx
import requests
from jsonschema i... |
GChatServer.py | import socket
import threading
host = '127.0.0.1'
port = 5000
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind((host, port))
server.listen()
clients = []
nicknames = []
def broadcast(message):
for client in clients:
client.send(message)
def handle(client):
... |
pyactor.py | """ This is the python PLambda actor akin to g2d.
"""
import os
import re
import sys
import signal
import time
import threading
import traceback
import psutil
from .actorlib import receive
from ..eval.Interpreter import Interpreter
from ..actors.console import Console
from ..util.Util import string2error
debug = F... |
main.py | """
AIR QUALITY MONITORING SYSTEM
@author: Paolo Santancini
"""
from modules import dht22
from modules import sds011
from modules import microelab
from modules import vk162
from modules import dag
from modules import io
import time, threading
import logging
DETECTIONS = 50 # sample size
CICLI = 9955 # number of o... |
tester.py | #!/usr/bin/python
#
# tester.py
#
# This source file is part of the FoundationDB open source project
#
# Copyright 2013-2018 Apple Inc. and the FoundationDB project 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 ob... |
manager.py | import argparse
from datetime import datetime, timedelta
from threading import Thread
from pkg.communication import CommunicateSTM32, CommunicateServer
from pkg.mask_detection import MaskDetector
parser = argparse.ArgumentParser(description='Initialize manager.')
parser.add_argument('--device_id', type=int, help='Dev... |
crawl_data.py | """
我们使用币安原生的api进行数据爬取.
1. 增加代理配置
"""
import pandas as pd
import time
from datetime import datetime
import requests
import pytz
from jiamtrader.trader.database import database_manager
pd.set_option('expand_frame_repr', False) #
from jiamtrader.trader.object import BarData, Interval, Exchange
BINANCE_SPOT_L... |
viewerClient.py | from multiprocessing import Process, Lock
from multiprocessing.sharedctypes import Value, Array
from ctypes import c_double
import pinocchio as pin
import numpy as np
import time
class NonBlockingViewerFromRobot():
def __init__(self,robot,dt=0.01):
# a shared c_double array
self.dt = dt
self... |
test_run_tracker.py | # coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import http.server
import json
import threading
from builtins import open
from future.mo... |
test_TimedLock.py | #!/usr/bin/env python
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from future import standard_library
standard_library.install_aliases()
from builtins import str
from builtins import range
from builtins import *
fr... |
ovsdb_monitor.py | # Copyright 2016 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
#
# Unless required by applicable law or agre... |
_punch_reader.py | from __future__ import print_function, absolute_import
from six import iteritems, itervalues
from six.moves import range
from pch_reader import FileReader
from _table_data import PunchTableData
# python 2/3 compatibility for chr, is there a better way?
_test_chr = b'abcd'
try:
chr(_test_chr[0])
except TypeError:... |
Odd-Even_transposition_parallel.py | """
This is an implementation of odd-even transposition sort.
It works by performing a series of parallel swaps between odd and even pairs of
variables in the list.
This implementation represents each variable in the list with a process and
each process communicates with its neighboring processes in the list to perfo... |
async.py | import asyncio
import threading
import time
import urllib.request
import aiohttp
urls = ['http://www.google.com', 'http://www.yandex.ru', 'http://www.python.org'] * 10
async def call_url(url):
response = await aiohttp.get(url)
data = await response.text()
return data
futures = [call_url(url) for url in ... |
application.py | # Copyright 2017 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... |
JDBCConnectionWrapper.py | """This module holds a ConnectionWrapper that is used with a
JDBC Connection. The module should only be used when running Jython.
"""
# Copyright (c) 2009-2011, Christian Thomsen (chr@cs.aau.dk)
# All rights reserved.
# Redistribution and use in source anqd binary forms, with or without
# modification, are permit... |
h2o.py | import time, os, stat, json, signal, tempfile, shutil, datetime, inspect, threading, getpass
import requests, psutil, argparse, sys, unittest, glob
import h2o_browse as h2b, h2o_perf, h2o_util, h2o_cmd, h2o_os_util
import h2o_sandbox, h2o_print as h2p
import re, random
# used in shutil.rmtree permission hack for window... |
test.py | import argparse
import json
import os
from pathlib import Path
from threading import Thread
import numpy as np
import torch
import yaml
from tqdm import tqdm
from models.experimental import attempt_load
from utils.datasets import create_dataloader
from utils.general import coco80_to_coco91_class, check_dataset, check... |
test_schedule_planner.py | import logging
import time
from threading import Thread
from unittest import TestCase
from unittest.mock import MagicMock
import schedule
import databay
from databay import Link
from databay.errors import MissingLinkError
from databay.planners import SchedulePlanner
from databay.planners.schedule_planner import Sched... |
test__threading_monkey_in_thread.py | # We can monkey-patch in a thread, but things don't work as expected.
from __future__ import print_function
import threading
from gevent import monkey
import gevent.testing as greentest
class Test(greentest.TestCase):
@greentest.ignores_leakcheck # can't be run multiple times
def test_patch_in_thread(self):... |
test_api.py | import json
import os
import time
import unittest
from functools import partial
from threading import Thread
import requests
import responses
from fastapi.testclient import TestClient
from emo_platform import Client
from emo_platform.exceptions import NoRoomError, TokenError, UnauthorizedError
EMO_PLATFORM_TEST_PATH... |
multi_inference_20200804112435.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... |
app.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
installwizard.py |
from functools import partial
import threading
import os
from typing import TYPE_CHECKING
from kivy.app import App
from kivy.clock import Clock
from kivy.lang import Builder
from kivy.properties import ObjectProperty, StringProperty, OptionProperty
from kivy.core.window import Window
from kivy.uix.button import Butto... |
test_insert_20.py | import threading
import numpy as np
import pandas as pd
import pytest
from pymilvus import Index
from base.client_base import TestcaseBase
from utils.util_log import test_log as log
from common import common_func as cf
from common import common_type as ct
from common.common_type import CaseLabel, CheckTasks
prefix =... |
onedrive.py | import base64
import random
import os
import re
import time
from datetime import datetime
import copy
import traceback
import sys
import json
from pydispatch import dispatcher
from requests import Request, Session
#Empire imports
from lib.common import helpers
from lib.common import agents
from lib.common import encry... |
shamir_server.py | import struct
import socket
import hashlib
import sqlite3
import time
import shamir_auth
import rsa_encrypt
import aes_crypt
import threading
import settings
import shamir_gen
import comms
import base64
import shamir_update_client
import auth_update
import sys
import json
from Crypto import Random
#set unique number ... |
train_multiprocess.py | """Multi-seed runs."""
from multiprocessing import Process
import json
import train_offpolicy
import train_onpolicy
processes = []
with open('config.json', 'r') as f:
config = json.load(f)
experiment = config['experiment']
use_alg_credit = config['use_alg_credit']
use_qmix = config['use_qmix']
n_seeds = config[... |
imap-user-login.py | import re
import requests
import hashlib
import imaplib
import mailparser
import threading
active_threads = 0
max_threads = 20
host = "127.0.0.1"
username = "paulbyrd"
password = "^(#J@SkFv2[%KhIxKk(Ju`hqcHl<:Ht"
def get_url(raw_email_content: bytes):
search_results = re.search(b"http\:\/\/\d{1,3}\.\d{1,3}\.... |
autocast_variable_test.py | # Copyright 2019 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... |
base.py | import os
import json
import re
import logging
import threading
from abc import ABC, abstractmethod
from datetime import datetime, timedelta
from flask_wtf import FlaskForm
from wtforms import StringField, BooleanField
from wtforms.validators import InputRequired, Optional, ValidationError
from collections import Ord... |
process_video.py | #!/usr/bin/env python
import sys
import os
import shutil
import math
import numpy as np
import argparse
import contextlib
import itertools
import signal
import subprocess
import tempfile
import threading
try:
import queue # Python 3
except ImportError:
import Queue as queue # Python 2
sys.dont_write_bytecode = T... |
lcd.py | import threading
from time import sleep
from . import i2c
from astroplant_kit.peripheral import Display
# I2C device constants
## Commands
LCD_CLEAR_DISPLAY = 0x01
LCD_RETURN_HOME = 0x02
LCD_ENTRY_MODE_SET = 0x04
LCD_DISPLAY_CONTROL = 0x08
LCD_CURSOR_SHIFT = 0x10
LCD_FUNCTION_SET = 0x20
LCD_SET_CGRAM_ADDR = 0x40
LCD_S... |
video_speed.py | import cv2
from multiprocessing import Process, Queue
import time
import queue
VIDEO = "../examples/videos/short.mp4"
WINDOW_NAME = "testing"
def get_frames(out_q: Queue, file: str):
cap = cv2.VideoCapture(file)
ret = True
print(f"Playing video {file} to queue.")
while ret:
ret, img = cap.r... |
models.py | # -*- coding: utf-8 -*-
"""
Data models for the Deis API.
"""
from __future__ import unicode_literals
import base64
from datetime import datetime
import etcd
import importlib
import logging
import re
import time
from threading import Thread
from django.conf import settings
from django.contrib.auth import get_user_mo... |
main.py | from sense_hat import SenseHat
from random import randint
from queue import LifoQueue
from threading import Thread
import time
import subprocess
import sys
import multiprocessing as mp
import requests
import os
import logging
from sensor import Sensor
from moon import Moon
import ruuvi
# Interval betw... |
event.py | #!/usr/bin/env python3
from __future__ import annotations
import logging
from abc import ABC, abstractmethod
from datetime import datetime
from threading import Thread
from typing import Any, Optional
from .enum import WeatherConditionEnum, WeatherSubConditionEnum
from .weather import Weather, Sun
from ..building.int... |
util.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 "L... |
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... |
wifiphisher.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import ssl
import re
import time
import sys
import SimpleHTTPServer
import BaseHTTPServer
import ConfigParser
import httplib
import SocketServer
import cgi
import string
import lib.fakeAP as fap
import lib.wifijammer as wj
from threading import Thread
from subpro... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.