source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
job.py | # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
alexa_1M.py | #!/usr/bin/env python
__author__ = "Gabriel Bassett"
"""
AUTHOR: {0}
DATE: <DATE>
DEPENDENCIES: <a list of modules requiring installation>
Copyright <YEAR> {0}
LICENSE:
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this wo... |
MicrosoftTeams.py | import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
''' IMPORTS '''
import requests
from distutils.util import strtobool
from flask import Flask, request, Response
from gevent.pywsgi import WSGIServer
import jwt
import time
from threading import Thread
from typing import ... |
server.py | """
server.py - Serving Notes'n'Todos frontend and web API using gunicorn and bottle
MIT license - see LICENSE file in Notes'n'Todos project root
Gunicorn is used in a slightly unusual way here because of the NoteCollection
object which must stay alive and represent the state of the notebook, thus:
- Exactly one in... |
telemetry_module.py | from enum import IntEnum
import struct
import socket
import select
from threading import Thread
class TelemetryManager:
def __init__(self, ip_address, port):
self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.socket.bind((ip_address, port))
self.team_id = -1
self.s... |
python3-49.py | #Intro to Multiprocessing
#Multiple processes running the same script!
#This is VERY different than threading
#Each process has its own memory space, and its own threads!
#Imports
import logging
import multiprocessing
from multiprocessing import process
import time
#Process starting function
def run(num):
name = ... |
base.py | # Copyright 2014 ETH Zurich
#
# 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, sof... |
dependent_operator.py | from multiprocessing import Process, Queue
from nlde.engine.contact_source import contact_source, contact_source_bindings
from nlde.operators.operatorstructures import Tuple
from nlde.query import TriplePattern, Argument
from time import time
class DependentOperator(object):
"""
Implements a plan leaf that i... |
travis_test_client.py | #!/usr/bin/env python
## This file is part of Scapy
## This program is published under a GPLv2 license
"""
TLS client used in unit tests.
Start our TLS client, send our send_data, and terminate session with an Alert.
Optional cipher_cuite_code and version may be provided as hexadecimal strings
(e.g. c09e for TLS_DHE... |
test_protocol_util.py | # Copyright 2018 Microsoft Corporation
#
# 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... |
extension_telemetry.py | # Microsoft Azure Linux Agent
#
# Copyright 2020 Microsoft Corporation
#
# 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 b... |
rgc-server.py | import SocketServer
import socket
import sys
import hashlib
from datetime import datetime
import _strptime
import os
import signal
import glob
import sqlite3
import threading
import time
import RPi.GPIO as GPIO
import logging
from systemd.journal import JournalHandler
import re
import zlib
from random import choice
fro... |
agent.py | # Copyright 2021 The Flax Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... |
system_utils.py | #!/usr/bin/python
# -*- coding: iso-8859-15 -*-
#
# Copyright (C) 2020 Centre National d'Etudes Spatiales (CNES)
#
# 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/l... |
bot.py | import requests
from requests_oauthlib import OAuth1Session
import json
import urllib
from src.config import API_KEY, API_KEY_SECRET, BEARER,ACCESS_TOKEN, ACCESS_TOKEN_SECRET, BOT_ID, BOT_HANDLE
import logging
from requests.exceptions import ChunkedEncodingError
# from threading import Thread
# import time
logger = lo... |
DLInspector.py |
import time
# logger = logging.getLogger('nbdler')
class Inspector(object):
def __init__(self, Handler, GlobalProgress, Allotter):
self.globalprog = GlobalProgress
self.handler = Handler
self.allotter = Allotter
self._selfcheck_thr = None
self._allo_thr = None
se... |
raspiclient_final.py | import serial
import time
import vlc
import detector_tflite as detector
import subprocess
from enum import Enum
from timeit import default_timer as timer
import socket
import time
import threading
import os
from io import StringIO
import base64
from PIL import Image
from io import BytesIO
import cv2
import struct
imp... |
_multi_process_subscription_impl.py | import logging
import queue
from multiprocessing import synchronize
from threading import Thread
from typing import NoReturn, Optional, TypeVar, Union
from puma.buffer import Observable, OnComplete, OnValue, Subscriber
from puma.buffer._queues import _ThreadQueue
from puma.buffer.implementation.managed_queues import M... |
1_simple_thread.py | import threading
import time
def funct(steps, delay):
print('thread functions start')
for i in range(steps):
time.sleep(delay)
print(f'Step: {i}')
print('thread function stop')
print('Main thread start')
# create threads
t1 = threading.Thread(target=funct, args=(5,1,))
t2 = threading.Thr... |
NetworkServer.py | from Client import Client, ClientUpdater
from SharedClientDataStore import SharedClientDataStore
from SocketNetworker import SocketNetworker
import threading
import socket
import os
class NetworkServer:
def __init__(self, config, universe):
self.ipmode = 4
self.host = '::' if self.ipmode == 6 else ... |
thread_definition.py | import threading
def my_hp(thread_number):
return print('Jumlah Handphone yang ada digudang {} buah'.format(thread_number))
def main():
threads = []
for i in range(10):
t = threading.Thread(target=my_hp, args=(i,))
threads.append(t)
t.start()
t.join()
if __name__ == "__m... |
pong_server.py | __author__ = 'Brent Berghmans 1334252'
import socket
import re
import time
from threading import Thread
from threading import Lock
import random
import math
#Shitty Timer class but it does the job
class Timer:
def __init__(self, object, function, millis, parameters):
self.mObject = object
... |
imgaug.py | from __future__ import print_function, division, absolute_import
from abc import ABCMeta, abstractmethod
import random
import numpy as np
import copy
import numbers
import cv2
import math
from scipy import misc, ndimage
import multiprocessing
import threading
import sys
import six
import six.moves as sm
import os
if s... |
spiderGUI.py | from mttkinter.mtTkinter import *
import school
import eleinstitute
import threading
import time
import detectcsv
def spider_gui():
"""
爬虫GUI界面
:return:
"""
def init_run(s: str):
"""
运行爬虫的函数
:param s: 输入要执行的参数。选择爬全校还是爬电院
:return:
"""
... |
Experiment.py | '''
This module implements the 4 strategies needed for the comfort experiment.
Just call run()
'''
from threading import Thread, Lock
import time
from time import sleep
import json
import logging
from Pubsub import pub, sub
import pika
import SerialSender
class Experiment(object):
'''
Class implements the ex... |
starting_threads.py | import sys
import threading
import time
def func():
for i in range(5):
print("hello from thread %s" % threading.current_thread().name)
time.sleep(1)
threads = []
for i in range(3):
thread = threading.Thread(target=func, args=())
thread.start()
threads.append(thread) |
downloader.py | #!/usr/bin/env python3
import os
import queue
import threading
from enum import Enum
import colored
import crunchy2mkv as cy
class LoginType(Enum):
Normal = 1
Cookie = 2
class Downloader:
"""Downloader wrapper for Crunchyroll"""
"""Public vars"""
# Login method
login_type = LoginType.Coo... |
personbehind.py | #! /usr/bin/env python
# -*- encoding: UTF-8 -*-
import qi
import argparse
import sys
import os
import time
import threading
import math
from naoqi import ALProxy
import conditions
from conditions import set_condition
def rhMonitorThread (memory_service):
global last_personid
t = threading.currentThread()
... |
nonogram.py | import os
import sys
import time
import threading
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
import vi.grid
import vi.search.graph
import vi.search.grid
class NonogramWidget(QWidget):
def __init__(self,
parent=None,
search_state_listener=N... |
test_local_task_job.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... |
ntlmrelayx.py | #!/usr/bin/env python
# SECUREAUTH LABS. Copyright 2018 SecureAuth Corporation. All rights reserved.
#
# This software is provided under under a slightly modified version
# of the Apache Software License. See the accompanying LICENSE file
# for more information.
#
# Generic NTLM Relay Module
#
# Authors:
# Alberto Sol... |
test_http.py | import contextlib
import asyncio
import os
import pytest
from http.server import BaseHTTPRequestHandler, HTTPServer
import sys
import threading
import fsspec
requests = pytest.importorskip("requests")
port = 9898
data = b"\n".join([b"some test data"] * 1000)
realfile = "http://localhost:%i/index/realfile" % port
index... |
cfg.py | # nano /usr/include/bits/typesizes.h -> change 1024 to 99999
# ulimit -n 1000000
import threading, random, socket, time, sys, urllib2
blacklisted = ["127.0","10.0","192.168"]
ports = [5000, 80, 8080, 8000, 8888, 8443]
if len(sys.argv) < 2:
sys.exit("Usage: python " + sys.argv[0] + " <ip-list> <cnc-ip>")... |
parallel_runner.py | from envs import REGISTRY as env_REGISTRY
from functools import partial
from components.episode_buffer import EpisodeBatch
from multiprocessing import Pipe, Process
import numpy as np
import torch as th
import random
from marl_envs.particle_envs.make_env import make_env
from marl_envs.my_env.capture_target import Capt... |
train_faster_rcnn_alt_opt.py | #!/usr/bin/env python
# --------------------------------------------------------
# Faster R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Train a Faster R-CNN network using alternat... |
threads.py | import threading
class ThreadsManager:
""" object that manage the callback threads """
def __init__(self):
self.proc_pool = []
def add(self, target, args):
""" add callabck func to the manager """
self.proc_pool.append(threading.Thread(target=target, args=args))
def start(se... |
pyosc_receive.py | """Simple OSC server
This program listens to one address, and prints some information about
received packets.
"""
import math
import time, threading
from pythonosc import dispatcher
from pythonosc import osc_server
def print_recibed_msg(addr, args, *osc):
"""Print the recibed OSC message.
Positional arguments... |
AltAnalyze.py | ###AltAnalyze
#Copyright 2005-2008 J. David Gladstone Institutes, San Francisco California
#Author Nathan Salomonis - nsalomonis@gmail.com
#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 Softwar... |
common.py | # Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved.
# Python
from datetime import timedelta
import json
import yaml
import logging
import os
import subprocess
import re
import stat
import urllib.parse
import threading
import contextlib
import tempfile
from functools import reduce, wraps
# Django
from django.cor... |
bitvavo.py | from threading import Timer
import requests
import time
import hmac
import hashlib
import json
import websocket
import threading
import os
import signal
import sys
import datetime
debugging = False
def debugToConsole(message):
if(debugging):
print(str(datetime.datetime.now().time())[:-7] + " DEBUG: " + message)... |
mangastyle.py | import sys
if len(sys.argv) != 8:
print ('usage : python mangastyle.py gpu-id [-1 : cpu] sketch reference hint version denoise output')
sys.exit()
if sys.argv[1] != '-1':
chainer_GPU_ID = sys.argv[1]
chainer_ID = chainer_GPU_ID
tensorflow_GPU_ID = sys.argv[1]
k_between_tf_and_chainer = 0.8... |
test_cli.py | import unittest
import os
import signal
import threading
import time
from prometheus_pgbouncer_exporter import cli
from unittest import mock
CURR_DIR=os.path.dirname(os.path.realpath(__file__))
class TestCLI(unittest.TestCase):
@mock.patch('prometheus_pgbouncer_exporter.cli.logging')
def testReadConfigFil... |
thread_test.py | import time, threading
##def loop():
## print('thread %s is running ...' % threading.current_thread().name)
## n=0
## while n < 5:
## n = n + 1
## print('thread %s >>> %s' % (threading.current_thread().name,n))
## time.sleep(1)
## print('thread %s ended.' % threading.current_thread().... |
nfcdaemon.py | import sys
import time
import signal
import threading
import logging
from nfcinterface import NFCInterface
from nfcsocket import NFCSocket
#from ledinterface import LEDInterface
from nfcclient import NFCClient
from daemon3x import Daemon
logging.basicConfig(level=logging.INFO)
class NFCDaemon(Daemon):
def __init__... |
kb_checkVServer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import json
import os
import random as _random
import sys
import traceback
from getopt import getopt, GetoptError
from multiprocessing import Process
from os import environ
from wsgiref.simple_server import make_server
import requests as _requests
from json... |
downloadNLMSA_megatest.py | import ConfigParser
import os.path
import shutil
import tempfile
import threading
import time
import unittest
from pygr import metabase
from pygr.downloader import SourceURL
from pygr.nlmsa_utils import NLMSABuilder
from testlib import megatest_utils, testutil, PygrTestProgram
def create_downloadable_resource(url, m... |
tumbleweed.py | #!/usr/bin/env python
import sys
import time
from progressBar import update_prog
from commands import getoutput
from multiprocessing import Process
#tumbleweed.py is part of the Lariat tool
#Author: sean.m.donnelly@navy.mil
'''takes a file name as a parameter and determines if the URLs in the file are operational a... |
aws_glue.py | import json
import os
import tempfile
import threading
import time
from collections import OrderedDict, deque
from typing import Any, Deque, Dict, Iterator, List, Optional, Tuple, Union, cast
from redun.executors import aws_utils
from redun.executors.base import Executor, register_executor
from redun.executors.code_pa... |
labels.py | import hashlib
import requests
import threading
import json
import sys
import traceback
import aes
import base64
import electrum_dash
from electrum_dash.plugins import BasePlugin, hook
from electrum_dash.i18n import _
class LabelsPlugin(BasePlugin):
def __init__(self, parent, config, name):
BasePlugi... |
smart_explainer.py | """
Smart explainer module
"""
import logging
import copy
import pandas as pd
from shapash.webapp.smart_app import SmartApp
from shapash.utils.io import save_pickle
from shapash.utils.io import load_pickle
from shapash.utils.transform import inverse_transform, apply_postprocessing
from shapash.utils.transform import ad... |
plotter.py | import atexit
from collections import namedtuple
from enum import Enum
from multiprocessing import JoinableQueue
from multiprocessing import Process
import platform
from threading import Thread
import numpy as np
from garage.sampler.utils import rollout
__all__ = ['Plotter']
class Op(Enum):
STO... |
test.py | import multiprocessing
import os
import re
import shutil
import socket
import subprocess
import sys
import time
import psutil
CURL = 'curl.exe -L -k -A "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36" -H "Accept-Language: en-US"'
CURL_PROXY = ' --proxy-n... |
socket_server.py | #!/usr/bin/env python
# -*- coding=utf-8 -*-
import json
import socket
import sys
import threading
import time
from rain.common import rain_log
from rain.config import default_conf
from rain.surface import rain_mongo
CONF = default_conf.CONF
logger = rain_log.logg(__name__)
class ScoketServer(object):
"""Socke... |
node.py | import socket
import random
import threading
import json
import time
from graph import Graph
from cryptography import KeyGen
from util import Util
k = KeyGen()
util = Util()
graph = Graph()
# Do not forget to add IPv6 Functionality!
class Node:
def __init__(self):
self.graph = Graph()
self.port =... |
enumerid.py | #!/usr/bin/python2
#
# enumerid.py
#
# Copyright 2017 Corey Gilks <CoreyGilks [at] gmail [dot] com>
# Twitter: @CoreyGilks
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version ... |
behaviors.py | # -*- coding: UTF-8 -*-
#NVDAObjects/behaviors.py
#A part of NonVisual Desktop Access (NVDA)
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
#Copyright (C) 2006-2013 NV Access Limited, Peter Vágner
"""Mix-in classes which provide common behaviour for particular t... |
AWSBucketDump.py | #!/usr/bin/env python
# AWSBucketDump is a tool to quickly enumerate AWS S3 buckets to look for loot.
# It's similar to a subdomain bruteforcer but is made specifically to S3
# buckets and also has some extra features that allow you to grep for
# delicous files as well as download interesting files if you're not
# afr... |
edited.py | # -*- coding: utf-8 -*-
#GhostRider_Bot
import LINETCR
from LINETCR.lib.curve.ttypes import *
from datetime import datetime
from bs4 import BeautifulSoup
from threading import Thread
from googletrans import Translator
from gtts import gTTS
import time,random,sys,json,codecs,threading,glob,urllib,urllib2,urll... |
wsdump.py | #!/home/ubuntu/notejam/flask/my-project-env/bin/python3
import argparse
import code
import sys
import threading
import time
import ssl
import gzip
import zlib
import six
from six.moves.urllib.parse import urlparse
import websocket
try:
import readline
except ImportError:
pass
def get_encoding():
encod... |
utils.py | # Copyright 2020 - 2021 MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in wri... |
Test.py | import sys
import os
import time
import datetime
import multiprocessing as mp
def long_time_task(i):
print('Process ID: {0}, Task: {1}'.format(os.getpid(), i))
time.sleep(2)
print('Task {0} - Result: {1}'.format(i, (2**20 + 3**30 + 4**40 + 5**50)))
def info(title):
print(title)
print("Module Name... |
build.py | from glob import glob
import itertools
from subprocess import Popen, PIPE, check_call
import os
import sys
from multiprocessing import Pool
import multiprocessing
import shutil
import time
import re
from pp.components import component_type2factory
from pp.config import CONFIG
from pp.config import logging
from pp.doe... |
IntegrationTests.py | import os
import sys
import time
import unittest
import multiprocessing
import percy
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.su... |
test_pool.py | import collections
import random
import threading
import time
import weakref
import sqlalchemy as tsa
from sqlalchemy import event
from sqlalchemy import pool
from sqlalchemy import select
from sqlalchemy import testing
from sqlalchemy.testing import assert_raises
from sqlalchemy.testing import assert_raises_context_o... |
build_faiss_index.py | # coding: utf8
# Copyright (C) 2020 OPPO Inc. All rights reserved.
#
# Author: Ligengze (ligengze@faiss_index.com)
''' 生成faiss扩展服务需要的相关文件。
输入为关键词向量文件,每行一个,第1列为关键词,后面为DIMENSION个浮点数
设数据源名称为data_src,则输出三个文件
1. $data_src.kw2id.txt 每行为<编号,关键词>
2. $data_src.vec.dat 存有K*D个浮点数,文件大小为4*K*D
1. $data_src.ivf ... |
PyV8.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, os, re
import logging
import collections
is_py3k = sys.version_info[0] > 2
if is_py3k:
import _thread as thread
from io import StringIO
str = str
raw_input = input
else:
import _thread
try:
from io import StringIO
exce... |
xss_v1.py | #!/usr/bin/python
# -*- coding: UTF-8 -*-
import mechanize
import requests
import random
import sys
from urlparse import urlparse
from urlparse import parse_qs
from urlparse import urlunsplit
import timeit
import argparse
import os
import multiprocessing as mp
import time
from pymongo import MongoClient
connection =... |
multi_proess.py |
import logging
import multiprocessing
import time
logging.basicConfig(level=logging.DEBUG, format="%(processName)s: %(message)s")
def worker1(i):
logging.debug("start")
logging.debug(i)
time.sleep(5)
logging.debug("end")
return i * 2
if __name__ == "__main__":
# t1 = multiprocessing.Proces... |
tf_record_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... |
multiproc.py | # Copyright 2013-2018 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
"""
This implements a parallel map operation but it can accept more values
than multiprocessing.Pool.apply() can. For exa... |
server.py | import asyncio
import websockets
import json
import socket
import threading
SERVER_PORT = 4455
'''
Simple Web server
If the IP is not set, then the server automatically finds and uses the current IP
'''
class WebServer:
def __init__(self,handler,ip = None,port = None):
self.ip = ip or se... |
target_bigquery.py | #!/usr/bin/env python3
import argparse
import io
import sys
import json
import logging
import collections
import threading
import http.client
import urllib
import pkg_resources
from jsonschema import validate
import singer
from oauth2client import tools
from tempfile import TemporaryFile
from google.oauth2 import s... |
fetcher.py | from threading import Thread
from bs4 import BeautifulSoup
from newspaper import Article
from newspaper import Config
from Shaunak import Shaunak
from Sumit import Sumit
from Shaktijit import Shaktijit
import time
import sys
import json
import requests
def get_article(Q,link):
art={}
config = Con... |
phoneControl.py | import threading
import adbconfig, time, datetime, sys
import uiautomator2 as u2
adb = adbconfig.adbCMD()
tool = adbconfig.util()
def phoneControl(phoneSN):
d = u2.connect(phoneSN)
d.set_fastinput_ime(True)
tool.runCmd(adb.shell + adb.backToHome)
tool.runCmd(adb.shell + adb.OpenSetting)
time.sleep... |
object_detection_zed.py | import numpy as np
import os
import six.moves.urllib as urllib
import sys
import tensorflow as tf
import collections
import statistics
import math
import tarfile
import os.path
from threading import Lock, Thread
from time import sleep
import cv2
# ZED imports
import pyzed.sl as sl
sys.path.append('utils')
# ## Obj... |
test_diskutils.py | from __future__ import print_function, division, absolute_import
import functools
import gc
import os
import shutil
import subprocess
import sys
from time import sleep
import mock
import pytest
import dask
from distributed.compatibility import Empty, WINDOWS
from distributed.diskutils import WorkSpace
from distribut... |
test_threading.py | """
Tests for the threading module.
"""
import test.support
from test.support import threading_helper
from test.support import verbose, cpython_only, os_helper
from test.support.import_helper import import_module
from test.support.script_helper import assert_python_ok, assert_python_failure
import random
import sys
i... |
fake_backend.py | import asyncio
import gzip
import json
import random
import socket
import string
import sys
import threading
from collections import OrderedDict, defaultdict
from contextlib import contextmanager
from queue import Queue
from google.protobuf import json_format
from sanic import Sanic, response
from signalfx.generated_p... |
DouBanTop250_crawl.py | import requests
import re
import json
from time import sleep
from threading import Thread
"""Crawl DouBan Movie Top250"""
def parse_page(resp):
pattern = re.compile(
r'<li>.*?class="pic">.*?class="">(?P<rank>.*?)</em>'
r'.*?<img.*?src="(?P<image>.*?)".*?</a>'
r'.*?<div class="info">.*?<spa... |
run-ds.py | import multiprocessing
from datetime import datetime
from multiprocessing import Process
from deepspeed.launcher import runner as ds_runer
from torch.distributed import launch as pt_runner
from config import Config
import sys
import socket
from ipc import resultServer
conf = Config.from_file('settings/tuned/ts_query... |
tftp.py | #!/usr/bin/env python3
import asyncio
import py3tftp.protocols
import pyroute2
import threading
from pathlib import Path
class FileReaderSingle:
def __init__(self, path, fname_req, chunk_size=0):
self.path = path
# TODO: Should check fname_req against actual name
self.chunk_size = chunk_s... |
worker.py | from contextlib import contextmanager
import atexit
import faulthandler
import hashlib
import inspect
import io
import json
import logging
import os
import redis
import sys
import threading
import time
import traceback
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union
# Ray modules
from ra... |
test_tracing_context.py | # ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import unittest
try:
from unittest import mock
except ImportError:
import mock
from azure.core.tracing.context import tracing_context
from azure.core.tracing i... |
framereader.py | import os
import sys
import json
import struct
import tempfile
import threading
import xml.etree.ElementTree as ET
import numpy as np
if sys.version_info >= (3,0):
import queue
import pickle
from io import BytesIO as StringIO
else:
import Queue as queue
import cPickle as pickle
from cStringIO import StringI... |
main.py | from __future__ import absolute_import, print_function
import argparse
import math
import os
import sys
import threading
import time
from os import listdir
from os.path import isfile, join
from sys import platform as _platform
from threading import Thread
import cv2
from PIL import Image, ImageTk
import ... |
BaseSpider.py | import datetime
import requests
from src.threadPool.ImageThreadPool import ImageThreadPool
from src.util import util
from copy import deepcopy
import json
from src.util.constant import BASE_DIR, EXPIRE_TIME_IN_SECONDS, BASE_PATH, QR_CODE_MAP_KEY
import re
import logging
from src.web.entity.UserInfo import UserInfo
fr... |
Urllib3Using.py | # Copyright 2021, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Python test originally created or extracted from other peoples work. The
# parts from me are licensed as below. It is at least Free Software where
# it's copied from other people. In these cases, that will normally be
# indicated.
#
# L... |
botnet.py | '''
Copyright 2017 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
http://aws.amazon.com/apache2.0/
or in the "license" file accompanying t... |
proc.py | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... |
installer.py | # /usr/bin/env python
# -*- coding: utf-8 -*-
from py.webconfig import *
from gui import *
from cui import *
from threading import Thread
import json
from time import sleep
print('wait',end='')
sleep(1)
try:
from app import *
except:
print('Module File NotFound')
print('% python -m installer')
exit... |
test_base_events.py | """Tests for base_events.py"""
import concurrent.futures
import errno
import math
import os
import socket
import sys
import threading
import time
import unittest
from unittest import mock
import asyncio
from asyncio import base_events
from asyncio import constants
from test.test_asyncio import utils as test_utils
fro... |
test_distributed_sampling.py | import dgl
import unittest
import os
from dgl.data import CitationGraphDataset
from dgl.data import WN18Dataset
from dgl.distributed import sample_neighbors, sample_etype_neighbors
from dgl.distributed import partition_graph, load_partition, load_partition_book
import sys
import multiprocessing as mp
import numpy as np... |
get_name_from_camera_feed.py | import face_recognition
import numpy as np
import cv2, queue, threading, time
import requests, os, re
# bufferless VideoCapture
class VideoCapture:
def __init__(self, name):
self.cap = cv2.VideoCapture(name)
self.q = queue.Queue()
t = threading.Thread(target=self._reader)
t.daemon =... |
Dataset.py | from scipy import misc
import os
import sys
import time
import random
import numpy as np
from tqdm import tqdm
from Queue import Queue
from threading import Thread, Lock, BoundedSemaphore
from itertools import cycle
from cv2 import resize
class DataLoader(object):
def __init__(self, file_path, data_path='./', mean... |
application.py | import asyncio
import os
import re
import signal
import sys
import threading
import time
from asyncio import (
AbstractEventLoop,
CancelledError,
Future,
Task,
ensure_future,
get_event_loop,
new_event_loop,
set_event_loop,
sleep,
)
from contextlib import contextmanager
from subproces... |
travis_run.py | #!/usr/bin/env python
import sys
import time
import threading
import subprocess
PingInterval = 15
def PingCallback(stop):
wait_time = 0
while True:
time.sleep(PingInterval)
wait_time += PingInterval
print(" + still running (" + str(wait_time) + "s) ...")
... |
CommandChannel.py | import socket, threading, time
import subprocess
from com.cleverworld.spring.transmitor import Utils
from multiprocessing import Process,Queue
# cmd is in root state,
STATE_ROOT = 0
# cmd is in host state
STATE_HOST = 1
# cmd is in terminal state
STATE_TERMINATOR = 2
# cmd is ready to exit
STATE_EXIT = -1
class C... |
discrete_DPPO.py | """
A simple version of OpenAI's Proximal Policy Optimization (PPO). [https://arxiv.org/abs/1707.06347]
Distributing workers in parallel to collect data, then stop worker's roll-out and train PPO on collected data.
Restart workers once PPO is updated.
The global PPO updating rule is adopted from DeepMind's paper (DPP... |
downloader.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import logging
import multiprocessing
import time
import signal
import functools
import threading
import collections
import contextlib
import six
import datetime
import os
import requests
from progress.bar import Bar
from chandl import ut... |
test.py | #!/usr/bin/env python
import threading
import Queue
import socket
import sys
q = Queue.Queue(maxsize = 0)
lock = threading.RLock()
a=[]
ip=sys.argv[1]
para=sys.argv[2]
paralis=para.split('-')
def port_test(x):
global count
portcon = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
portcon.se... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.