source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
qira_program.py | from __future__ import print_function
from qira_base import *
import qira_config
import qira_analysis
import os
import shutil
import sys
import subprocess
import threading
import time
import collections
from hashlib import sha1
from subprocess import (Popen, PIPE)
import json
import struct
import qiradb
import arch... |
fog_agent_new_tests.py | #Author: Roberto Goncalves Pacheco
#Universidade do Estado do Rio de Janeiro
#Departamento de Eletronica e Telecomunicacoes
#Project: Sensing Bus
#Subject: Comunication between Cloud and Fog
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
import SocketServer
from signal import signal, SIGPIPE, SIG_DFL
f... |
vid2img_other.py | # Code for "TSM: Temporal Shift Module for Efficient Video Understanding"
# arXiv:1811.08383
# Ji Lin*, Chuang Gan, Song Han
# {jilin, songhan}@mit.edu, ganchuang@csail.mit.edu
import os
import threading
import pdb
NUM_THREADS = 12
# VIDEO_ROOT = '/ssd/video/something/v2/20bn-something-something-v2' # Downloa... |
ua_client.py | """
Low level binary client
"""
import logging
import socket
from threading import Thread, Lock
from concurrent.futures import Future
from functools import partial
from opcua import ua
from opcua.ua.ua_binary import struct_from_binary, uatcp_to_binary, struct_to_binary, nodeid_from_binary
from opcua.ua.uaerrors impor... |
dnsspoof.py | from twisted.internet import reactor
from twisted.internet.interfaces import IReadDescriptor
import os
import nfqueue
from scapy.all import *
import argparse
import threading
import signal
def arg_parser():
parser = argparse.ArgumentParser()
parser.add_argument("-d", "--domain", help="Choose the domain to spoo... |
deltaproxy.py | #
# Proxy minion metaproxy modules
#
import copy
import logging
import os
import sys
import threading
import traceback
import types
import salt
import salt.beacons
import salt.cli.daemons
import salt.client
import salt.config
import salt.crypt
import salt.defaults.exitcodes
import salt.engines
import salt.loader
im... |
train_tcn.py | import os
import argparse
import torch
import numpy as np
from torch import optim
import multiprocessing
from threading import Thread
from queue import Queue
from torch.optim import lr_scheduler
from torch.autograd import Variable
from torch.utils.data import DataLoader, ConcatDataset
from util import (SingleViewTriple... |
server.py | import socket
from threading import Thread
import traceback
import json
import struct
from copy import deepcopy
import random
from tkinter import *
from GUI import Window
from queue import Queue
buf_size = 1024
class Server(Thread):
def __init__(self, root):
super().__init__()
self.host = '127.0.... |
PyPortScanner.py | import argparse
import logging
import time
import Queue
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
from scapy.all import *
from threading import *
import sys
# Where you want to save your html file
html_file = "dashboard.html"
src_port = 400
# Thread dictionary
Hosts = dict()
# My Host class which mak... |
devserver.py | #!/usr/bin/env python
"""
To get quick feedback this implements an automatically reloading web server
to be run locally.
Reloading functionality is taken from the fabulous
`Werkzeug WSGI toolkit <http://www.pocoo.org/projects/werkzeug/#werkzeug>`
"""
import logging
import mimetypes
import os
import subprocess
import s... |
driver_util.py | """Scripts for drivers of Galaxy functional tests."""
import http.client
import logging
import os
import random
import re
import shlex
import shutil
import signal
import socket
import string
import subprocess
import sys
import tempfile
import threading
import time
from typing import Optional
from urllib.parse import u... |
config_test.py | # coding=utf-8
# Copyright 2018 The Gin-Config Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
datagen.py | #!/usr/bin/env python
from argparse import ArgumentParser
import sys
import os
from random import randint, uniform, choice
import string
from datetime import datetime, timedelta
import operator
import csv
from threading import Thread
import gzip
__author__ = 'franklinsijo'
class DataGen(object):
ALLOWED_UNITS =... |
threaded_batched.py | """ batched, sqlite3 optimised and multi threaded version.
This version builds from sqlite3_opt_batched.py, but this one is multithreaded and probabaly the complex variant of all python ones.
We have a queue, spawn a single writer thread which consumes from queue and writes to SQLite. Then we spawn few more producer ... |
test_advisory_lock.py | from contextlib import contextmanager
from multiprocessing import get_all_start_methods
from multiprocessing import get_start_method
from multiprocessing import Pipe
from multiprocessing import Process
from multiprocessing import set_start_method
from time import sleep
from django.db import transaction
from django.tes... |
ex4_sample.py | import logging
import threading
import time
def thread_function(name):
logging.info("Thread %s: starting", name)
time.sleep(2)
logging.info("Thread %s: finishing", name)
if __name__ == "__main__":
format = "%(asctime)s: %(message)s"
logging.basicConfig(format=format, level=logging.INFO,
... |
scheduler.py | """
This module is the main part of the library. It houses the Scheduler class
and related exceptions.
"""
from threading import Thread, Event, Lock
from datetime import datetime, timedelta
from logging import getLogger
import os
import sys
from apscheduler.util import *
from apscheduler.triggers import SimpleTrigger... |
run.py |
# Copyright (c) 2020 Institution of Parallel and Distributed System, Shanghai Jiao Tong University
# ServerlessBench is licensed under the Mulan PSL v1.
# You can use this software according to the terms and conditions of the Mulan PSL v1.
# You may obtain a copy of Mulan PSL v1 at:
# http://license.coscl.org.cn/M... |
main.py | import npyscreen
import os
import re
import sys
import time
from docker.errors import DockerException
from npyscreen import notify_confirm
from threading import Thread
from vent.api.actions import Action
from vent.api.menu_helpers import MenuHelper
from vent.helpers.meta import Containers
from vent.helpers.meta impor... |
test_tune_restore.py | # coding: utf-8
import signal
from collections import Counter
import multiprocessing
import os
import shutil
import tempfile
import threading
import time
from typing import List
import unittest
import ray
from ray import tune
from ray._private.test_utils import recursive_fnmatch
from ray.exceptions import RayTaskError... |
decorators.py | import threading
from functools import wraps
from django.core.exceptions import PermissionDenied
def require_member(func):
@wraps(func)
def inner(request, *args, **kwargs):
if request.user_obj:
return func(request, *args, **kwargs)
else:
raise PermissionDenied('You mus... |
uploadMgr.py | import scanner
from fileReader import FileReader
from s3FileUpload import S3FileUpload
from queue import Queue
import time
import os
import threading
fileQ = Queue(10000)
errorReportQ = Queue()
scanner.Scanner('c:\\python', fileQ, errorReportQ).start()
def upload():
fr = FileReader(fileQ, errorReportQ, 1024 * 10... |
event_board.py | from typing import Callable
from threading import Thread
from functools import partial
from collections import defaultdict
from multiprocessing import Pipe, SimpleQueue
from pipert2.core.handlers.event_handler import EventHandler
from pipert2.utils.method_data import Method
from pipert2.utils.consts.event_names import ... |
scanner_engine.py |
from iemlav.lib.antivirus.scanner.hash_scanner import HashScanner
from iemlav.lib.antivirus.scanner.yara_scanner import YaraScanner
from iemlav.lib.antivirus.scanner.clamav_scanner import ClamAVScanner
from iemlav.lib.antivirus.antivirus_logger import AntiVirusLogger
import multiprocessing
import sys
class Scanner... |
mongodb_04.py | import time
from pymongo import MongoClient
from datetime import datetime
from threading import Thread, Lock
start = datetime.now()
client = MongoClient("mongodb://username:password@127.0.0.1")
database = client["database_name"]
collection = database["collection_name"]
threads_count = 0
lock = Lock()
package = []
... |
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 gc
import os
import errno
import pprint
import tempfile
import urllib.request
import traceback
import asyncore
import weakref
import platform
import functools
ssl = support.import_... |
pipeline.py | """
pipeline.py
"""
from os import walk
from re import search
from importlib import import_module
from multiprocessing import Process
from pydoc import locate
from lxml import etree
class Pipeline(object):
"""
pipeline class
"""
def __init__(self, log_server, file_name):
super(Pipeline, self)._... |
__init__.py | from thonny.plugins.micropython import MicroPythonProxy, MicroPythonConfigPage,\
add_micropython_backend
from thonny import get_workbench, get_runner, ui_utils
import os
import subprocess
import tkinter as tk
from tkinter import ttk
from urllib.request import urlopen
from thonny.ui_utils import SubprocessDialog
fro... |
utils.py | import requests
import ConfigParser
from bs4 import BeautifulSoup
from time import sleep
from clint.textui import progress
import os, sys, itertools
from threading import Thread
from logs import *
def ip_address():
"""
Gets current IP address
"""
response = requests.get('http://www.ip-addr.es')
pr... |
tasks.py | #!/usr/local/bin/python3
# coding: utf-8
# ytdlbot - tasks.py
# 12/29/21 14:57
#
__author__ = "Benny <benny.think@gmail.com>"
import json
import logging
import os
import pathlib
import re
import subprocess
import tempfile
import threading
import time
from urllib.parse import quote_plus
import psutil
import requests... |
test_ftplib.py | """Test script for ftplib module."""
import ftplib
import asyncore
import asynchat
import socket
import io
import errno
import os
import time
try:
import ssl
except ImportError:
ssl = None
from unittest import TestCase, skipUnless
from test import support
from test.support import HOST, HOSTv6
threading = suppor... |
server.py | import hmac
import json
import urllib.parse
from .main import (
PullReqState,
parse_commands,
db_query,
INTERRUPTED_BY_HOMU_RE,
synchronize,
)
from .action import LabelEvent
from . import utils
from .utils import lazy_debug
import github3
import jinja2
import requests
import pkg_resources
from bottl... |
variable_scope_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... |
test.py | #!/bin/python3
import subprocess
import time
import struct
import sys
import threading
import socket
import os
shellcode = b"\x04\x00\r4\x04\x00\x084\x00\xa2\t<\x00\x80)5\x00\xa3\n<$\x00J5\x00\x00\x0b4\x00\x00\"\x8d\x00\x00\x00\x00\x00\x00B\xad\x04\x00)%\x04\x00J%\x01\x00k%\xf9\xffm\x15\x00\x00\x00\x00\x00\xa3\x0c<... |
operators.py | import copy
from random import shuffle
from typing import Dict, List, Union
from Ombuki.constants import MUTATION_REVERSAL_LENGTH
from Ombuki.auxiliaries import is_nondominated, mmoeasa_is_nondominated
from Ombuki.ombukiSolution import OmbukiSolution
from MMOEASA.mmoeasaSolution import MMOEASASolution
from threading im... |
realtime_detect.py | import colorsys
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '2'
import cv2
import numpy as np
from keras import backend as K
from keras.models import load_model
from keras.layers import Input
from yolo3.model import yolo_eval, yolo_body, tiny_yolo_body
from yolo3.utils import image_preporcess
import multiprocessi... |
datasets.py | import glob
import math
import os
import random
import shutil
import time
from pathlib import Path
from threading import Thread
import cv2
import numpy as np
import torch
from PIL import Image, ExifTags
from torch.utils.data import Dataset
from tqdm import tqdm
from utils.utils import xyxy2xywh, xywh2xyxy
help_url =... |
train.py | import sys
import os
import threading
import torch
from torch.autograd import Variable
import torch.utils.data
from lr_scheduler import *
import numpy
from AverageMeter import *
from loss_function import *
import datasets
import balancedsampler
import networks
from my_args import args
def train():
torch.manual_... |
utils.py | u"""twitter apiを叩くクライアントを提供する."""
import json
import os
import threading
import datetime
from pytz import timezone
from queue import Queue
from requests_oauthlib import OAuth1Session
# from django.core.paginator import Paginator
def merge_two_dicts(a, b):
u"""2つの辞書オブジェクトを合体させる."""
c = a.copy()
c.update(... |
connection.py | # Copyright 2019 ARM Limited
#
# 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 writin... |
controller.py | import os
import re
import traceback
from datetime import datetime
from math import floor
from pathlib import Path
from threading import Thread
from typing import List, Set, Type, Tuple, Optional
from packaging.version import Version
from bauh.api.abstract.controller import SearchResult, SoftwareManager, ApplicationC... |
client.py | from __future__ import print_function
import threading
import Pyro4
import bouncer
abort = False
def PyroLoop(daemon):
daemon.requestLoop()
def main():
global abort
daemon = Pyro4.Daemon()
server = Pyro4.Proxy("PYRONAME:example.deadlock")
bounceObj = bouncer.Bouncer("Client")
daemon.regis... |
test_facial_recognition_handler.py | """utest channel handler module"""
# -*- coding: UTF-8 -*-
#
# =======================================================================
#
# Copyright (C) 2018, Hisilicon Technologies Co., Ltd. All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted pro... |
set_posture.py | #!/usr/bin/env python
"""
Tool that use to set Baxter into different modes
"""
import os
import rospy
import argparse
import baxter_interface
import yaml
from ik_solver import solve_IK
import threading
import alloy.ros
def move_arm_to_pose(limb_name, pose):
#create the baxter interface
limb_interface = bax... |
views.py | from django.shortcuts import render
from news.models import Universidad, Noticia
from bs4 import BeautifulSoup
from django.conf import settings
import feedparser, unicodedata, urllib.request, time, re, datetime, time, threading
import ssl
import dateutil.parser
import logging
import unidecode
result = []
# Create yo... |
multiprocessing.py | """Test for suspending and resuming a process."""
import multiprocessing as mp
import time
import psutil
from bsl.triggers import ParallelPortTrigger
from cardio_audio_sleep.config import load_triggers
from cardio_audio_sleep.tasks import isochronous
from cardio_audio_sleep.utils import generate_sequence, search_ANT... |
sngcja5_thread.py | import sys
import logging
import threading
import smbus
from time import sleep
from queue import Queue
from datetime import datetime
MASS_DENSITY_PM_TYPES = ["pm1.0", "pm2.5", "pm10"]
MASS_DENSITY_BLOCK_SIZE = 4
ADDRESS_MASS_DENSITY_HEAD = 0
ADDRESS_MASS_DENSITY_TAIL = 11
ADDRESS_MASS_DENSITY_LENGTH = (ADDRESS_MASS_D... |
scriptinfo.py | import os
import sys
from tempfile import mkstemp
import attr
import collections
import logging
import json
from furl import furl
from pathlib2 import Path
from threading import Thread, Event
from .util import get_command_output
from ....backend_api import Session
from ....debugging import get_logger
from .detectors ... |
thread_collision.py | '''
multi-threading (python3 version)
https://docs.python.org/3/library/threading.html
'''
from time import clock
import threading
THREADS=2
lock = threading.Lock()
A = 0
B = 0
C = 0
def test_globals():
global A, B, C
for i in range(1024*1024):
lock.acquire()
A += 1
B += 2
C = A + B
lock.release()
def... |
server.py | # -*- coding: utf-8 -*-
# =================================================================
#
# Authors: Tom Kralidis <tomkralidis@gmail.com>
# Angelos Tzotsos <tzotsos@gmail.com>
#
# Copyright (c) 2016 Tom Kralidis
# Copyright (c) 2015 Angelos Tzotsos
# Copyright (c) 2016 James Dickens
# Copyright (c) 2016 Ri... |
dr_beam.py | #!/usr/bin/env python
from __future__ import division, print_function
try:
range = xrange
except NameError:
pass
import os
import sys
import h5py
import json
import time
import numpy
import ctypes
import signal
import logging
import argparse
import threading
from functools import reduce
from datetime import d... |
main.py | import json
import os
import sys
import threading
import modules.ui
import modules.engine
import modules.networking
import modules.editor
import modules.netclients
class App:
def __init__(self):
self.editor = None
self.game = None
self.client = None
self.server = None
self.... |
serv.py | import os,sys,logging
import signal, time
from xmlrpc.server import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler
import threading
import queue
import socket
import io
import sqlite3
import bb.server.xmlrpcclient
import prserv
import prserv.db
import errno
import select
logger = logging.getLogger("BitBake.PRserv")
i... |
WebFuzzer.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# "Testing Web Applications" - a chapter of "The Fuzzing Book"
# Web site: https://www.fuzzingbook.org/html/WebFuzzer.html
# Last change: 2022-02-03 14:31:04+01:00
#
# Copyright (c) 2021 CISPA Helmholtz Center for Information Security
# Copyright (c) 2018-2020 Saarland Un... |
qgui1.py | #!/usr/bin/python
#from PyQt4.QtCore import *
#from PyQt4.QtGui import *
#from PyQt4.Qwt5 import *
import socket
import struct
import logging
import sys,getopt
import os
import random
import numpy
from matplotlib import pyplot as plt
import threading
import sys, time
from PyQt4 import QtCore, QtGui, Qwt5,Qt
import pa... |
bot.py | ''' Module main class '''
import os
import logging
import datetime
import json
from time import sleep
from threading import Thread
from shutil import copyfile
from tweepy import API, StreamListener
from .file_io import LoadFromFile
from .config import Config
from .flags import BotFunctions, BotEvents
from .logs import ... |
lmd.py | #!/usr/bin/env python
##############################################################################
#
# $Id$
##############################################################################
'''
LMD - python prototype for Enstore File Cache Library Manager Dispatcher core functionality implementation
'''
# system... |
mrun.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Seaky
# @Date: 2019/4/20 14:44
import queue
import time
import traceback
from collections import OrderedDict
from multiprocessing import Process, Manager
from random import randint
from ..data.mysql import MyModel
from ..data.mysql import new_session
from ..f... |
io_bound_threading.py | import time
import threading
def io_bound_job(job_id, num_requests):
start_job = time.time()
print(f"IO-bound sub-job {job_id} started.")
for _ in range(num_requests):
# IO-bound jobs spend most of the time waiting for responses.
time.sleep(3)
duration = time.time() - start_job
prin... |
run_experiment_nordri_torque_control.py | #!/usr/bin/env python
import grip_and_record.inverse_kin
from geometry_msgs.msg import (
PoseStamped,
Pose,
Point,
Quaternion,
)
from data_recorder_and_torque_controller import DataRecorder_TorqueController as DR_TC
import data_recorder_and_torque_controller as dr
from grip_and_record.robot_utils imp... |
__main__.py | #!/usr/bin/env python3
import connexion
from swagger_server import encoder
from swagger_server.messaging.rpc_queue_consumer import *
from swagger_server.utils.db_utils import *
from optparse import OptionParser
import argparse
import time
import threading
import logging
import json
# make sure to install datamodel:
... |
invokers.py | #
# (C) Copyright IBM Corp. 2020
# (C) Copyright Cloudlab URV 2020
#
# 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... |
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... |
test_resource.py | import resource
from multiprocessing import Manager, Process
import pytest
from pji.control.model import ResourceLimit
@pytest.mark.unittest
class TestControlModelResource:
def test_properties(self):
rl = ResourceLimit(
max_stack=1,
max_memory=2,
max_cpu_time=3,
... |
testmp.py | import os
import subprocess
import time
import sys
import re
import lcd
import threading
import Adafruit_BBIO.GPIO as GPIO
stations={'JAZZ': 'http://www.radioswissjazz.ch/live/aacp.m3u', 'Virgin Radio': 'http://shoutcast.unitedradio.it:1301','Deejay': 'http://mp3.kataweb.it:8000/RadioDeejay','105Hits': 'http:... |
lisp.py | # -----------------------------------------------------------------------------
#
# Copyright 2013-2019 lispers.net - Dino Farinacci <farinacci@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain... |
__init__.py | from multiprocessing import Queue
import threading
import logging
import json
import socket
import time
class doorbell:
def __init__(self, parent):
self.parent = parent
self.logger = parent.logger
self.sound = 10
self.volume = 10
## TODO: rewrite
def set_doorbell_sound(sel... |
drive_manager.py | """
********************************
* Created by mohammed-alaa *
********************************
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVE... |
engine.py | """
This is the OceanMonkey engine which controls all the monkeys to crawling data
"""
import time
import importlib
import multiprocessing
import copy
import pickle
import threading
import asyncio
from threading import Lock, Condition
from oceanmonkey.core.monkey import MonkeyType
from oceanmonkey.core.request import ... |
accelerometer.py | '''
'Windows' accelerometer
---------------------
A dummy accelerometer for phone emulation
'''
from plyer.facades import Accelerometer
from sensor_simulate import SemiRandomData
# from multiprocessing import Process, Manager
from threading import Thread
import time
import sys
class AccelerometerSensorListener(objec... |
test_http.py | import asyncio
import contextlib
import logging
import socket
import threading
import time
import pytest
from tests.response import Response
from uvicorn import Server
from uvicorn.config import Config
from uvicorn.main import ServerState
from uvicorn.protocols.http.h11_impl import H11Protocol
try:
from uvicorn.... |
presence.py | import subprocess
from time import sleep, strftime, time
from threading import Thread
# Edit these for how many people/devices you want to track
occupant = [""]
# MAC addresses for our phones
address = [""]
# Some arrays to help minimize streaming and account for devices
# disappearing from the network when asleep
f... |
t0.py | import threading
from time import sleep
import sys
x=int()
p=int()
def c():
global x,p
while 1:
x=input()
#x=x+p
def printer():
global x,p
while 1:
#q=q+x
print(x)
sleep(1)
t1=threading.Thread(target=c)
t1.daemon=True
t1.start()
printer()
|
ffmpegstream.py | """ OpenCV Backend RTSP Client """
import cv2
from io import BytesIO
from PIL import Image
from threading import Thread
class Client:
""" Maintain live RTSP feed without buffering. """
_stream = None
def __init__(self, rtsp_server_uri, verbose = False):
"""
rtsp_server_uri: the path ... |
run_severus.py | import severus
import _thread as thread
import socket
import requests
import random
import threading
import time
def is_relay():
def listen(port):
s = socket.socket()
s.bind(("0.0.0.0", port))
s.listen(5)
_, __ = s.accept()
_.close()
port = random.randint(5000, 9999)
... |
auth.py | import base64 as _base64
import hashlib as _hashlib
import os as _os
import re as _re
import webbrowser as _webbrowser
from multiprocessing import Process as _Process
from multiprocessing import Queue as _Queue
import keyring as _keyring
import requests as _requests
try: # Python 3.5+
from http import HTTPStatus... |
AuditLogCollector.py | #!/usr/bin/python3
# Standard libs
import os
import json
import logging
import datetime
import argparse
import dateutil.parser
from collections import deque
import threading
# Internal libs
import GraylogInterface
import ApiConnection
class AuditLogCollector(ApiConnection.ApiConnection):
def __init__(self, outp... |
network.py | # Copyright 2019 Uber Technologies, 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 applica... |
queuetest3.py | "same as queuetest2.py, but uses threading, not _threads"
numconsumers = 2 # how many consumers to start
numproducers = 4 # how many producers to start
nummessages = 4 # messages per producer to put
import threading, queue, time, sys
safeprint = threading.Lock() ... |
wordnet_app.py | # Natural Language Toolkit: WordNet Browser Application
#
# Copyright (C) 2001-2018 NLTK Project
# Author: Jussi Salmela <jtsalmela@users.sourceforge.net>
# Paul Bone <pbone@students.csse.unimelb.edu.au>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
A WordNet Browser application whic... |
statreload.py | import logging
import multiprocessing
import os
import signal
import sys
import time
from pathlib import Path
import click
HANDLED_SIGNALS = (
signal.SIGINT, # Unix signal 2. Sent by Ctrl+C.
signal.SIGTERM, # Unix signal 15. Sent by `kill <pid>`.
)
logger = logging.getLogger("uvicorn.error")
class StatRe... |
prova.py | import threading, time
from msvcrt import getch
key = "lol"
def thread1():
global key
lock = threading.Lock()
while True:
with lock:
key = getch()
threading.Thread(target = thread1).start()
while True:
time.sleep(0.001)
print(key) |
collector-test.py | #!/usr/bin/env python3
from __future__ import print_function, division
# from the_collector import BagReader, BagWriter
# fix path for now
import sys
sys.path.append("../")
from the_collector.messages import Messages
from the_collector.messages import Vector
from the_collector.messages import IMU
from pygecko.transp... |
test_worker.py | # -*- encoding: 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 ... |
custom.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
common.py | import asyncio
import io
import json
import logging
import os
import random
import re
import string
import subprocess
import sys
import typing
from pathlib import Path
from typing import Any, Awaitable, Callable, List, Tuple, Union
from threading import Thread
import boto3
import chat_exporter
import configcatclient
i... |
HiwinRA605_socket_ros_test_20190626123236.py | #!/usr/bin/env python3
# license removed for brevity
#接收策略端命令 用Socket傳輸至控制端電腦
import socket
##多執行序
import threading
import time
##
import sys
import os
import numpy as np
import rospy
import matplotlib as plot
from std_msgs.msg import String
from ROS_Socket.srv import *
from ROS_Socket.msg import *
import HiwinRA605_s... |
main.py | from selenium import webdriver
import time
from selenium.webdriver.firefox.options import Options
import os
import random
import json
import threading
from os import path
from requests import get
import tqdm
from html.parser import HTMLParser
import re
from datetime import datetime
from vpnswitch import *
class HTMLFi... |
analyze_manager.py | #!/usr/bin/env python3
"""
Call this script in order to analyze all founds crashes.
"""
import json
import pathlib
import celery
import os
parentdir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
os.sys.path.insert(0, parentdir)
import helpers.utils
from celery_tasks.tasks import analyze_package
cla... |
grab_ticket.py | import redis
import threading
# 创建连接池
pool = redis.ConnectionPool(host="localhost", port=6379, db=0, password='macintosh')
r = redis.StrictRedis(connection_pool = pool)
KEY = "ticket_count"
# 模拟第i用户进行抢票
def sell(i):
# 初始化 pipe
pipe = r.pipeline()
while True:
try:
# 监视票数
pi... |
train_pg.py | import numpy as np
import tensorflow as tf
import gym
import logz
import scipy.signal
import os
import time
import inspect
from multiprocessing import Process
#============================================================================================#
# Utilities
#====================================================... |
test_sys.py | # -*- coding: iso-8859-1 -*-
import unittest, test.test_support
import sys, cStringIO, os
import struct
class SysModuleTest(unittest.TestCase):
def test_original_displayhook(self):
import __builtin__
savestdout = sys.stdout
out = cStringIO.StringIO()
sys.stdout = out
dh = ... |
connection.py | import errno
import os
import random
import socket
import ssl
import sys
from itertools import chain
from queue import Empty, Full, LifoQueue
from basepy.exceptions import ConnectionError
import threading
import time
def threading_spawn(func, *args, **kwargs):
t = threading.Thread(target=func, args=args, kwargs=... |
custom_model.py | import json
import threading
from moto import settings
from moto.core.models import CloudFormationModel
from moto.awslambda import lambda_backends
from uuid import uuid4
class CustomModel(CloudFormationModel):
def __init__(self, region_name, request_id, logical_id, resource_name):
self.region_name = regi... |
pubsub_redis.py | #
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
"""
In order to run this pubsub transport, you need to have the python
'redis-py' module installed. AND you need to be running a Redis server.
"""
import threading
import time
import redis
from g2base impo... |
eliza.py | import logging
import random
import re
from collections import namedtuple
from EmotionDynamics import EmotionalAgent
import threading
# Fix Python2/Python3 incompatibility
try: input = raw_input
except NameError: pass
log = logging.getLogger(__name__)
class Key:
def __init__(self, word, weight, decomps):
... |
server.py | from flask import Flask
from flask import request, Response, render_template, json, url_for
from flask_restful import reqparse, abort, Api, Resource
import os
import base64
from io import BytesIO
import qrcode
import time
import threading
# Create an instance of Flask API
app = Flask(__name__, template_folder="templa... |
PackageManager.py | ######################################################################
# PACKAGE MANAGER #
######################################################################
from logger import log_info, closeLog
from Classes.Download import Download
from Classes.Install import I... |
test_v2_0_0_image.py | import json
import unittest
from multiprocessing import Process
import requests
from dateutil.parser import parse
from .fixtures import APITestCase
class ImageTestCase(APITestCase):
def test_list(self):
r = requests.get(self.podman_url + "/v1.40/images/json")
self.assertEqual(r.status_code, 200, ... |
datastore.py | from abc import abstractmethod
import requests
import json
import os
import logging
from logging import Logger
from collections import namedtuple
from typing import Any, Optional
from queue import Queue
from threading import Thread, Timer
from itsim.datastore.datastore_server import DatastoreRestServer
from itsim.loggi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.