source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
test_many_requests.py | import asyncio
import multiprocessing
import random
from time import sleep
from unittest import TestCase
from aiohttp import web
import pytest
from asks.response_objects import Response
import logging
from flaky import flaky
from many_requests.many_requests_ import ManyRequests
from many_requests.common import BadResp... |
worker.py | """This module contains worker that makes non-blocking HTTP requests.
Copyright (c) 2018 http://reportportal.io .
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/LIC... |
artifactshare.py | import os
import shutil
import signal
from collections import namedtuple
from contextlib import ExitStack, contextmanager
from concurrent import futures
from multiprocessing import Process, Queue
from urllib.parse import urlparse
import grpc
from buildstream._cas import CASCache
from buildstream._cas.casserver import... |
queue_worker.py | #!/usr/bin/env python
from . import config, logdir
import logging
import sys
from multiprocessing import Process
from rq import Queue, Connection, Worker
from rq.worker import logger
rqLoggerFileHandler = logging.FileHandler(logdir + "/worker.log")
rqLoggerFileHandler.setFormatter(logging.Formatter(
fmt='%(asctime... |
solrqueue.py | import logging
import threading
from queue import Empty, Full, Queue
from haystack.utils import get_identifier
from api.v2.search.index import TxnAwareSearchIndex
LOGGER = logging.getLogger(__name__)
class SolrQueue:
def __init__(self):
LOGGER.info("Initializing Solr queue ...")
self._queue = Q... |
discogs.py | import MySQLdb
import threading
import requests
import re
import os
from bs4 import BeautifulSoup
myheaders = {
'User-Agent': 'Discogs crawler 1.0',
}
# Execute a SQL command and commit.
def exec_commit(db, cursor, command):
try:
# Execute the SQL command.
cursor.execute(command)
# Com... |
notifications.py | import sched
from threading import Thread
import monitoro.discord as discord
class Notifications:
def __init__(self, smalld, watchers):
self.smalld = smalld
self.watchers = watchers
self.scheduled_notifications = {}
def notify_offline(self, bot_id):
if monitored_by := self.wa... |
bomber.py | #!/usr/bin/env python
from datetime import datetime
import os
import hashlib
import sys
import time
import threading
import string
import random
import base64
import urllib.request
import urllib.parse
try:
import requests
except ImportError:
print('[!] Error: some dependencies are not installed')
print('Ty... |
test_basic.py | import pytest
import click_threading
from click_threading._compat import PY2
import click
from click.testing import CliRunner
@pytest.fixture
def runner():
return CliRunner()
def test_context_pushing_thread(runner):
@click.command()
@click.pass_context
def cli(ctx):
contexts = []
... |
spinner.py | import sys
import time
import threading
class Spinner:
busy = False
delay = 0.1
@staticmethod
def spinning_cursor():
print("Processing ... ")
while 1:
for cursor in '|/-\\': yield cursor
def __init__(self, delay=None):
self.spinner_generator = self.spinning_cur... |
aws_batch.py | import copy
import datetime
import json
import logging
import re
import subprocess
import threading
import time
import uuid
from collections import OrderedDict, defaultdict
from configparser import SectionProxy
from functools import lru_cache
from itertools import islice
from shlex import quote
from typing import Any, ... |
qss.py | import time
from contextlib import closing
from functools import partial
from threading import Thread
from numpy import array, frombuffer, copyto, ndarray, arange, linspace, array_split, zeros, round
from numpy.random.mtrand import normal
from ctypes import c_double
from multiprocessing import Array, Pool, cpu_count, V... |
test_ssl.py | # Test the support for SSL and sockets
import sys
import unittest
import unittest.mock
from test import support
from test.support import import_helper
from test.support import os_helper
from test.support import socket_helper
from test.support import threading_helper
from test.support import warnings_helper
import sock... |
test_partition.py | from functools import reduce
from os import name
import threading
import pytest
from base.partition_wrapper import ApiPartitionWrapper
from base.client_base import TestcaseBase
from common import common_func as cf
from common import common_type as ct
from utils.util_log import test_log as log
from common.common_type i... |
VideoStream.py | # To make python 2 and python 3 compatible code
from __future__ import absolute_import
from threading import Thread
import time
import sys
if sys.version_info[0] < 3: # e.g python version <3
import cv2
else:
import cv2
# from cv2 import cv2
# import the Queue class from Python 3
if sys.version_info >= (3... |
scheduler.py | import logging
import os
import signal
import time
import traceback
from datetime import datetime
from multiprocessing import Process
from .job import Job
from .queue import Queue
from .registry import ScheduledJobRegistry
from .utils import current_timestamp, enum
SCHEDULER_KEY_TEMPLATE = 'rq:scheduler:%s'
SCHEDUL... |
uart.py | import os
import ipaddress
import logging
import threading
import time
import glob
from tqdm import tqdm
import serial
from nebula.common import utils
import xmodem
log = logging.getLogger(__name__)
LINUX_SERIAL_FOLDER = "/dev/serial"
class uart(utils):
""" UART Interface Handler
This class enables... |
okexGateway.py | # encoding: UTF-8
'''
vnpy.api.okex的gateway接入
注意:
1. 目前仅支持USD现货交易
'''
import os
import json
from datetime import datetime
from time import sleep
from copy import copy
from threading import Condition
from Queue import Queue
from threading import Thread
from time import sleep
from vnpy.api.okex import OkexSpotApi, CO... |
main.py | # Libraries OwO
from os import listdir, remove, path, chdir
import sys
from shutil import rmtree
from re import compile
import tkinter as tk
from tkinter import filedialog
from threading import *
# Changing the working directory to the temporary one created by pyinstaller (mainly for the .ico)
try:
chdir(sys._MEI... |
index_get.py | # coding: utf-8
from pandas import *
from numpy import *
import tushare as ts
import os
import sqlite3
import threading
import time
from pyquery import PyQuery as pq
from urllib.request import urlopen, Request
import json
from datetime import datetime,date
from tushare.stock import cons as ct
import os
import requests... |
CacheManager.py | from typing import Optional, Any, Dict, Tuple
import time, threading
from RWLock import RWLock
class Cache:
"""
Cache class with content and ttl
"""
invalidTime : float
content : Any
def __init__(self, content : Any, ttl : float):
self.content = content
self.invalidTime = time.t... |
agent.py | #!/usr/bin/env python
import json
import os
import requests
import urllib
import ConfigParser
import time
import sys
from bson.json_util import dumps
import pyinotify
from multiprocessing import Process
config = ConfigParser.ConfigParser()
config.read('config.ini')
url = config.get("repl", "api-url")
base = config.g... |
flir_videostream.py | # import the necessary packages
from threading import Thread
import cv2, time
from FLIR_pubsub.FLIR_client_utils import *
class Flir_VideoStream:
""" Maintain live FLIRCam feed without buffering. """
def __init__(self, src=0, name="FlirVideoStream", verbose = False):
"""
src: the path to an RTSP server. sh... |
Main.py | from google.api_core.exceptions import InvalidArgument
from google.cloud import texttospeech
from PySide2 import QtGui
from PySide2.QtWidgets import (QApplication, QLabel, QPushButton,
QVBoxLayout, QWidget, QShortcut)
from PySide2.QtCore import Qt
from pydub import AudioSegment
from pydub... |
writer.py | import os
import time
from threading import Thread
from queue import Queue
import cv2
import numpy as np
import torch
import torch.multiprocessing as mp
from alphapose.utils.transforms import get_func_heatmap_to_coord
from alphapose.utils.pPose_nms import pose_nms, write_json
DEFAULT_VIDEO_SAVE_OPT = {
'savepath... |
timer.py | #!/usr/bin/env python
#############################################################################
##
# This file is part of Taurus
##
# http://taurus-scada.org
##
# Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
##
# Taurus is free software: you can redistribute it and/or modify
# it under the terms of t... |
helper.py | """Author: Brandon Trabucco.
The engine class behind the image captioner.
"""
import tf2_ros
import rospy
import threading
from image_caption_machine.values import *
from image_caption_machine.utils import get_pose_stamped
from image_caption_machine.machine.abstract import Abstract
from image_caption_machine.world.... |
server.py | #!/usr/bin/env python2
from hashcash import check
import os
import signal
import SocketServer
import threading
magic = os.urandom(8).encode("hex")
class threadedserver(SocketServer.ThreadingMixIn, SocketServer.TCPServer):
pass
class incoming(SocketServer.BaseRequestHandler):
def recvline(self):
line... |
dev_test_dex_print.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# File: dev_test_dex_print.py
#
# Part of ‘UNICORN Binance WebSocket API’
# Project website: https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api
# Documentation: https://oliver-zehentleitner.github.io/unicorn-binance-websocket-api
# PyPI: https://pypi.o... |
Tools.py | from RPhysics import Position2D,Rectangle,Color,Vector2D
from pygame import Surface,font,mouse
from pygame.draw import rect,line
from pygame import Rect,K_BACKQUOTE,K_BACKSPACE,KEYDOWN,KEYUP,K_t,K_r,K_F3,K_c,K_SPACE,K_q,K_UP,K_DOWN,K_LEFT,K_RIGHT,K_w,K_a,K_s,K_d
import threading
import time
import math
K_ENTER = 13
imp... |
transaction.py | #!/usr/bin/python3
import functools
import re
import sys
import threading
import time
from collections import deque
from enum import IntEnum
from hashlib import sha1
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
import black
import requests
from eth_abi import... |
server.py | import socket
import threading
from home_automation.functions import handler
HEADER = 64
# Choose a port
PORT = 5051
FORMAT = 'utf-8'
DISCONNECT_MESSAGE = "!DISCONNECT"
SERVER = ''
ADDR = (SERVER, PORT)
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind((SERVER, PORT))
def handle_client(conn, a... |
server.py | #http serv
import socket
import time
import sqlite3
import threading
def console():
"""Constantly read from stdin and discard"""
try:
while 1:
a = input()
if a == "d":
s.delall()
except (KeyboardInterrupt, EOFError):
socket.socke... |
exchange_rate.py | from datetime import datetime
import inspect
import requests
import sys
from threading import Thread
import time
import csv
import decimal
from decimal import Decimal
from .bitcoin import COIN
from .i18n import _
from .util import PrintError, ThreadJob
from .util import format_satoshis
# See https://en.wikipedia.org... |
miniterm.py | #!/usr/bin/env python
# Very simple serial terminal
# (C)2002-2009 Chris Liechti <cliechti@gmx.net>
# Input characters are sent directly (only LF -> CR/LF/CRLF translation is
# done), received characters are displayed as is (or escaped trough pythons
# repr, useful for debug purposes)
import sys, os, serial, thread... |
2.4.thread_unsafe_read_write.py |
'''
说明:线程不安全的例子: 在多线程中,如果不加锁, 既做读又做写,会导致数据不对,举例说明不对的原因
分析: 在get执行之后,put执行之前切换出线程, 不能保证将要存入的变量(b+1),是从内存获取的最新数据
关键步骤: [13220-06 put 7] 这一步的7是通过代码中b+1获取的,这b不是从内存中获取的值,而是这一步获取的值为6[17528-00 get 6]. 内存中b已经被另外的线程变成9了[17528-02 put 9],但是这一步
b却是6,导致b+1为7
'''
from threading import Thread, current_thread
from typing import List... |
utils.py | # Copyright 2018 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
test_generators.py | import copy
import gc
import pickle
import sys
import unittest
import weakref
import inspect
import threading
from test import support
try:
import _testcapi
except ImportError:
_testcapi = None
# This tests to make sure that if a SIGINT arrives just before we send into a
# yield from chain, the KeyboardInte... |
quantize_ssd_BAC_multiprocess.py | #!/usr/bin/env python
# --------------------------------------------------------
# Quantize Fast R-CNN based Network
# Written by Chia-Chi Tsai
# --------------------------------------------------------
"""Quantize a Fast R-CNN network on an image database."""
import os
os.environ['GLOG_minloglevel'] = '2'
import _... |
test_env.py | # Copyright (c) 2017, IGLU consortium
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# - Redistributions of source code must retain the above copyright notice,
# this list of conditions and... |
bridge.py | # Copyright 2020 The FedLearner 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... |
downloader.py | #!/usr/bin/env python
import requests
import urllib
import threading
import time
from BeautifulSoup import BeautifulSoup
target = "http://ropas.snu.ac.kr/~kwang/4190.310/mooc/"
response = requests.get(target)
page = str(BeautifulSoup(response.content))
def getURL(page):
start_link = page.find("a href")
if st... |
quiz_http_server_test.py | import json
import os
from quiz_db import Answer, Team, QuizDb
from quiz_http_server import create_quiz_tornado_app
from telegram_quiz import QuizStatus, Updates, TelegramQuiz
from telegram_quiz_test import STRINGS
import telegram
import tempfile
import threading
import time
import tornado.testing
from typing import An... |
threadrunner.py | from threading import Thread, Lock
from Queue import Queue
import threading
q = Queue(maxsize=0)
mq = Queue(maxsize=0)
def execute_next():
global q, lock
while True:
(fn, args) = q.get()
fn(args)
q.task_done()
def execute_mq():
global mq, lock
while True:
(fn, args) = mq.get()
fn(args)
mq.task_done()... |
benchmarkncs.py | #! /usr/bin/env python3
# Copyright(c) 2017 Intel Corporation.
# License: MIT See LICENSE file in root directory.
from mvnc import mvncapi as mvnc
from sys import argv
import numpy
import cv2
from os import listdir
from os.path import isfile, join
from random import choice
from timeit import timeit
from threading imp... |
agent.py | import threading
import socket
import logging
from injector import Module, Injector, inject, singleton
import flask
import app
import version
@singleton
class TestronyxAgent(object):
"""
Agent class for Testronyx
"""
SERVER_PORT = 6780
ZMQ_PORT = 6781
@inject(logger=logging.Logger, flask_app... |
rss_parser.py | # -*- coding: utf-8 -*-
########################################################################
# #
# Парсер ленты RSS #
# #
# MI... |
tests.py | # Unit tests for cache framework
# Uses whatever cache backend is set in the test settings file.
import copy
import io
import os
import pickle
import re
import shutil
import tempfile
import threading
import time
import unittest
import warnings
from unittest import mock
from django.conf import settings
from django.core... |
launcher.py | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'mainwindow.ui'
#
# Created by: PyQt5 UI code generator 5.10.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
from remover.dogdrip import DogdripRemover
from toollib.logger import Logger
i... |
spyroghraph III.py | import threading
import time
import turtle
window = turtle.Screen ()
a = turtle.Turtle ()
turtle = turtle.Turtle ()
turtle.speed(0) #speed and coulor ect.
a.speed(0)
turtle.color ('white')
a.color ('white')
def drawasquare(a):
for x in range (4):
a.forward(150) # dr... |
dnssecchef.py | #!/usr/bin/env python
#
# Tool:
# dnssecchef.py
#
# Description:
#
# DNSSECChef is a highly configurable DNS and DNSSEC proxy for penetration testers
# (based on DNSChef).
#
# Please visit https://www.github.com/dinosec/dnssecchef for the latest version
# and documentation. Please forward all issues and c... |
minion.py | # -*- coding: utf-8 -*-
'''
Routines to set up a minion
'''
# Import python libs
from __future__ import absolute_import, print_function, with_statement, unicode_literals
import functools
import os
import sys
import copy
import time
import types
import signal
import random
import logging
import threading
import tracebac... |
elastic_scheduler.py | # Copyright (c) 2017, Daniele Venzano
#
# 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 w... |
01_demo.py | # This is an example where we learn how to run code concurrenty
# For running code in parallel we need to use multiprocessing
# We can benifit from threading when our task are I/O bound.
# When the task is CPU Bound , multi processing makes more sense.
import threading
import time
start = time.perf_counter()
def do_... |
VolumeChangerArduino.py | import serial
import time
import math
class VolumeChangerArduino():
def __init__(self, port="COM6", baudrate=115200, sleeptime=0.001):
self.arduino = serial.Serial(port=port, baudrate=baudrate, timeout=1)
self.sleeptime = sleeptime
self.serialData = ""
self.volume_level = 0
... |
test_local.py | # -*- coding: utf-8 -*-
"""
tests.local
~~~~~~~~~~~~~~~~~~~~~~~~
Local and local proxy tests.
:copyright: (c) 2014 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import pytest
import time
import copy
from functools import partial
from threading import Thread
from werkzeug im... |
media.py | import sys
import queue
import threading
from subprocess import run, DEVNULL
class MediaDaemon:
def __init__(self):
self.queue = queue.SimpleQueue()
self.thread = threading.Thread(target=self.loop, daemon=True)
self.thread.start()
def loop(self):
try:
while True:
... |
results_2_08_code.py | import tensorflow as tf
from tensorflow.keras.layers import Dense, Conv2D, MaxPooling2D, Dropout, Flatten
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras.callbacks import Callback
import numpy as np
import matplotlib.pyplot as plt
f... |
start_to_finish.py | import time
import deepmars2.post_processing_net.model as ppn
from keras.callbacks import TensorBoard, ModelCheckpoint
import os
from subprocess import Popen
import matplotlib.pyplot as plt
from sklearn.neighbors import RadiusNeighborsClassifier
from joblib import Parallel, delayed
import tifffile
from tqdm import tqdm... |
demo.py | import pandas as pd
import sys
import argparse
import os
import cv2 as cv
import time
import numpy as np
import librosa
import pyaudio
import webrtcvad
from threading import Thread
import queue
#from aiy.leds import Leds, Color
#from aiy.leds import RgbLeds
import glob, os
from scipy.signal import lfilter, butter
impor... |
train_pg_f18.py | """
Original code from John Schulman for CS294 Deep Reinforcement Learning Spring 2017
Adapted for CS294-112 Fall 2017 by Abhishek Gupta and Joshua Achiam
Adapted for CS294-112 Fall 2018 by Michael Chang and Soroush Nasiriany
"""
import numpy as np
import tensorflow as tf
import gym
import logz
import os
import time
im... |
makecorpusandcounts.py | import argparse
import os
import numpy as np
from multiprocessing import Process, Queue
from Queue import Empty
import ioutils
from representations.explicit import Explicit
from statutils.fastfreqdist import CachedFreqDist
SAMPLE_MAX = 1e9
def worker(proc_num, queue, out_dir, in_dir, count_dir, valid_words, num_word... |
callback_demo.py | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
# author: bigfoolliu
"""
回调函数的原理
"""
import threading
import time
def callback(ret):
print("callback run, ret: {}".format(ret))
def long_io(callback):
def func(callback):
print("start long io")
time.sleep(5)
ret = "long io ret"
... |
launch.py | # Copyright 2018 Datawire. 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 applicable law or agr... |
app.py | # Joe Lewis 2021
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
import docker, sys, redis, signal, os, logging
from time import sleep
from threading import Thread, current_thread
import manager_config as config
RUNNING_CONTAINERS = []
logging.... |
primefac.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import print_function, division
import logging
import _primefac
from threading import Timer
from _primefac._prime import primes
from lib.timeout import timeout
from lib.rsalibnum import gcd
from lib.keys_wrapper import PrivateKey
from _primefac._util impor... |
node_notification.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# encoding=utf8
import os
from pathlib import Path
from config.config import Config
from log import log
from objdict import ObjDict
from datetime import datetime
from server_api.http_function import HttpFunction
from parsers import harvester_parser
import threading
import multi... |
showfile.py | '''
# Showfile Module
Shows user a file (filepath,url,bytearray) on most OSes
'''
import logging,os,random,threading,requests,time
from pathlib import Path
logger = logging.getLogger('ShowFile')
tempfolder = 'temp'
# Temp folder to hold bytes/url types
buffersize = 2048
# How many bytes will `resopnse.iter_conten... |
core.py | # -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... |
KiwoomOpenApiPlusStore.py | import collections
import datetime
import threading
import time
import backtrader as bt
import numpy as np
import pandas as pd
from backtrader import TimeFrame
from backtrader.metabase import MetaParams
from backtrader.utils.py3 import queue
from exchange_calendars import get_calendar
from koapy.backend.kiwoom_open_... |
server.py | #!/usr/bin/env python
import SocketServer,threading,os,socket
from quantum import qubit, Alice, Bob
def recvuntil(s, until, maxlen=2048):
buf = ''
while until not in buf and len(buf) < maxlen:
tmp = s.recv(1)
if len(tmp) == 0:
raise socket.error
buf += tmp
return buf
class threadedserver(Sock... |
bl_emulate.py | import argparse
import pathlib
import os
import pty
import subprocess
import fcntl
import threading
import time
from core.pseudo_serial import SocketSerial
def set_nonblocking(fd):
"""Make a file_handle non-blocking."""
global OFLAGS
OFLAGS = fcntl.fcntl(fd, fcntl.F_GETFL)
nflags = OFLAGS | os.O_NONB... |
app.py | import atexit
import csv
import logging
import os
import time
from csv import DictWriter
from datetime import timedelta, datetime
from sched import scheduler
from threading import Thread
import RPi.GPIO as GPIO
import adafruit_dht
import board
from flask import Flask
# TODO: Move to config file
PORT_DHT = board.D14
#... |
export_d3po.py | from __future__ import absolute_import, division, print_function
import json
import os
from ..qt.widgets import ScatterWidget, HistogramWidget
from ..core import Subset
def save_page(page, page_number, label, subset):
""" Convert a tab of a glue session into a D3PO page
:param page: Tuple of data viewers t... |
Dos.py | import socket,os,time
import threading
from colorama import Fore,init
init()
RESET = Fore.RESET
def banner():
os.system("cls" or "clear")
print(Fore.CYAN+"""
_____ _____ _____ ______
/\ __/\ /\ __/\ ) ___ ( / ____/\
) ) \ \ ) ) \ \ / /\_/\ \ ) ) __\/
/ / /\... |
nc.py | """NC Server, Client SDK"""
# coding=utf-8
#
# /************************************************************************************
# ***
# *** Copyright Dell 2020, All Rights Reserved.
# ***
# *** File Author: Dell, 2021年 11月 12日 星期五 03:00:26 CST
# ***
# *********************************************************... |
__init__.py | #############################################################################
# Copyright Kitware Inc.
#
# Licensed under the Apache License, Version 2.0 ( the "License" );
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licen... |
tf_unittest_runner.py | # ==============================================================================
# Copyright (C) 2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# ==============================================================================
import unittest
import sys
import argparse
import os
import re
import fnmatch
im... |
main_window_app.py | import tkFileDialog
import tkMessageBox
import gettext
import logging
import os
import multiprocessing
from Tkinter import *
from PIL import ImageTk, Image
from handlers.senz_handler import SenzHandler
from miner_ui import view_log
from miner_ui.block_chain_data_view import BlockChainDataView
from miner_ui.data_view i... |
cracker.py |
#Zip Password Cracker
import optparse
import zipfile
from threading import Thread
def extract_zip(zfile, password):
try:
zfile.extractall(pwd=password)
print "[+] Password Found: " + password + '\n'
except:
pass
def main():
parser = optparse.OptionParser("usage %prog "+\
"-f <zipfile> -d... |
managers.py | #
# Module providing manager classes for dealing
# with shared objects
#
# multiprocessing/managers.py
#
# Copyright (c) 2006-2008, R Oudkerk
# Licensed to PSF under a Contributor Agreement.
#
__all__ = [ 'BaseManager', 'SyncManager', 'BaseProxy', 'Token' ]
#
# Imports
#
import sys
import threading
import signal
imp... |
threads.py | import threading # 1° Passo
import time
def main():
th = threading.Thread(target=contar, args=('elefante', 10)) # 2° Passo - instânciando uma threading
th.start() # 3° Passo - adiciona a nossa thread na pool de threads prontas para execução, a função start() não inicia o processo, ele fala pro processo pyth... |
panderum.py | #!/usr/bin/python2
#-*- coding:utf-8 -*-
import platform
import sys
import subprocess
import os
import socket
import requests
import json
import argparse
import thread
from datetime import datetime
import time
import threading
import urllib2
banner = '''
██▓███ ▄▄▄ ███▄ █ ▓█████▄ ▓█████ ██▀███ █ ██... |
__init__.py | import os
from .core import *
from .sublime import *
from .log import *
from .event import Handle, Event, EventDispatchMain
from . import platform
from .error import Error
from .dispose import Disposables
_current_package = ""
def current_package() -> str:
return os.path.join(sublime.packages_path(), _current_packa... |
features.py | from ev3dev.fonts import ImageFont
from ev3dev.ev3 import *
from time import sleep
from threading import Thread
def start_features(robot):
t = Thread(target=run_display, args=(robot,))
t.start()
run_wings()
return [t]
def run_display(robot):
lcd = Screen()
lcd.clear()
lcd.draw.rectangl... |
PyGPSLogger.py | __author__ = 'Tarsier'
try:
from Tkinter import *
import ttk
import tkFileDialog
except:
from tkinter import *
from tkinter import ttk
from tkinter import filedialog
from tkinter import simpledialog
from tkinter import messagebox
try:
import configparser
except:
from six.moves i... |
event_example.py | import threading
import logging
import time
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)s [%(threadName)s] %(message)s')
def worker(event):
event.wait(3)
logging.debug("event is set")
def set(event):
time.sleep(2)
event.set()
logging.debug("event is set")
if __nam... |
ep_obs_orth_test.py | import tempfile
import os
import time
import logging
from multiprocessing import Process
from diana.apis import Orthanc, DcmDir
from diana.apis.observables import ObservableOrthanc
from diana.utils.dicom import DicomEventType
from diana.utils.endpoint import Watcher, Trigger
from diana.dixel import DixelView
from util... |
base_model.py | import sys
import os
from datetime import datetime
VERSION_INFO = \
"""----------------------------
| BaseModel
| Version: 1.0.0
| Available feature
| * Snapshot
| Modified date: 2018.08.29.
----------------------------"""
print(VERSION_INFO)
def remove_flag(dir):
dirList = os.listdir(dir)
... |
settings.py | import sys
import os
from namedlist import namedlist
import logging
import logging.config
import logging.handlers
from multiprocessing import Process, Queue, Event
import threading
from Queue import Empty
import time
import pprint
__author__ = 'matiasbevilacqua'
__version__ = '0.8.0'
__versiondate__ = "2017-03-18T13:2... |
Hiwin_RT605_ArmCommand_Socket_20190627194455.py | #!/usr/bin/env python3
# license removed for brevity
import rospy
import os
import socket
##多執行序
import threading
import time
import sys
import matplotlib as plot
import HiwinRA605_socket_TCPcmd as TCP
import HiwinRA605_socket_Taskcmd as Taskcmd
import numpy as np
from std_msgs.msg import String
from ROS_Socket.srv imp... |
utils.py | # import readline
import rlcompleter
# readline.parse_and_bind("tab: complete")
# import code
import pdb
import time
import argparse
import os
import imageio
import torch
import torch.multiprocessing as mp
# debugging tools
# def interact(local=None):
# """interactive console with autocomplete function. Useful fo... |
common.py | """Test the helper method for writing tests."""
import asyncio
import os
from datetime import timedelta
from unittest import mock
from unittest.mock import patch
from io import StringIO
import logging
import threading
from homeassistant import core as ha, loader
from homeassistant.bootstrap import setup_component
from... |
transfer_service.py | # Copyright (c) 2019 - now, Eggroll 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 ... |
servidor_web.py | # Imports --------------
import threading
import time
import random
# Variables globales -----------------
n_trabajadores = 3
hilos_conexiones = 5
p_conexion = .4
semaforo_trabajadores = threading.Semaphore(0)
mutex_conexion = threading.Semaphore(1)
nombre_paginas = ['Google', 'Facebook', 'YouTube','Github','Wiki... |
session_test.py | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
pyfora_aws.py | import argparse
import itertools
import os
import subprocess
import sys
import threading
import time
from pyfora.aws.Cluster import Cluster, EventTypes
def get_region(region):
region = region or os.getenv('PYFORA_AWS_EC2_REGION')
if region is None:
raise ValueError('EC2 region not specified')
retu... |
multiproc_vec.py | import copy
from .utils.shared_array import SharedArray
import multiprocessing as mp
import numpy as np
import traceback
import gym.vector
from gym.vector.utils import (
create_shared_memory,
create_empty_array,
write_to_shared_memory,
read_from_shared_memory,
concatenate,
iterate,
)
def comp... |
EX8.py | from net_system.models import NetworkDevice, Credentials
import django
from netmiko import ConnectHandler
from getpass import getpass
from datetime import datetime
from multiprocessing import Process,Queue
#password=getpass()
def show_arp_queue(a_device,q):
output_dict={}
remote_conn=ConnectHandler(device_ty... |
bot2.py | from client import Client
from engine_revised import Engine
from threading import Thread
import random
import sys
class Bot():
def __init__(self, id, engine:Engine, client:Client) -> None:
self.id = id
self.engine = Engine
self.client = Client(self.id, self.engine)
self.heading = "... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.