source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
test_basic.py | import gc
import re
import time
import uuid
import weakref
from datetime import datetime
from platform import python_implementation
from threading import Thread
import pytest
import werkzeug.serving
from werkzeug.exceptions import BadRequest
from werkzeug.exceptions import Forbidden
from werkzeug.exceptions import Not... |
test_xmlrpc.py | import base64
import datetime
import sys
import time
import unittest
import xmlrpclib
import SimpleXMLRPCServer
import threading
import mimetools
import httplib
import socket
import os
from test import test_support
try:
unicode
except NameError:
have_unicode = False
else:
have_unicode = ... |
SourceCode.py | from Base import BaseClass
import ast
from threading import Thread
import pickle
class SourceCode(BaseClass):
def add(self):
input_1 = open(self.get_file_path(), 'r').readline().strip()
input_2 = open(self.get_file_path_2(), 'r').readline().strip()
try:
input_1 = ast.literal_... |
py3_asyncioscheduler.py | from nose import SkipTest
import rx
import asyncio
import threading
import unittest
from datetime import datetime, timedelta
from rx.concurrency import AsyncIOScheduler
class TestAsyncIOScheduler(unittest.TestCase):
def test_asyncio_schedule_now(self):
loop = asyncio.get_event_loop()
scheduler ... |
test_cuda.py | # Owner(s): ["module: cuda"]
from itertools import repeat, chain, product
from typing import NamedTuple
import collections
import contextlib
import ctypes
import gc
import io
import pickle
import queue
import sys
import tempfile
import threading
import unittest
import torch
import torch.cuda
import torch.cuda.comm as... |
altitude_plot.py | #!/usr/bin/env python3
'''
Dependencies: numpy, matplotlib, https://github.com/simondlevy/RealtimePlotter
Copyright (C) 2021 Simon D. Levy
MIT License
'''
import serial
from realtime_plot import RealtimePlotter
import numpy as np
from threading import Thread
from sys import argv, stdout
# Change th... |
Day05-00-2.py | ## 영상 처리 및 데이터 분석 툴
## (1) 대용량 영상을 128x128로 미리보기
## 데이터 처리는 그대로이며 display() 함수에서만 128x128로....
## (2) 스레드로 디스플레이
## (3) 상태바에 파일명과 크기를 명시
from tkinter import *; import os.path ;import math
from tkinter.filedialog import *
from tkinter.simpledialog import *
import math
## 함수 선언부
def loadImage(fname) :
global win... |
hw2.py | '''
2.使用多进程模型实现,父进程将命令行所跟的文件发送给子进程,子进程将收到的文件打印出来
python hw2.py “/etc/passwd”
'''
from multiprocessing import Pipe, Process
def job(inn,out):
inn.close()
while True:
try:
print(out.recv())
except:
out.close()
break
if __name__=='__main__':
in_pipe,out... |
draftwindow.py | from tkinter import *
from tkinter import font
import threading
import socket
import time
class DraftWindow():
def __init__(self):
threading.Thread(target=self.spawn, daemon=False).start()
def spawn(self):
while True: # recreate the window when closed
self.gui = Tk()
self.gui.client(socket.gethostname())... |
example_test.py | import http.server
import multiprocessing
import os
import random
import re
import socket
import ssl
import struct
import subprocess
import ttfw_idf
from RangeHTTPServer import RangeRequestHandler
from tiny_test_fw import DUT, Utility
server_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'test_certs/... |
async_consumer.py | # -*- coding: utf-8 -*-
from __future__ import print_function
import time
import signal
import sys
import subprocess
import threading
import logging
from logging.config import fileConfig
from async_app.config import get_configs
from async_app.async.kafka import init_kafka_manager
from async_app.async.consumer import co... |
__init__.py | import sys
import io
import time
import json
import threading
import traceback
import collections
import bisect
try:
import Queue as queue
except ImportError:
import queue
# Patch urllib3 for sending unicode filename
from . import hack
from . import exception
__version_info__ = (12, 7)
__version__ = '.'.jo... |
client.py | """
Copyright 2018 InfAI (CC SES)
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... |
HelloWorldServer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from wsgiref.simple_server import make_server
import sys
import json
import traceback
import datetime
from multiprocessing import Process
from getopt import getopt, GetoptError
from jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError,\
JSONRPCError, Inva... |
test_multiprocessing.py | import time
import multiprocessing as mp
from multiprocessing.queues import Queue
def fill_queue(queue_x, queue_y):
""" Endless process that fills the queue"""
task = 0
while True:
time.sleep(0.00000001)
queue_x.put(task)
task += 1
queue_y.put(task)
# print(f"Added... |
test_v2_0_0_container.py | import multiprocessing
import queue
import random
import threading
import unittest
import requests
import time
from dateutil.parser import parse
from .fixtures import APITestCase
class ContainerTestCase(APITestCase):
def test_list(self):
r = requests.get(self.uri("/containers/json"), timeout=5)
... |
example.py | # Copyright (c) 2021 by xfangfang. All Rights Reserved.
#
# Macast Dummy media renderer
#
# Macast Metadata
# <macast.title>Dummy Renderer</macast.title>
# <macast.renderer>DummyRenderer</macast.renderer>
# <macast.platform>darwin,linux,win32</macast.platform>
# <macast.version>0.1</macast.version>
# <macast.author>xfa... |
socket.py | import json
import threading
import time
import websocket
class SocketHandler():
def __init__(self, client, socket_trace=False):
"""
Build the websocket connection.
client: client that owns the websocket connection.
"""
websocket.enableTrace(True)
self.socket_url = ... |
test_httplib.py | import enum
import errno
from http import client, HTTPStatus
import io
import itertools
import os
import array
import re
import socket
import threading
import warnings
import unittest
from unittest import mock
TestCase = unittest.TestCase
from test import support
from test.support import os_helper
from test.support i... |
portscan.py | #!/usr/local/opt/python/bin/python3.7
import socket
import threading
import argparse
import re
import os
import time
try:
from queue import Queue
except ImportError:
from Queue import Queue
import resource
# Expand thread number possible with extended FILE count.
# This remain as low as 2048 due to macOS secret... |
viterbi_cxxrtl_tb.py | import subprocess
from threading import Thread
import numpy as np
def viterbi_cxxrtl_tb(coded_sequence, cxxrtl_tb_filename):
"""Python interface to cxxrtl executable
coded_sequence
Input data
cxxrtl_tb_filename
Executable name
"""
coded_string = "".join([chr(c + 97) for c in cod... |
test_poplib.py | """Test script for poplib module."""
# Modified by Giampaolo Rodola' to give poplib.POP3 and poplib.POP3_SSL
# a real test suite
import poplib
import asyncore
import asynchat
import socket
import os
import time
import errno
from unittest import TestCase
from test import support as test_support
threadi... |
session_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... |
picorv32_benchmark.py | #!/usr/bin/env python3
import os, sys, threading
from os import path
import subprocess
import re
num_runs = 8
if not path.exists("picorv32.json"):
subprocess.run(["wget", "https://raw.githubusercontent.com/cliffordwolf/picorv32/master/picorv32.v"], check=True)
subprocess.run(["yosys", "-q", "-p", "synth_ice40... |
tcp.py | # -*- coding: utf-8 -*-
'''
Syslog TCP listener for napalm-logs.
'''
from __future__ import absolute_import
from __future__ import unicode_literals
# Import pythond stdlib
import re
import time
import random
import socket
import logging
import threading
try:
import Queue as queue
except ImportError:
import qu... |
client.py | #!/usr/bin/env python3
import getpass
import json
import os
import select
import sys
import time
from multiprocessing import Process, shared_memory, Lock
from threading import Thread
import nest_asyncio
from securedrop import utils
from securedrop.List_Contacts_Packets import ListContactsPackets
from securedrop.List_... |
_poller.py | # --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""), ... |
test_topic.py | #!/usr/bin/env python
import QAPUBSUB
import threading
from QAPUBSUB.consumer import subscriber_topic
from QAPUBSUB.producer import publisher_topic
z1 = subscriber_topic(exchange='testTopic', routing_key='#')
z2 = subscriber_topic(exchange='testTopic', routing_key='#.SZ')
z3 = subscriber_topic(exchange='testTopic',... |
train_rfcn_alt_opt_5stage.py | #!/usr/bin/env python
# --------------------------------------------------------
# R-FCN
# Copyright (c) 2016 Yuwen Xiong, Haozhi Qi
# Licensed under The MIT License [see LICENSE for details]
# --------------------------------------------------------
"""Train a R-FCN network using alternating optimization.
This tool ... |
concurrencytest.py | #!/usr/bin/env python3
#
# Modified for use in OE by Richard Purdie, 2018
#
# Modified by: Corey Goldberg, 2013
# License: GPLv2+
#
# Original code from:
# Bazaar (bzrlib.tests.__init__.py, v2.6, copied Jun 01 2013)
# Copyright (C) 2005-2011 Canonical Ltd
# License: GPLv2+
import os
import sys
import traceback... |
adaptiveStreamProducer.py | import cv2,imutils, socket
import time
import threading
import time
import uuid
import logging, os
from functools import partial
from numpy import double
import requests
import json
import sys
import configparser
####### CONFIG PARAMS
#CONFIGSERVERIP = '127.0.0.1'
#CONFIGSERVERPORT = 9997
#logging.basicConfig(filena... |
projectInterface.py | import tornado.web
import tornado.websocket
import os
import time
import ssl
import json
import queue
import logging
import re
import toml
import shlex
import uuid
import bcrypt
import numbers
import asyncio
import threading
import subprocess
from pathlib import Path
from rtCommon.projectUtils import listFilesReqStruct... |
pykms_Format.py | #!/usr/bin/env python3
from __future__ import print_function, unicode_literals
import re
import sys
import threading
try:
# Python 2.x imports
from StringIO import StringIO
import Queue as Queue
except ImportError:
# Python 3.x imports
from io import StringIO
import queue as Queue
pyver = sys... |
arduinoController.py | import serial
import serial.tools.list_ports
import time
import threading
import re
import os
import logger
cf_logger = logger.get_logger(__name__)
TIME_BETWEEN_MESSAGES = 0.01
LED_MESSAGE_PREFIX = 17
RESET_MESSAGE_BYTE = 89
CALIBRATION_SAMPLES = 10
arduino_message_format = r'^(\d{1,3}) (\d{1,3}) ([01])$'
arduino_me... |
scalaris_test.py | # Copyright 2011-2015 Zuse Institute Berlin
#
# 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... |
dataloader.py | import threading
import queue
from typing import Iterable, Callable, Optional, Any, Union
import time
import torch
from copy import deepcopy
from ctools.torch_utils import to_device
from .collate_fn import default_collate
class AsyncDataLoader(object):
def __init__(
self,
data_source: Uni... |
testConf.py | '''
Created on Jun 13, 2017
@author: ubuntu
'''
import unittest
import yaml
import threading
import logging
import time
import sys
from multiprocessing import Process
from fakeFLM import fakeflm
from fakeSMR import fakesmr
from sonmanobase import messaging
from sonfsmvprxsquidconfiguration1.sonfsm_face import faceFS... |
__init__.py | # pylint: disable=too-many-lines
# (Yes, it has a point!)
__copyright__ = "Copyright (C) 2009-2013 Andreas Kloeckner"
__license__ = """
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 r... |
dag_processing.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... |
test_chatcommunicate.py | import chatcommunicate
import chatcommands
from globalvars import GlobalVars
from datahandling import _remove_pickle
import collections
import io
import os
import os.path
import pytest
import threading
import time
import yaml
from fake import Fake
from unittest.mock import Mock, patch
def test_validate_yaml():
... |
httpclient_test.py | #!/usr/bin/env python
from __future__ import absolute_import, division, print_function, with_statement
import base64
import binascii
from contextlib import closing
import copy
import functools
import sys
import threading
import datetime
from io import BytesIO
from tornado.escape import utf8
from tornado import gen
f... |
example_test.py | import multiprocessing
import os
import re
import socket
import ssl
from tiny_test_fw import DUT
import ttfw_idf
try:
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
except ImportError:
import http.server as BaseHTTPServer
from http.server import SimpleHTTPRequestHandler
s... |
rdd.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... |
experiments.py | import os
from sklearn.model_selection import KFold
import numpy as np
from segmentation_functions import cell_segment, masks_to_npy
from gan_model import create_model, rotation, train_representation
import multiprocessing
from generate_figures import figure_8
import matplotlib.pyplot as plt
from matplotlib.pyplot impo... |
rest_api_return_and_process.py | import multiprocessing
from flask import Flask, jsonify, request, make_response, abort
app = Flask(__name__)
def long_running_task(thread_name):
for i in range(100000000):
if i % 100000 == 0:
print('Processing request ' + str(thread_name))
@app.route('/eshan/api/v1.0/superheroes/add', meth... |
train_ac_f18.py | """
Original code from John Schulman for CS294 Deep Reinforcement Learning Spring 2017
Adapted for CS294-112 Fall 2017 by Abhishek Gupta and Joshua Achiam
Adapted for CS294-112 Fall 2018 by Soroush Nasiriany, Sid Reddy, and Greg Kahn
Adapted for pytorch version by Ning Dai
"""
import numpy as np
import torch
import gym... |
authenticator.py | """Authenticator module"""
from __future__ import absolute_import
from eap_module import EapModule
from heartbeat_scheduler import HeartbeatScheduler
from radius_module import RadiusModule, RadiusPacketInfo, RadiusSocketInfo, port_id_to_int
from message_parser import IdentityMessage, FailureMessage
import json
import ... |
__main__.py | import asyncio
import json
import logging
import argparse
import threading
import sys
from typing import List
from .utils import lookup_charger_stream_id, lookup_equalizer_stream_id
from . import Easee, Charger, Site, Circuit, Equalizer, DatatypesStreamData
CACHED_TOKEN = "easee-token.json"
_LOGGER = logging.getLog... |
tfrecord.py | # coding:utf-8
# 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 appl... |
chatClient.py | #! /usr/bin/env python3
import os
import sys
import select
import socket
import pickle
import getpass
import threading
import time
from datetime import datetime
from tkinter import *
# Adding APIs directory to python system path
# sys.path.insert(-1, os.path.join(os.path.dirname
# (os... |
system_stress.py | #!/usr/bin/env python
# Copyright (c) 2014-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same director... |
local.py | # vim:ts=4:sts=4:sw=4:expandtab
import datetime
import math
import os
import pathlib
import pwd
import resource
import signal
import tempfile
import time
import threading
import traceback
import kolejka.common.subprocess
from kolejka.judge import config
from kolejka.judge.result import Result
from kolejka.judge.s... |
mplsmall_FFT.py | from PyQt5.QtWidgets import *
import matplotlib.pyplot as plt
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from PyQt5 import QtCore
import threading
from PyQt5.Qt import QPoint, QRect
class mplsmall_FFT(QWidget):
def __init__(self,parent=None):
QWidget.__init__(self)
... |
baseSoftRobot.py | import multiprocessing
import socket
import struct
from ctypes import c_bool
import time
#---------------------------------------------------------------------
#- main SoftRC class -------------------------------------------------
class baseSoftRobot:
def __init__(self,nSensors,port):
self.nSensors = nSens... |
convert_tfrecords_mislabelled.py | # Copyright 2018 Changan Wang
# 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, so... |
video_ffpyplayer.py | '''
FFmpeg based video abstraction
==============================
To use, you need to install ffpyplayer and have a compiled ffmpeg shared
library.
https://github.com/matham/ffpyplayer
The docs there describe how to set this up. But briefly, first you need to
compile ffmpeg using the shared flags while disabling... |
util.py | import os
import re
import shutil
import sys
import ctypes
from pathlib import Path
from colorama import Fore, Back, Style
from .settings import *
if sys.version_info[0] < 3 or sys.version_info[1] <= 5:
raise RuntimeError(
"\nPlease restart with Python 3.6+\n" + "Current Python version:",
sys.versi... |
profiler.py | #! /usr/bin/env python3
# Copyright (c) 2014, HashFast Technologies LLC
# 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
# ... |
gce.py | # Copyright (c) 2015-2020 Avere Systems, Inc. All Rights Reserved.
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root for license information.
''' Abstraction for doing things on instances via Google Compute
Cookbook/examples:
# With JSON key... |
prometheus_exporter.py |
import json, requests, urllib3
from flask import Flask, request, jsonify
from datetime import datetime
import time
import traceback
import os
import redis
import cPickle as pickle
import virtualservice_static
import serviceengine_static
import servicediscovery
import pool_static
import controller_static
from multiproc... |
exchange_rate.py | from datetime import datetime
import inspect
import requests
import sys
import os
import json
from threading import Thread
import time
import csv
import decimal
from decimal import Decimal
from .bitcoin import COIN
from .i18n import _
from .util import PrintError, ThreadJob, make_dir
# See https://en.wikipedia.org/w... |
proxy.py | # -*- coding: utf-8 -*-
# Copyright 2019-2020 Mircea Ulinic. All rights reserved.
#
# The contents of this file are 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/licen... |
example2.py | #!/usr/bin/env python
import threading
import time
def worker():
print('new worker')
time.sleep(0.5)
print('end of worker')
t0 = threading.Thread(target = worker)
t1 = threading.Thread()
t0.daemon = t1.daemon = True
t1.run = worker
print('before')
t0.start()
time.sleep(0.1)
t1.start()
print('after')
|
speedtest.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2012-2014 Matt Martz
# 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.or... |
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... |
multithreading.py | import time
import threading
def calc_square(numbers):
print("calculate square of numbers")
for n in numbers:
time.sleep(0.1)
print("square", n*n)
def calc_cube(numbers):
print('calculate cube of numbers')
for n in numbers:
time.sleep(0.1)
print("cube", n*n... |
test_context.py | #
# Copyright (c) 2015-2021 Canonical, Ltd.
#
# This file is part of Talisker
# (see http://github.com/canonical-ols/talisker).
#
# 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
# regardin... |
thread_local.py | #!/usr/bin/env python3
import threading
# thread local is used to args delivery between functions in one thread
local_school = threading.local()
def process_student():
std = local_school.student
print('Hello, %s (in %s)' % (std, threading.current_thread().name))
def process_thread(name):
local_school.s... |
open_create_stress.py | #!/usr/bin/env python3.6
"""
author: samuels (c) 2018
"""
import argparse
import time
import os
import sys
from queue import Queue
from threading import Thread
sys.path.append(os.path.join(os.path.join('../')))
from client.generic_mounter import Mounter
from logger.server_logger import ConsoleLogger
logger = None
de... |
test_concurrent_futures.py | import test.support
# Skip tests if _multiprocessing wasn't built.
test.support.import_module('_multiprocessing')
# Skip tests if sem_open implementation is broken.
test.support.import_module('multiprocessing.synchronize')
from test.support.script_helper import assert_python_ok
import contextlib
import itertools
imp... |
HumanAgent.py | import cv2
import numpy as np
import time
from threading import Thread
try:
import pygame
from pygame.locals import K_BACKSPACE
from pygame.locals import K_COMMA
from pygame.locals import K_DOWN
from pygame.locals import K_ESCAPE
from pygame.locals import K_F1
from pygame.locals import K_LE... |
example_client.py | # File: example_client.py
# Aim: Define example of client connection
import socket
import threading
from . import CONFIG, tools
CONFIG.logger.debug('Define components in TCP package')
class ExampleClient(object):
def __init__(self, IP, port):
# Initialize and setup client
client = s... |
upnp.py | import logging
import threading
from queue import Queue
from typing import Optional
try:
import miniupnpc
except ImportError:
pass
log = logging.getLogger(__name__)
class UPnP:
thread: Optional[threading.Thread] = None
queue: Queue = Queue()
def __init__(self):
def run():
t... |
test.py | import json
import os.path as p
import random
import socket
import threading
import time
import logging
import io
import string
import avro.schema
import avro.io
import avro.datafile
from confluent_kafka.avro.cached_schema_registry_client import CachedSchemaRegistryClient
from confluent_kafka.avro.serializer.message_s... |
keepalived_state_change.py | # Copyright (c) 2015 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 a... |
sbuild.py | import yaml
import os
import sys
import time
import threading
from selenium import webdriver
###################################################
import serverutils.process
serverutils.process.VERBOSE = False
from serverutils.process import PopenProcess
###################################################
ANSI = {
... |
kws_detector.py | """
This is a packet of KWS detection,
dependent on DNN training part
"""
import pyaudio
import ctypes as ct
import numpy as np
import wave
import math
import matplotlib.pyplot as plt
import pyaudio
import os
import librosa
import librosa.display
import threading
import time
from numpy.linalg import norm
f... |
refactor.py | # Copyright 2006 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Refactoring framework.
Used as a main program, this can refactor any number of files and/or
recursively descend down directories. Imported as a module, this
provides infrastructure to write your own refactoring too... |
subproc_vec_env.py | import numpy as np
from multiprocessing import Process, Pipe
from rlstudy.common.vec_env import VecEnv, CloudpickleWrapper
def worker(remote, parent_remote, env_fn_wrapper):
parent_remote.close()
env = env_fn_wrapper.x()
while True:
cmd, data = remote.recv()
if cmd == 'step':
ob... |
twitterfeed.py | from StocktonBotPackage.DevUtilities import configutil, utils
from collections import OrderedDict
import discord
import tweepy
import os
import datetime
import threading
import asyncio
import json
import warnings
import copy
class TweepyClient:
def __init__(self, profile=None):
self.auth = tweepy.OAuthHa... |
bot.py | import os
import youtube_dl
import telepotpro
from random import randint
from multiprocessing import Process
from youtubesearchpython import VideosSearch
from dotenv import load_dotenv
from os.path import join, dirname
dotenv_path = join(dirname(__file__), '.env')
load_dotenv(dotenv_path)
TOKEN = os.environ.get("TOKE... |
gui.py | from Neobux import Neobux
from Neobux import NeobuxPage
import tkinter
from tkinter import ttk
import multiprocessing
from PIL import Image
from PIL import ImageTk
from PIL.PngImagePlugin import PngImageFile
from urllib.request import Request, urlopen
from base64 import b64decode
from io import BytesIO
... |
BlockChainManager.py | import threading
from time import sleep
import grpc
from qrl.core import logger
from qrl.generated import qrl_pb2
from qrl.services.PeerManager import PeerManager
class BlockChainManager(object):
def __init__(self, node, peer_manager):
self.node = node
self.peer_manager = peer_manager
s... |
create_images.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 ... |
dispatcher.py | """GRPC client.
Implements loading and execution of Python workers.
"""
import asyncio
import concurrent.futures
import logging
import queue
import threading
import traceback
import grpc
from . import bindings
from . import functions
from . import loader
from . import protos
from .logging import error_logger, logg... |
BasicStorage.py | ##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# TH... |
couchdb.py | #!/usr/bin/env python
from requests.auth import HTTPBasicAuth
import random
import requests
import re
import sys
from threading import Thread
from time import sleep
ips = open(sys.argv[1], "r").readlines()
Rdatabases = ["/a564r6fusmg","/dyejdffyjdxryj","/esreghsrgfbgrsb","/sfafdbsrdgjqef","/fyukddyuodyj","/yfjdued6y... |
connection_manager_4edge.py | import socket
import threading
import pickle
import codecs
from concurrent.futures import ThreadPoolExecutor
from .core_node_list import CoreNodeList
from .message_manager import (
MessageManager,
MSG_CORE_LIST,
MSG_PING,
MSG_ADD_AS_EDGE,
ERR_PROTOCOL_UNMATCH,
ERR_VERSION_UNMATCH,
OK_WITH... |
helper.py | # -*- coding: utf-8 -*-
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2020 Megvii Inc. All rights reserved.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT ARRANTI... |
spinny.py | # pylint: skip-file
import itertools, time, threading, sys
class Spinner:
def __init__(self, dt='Loading...', at='Done.'): self.spinner,self.dt,self.at,self.busy = itertools.cycle('⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏'),dt,at,True
def spin(self):
while self.busy: [print(f'{next(self.spinner)} {self.dt}', end='\r', flush=True), t... |
ae.py | """
The main user class, represents a DICOM Application Entity
"""
from copy import deepcopy
from datetime import datetime
import logging
from ssl import SSLContext
import threading
from typing import (
Union,
Optional,
List,
Tuple,
Dict,
cast,
TypeVar,
Type,
Any,
Sequence,
)
imp... |
old_server.py | import socket
import threading
import sys
import re
from base64 import b64encode, b64decode
from hashlib import sha1
class Server:
# create socket using TCP
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
# create list of connections... |
online.py | '''
Online link spider test
'''
from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
from builtins import next
import unittest
from unittest import TestCase
import time
import sys
from os import path
sys.path.append(path.dirname(path.dirname(path.abspath(__file__... |
receiver_service.py | import config
import account_helper
import node_rpc_helper
import recv_db
import node_rpc_helper
import recv_setup
import os
import json
from bottle import post, request, response, get, route, static_file
from threading import Thread
import requests
import time
def setHeaders():
response.content_type = 'applicati... |
FuzzingInTheLarge.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# "Fuzzing in the Large" - a chapter of "The Fuzzing Book"
# Web site: https://www.fuzzingbook.org/html/FuzzingInTheLarge.html
# Last change: 2021-10-19 15:30:44+02:00
#
# Copyright (c) 2021 CISPA Helmholtz Center for Information Security
# Copyright (c) 2018-2020 Saarlan... |
agent.py | import gevent
from gevent import monkey
monkey.patch_all()
import json
from signal import signal, SIGTERM
from multiprocessing import Process
from leek.agent.logger import get_logger
from leek.agent.consumer import LeekConsumer
logger = get_logger(__name__)
class LeekAgent:
"""Main server object, which:
... |
device.py | import importlib
import logging
import os
import signal
import subprocess
import sys
import threading
import time
import pexpect
import pexpect.fdpexpect
import serial
from pexpect.exceptions import TIMEOUT, EOF
from .config import PHRTOS_PROJECT_DIR, DEVICE_SERIAL
from .tools.color import Color
_BOOT_DIR = PHRTOS... |
test_jobs.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
#... |
smoketest.py | import os
import sys
import time
import shlex
import shutil
import signal
import tempfile
import requests
import threading
import subprocess as sp
CPP = []
class Cpp(object):
def __init__(self, args):
args = [sys.executable, "-m", "copyparty"] + args
print(" ".join([shlex.quote(x) for x in args]... |
infolog.py | import atexit
from datetime import datetime
import json
from threading import Thread
from urllib.request import Request, urlopen
_format = '%Y-%m-%d %H:%M:%S.%f'
_file = None
_run_name = None
_slack_url = None
def init(filename, run_name, slack_url=None):
global _file, _run_name, _slack_url
_close_logfile()
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.