source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
__init__.py | # -*- coding: utf-8 -*-
# coding: utf8
import threading
from multiprocessing import Process
try:
import thread # python2
except:
import _thread as thread # python3
import json, logging, websocket, time, sys, re, fnmatch, ssl
from functools import wraps
from collections import defaultd... |
demo_1_4_2_1.py | #!/usr/bin/python2.7
# -*- coding:utf-8 -*-
# Author: NetworkRanger
# Date: 2019/1/7 下午11:31
"""
1. threading模块创建多线程
"""
import random
import time, threading
# 新线程执行的代码
def thread_run(urls):
print 'Current %s is running...' % threading.current_thread().name
for url in urls:
print '%s ---->>> %s' % (... |
run_squad_ColabTCPTrans_201910161851.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... |
vaitracePyRunner.py | #!/usr/bin/python3
# -*- coding: UTF-8 -*-
# Copyright 2019 Xilinx 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... |
train_extractive.py | #!/usr/bin/env python
"""
Main training workflow
"""
from __future__ import division
import glob
import os
import random
import signal
import time
import torch
import distributed
from models import data_loader, model_builder
from models.data_loader import load_dataset
from models.model_builder import ExtSummariz... |
socketServer.py | import time
import datetime
print(datetime.datetime.now())
def do_some_stuffs_with_input(input_string):
"""
This is where all the processing happens.
Let's just read the string backwards
"""
print("Processing that nasty input!")
return input_string[::-1]
def client_thread(conn, ip, port, MA... |
ner.py |
import logging
import os
import socket
import subprocess
from contextlib import contextmanager, closing
from threading import Thread
from time import sleep
logger = logging.getLogger(__name__)
class NER(object):
ROOT = os.path.join(os.path.dirname(__file__), 'stanford-ner')
IP = 'localhost'
def __init_... |
__main__.py | #!/usr/bin/env python3
import argparse
from datetime import timedelta, datetime
import io
import itertools as it
import json
import multiprocessing as mp
import multiprocessing.dummy as mp_dummy
import os
import os.path as path
import sys
from time import strptime, strftime, mktime
import urllib.request
from glob impo... |
installwizard.py | # -*- mode: python3 -*-
import os
import random
import sys
import tempfile
import time
import threading
import traceback
from PyQt5.QtCore import QEventLoop, QRect, Qt, QThread, pyqtSignal
from PyQt5.QtGui import QIcon, QPainter, QPalette, QPen
from PyQt5 import QtWidgets
from electroncash import keystore, Wallet, Wa... |
proxy_checker.py | import threading
import requests
import ctypes
from easygui import fileopenbox
timeout = 10
checked = 0
working = 0
def split_list(alist, wanted_parts=1):
length = len(alist)
return [ alist[i*length // wanted_parts: (i+1)*length // wanted_parts]
for i in range(wanted_parts) ]
def ... |
widget.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
The widget is called from web2py.
"""
import datetime
import sys
import cStringIO
import time
import threa... |
conftest.py | '''Tests configuration.'''
import multiprocessing
import os
import sys
import pytest
TEST_DIR = os.path.abspath(os.path.dirname(__file__))
if TEST_DIR not in sys.path:
sys.path.append(TEST_DIR)
from server import test_server_process # noqa: E402
def values_list():
return ['foo', 'bar', 'baz', 1, -1.5, T... |
MCID_reporter.py | #!/usr/bin/env python3
'''
Analyzes Mobile-Camera Intrusion Detection Tool log files to find abnormal and normal usage
Log files are stored in the format: "cust[ID]-[day].txt"
And reports are generated in the format: "[ID] [DURATION in minutes] [START TIME] [END TIME]"
'''
import os
import threading
from glob import ... |
client.py | import cv2
import pygame.camera
import pygame.image
import zipfile
import json
from datetime import datetime
import base64
import time
import os
import sys
import queue
import threading
import psutil
from persistqueue import Queue
import queue
import os
addressIp='62.244.197.146'
# addressIp='192.168.116.20'
# conn... |
helper.py | import functools
from multiprocessing import Process
from multiprocessing import Queue
import traceback
from six.moves import socketserver
class TestsTimeoutException(Exception):
pass
def time_limit(seconds, fp, func, *args, **kwargs):
if fp:
if not hasattr(fp, 'write'):
raise TypeErro... |
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... |
multiprocessing_fibonacci.py | # coding: utf-8
import sys
import logging
import time
import os
import random
from multiprocessing import Process, Queue, Pool, \
cpu_count, current_process, Manager
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(message)s')
ch = logging.StreamHandler()... |
main.py | from Backend import Simulator
from Backend.resources import GetDataFromSMHIApi
import threading
if __name__ == "__main__":
"""[summary]
"""
sim = Simulator.Simulator()
smhi = GetDataFromSMHIApi.get_data_from_station()
sim._debugmode = True
x = threading.Thread(target=sim.run)
x.daemon = Tr... |
nt.py | # -*- coding: utf-8 -*-
"""NT implementation of platform-specific services."""
import threading
# This only loads on Windows
# pylint: disable-next=import-error
import msvcrt
import nagiosplugin
# Changing the badly-named `t` variable at this point is likely API-breaking,
# so it will be left in place.
# pylint: dis... |
process02.py | """
包含参数的进程函数
"""
from multiprocessing import Process
from time import sleep
# 带有参数的进程函数
def worker(sec, name):
for i in range(3):
sleep(sec)
print("I'm %s" % name)
print("I'm working")
# 按照位置传参
# p = Process(target=worker, args=(2, "Tom"))
# 按照关键字传参
p = Process(target=worker,
... |
exporter.py | """ Handle exporting a VMWare VM """
import os
import requests
import signal
import sys
from datetime import datetime
from time import sleep, time
from threading import Thread
from pathlib import Path
from hurry.filesize import size
from pyVmomi import vim
from voithos.lib.system import run
SLEEP_INTERVAL = 30 # s... |
test_arrow.py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... |
040-Process.py | # !/usr/bin/env python
# coding: utf-8
# import os
#
# print 'Process (%s) start...' % os.getpid()
# pid = os.fork()
# if pid == 0 :
# print 'I am child process (%s) and my parent is %s.' %(os.getpid(), os.getppid())
# else:
# print 'I (%s) just created a child process (%s).' % (os.getpid(), pid)
# from mul... |
test_wsgiref.py | from unittest import mock
from test import support
from test.test_httpservers import NoLogRequestHandler
from unittest import TestCase
from wsgiref.util import setup_testing_defaults
from wsgiref.headers import Headers
from wsgiref.handlers import BaseHandler, BaseCGIHandler, SimpleHandler
from wsgiref import util
from... |
advanced-reboot.py | #
# ptf --test-dir ptftests fast-reboot --qlen=1000 --platform remote -t 'verbose=True;dut_username="admin";dut_hostname="10.0.0.243";reboot_limit_in_seconds=30;portchannel_ports_file="/tmp/portchannel_interfaces.json";vlan_ports_file="/tmp/vlan_interfaces.json";ports_file="/tmp/ports.json";dut_mac="4c:76:25:f5:48:80";... |
DebugReplTest3.py | import threading
stop_requested = False
t1_done = None
t2_done = None
def thread1():
global t1_done
t1_done = False
t1_val = 'thread1'
while not stop_requested:
pass
t1_done = True
def thread2():
global t2_done
t2_done = False
t2_val = 'thread2'
while not stop_requested:
... |
stable_topology_fts.py | # coding=utf-8
import copy
import json
import random
import time
from threading import Thread
import Geohash
from membase.helper.cluster_helper import ClusterOperationHelper
from remote.remote_util import RemoteMachineShellConnection
from TestInput import TestInputSingleton
from tasks.task import ESRunQueryCompare
f... |
photoboothapp.py | # import the necessary packages
from __future__ import print_function
from PIL import Image
from PIL import ImageTk
import tkinter as tki
import threading
import datetime
import imutils
import cv2
import os
import sys
class PhotoBoothApp:
def __init__(self, vs, outputPath, name):
# store the video stream object and... |
api_access.py | import socket, ssl, time, threading, ujson
from tqdm import trange
from datetime import datetime
from PyXTB.settings import *
#### QuerySets are named lists of queries (static requests each associated to a name) ####
class QuerySet:
def __init__(self, name):
self.name = name
... |
echoServer.py | #!/usr/bin/env python3
import scheduler
from systemCall import *
import threading
import socket, time, random
def handleClient(client, address):
print('>>> client connect[%s:%s]' % address)
while True:
data = yield sockRecv(client, 1024)
if not data:
break
pr... |
test_numexpr.py | ###################################################################
# Numexpr - Fast numerical array expression evaluator for NumPy.
#
# License: MIT
# Author: See AUTHORS.txt
#
# See LICENSE.txt and LICENSES/*.txt for details about copyright and
# rights to use.
##########################################... |
test_utils.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import ctypes
import multiprocessing
import queue
import socket
import uuid
from typing i... |
test.py | import sys , os
from tdinput import td_input,td_print
# @register_func(CmdType.CMD_UP)
# def up():
# td_print("按了↑箭头")
# @register_func(CmdType.CMD_DOWN)
# def down():
# td_print("按了↓箭头")
if __name__ == '__main__':
td_print(">>> ***********************************")
td_print(">>> ** TDInput输入模... |
core.py | """
libraries needed
machine: for uart usage
uio: packet buffer
struct: serlization
_TopicInfo: for topic negotiation
already provided in rosserial_msgs
"""
import machine as m
import uio
import ustruct as struct
from time import sleep, sleep_ms, sleep_us
from rosserial_msgs import TopicInfo
import sys
import o... |
main.py | import json, os, sys, webbrowser, ctypes
from threading import Thread
from urllib.request import build_opener, install_opener
current_dir = os.path.abspath(os.path.dirname(__file__))
try:
import requests
from PyQt6 import QtWidgets
from UI import Ui_MainWindow
from pypresence import Presence
from flask impor... |
playerctl.py | #!/usr/bin/env python3
from gi.repository import GLib
import subprocess
import threading
from nwg_panel.tools import check_key, update_image, player_status, player_metadata
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('Gdk', '3.0')
from gi.repository import Gtk, Gdk
class Playerctl(Gtk.EventBox... |
dataset.py | # -*- coding:utf-8 -*-
# Author: hankcs
# Date: 2020-05-09 20:27
import math
import os
import random
import tempfile
import warnings
from abc import ABC, abstractmethod
from copy import copy
from logging import Logger
from typing import Union, List, Callable, Iterable, Dict, Any
import torch
import torch.multiprocessi... |
videostream.py | import os, logging, time
import cv2
from queue import Queue, Full, Empty
import threading
logging.basicConfig(format='%(asctime)s %(levelname)-10s %(message)s', datefmt="%Y-%m-%d-%H-%M-%S",
level=logging.INFO)
class VideoStream:
default_fps = 30.
def __init__(self, stream_source, interval=0.... |
connections.py | import socket
import queue
import threading
import logging
import binascii
import sys
from abc import ABC, abstractmethod
import functools
import time
try:
import can
_import_can_err = None
except Exception as e:
_import_can_err = e
try:
import isotp
_import_isotp_err = None
exc... |
helper.py | import functools
import json
import multiprocessing
import os
import socket
import subprocess
from datetime import datetime
from typing import List, Tuple
import base58
import dateutil.tz
from plenum.bls.bls_crypto_factory import create_default_bls_crypto_factory
from plenum.test.node_catchup.helper import waitNodeDat... |
zgrab_probe.py | #!/usr/bin/env/ python
# coding=utf-8
__author__ = 'Achelics'
__Date__ = '2017/04/18'
import os as _os
import multiprocessing
def zgrab_http(ip_list_file="", port="80", result_banner="banner80.json", **kwagrs):
"""
获取http协议标语和首页信息
:param ip_list_file: ip列表文件
:param port: 探测的端口
:param result_ba... |
main.py | from components import mqtt_controller,ipmi_controller
from threading import Thread
import paho.mqtt.client as mqtt
def on_connect(client, userdata, flags, rc):
print("Connected with result code {0}".format(str(rc)))
client.subscribe(
mqtt_controller.mqtt_control_topic)
def on_message(client, userdat... |
database.py | from itertools import permutations
try:
from Queue import Queue
except ImportError:
from queue import Queue
import re
import threading
from peewee import *
from peewee import Database
from peewee import FIELD
from peewee import attrdict
from peewee import sort_models
from .base import BaseTestCase
from .base ... |
api.py | import importlib.resources
import importlib.util
import logging
import os
import platform
import re
import subprocess
import sys
import time
from contextlib import contextmanager
from importlib import import_module as im
from multiprocessing import Process
import packaging.version
LOGGER = logging.getLogger(__name__)... |
threaded_work_queue.py | # Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import threading
import traceback
import Queue
class ThreadedWorkQueue(object):
def __init__(self, num_threads):
self._num_threads = num_threads
... |
pump_control.py | # Please remove all signs of simulate.py when finished. Especially that thing with the speed
import threading
import time
import json
with open("config.json", "r") as fobj:
config = json.load(fobj)
if "simulate" in config and config["simulate"]:
from simulate import Pump
else:
from pump impor... |
rpc_test.py | import concurrent.futures
import contextlib
import json
import os
import sys
import threading
import time
import unittest
from collections import namedtuple
from functools import partial
from threading import Event
from threading import Lock
from unittest import mock
import torch
import torch.nn as nn
import torch.di... |
main_window.py | import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
import asyncio
from typing import TYPE_CHECKING, Optional, Union, Callable, Sequence
from electrum.storage import WalletStorage, StorageReadWriteError
from electrum.wallet_db import WalletDB
from el... |
PrecisionAndRecall.py | import multiprocessing
"""Calculates precision and recall between two sets of rectangles"""
class PrecisionAndRecall(object):
precision = 0
recall = 0
specifity = 0
falsePositive = 0
falseNegative = 0
truePositive = 0
__threshold = 1
def __init__(self, threshold):
manager = m... |
SubClassReasoner.py | __author__ = 'tmy'
import os
from datetime import datetime
from multiprocessing import Process
from .ProcessManager.ProcessManager import ProcessManager, OccupiedError
from .NTripleLineParser.src.NTripleLineParser import NTripleLineParser
from .SparqlInterface.src import ClientFactory
from .Materializer.Materializer i... |
calc.py | import time
from multiprocessing import Process, JoinableQueue
from random import randint
class Worker(Process):
def __init__(self, *args, **kwargs):
self._id = kwargs.pop('id')
self.stopped = False
super(Worker, self).__init__(*args, **kwargs)
def stop(self):
print "Worker %d... |
contact_PPO.py | import argparse
import os
import sys
import random
import numpy as np
import scipy
import torch
import torch.optim as optim
import torch.multiprocessing as mp
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import torch.utils.data
from params import Params
import pickle
impo... |
synchronizing_threads.py | import logging
import threading
import time
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s (%(threadName)-2s) %(message)s',
)
def consumer(cond):
"""wait for the condition and use the resource"""
logging.debug('Starting consumer thread')
t = threading.... |
nsf_impacts.py | import sklearn
import torch
import librosa
import numpy as np
import time
import os
import random
import tqdm
# import torchaudio
import soundfile as sf
import threading
from multiprocessing import Event, Process
from torch2trt import torch2trt
from torch2trt import TRTModule
def spectral_features(y, sr):
features... |
run-bmv2-test.py | #!/usr/bin/env python
# Copyright 2013-present Barefoot Networks, 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... |
json_udp_example.py | from DataSocket import UDPSendSocket, UDPReceiveSocket, JSON
import time
from threading import Thread
number_of_messages = 5 # number of sample messages to send
port = 4001 # TCP port to use
# define a function to send data across a UDP socket
def sending_function():
send_socket = UDPSendSocket(udp_port=port,... |
run.py | import argparse
import time
from datetime import datetime
from threading import Thread
from multiprocessing import Process, Pipe
from multiprocessing.connection import Connection
from typing import Callable, Optional, Collection, Hashable, List, Tuple
import telebot
from telebot.types import Message, Location, User
f... |
access_count.py | import subprocess
import logging
import argparse
import csv
from threading import Thread, Lock
import multiprocessing
import sys
try:
#python3
from queue import Queue
except:
#python 2
from Queue import Queue
def main(args=None):
# Construct the argument parser
parser = argparse.ArgumentParser... |
email.py | # Importamos capacidad de enviar mensaje a travez de la las funciones de "message"
from flask_mail import Message
# Importamos capacidad de usar las APP del proyecto
from flask import current_app, render_template
# Importamos herramientas paara envio asincrona del correo
from threading import Thread
# Importar la funci... |
run_odometry_control.py | from control.js_linux import Joystick
from control.odometry_control import OdoControl
import threading
import communication.socket_comm as sc
import socket
def main():
# set up the server
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
port = 8001
print(port)
s.bind(('', port))
s.listen(1)
clientsocket, a... |
plotshape.py | import uuid
import threading
import ctypes
import json
import weakref
import time
import neuron
from neuron import h
_update_thread = None
_gui_widgets = []
_shape_plot_list = []
_active_container = None
_structure_change_count = neuron.nrn_dll_sym("structure_change_cnt", ctypes.c_int)
_diam_change_count = neuron.nrn_... |
__main__.py | import os
import labscript_utils.excepthook
# Associate app windows with OS menu shortcuts:
import desktop_app
desktop_app.set_process_appid('lyse')
# Splash screen
from labscript_utils.splash import Splash
splash = Splash(os.path.join(os.path.dirname(__file__), 'lyse.svg'))
splash.show()
splash.update_text('importi... |
test_sampling.py | from functools import partial
import math
import threading
import pickle
import pytest
from copy import deepcopy
import numpy as np
from numpy.testing import assert_allclose, assert_equal, suppress_warnings
from numpy.lib import NumpyVersion
from scipy.stats.sampling import (
TransformedDensityRejection,
Discre... |
image.py | # vim: ft=python fileencoding=utf-8 sw=4 et sts=4
"""Image part of vimiv."""
from random import shuffle
from threading import Thread
from gi.repository import GdkPixbuf, GLib, Gtk
from vimiv.exceptions import StringConversionError
from vimiv.fileactions import is_animation, is_svg
from vimiv.helpers import get_float
... |
eva_ws.py | import websocket # type: ignore
import logging
import json
from threading import Thread, Condition
from .eva_errors import EvaWebsocketError
from .observer import Subject
logger = logging.getLogger(__name__)
class Websocket:
"""
This class creates a context which runs a thread to monitor a websocket in the... |
asio_chat_client_test.py | import re
import os
import socket
from threading import Thread
import time
import ttfw_idf
global g_client_response
global g_msg_to_client
g_client_response = b""
g_msg_to_client = b" 3XYZ"
def get_my_ip():
s1 = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s1.connect(("8.8.8.8", 80))
my_ip = s1.g... |
games_pi.py | # WS2812 LED Matrix Gamecontrol (Tetris, Snake, Pong)
# by M Oehler
# https://hackaday.io/project/11064-raspberry-pi-retro-gaming-led-display
# ported from
# Tetromino (a Tetris clone)
# By Al Sweigart al@inventwithpython.com
# http://inventwithpython.com/pygame
# Released under a "Simplified BSD" license
import rando... |
test.py | from tkinter import *
import cv2
import tkinter as tk
import logging
from PIL import Image,ImageTk
import pyzed.sl as sl
import numpy as np
import datetime
# Get the top-level logger object
log = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
global current_image
def take_shot():
flag = 1
... |
runtests.py | #!/usr/bin/env python
from __future__ import print_function
import atexit
import os
import sys
import re
import gc
import heapq
import locale
import shutil
import time
import unittest
import doctest
import operator
import subprocess
import tempfile
import traceback
import warnings
import zlib
import glob
from context... |
client.py | from __future__ import unicode_literals
import six
if six.PY3:
from queue import Queue, Empty
import urllib.parse as parse
else:
from Queue import Queue, Empty
import urllib as parse
from decimal import Decimal
import json
import threading
import websocket
import logging
from .datastructures import Amou... |
http-flood.py | #!/usr/bin/env python
import socket
import sys
import random
import time
import string
import threading
import argparse
import logging
# setup logging
logging.basicConfig(stream=sys.stdout,level = logging.DEBUG)
logger = logging.getLogger(__name__)
attack_iterations = 100000000000
def cmd_arguments():
try:
... |
vis_80x80.py | import os
import cv2
import numpy as np
import json
import time
import threading
import random
from multiprocessing.dummy import Pool
from multiprocessing import cpu_count
import scipy.io as sio
import importlib.util
class Net:
def __init__(self, subset_name='train', options=None):
self._debug = False
self... |
service_socket.py | import threading
import socket
import json
import numpy as np
import utils
import requests
import base64
import hashlib
import struct
'''
Python处理前端javascript发来的数据解码和编码参考以下内容,针对其中BUG有修改
https://blog.csdn.net/ice110956/article/details/34118203
'''
#支持的API类型,如果token不在list中则认为无效
API_Surport_List = ['SR']
ues_tf_serving =... |
unittests.py | import unittest, subprocess, tempfile, os, threading
from socket import socket, AF_INET, SOCK_STREAM
from astron import *
class ConfigTest(unittest.TestCase):
class ConfigRunner(object):
DAEMON_PATH = './astrond'
def __init__(self, config):
self.config = config
self.process... |
jobStoreTest.py | # Copyright (C) 2015-2016 Regents of the University of California
#
# 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... |
utils.py | #!/usr/bin/env python
"""
General Utilities
(part of web.py)
"""
__all__ = [
"Storage", "storage", "storify",
"Counter", "counter",
"iters",
"rstrips", "lstrips", "strips",
"safeunicode", "safestr", "utf8",
"TimeoutError", "timelimit",
"Memoize", "memoize",
"re_compile", "re_subm",
"group", "uniq"... |
ventana_perceptron.py | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 11 15:05:41 2019
@author: jrodriguez119
"""
import tkinter as tk
from tkinter import ttk
import crearcapas
import perceptron_multicapa
from threading import Thread
import sys
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2... |
safe_t.py | from binascii import hexlify, unhexlify
import traceback
import sys
from electrum_dash.util import bfh, bh2u, versiontuple, UserCancelled
from electrum_dash.bitcoin import (b58_address_to_hash160, xpub_from_pubkey, deserialize_xpub,
TYPE_ADDRESS, TYPE_SCRIPT, is_address)
from electrum_das... |
irc.py | import logging
log = logging.getLogger(__name__)
import re
import signal
import socket
import ssl
import threading
import botologist.protocol
# https://github.com/myano/jenni/wiki/IRC-String-Formatting
irc_format_pattern = re.compile(r"(\x03\d{1,2}(,\d{1,2})?)|[\x02\x03\x0F\x16\x1D\x1F]")
def strip_irc_formattin... |
concurrency.py | import queue
import sys
import threading
import traceback
from cognite.async_client.jobs import CountDatapointsJob, CreateJob, DatapointsJob, DatapointsListJob, Job
from cognite.async_client.utils import to_list
class JobQueue:
def __init__(self, num_workers):
self.job_queue = queue.PriorityQueue()
... |
google_speech_wrapper.py | import asyncio
import queue
import sys
import threading
from typing import Dict
from google.cloud import speech
from backend.settings import GOOGLE_SERVICE_JSON_FILE
clients = {}
class ClientData:
def __init__(self, transcribe_thread, conn, config: Dict):
self._buff = queue.Queue()
self._thread... |
launch.py | # Lint as: python3
# Copyright 2020 DeepMind Technologies Limited. 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
#
# ... |
__init__.py | """
serverly - http.server wrapper and helper
--
Attributes
--
`address: tuple = ('localhost', 8080)` The address used to register the server. Needs to be set before running start()
`name: str = 'PyServer'` The name of the server. Used for logging purposes only.
`logger: fileloghelper.Logger = Logger()` The logger ... |
v2_decompiled.py | #Decompiled At:Thu Mar 12 23:50:07 2020
try:
import os, sys, time, random, hashlib, re, threading, json, urllib, requests, mechanize, urllib, cookielib, marshal, zlib, base64
from multiprocessing.pool import ThreadPool
from bs4 import BeautifulSoup as sup
except Exception as modul:
sys.exit()
reload(... |
driver.py | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright (c) 2010 Citrix Systems, Inc.
# Copyright (c) 2011 Piston Cloud Computing, Inc
# Copyright (c) 2012 University Of Minho
# (c) Copyright 2013 Hewlett-Pa... |
basic_server_TCP.py | import socket
import threading
bind_ip = '0.0.0.0'
bind_port = 9999
s = socket.socket()
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind((bind_ip, bind_port))
server.listen(5)
print(f'[*] listening on port {bind_ip}:{bind_port}')
def h... |
bot.py | # coding=utf-8
# Copyright 2008, Sean B. Palmer, inamidst.com
# Copyright © 2012, Elad Alfassa <elad@fedoraproject.org>
# Copyright 2012-2015, Elsie Powell, http://embolalia.com
#
# Licensed under the Eiffel Forum License 2.
from __future__ import unicode_literals, absolute_import, print_function, division
import col... |
BucketScanner.py | #!/bin/env python
'''
--------------
BucketScanner
By @Rzepsky
Updated by @_pkusik
--------------
======================= Notes =======================
This tool is made for legal purpose only!!! It allows you to:
- find collectable files for an anonymous/authenticated user in your buckets
- verify if an anonymous/auth... |
recalbox_SafeShutdown_gpi.py | import RPi.GPIO as GPIO
import os
import time
from multiprocessing import Process
#initialize pins
powerPin = 26
powerenPin = 27
#initialize GPIO settings
def init():
GPIO.setmode(GPIO.BCM)
GPIO.setup(powerPin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(powerenPin, GPIO.OUT)
GPIO.output(power... |
http.py | import os
import sys
import json
import time
import secrets
import asyncio
import logging
import schedule
import threading
import tornado.web
import tornado.ioloop
import tornado.log
import tornado.template
import tornado.escape
import tornado.locale
import tornado.httpserver
from pathlib import Path
from app.classes.... |
fault_injector.py | """
Copyright (c) 2018 NSF Center for Space, High-performance, and Resilient Computing (SHREC)
University of Pittsburgh. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions of source code ... |
hotword_factory.py | # Copyright 2017 Mycroft AI Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
loader.py | # Copyright (c) 2017-present, Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
java_gateway_test.py | # -*- coding: UTF-8 -*-
"""
Created on Dec 10, 2009
@author: barthelemy
"""
from __future__ import unicode_literals, absolute_import
from collections import deque
from contextlib import contextmanager
from decimal import Decimal
import gc
import math
from multiprocessing import Process
import os
from socket import AF... |
ng.py | #!/usr/bin/env python
#
# Copyright 2004-2015, Martian Software, Inc.
# Copyright 2017-Present Facebook, 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/license... |
train_sampling_multi_gpu.py | import dgl
import numpy as np
import torch as th
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torch.multiprocessing as mp
from torch.utils.data import DataLoader
import dgl.function as fn
import dgl.nn.pytorch as dglnn
import time
import math
import argparse
from dgl.data imp... |
test_util.py | # Copyright (c) OpenMMLab. All rights reserved.
import logging
import os
import tempfile
from functools import partial
import mmcv
import pytest
import torch.multiprocessing as mp
import mmdeploy.utils as util
from mmdeploy.utils import target_wrapper
from mmdeploy.utils.constants import Backend, Codebase, Task
from ... |
thermald.py | #!/usr/bin/env python3
import datetime
import os
import queue
import threading
import time
from collections import OrderedDict, namedtuple
from pathlib import Path
from typing import Dict, Optional, Tuple
import psutil
import cereal.messaging as messaging
from cereal import log
from common.dict_helpers import strip_d... |
scrape_reviews_by_user_multiprocessing.py | import selenium
from selenium import webdriver
import pandas as pd
import time
import io
import requests
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.options import Options
import multiprocessing as mp
from multiprocessing import Process,Queue,Array
import pandas as pd
import ... |
grr_hosts.py | # -*- coding: utf-8 -*-
"""Definition of modules for collecting data from GRR hosts."""
import datetime
import os
import re
import threading
import time
import zipfile
from grr_api_client import errors as grr_errors
from grr_response_proto import flows_pb2, timeline_pb2
from dftimewolf.lib.collectors.grr_base import... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.