source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
main.py | import sys
import json
import string
import random
from os import system
from random import randint
from itertools import cycle
from time import time, sleep
from threading import Thread
from pypresence import Presence
from requests_futures.sessions import FuturesSession
version = "1.0"
session = FuturesSession()
user... |
vidIO.py | #!/usr/bin/env python3
import cv2
import numpy as np
from time import perf_counter, sleep
from queue import Queue
from threading import Thread, Event
from pcv.interact import DoNothing, waitKey
from pcv.source import VideoSource
class BlockingVideoWriter(cv2.VideoWriter):
''' A cv2.VideoWriter with a context man... |
etherscan_py.py | import requests
import IPython
import copy
from threading import Thread, Lock
import itertools
from toolz import partition
class EtherscanEvent:
def __init__(self, event):
self.address = event['address']
self.topics = event['topics']
self.data = event['data']
self.block_height = int... |
agent.py | #!/usr/bin/python3
# Copyright (c) 2021 Intel Corporation.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify... |
test_ssl.py | # Test the support for SSL and sockets
import sys
import unittest
from test import support
import socket
import select
import time
import datetime
import gc
import os
import errno
import pprint
import urllib.request
import threading
import traceback
import asyncore
import weakref
import platform
import functools
impor... |
util.py | # coding: utf-8
import sys
import json
import re
import os
import functools
import platform
import threading
import subprocess
try:
from bs4 import BeautifulSoup as bs
import requests as rq
from argparse import ArgumentParser
except:
err = """
You haven't installed the required dependencies.
Run... |
test_ctypes.py | from __future__ import print_function, absolute_import, division
import sys
import threading
import numpy as np
from numba.ctypes_support import *
from numba import unittest_support as unittest
from numba.compiler import compile_isolated
from numba import jit, types, errors
from numba.typing import ctypes_utils
fro... |
app2.py | from telegram import (KeyboardButton, KeyboardButtonPollType, ParseMode,
ReplyKeyboardMarkup, ReplyKeyboardRemove)
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, ConversationHandler
import logging
import os
import sys
from threading import Thread
from XYGameHandler impo... |
resetpassword.py | # -*- coding: utf-8 -*-
# vim:set expandtab tabstop=4 shiftwidth=4:
#
# Copyright (c) 2020 Colin Tück
import cherrypy
import threading
import subprocess
import logging
from secrets import token_urlsafe
from hashlib import sha512
from datetime import datetime, timedelta
from email.message import EmailMessage
from che... |
test_server.py | import os
from multiprocessing.managers import DictProxy
from pathlib import Path
from unittest.mock import Mock, ANY
import requests
import time
import uuid
from typing import List, Text, Type, Generator, NoReturn, Dict
from contextlib import ExitStack
from _pytest import pathlib
from aioresponses import aiorespons... |
views.py | import os
import pdb
from threading import Thread
from django.conf import settings
from django.contrib import messages
from django.db.models import Q
from django.http import HttpResponse
from django.shortcuts import render
from django.views.generic import TemplateView
from django.utils.encoding import smart_str
fr... |
memserver.py | import torch
import numpy as np
import time, threading, collections
from torch.multiprocessing import Queue, Process
from timebudget import timebudget
from utils.fastmem import FastMemory
class MemoryServer(Process):#threading.Thread):#
def __init__(self, descs, memory, credit_assign, brain, n_step, good_reach)... |
pong_v0.py | # Import the pygame library and initialise the game engine
import pygame
from paddle import Paddle
from ball import Ball
import threading
pygame.init()
# Define some colors
BLACK = (0,0,0)
WHITE = (255,255,255)
# Open a new window
size = (700, 500)
screen = pygame.display.set_mode(size)
pygame.display.set_caption(... |
bannergrab.py | #!/usr/bin/python
#
##################################################
######## Please Don't Remove Author Name #########
############### Thanks ###########################
##################################################
#
#
__author__='''
Suraj Singh
surajsinghbisht054@gmail.com
http://bitforestinfo.bl... |
mp3player.py | #!/usr/bin/env python
import ctypes
from enum import Enum
import threading
import queue
from queue import Empty
import mpg123
import logging
import random
logger = logging.getLogger(__name__)
class mpg123_frameinfo(ctypes.Structure):
_fields_ = [
('version', ctypes.c_ubyte),
('layer', c... |
containers.py | """Container wrappers."""
import sys
import threading
import time
import queue
from linux.log import Log, logging
from linux.shell import Shell
import docker
from docker import errors as docker_errors
# pylint: disable=too-few-public-methods
class StreamQueue:
"""A class used to print the stream generator.
U... |
test_indexed_dataset.py | #!/usr/bin/env python3
"""
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import itertools
import multiprocessing
import os
import unittest
from contextlib import ExitStack
from functools impor... |
managers.py | #
# Module providing the `SyncManager` class for dealing
# with shared objects
#
# multiprocessing/managers.py
#
# Copyright (c) 2006-2008, R Oudkerk
# Licensed to PSF under a Contributor Agreement.
#
from __future__ import absolute_import
__all__ = ['BaseManager', 'SyncManager', 'BaseProxy', 'Token']
#
# Imports
#
... |
worker.py | """
Background job workers
"""
import logging
import traceback
from datetime import timedelta
from multiprocessing import Process
from sched import scheduler
from time import monotonic, sleep
import sentry_sdk
from google.protobuf import empty_pb2
from couchers.db import get_engine, session_scope
from couchers.jobs.d... |
flag.py | # ===============================================================================
# Copyright 2012 Jake Ross
#
# 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/licens... |
relay_integration.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 u... |
test_tk.py | # ------------------------------------------------------------------------------
# Created by Tyler Stegmaier.
# Property of TrueLogic Company.
# Copyright (c) 2020.
# ------------------------------------------------------------------------------
#
# ------------------------------------------------------------------... |
sysutils.py | import psutil
import numpy as np
import matplotlib.pyplot as plt
import os
import time
import multiprocessing
from IPython.display import clear_output
from collections import deque
logs = multiprocessing.Manager().dict()
class SystemMonitorProcess:
def __init__(self, start_timestamp, update_interval=0.1):
... |
pfs.py | import logging
import threading
import time
from dataclasses import dataclass
from enum import Enum
from typing import Dict, Iterable, List, Literal, Optional, Set, Union, cast
from urllib.parse import urlparse
from eth_typing import Address
from eth_utils import encode_hex, to_canonical_address, to_checksum_address
f... |
main.py | # -*- coding: utf-8 -*-
from tkinter import *
from tkinter import messagebox
# import tkMessageBox
from threading import Thread
from common import common
from parser import parser as htmlparse
from crawler import gethtml
from worker import Worker, WorkerConfig
from sentiment_analysis import inference
from simple_craw... |
inference_webcam.py | """
Inference on webcams: Use a model on webcam input.
Once launched, the script is in background collection mode.
Press B to toggle between background capture mode and matting mode. The frame shown when B is pressed is used as background for matting.
Press Q to exit.
Example:
python inference_webcam.py \
... |
runtime.py | # Python dependencies
import os
from datetime import datetime
import threading
# Third-party dependencies
import cronex
# First-party dependencies
from chronos.util import *
from chronos.venv import *
import chronos.metadata
from chronos.script import Script
def create_script(name=None):
"""Create a new script ... |
FileObserver.py | """
TheNexusAvenger
Observes changes to files and handles IO operations.
"""
import threading
import time
import os
from Observer import Observer
"""
Class representing a file observer.
"""
class FileObserver(Observer.Observable):
"""
Creates a file observer object.
"""
def __init__(self,fileName):... |
app.py | import tkinter as tk
from tkinter import ttk,messagebox
from tkinter import font
from tkinter.constants import CENTER, LEFT
from PIL import ImageTk, Image
import cv2
from random import randrange
import os
from camera import MyVideoCapture
import trainning_model_auto
from datetime import datetime
from threading import T... |
streams.py | import asyncio
import base64
import json
import logging
import os
import threading
import time
import socket
import cv2
import numpy as np
import requests
from io import BytesIO, BufferedReader
from azure.iot.device import IoTHubModuleClient, Message
from shapely.geometry import Polygon
from api.models import StreamM... |
text2numpy.py | import numpy as np
from multiprocessing import Queue, Process
from argparse import ArgumentParser
from ioutils import load_pickle, write_pickle
from glove_helper import text2numpy
def worker(proc_num, queue, dir, count_dir, min_count):
while True:
if queue.empty():
break
year = queue.g... |
test_browser.py | # coding=utf-8
# Copyright 2013 The Emscripten Authors. All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.
import argparse
import json
import multiprocessing
imp... |
test_ssl.py | # Test the support for SSL and sockets
import sys
import unittest
from test import test_support
support = test_support
import asyncore
import socket
import select
import time
import gc
import os
import errno
import pprint
import urllib, urlparse
import traceback
import weakref
import functools
import platform
from con... |
test_sys.py | from test import support
from test.support.script_helper import assert_python_ok, assert_python_failure
import builtins
import codecs
import gc
import locale
import operator
import os
import struct
import subprocess
import sys
import sysconfig
import test.support
import textwrap
import unittest
import warnings
# coun... |
test_parallel.py | # -*- coding: utf-8 -*-
import unittest
import sys
import os
import multiprocessing
import tempfile
import time
import random
import numpy as np
if __name__ == '__main__':
# add ../.. directory to python path such that we can import the main
# module
HERE = os.path.dirname(os.path.realpath(__file__))
... |
camera.py | #!/usr/bin/env python
# coding: utf-8
import math
import time
import atexit
import weakref
import pybullet
import threading
import numpy as np
from qibullet.link import Link
from qibullet.sensor import Sensor
class CameraResolution:
"""
Structure for the camera resolutions
"""
def __init__(self, wid... |
linkcheck.py | # -*- coding: utf-8 -*-
"""
sphinx.builders.linkcheck
~~~~~~~~~~~~~~~~~~~~~~~~~
The CheckExternalLinksBuilder class.
:copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
import socket
import codecs
import threading
from os import p... |
pickletester.py | import collections
import copyreg
import dbm
import io
import functools
import os
import pickle
import pickletools
import shutil
import struct
import sys
import threading
import unittest
import weakref
from textwrap import dedent
from http.cookies import SimpleCookie
from test import support
from test.support import (... |
utils_test.py | import asyncio
import collections
from contextlib import contextmanager
import copy
from datetime import timedelta
import functools
from glob import glob
import itertools
import logging
import logging.config
import os
import queue
import re
import shutil
import signal
import socket
import subprocess
import sys
import t... |
apps.py | from django.apps import AppConfig
import socket
import threading
from . import views
import os
from asgiref.sync import async_to_sync
from channels.layers import get_channel_layer
channel_layer = get_channel_layer()
def process_message(data):
async_to_sync(channel_layer.group_send)(
"data",
{
... |
devtools_browser.py | # Copyright 2017 Google Inc. All rights reserved.
# Use of this source code is governed by the Apache 2.0 license that can be
# found in the LICENSE file.
"""Base class support for browsers that speak the dev tools protocol"""
import glob
import gzip
import logging
import os
import re
import shutil
import subprocess
im... |
record_multiplayer.py | #!/usr/bin/python
#####################################################################
# This script presents how to use Doom's native demo mechanism to
# record multiplayer game and replay it with perfect accuracy.
#####################################################################
# WARNING:
# Due to the bug in ... |
p2p_stress.py | import testUtils
import p2p_test_peers
import random
import time
import copy
import threading
from core_symbol import CORE_SYMBOL
class StressNetwork:
speeds=[1,5,10,30,60,100,500]
sec=10
maxthreads=100
trList=[]
def maxIndex(self):
return len(self.speeds)
def randAcctName(self):
... |
cache_test.py | from Queue import Queue
import random
import socket
import threading
import unittest
from coapclient import HelperClient
from coapforwardproxy import CoAPForwardProxy
from coapserver import CoAPServer
from coapthon import defines
from coapthon.messages.option import Option
from coapthon.messages.request impor... |
mate.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2018 JiNong, Inc.
# All right reserved.
#
"""
Base Mate를 정의함.
"""
import time
import util
import logging
import logging.handlers
import traceback
from calibration import Calibrator
from threading import Thread
from mblock import MBlock, BlkType
from ... |
vmware_client.py | import uuid
from contextlib import contextmanager
from pyVim import connect
from pyVmomi import vim, vmodl
import json
import redis
import threading
from vmware.models import Tasks, DeployLists
from get2unix.settings import RUNNING_ENV
REDIS_LIVETIME = 9999999
class VMWare(object):
def __init__(self, host, port... |
test_browser.py | # coding=utf-8
from __future__ import print_function
import multiprocessing, os, shutil, subprocess, unittest, zlib, webbrowser, time, shlex
from runner import BrowserCore, path_from_root, has_browser, get_browser
from tools.shared import *
try:
from http.server import BaseHTTPRequestHandler, HTTPServer
except Impo... |
gloo.py | #!/usr/bin/env python
import os
import torch as th
import torch.distributed as dist
from torch.multiprocessing import Process
def allreduce(send, recv):
""" Implementation of a ring-reduce. """
rank = dist.get_rank()
size = dist.get_world_size()
send_buff = th.zeros(send.size())
recv_buff = th.zer... |
ssh.py | import shlex
import threading
import typing
# third-party
import paramiko # type: ignore[import]
def connect_ssh(
host: str,
port: int = 22,
username: typing.Optional[str] = None,
password: typing.Optional[str] = None,
public_key: typing.Optional[str] = None
) -> paramiko.SSH... |
server.py | # server.py
import logging
logging.basicConfig(level=logging.DEBUG, format='%(message)s', )
import datetime as dt
import logging
import sys
import socketserver
logging.basicConfig(level=logging.DEBUG,
format='%(name)s: %(message)s',
)
local_ip = "127.0.0.1"
n_port = 1234
tw = ... |
multiprocessing_demo.py | #!/usr/bin/env python3
"""multiprocessing demo."""
import os
from multiprocessing import Process, current_process
def square(number: int):
"""
Square number.
:return: number²
"""
result = number * number
process = current_process()
print(f'{number}² = {result} '
f'by process: ... |
test.py | """
Inference video: Extract matting on video.
Example:
python inference_video.py \
--model-type mattingrefine \
--model-backbone resnet50 \
--model-backbone-scale 0.25 \
--model-refine-mode sampling \
--model-refine-sample-pixels 80000 \
--model-checkpoint "PATH_TO... |
child_process_executor.py | """Facilities for running arbitrary commands in child processes."""
import os
import queue
import sys
from abc import ABC, abstractmethod
from collections import namedtuple
from dagster import check
from dagster.core.errors import DagsterExecutionInterruptedError
from dagster.seven import multiprocessing
from dagster... |
tests.py | import json
import ssl
from random import randint
from random import random
from threading import Thread
from time import sleep
from django.conf import settings
from django.test import TestCase
from websocket import create_connection
# class ModelTest(TestCase):
#
# def test_gender(self):
# user = UserProfile(sex_... |
parallel-crawl-script-demo.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Author: Shuyue Jia
@Date: Arg 19, 2020
"""
# Import necessary packages
import os
import ssl
import json
import time
import requests
import numpy as np
import pandas as pd
from random import randint
import urllib3
import threading
# Disable all kinds of warnings
urll... |
keep_alive.py | # to keep the bot not dead when hosted on replit
from flask import Flask
from threading import Thread
app = Flask('')
@app.route('/')
def main():
return "Your bot is alive!"
def run():
app.run(host="0.0.0.0", port=8080)
def keep_alive():
server = Thread(target=run)
server.start()
|
postInLoop.py | import http.client
import argparse
from multiprocessing import Process, Lock
def worker(lock, num, args):
headers = {'Content-type': 'application/json'}
dummyRequest = "{ param1: 42, param2: \"test\"}"
for r in range(int(args.requests)):
with lock:
print("#",num,": Sending ... |
13_exercise_22.py | # -*- coding: utf-8 -*-
import time, threading
# 假定这是你的银行存款:
balance = 0
def change_it(n):
# 先存后取,结果应该为0:
global balance
balance = balance + n
balance = balance - n
def run_thread(n):
for i in range(1000000):
change_it(n)
t1 = threading.Thread(target=run_thread, args=(5,))
t2 = thread... |
mgmt.py | from dearpygui.core import *
from dearpygui.simple import *
from dearpygui.demo import show_demo
import docker
import threading
import time
import webbrowser
import requests
import json
import os
import psycopg2
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
# noinspection PyUnresolvedReferences
from psycop... |
web_app_mapper.py | import urllib.request
import queue
import threading
import os
threads = 10
# Define the target website and the local directory to download and extract the web application.
target = "http://www.blackhatpython.org"
directory = "C:/Users/Max/Downloads/Joomla_3.8.6-Stable-Full_Package"
# Defile list of file extensions t... |
OffProcessWorldAccess.py | """
mcpython - a minecraft clone written in python licenced under the MIT-licence
(https://github.com/mcpython4-coding/core)
Contributors: uuk, xkcdjerry (inactive)
Based on the game of fogleman (https://github.com/fogleman/Minecraft), licenced under the MIT-licence
Original game "minecraft" by Mojang Studios (www.m... |
test_functools.py | import abc
import collections
from itertools import permutations
import pickle
from random import choice
import sys
from test import support
import unittest
from weakref import proxy
try:
import threading
except ImportError:
threading = None
import functools
py_functools = support.import_fresh_module('functoo... |
ExportIndicators.py | import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
import re
import json
import traceback
from base64 import b64decode
from multiprocessing import Process
from gevent.pywsgi import WSGIServer
from tempfile import NamedTemporaryFile
from flask import Flask, Response, req... |
physical_objects.py | import time
import threading
import RPi.GPIO as gpio
class Stepper:
def __init__(self, pulse = 23, direction = 24, enable = 25, steps = 80, step_delay = 0.0000001, name = 'Elevator'):
self.pulse = pulse
self.direction = direction
self.enable = enable
self.steps = steps #... |
test_lock.py | from unittest import TestCase, skip
from sys import modules
from unittest.mock import Mock, mock_open, patch
from threading import Thread
mock_os = modules["os"] = Mock()
mock_logger = modules["pitopcommon.logger"] = Mock()
# import after applying mocks
from pitopcommon.lock import PTLock # noqa: E402
@skip
class ... |
client.py | # coding: utf-8
import os
import socket
import threading
import time
import logging
import threading
import json
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger('Client')
class Client(object):
def __init__(self, host, port):
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREA... |
test_event_based_scheduler.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 u... |
tcp_consumer.py | # -*- coding: utf-8 -*-
# @Author : ydf
# @Time : 2019/8/8 0008 13:32
import json
from threading import Thread
import socket
from function_scheduling_distributed_framework.constant import BrokerEnum, ConcurrentModeEnum
from function_scheduling_distributed_framework.consumers.base_consumer import AbstractConsumer
... |
eventEngine.py | # encoding: UTF-8
# 系统模块
from Queue import Queue, Empty
from threading import Thread
from time import sleep
from collections import defaultdict
# 第三方模块
from PyQt4.QtCore import QTimer
# 自己开发的模块
from eventType import *
########################################################################
class EventEngine(object... |
skeletonAppiumVirtualParsable.py | ###################################################################
# Skeleton for Appium Virtual Tests on Sauce Labs
####################################################################
###################################################################
# Imports that are good to use
#################################... |
trainer_utils.py | # coding=utf-8
# Copyright 2020-present the HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... |
test_rpcfs.py |
import unittest
import sys
import os, os.path
import socket
import threading
import time
from fs.tests import FSTestCases, ThreadingTestCases
from fs.tempfs import TempFS
from fs.osfs import OSFS
from fs.memoryfs import MemoryFS
from fs.path import *
from fs.errors import *
from fs import rpcfs
from fs.expose.xmlrpc... |
sv.py | import time, threading
import configparser as cfg
from telegram_bot import telegram_bot
from mobile_de.methods import surface_search
class SEARCH:
def input_wait(self, offset_update):
update_id = offset_update
while True:
updates = bot.get_updates(offset=update_id)
updates... |
runFastTextCBOW.py | from helper import *
import multiprocessing
import sys
import time
numKeywords = int(sys.argv[1])
vectorSize = int(sys.argv[2])
maxCandidateArticles = int(sys.argv[3])
reducedSet = str(sys.argv[4])
printTimestamp("Getting candidate articles")
if reducedSet=='true':
candidate_articles = getCandidateArticles(maxCand... |
Malum.py | #!/usr/bin/python3
import Memory
import PIA6821
import Terminal
import Processor
import argparse
import threading
parser = argparse.ArgumentParser(description="Apple 1 Emulator")
parser.add_argument("-m", "--model",
help="set model to apple1 (default) or replica1",
default="apple1")
parser.add_argume... |
circle_map.py | #!/usr/bin/env python
#MIT License
#
#Copyright (c) 2019 Iñigo Prada Luengo
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use... |
WCPE_support.py | #!/usr/bin/env python
# -*- python -*-
# Time-stamp: <2014-06-18 14:45:31 rozen>
##############################################################################
#
# WCPE - A program for displaying the current piece playing on WCPE.
#
# Copyright (C) 2013 - Donald Rozenberg
#
# This program is free software; you can red... |
tpu_estimator.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... |
threadtest.py | import math
from threading import Thread
from time import sleep
def calc_fact(num):
sleep(0.001)
math.factorial(num)
num = 600000
t = Thread(target=calc_fact, daemon=True, args=[num])
print("About to calculate: {}!".format(num))
t.start()
print("Calculating...")
t.join()
print("Calculated")
|
likeandfollow_users_with_many_followers_by_location_schedule.py | # -*- coding: utf-8 -*-
import schedule
import time
import sys
import os
import random
import yaml #->added to make pics upload -> see job8
import glob #->added to make pics upload -> see job8
from tqdm import tqdm
import threading #->added to make multithreadening possible -> see fn run_... |
run-emu-experiment-osm.py | # import wrappers
# make method which does the following, take mano as parameter
# get start time
# sleep 5 min
# get NS instantiation time
# send instantiation request to osm/sonata
from wrappers import OSMClient
import time
import json
import requests
from urllib.request import urlopen
import csv
import os
import d... |
manager.py | # -*- coding: utf-8 -*-
#
# profiler : a Wi-Fi client capability analyzer tool
# Copyright : (c) 2020-2021 Josh Schmelzle
# License : BSD-3-Clause
# Maintainer : josh@joshschmelzle.com
"""
profiler.manager
~~~~~~~~~~~~~~~~
handle profiler
"""
# standard library imports
import argparse
import inspect
import logging
... |
run.py | import os
import re
import sys
import time
import logging
import threading
import signal
import docker
import socket
import dns.resolver
from requests.exceptions import ConnectionError
KUBELET_INTERVAL = int(os.environ.get('KUBELET_INTERVAL', 120))
KUBELET_CHECK_STRING = os.environ.get('KUBELET_CHECK_STRING', "use of... |
gamepad_reader.py | from absl import app
from absl import flags
from inputs import get_gamepad
import threading
import time
import collections
from statistics import mean
FLAGS = flags.FLAGS
MAX_ABS_RX = 32768
MAX_ABS_RY = 32768
def _interpolate(raw_reading, max_raw_reading, new_scale):
return raw_reading / max_raw_reading * new_scal... |
picamera_device.py | """This module contains the PiCameraDevice type."""
import sys
import threading
from Queue import Queue, Empty
from pyee import EventEmitter
from subprocess import Popen, PIPE
from raspy.object_disposed_exception import ObjectDisposedException
from raspy.devices.device import Device
from raspy.devices.picamera.events... |
text_preprocess.py | import csv
import time
import re
import text2emotion as te
import multiprocessing
import os
from multiprocessing import Process, Queue, cpu_count
import sys
import phoneme_features
import queue
from consts import TITLE, FORM, ALLITERATION, ASSONANCE, TAGS, EMOTIONS, START, DELIM, METER
def remove_trailing_whitespace(t... |
ner.py | from pepper import logger
from contextlib import contextmanager, closing
from threading import Thread
import socket
import subprocess
import os
from time import sleep
class NER(object):
ROOT = os.path.join(os.path.dirname(__file__), 'stanford-ner')
IP = 'localhost'
def __init__(self, classifier='engl... |
app.py | import threading
from flask import Flask, render_template, request, redirect, url_for
from skpy import SkypeTextMsg
from server import Server
def parse_chat(html):
command = None
content = None
if html.startswith("/all "):
command = "all"
content = html[5:]
return command, content
de... |
hole_punching_messenger.py | import argparse
import socket
import time
import threading
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
class UdpServerAndClient:
def __init__(self, args):
self.user = args.user_name
self.target_ip = args.target_ip
sel... |
output_progress.py | import sys
import time
import threading
from progress.bar import Bar
class Spinner:
busy = False
delay = 0.1
@staticmethod
def spinning_cursor():
while 1:
for cursor in "|/-\\":
yield cursor
def __init__(self, delay=None):
self.spinner_generator = self... |
exec.py | import threading
from jacdac.transport import Transport
import subprocess
from jacdac.util import buf2hex, hex2buf
class ExecTransport(Transport):
def __init__(self, exec: str):
self.exec = exec
self.open()
def open(self) -> None:
self.proc = subprocess.Popen(self.exec,
... |
urls.py | # *****************************************************************************
#
# Copyright (c) 2020, the pyEX authors.
#
# This file is part of the pyEX library, distributed under the terms of
# the Apache License 2.0. The full license can be found in the LICENSE file.
#
from __future__ import print_function
impor... |
mocks.py | import socket
from functools import partial
from http.server import BaseHTTPRequestHandler, HTTPServer
from threading import Thread
class MockServerRequestHandler(BaseHTTPRequestHandler):
def __init__(self, mock_name, *args, **kwargs):
self.mock_name = mock_name
self.retry_counter = 0
sup... |
test_gc.py | import unittest
from test.support import (verbose, refcount_test, run_unittest,
strip_python_stderr, cpython_only, start_threads,
temp_dir, requires_type_collecting, TESTFN, unlink,
import_module)
from test.support.script_helper import assert... |
TCPclint.py | from socket import *
from threading import Thread
def recv():
while True:
data_recv = tcp_socket_client.recv(1024)
print('服务器:', data_recv.decode('gbk'))
def send_msg():
while True:
msg = input('>>>')
tcp_socket_client.send(msg.encode('gbk'))
# 1、创建套接字
tcp_socket_client = soc... |
test_ssl.py | import asyncio
import asyncio.sslproto
import contextlib
import gc
import logging
import os
import select
import socket
import ssl
import tempfile
import threading
import time
import weakref
from test import support
from test.test_asyncio import utils as test_utils
def tearDownModule():
asyncio.set_event_loop_po... |
flexbe_onboard.py | #!/usr/bin/env python
import rospy
import os
import sys
import inspect
import tempfile
import threading
import time
import smach
import zlib
import contextlib
from ast import literal_eval as cast
from flexbe_core import Logger, BehaviorLibrary
from flexbe_core.proxy import ProxyPublisher, ProxySubscriberCached
from f... |
Bee_MAIL.py | import pythoncom
import pyHook
from os import path
from time import sleep
from threading import Thread
import urllib, urllib2
import smtplib
import datetime
import win32com.client
import win32event, win32api, winerror
from _winreg import *
import shutil
import sys
ironm = win32event.CreateMutex(None, 1, 'NOSIGN')
if w... |
grpc_inference_generator.py | import logging
import threading
import grpc
import io
import random
import torch
import torchvision
from PIL import Image
from inference.configuration import cfg
from inference.service import InferenceService
import inference.proto.inference_service_pb2_grpc as grpc_service
import inference.proto.inference_service_... |
compliancetest.py | import os
import threading
import shutil
import lockfile
class ComplianceTest(object):
def __init__(self):
self.saved_class = lockfile.LockFile
def _testfile(self):
"""Return platform-appropriate file. Helper for tests."""
import tempfile
return os.path.join(tempfile.gettempd... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.