source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
invoker.py | #
# (C) Copyright IBM Corp. 2019
#
# 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 writi... |
pipeline_ops_test.py | # Copyright 2020 Google LLC. 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 a... |
s3.py | from flask import Blueprint, Response, request, jsonify
from serialize import serialize
from error_handler import Error, register_handler
from downloader import downloads
from sift import init, work
from thread import Thread
app = Blueprint('s3_api', __name__)
register_handler(app)
@app.route('/ping', methods=['GET']... |
spike_display.py | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'interface.ui'
#
# Created by: PyQt5 UI code generator 5.10.1
#
# WARNING! All changes made in this file will be lost!
import os, sys, glob
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.uic import loadUiType
import numpy as np
import ... |
memory.py | import time
import threading
from . import Cache
class MemoryCache(Cache):
def __init__(self, autocleanup=True):
self.cache = {}
self.lock = threading.RLock()
if autocleanup:
def cleanup_loop():
while True:
self.cleanup()
... |
benchmark_incr.py | """Benchmark cache.incr method.
"""
import json
import multiprocessing as mp
import shutil
import time
import diskcache as dc
from .utils import secs
COUNT = int(1e3)
PROCS = 8
def worker(num):
"""Rapidly increment key and time operation."""
time.sleep(0.1) # Let other workers start.
cache = dc.Cach... |
utils.py | # -*- coding: utf-8 -*-
# Copyright 2012-2021 CERN
#
# 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 a... |
TamTamBot.py | # -*- coding: UTF-8 -*-
import json
import logging
import math
import os
import re
import sqlite3
import sys
import traceback
from datetime import datetime
from logging.handlers import RotatingFileHandler
from threading import Thread
from time import sleep
import requests
import six
import urllib3
from openapi_client... |
MaskedLM.py | import torch
from pytorch_pretrained_bert import BertTokenizer, BertForMaskedLM
from Terry_toolkit import Text
#进度条显示
from tqdm import tqdm
import numpy as np
import random
import gc
from sys import getrefcount
import multiprocessing as mp
import resource
# import numba
# from numba import jit, njit, prange, config,... |
FiveInRowClient_AI.py | #!/usr/bin/env python
"""This program is a five in row game, which is used for the coding
camp 2015 in WindRiver.com"""
import os
import sys, getopt
import pygame as pg
import threading
import json
from toolbox import button
from toolbox import tools
from AI import searcher
## Cloud API
#from node import Node
#from ... |
clean_folder.py | import sys
from pathlib import Path
import shutil
import os
import re
import threading
SORTING_DICT = {
'archives': ('ZIP', 'GZ', 'TAR'),
'video': ('AVI', 'MP4', 'MOV', 'MKV'),
'audio': ('MP3', 'OGG', 'WAV', 'AMR'),
'documents': ('DOC', 'DOCX', 'TXT', 'PDF', 'XLSX', 'PPTX'),
'images': ('JPEG', 'PNG... |
distributed_run.py | from multiprocessing.connection import Listener
import os
import subprocess
import socket
import tempfile
from contextlib import closing
import argparse
import uuid
import getpass
import atexit
import pathlib
import asyncio
import glob
from datetime import date
from pathlib import Path
HARD_CODED_AFFILIATIONS = {
... |
_reloader.py | import os
import subprocess
import sys
import threading
import time
from itertools import chain
from ._compat import iteritems
from ._compat import PY2
from ._compat import text_type
from ._internal import _log
def _iter_module_files():
"""This iterates over all relevant Python files. It goes thro... |
execution.py | from typing import Optional, Callable, Dict
import ast
import contextlib
import faulthandler
import io
import os
import multiprocessing
import platform
import signal
import tempfile
def unsafe_execute(problem, completion, timeout, result):
with create_tempdir():
# These system calls are needed when clean... |
mudpi_server.py | import socket
import sys
import threading
import pickle
from logger.Logger import Logger, LOG_LEVEL
# A socket server prototype that was going to be used for devices to communicate.
# Instead we are using nodejs to catch events in redis and emit them over a socket.
# May update this in later version for device commun... |
val.py | """Validate a trained YOLOv5 model accuracy on a custom dataset
Usage:
$ python path/to/val.py --data coco128.yaml --weights yolov5s.pt --img 640
"""
import argparse
import json
import os
import sys
from pathlib import Path
from threading import Thread
import numpy as np
import torch
import yaml
from tqdm import... |
context.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 us... |
stress_test.py | import requests
import threading
def worker(num):
print(f"Worker START: {num}")
requests.post("http://localhost:8080", json={
"html": "<h1>AlexFlipnote</h1>"
})
print(f"Worker END: {num}")
return
threads = []
for g in range(100):
t = threading.Thread(target=worker, args=(g,))
thr... |
launch.py | """Launching tool for DGL distributed training"""
import os
import stat
import sys
import subprocess
import argparse
import signal
import logging
import time
from threading import Thread
def execute_remote(cmd, ip, thread_list):
"""execute command line on remote machine via ssh"""
cmd = 'ssh -o StrictHostKeyCh... |
multithreaded.py | from __future__ import division
from PIL import Image, ImageDraw
import urllib2, io, math, cStringIO, os, threading
normalMapBaseURL = u'http://betaserver.icgc.cat/tileserver3/tileserver.php?/norm2x2/{}/{}/{}.png'
destinationLayer8To12BaseURL = u'http://tilemaps.icgc.cat/mapfactory/wmts/orto_8_12/CAT3857/{}/{}/{}.png'... |
MPS_Server.py | from statistics import mode
import time
import sys
import queue
import struct
import threading
import importlib
import torch.multiprocessing as mp
from util.util import TcpServer, TcpAgent, timestamp
def func_get_request(qout):
# Listen connections
server = TcpServer('localhost', 12345)
while True:
... |
utils.py | import collections.abc
import dis
import functools
import inspect
import itertools
import json
import os
import queue
import threading
import types
import dask.distributed as dd
import numpy as np
import toolz
def expand(func):
"""
Decorator to expand an (args, kwargs) tuple in function calls
Intended f... |
3_loop_threading.py | # 3 Using for loop threading in python
# Import Threading & Time
import threading
import time
# Start counting
start = time.perf_counter()
# Create simple function that sleep in 1 second
def do_something():
print('Sleeping 1 second..')
time.sleep(1)
print('Done Sleeping..')
# Create empty list
threads... |
admin.py | # -*- coding: utf-8 -*-
""" Admin web server for netskrafl.is
Copyright (C) 2020 Miðeind ehf.
Original author: Vilhjálmur Þorsteinsson
The GNU General Public License, version 3, applies to this software.
For further information, see https://github.com/mideind/Netskrafl
Note: SCRABBLE is a regist... |
nodemgr.py | #!/usr/bin/python3
import threading, random, time, xmlrpc.client, sys
#import network
from utils.nettools import netcontrol,ovscontrol
from utils.log import logger
from utils import env
from queue import Queue
##########################################
# NodeMgr
# Description : manage the physical node... |
queue_Demo.py | '''
Created on 2016年8月8日
@author: Administrator
'''
from multiprocessing.context import Process
from multiprocessing.queues import Queue
import os, time, random
# 写数据进程执行的代码:
def write(q):
print('Process to write: %s' % os.getpid())
for value in ['A', 'B', 'C']:
print('Put %s to queue...' % value)
... |
views.py | from flask import request
from flask_cors import CORS, cross_origin
from datetime import datetime, timezone
from functools import wraps
import threading, json, time
from googletrans import Translator
from AuthModule.azuread import authProvider
from SearchModule import app
from SearchModule.TextSearchModule import load... |
util.py | #
# Copyright (C) 2012-2016 The Python Software Foundation.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
import codecs
from collections import deque
import contextlib
import csv
from glob import iglob as std_iglob
import io
import json
import logging
import os
import py_compile
import re
import shutil
import socket
import... |
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... |
utils.py | #!/usr/bin/env python3
"""
General Utilities
(part of web.py)
"""
import datetime
import os
import re
import shutil
import subprocess
import sys
import threading
import time
import traceback
from threading import local as threadlocal
from .py3helpers import (
is_iter,
iteritems,
itervalues,
)
try:
fr... |
test_html.py | from __future__ import print_function
import glob
import os
import re
import threading
import warnings
# imports needed for Python 3.x but will fail under Python 2.x
try:
from importlib import import_module, reload
except ImportError:
import_module = __import__
from distutils.version import LooseVersion
i... |
ARAX_query.py | #!/bin/env python3
import sys
def eprint(*args, **kwargs): print(*args, file=sys.stderr, **kwargs)
import os
import json
import ast
import re
import time
from datetime import datetime
import subprocess
import traceback
from collections import Counter
import numpy as np
import threading
from response import Response
f... |
test_pooling.py | # Copyright 2009-present MongoDB, 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 wri... |
run.py | import init
from web import webapp
from multiprocessing import Process
if __name__ == "__main__":
p1 = Process(target=webapp.run)
p1.start()
init.init() |
coap_dos_attack.py | import logging
import multiprocessing
import signal
import time
import unittest
from coapthon.client.helperclient import HelperClient
from Entity.attack import Attack
from Entity.input_format import InputFormat
from protocols import CoAP as PeniotCoAP
class CoAPDoSAttack(Attack):
"""
CoAP Protocol - DoS Att... |
serverPi.py | from flask import Flask, render_template
from pymavlink import mavutil
from msgdef import *
import socket
import os
import sys
import threading
HOST = '127.0.0.1' #Server IP address
PORT = 65432 #Server port
firstTime = True #Indicates whether its the first time to call my_server()
data_view = """""" #Store data to... |
booktab.py | import cfg
from kivymd.uix.bottomnavigation import *
from kivymd.uix.bottomsheet import *
from kivy.clock import Clock
from kivy.properties import *
from threading import Thread
import ytvApi as ytv
from kivy.lang import Builder
Builder.load_string('''
<BookTab>:
name:'s3'
icon:'star'
text:'BookMar... |
test_arrow_eager.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... |
common.py | """Test the helper method for writing tests."""
import asyncio
import os
import sys
from datetime import timedelta
from unittest import mock
from unittest.mock import patch
from io import StringIO
import logging
import threading
from contextlib import contextmanager
from aiohttp import web
from homeassistant import c... |
4_edf_bankers_gui.py | import matplotlib
matplotlib.use('TkAgg')
from functools import reduce
from sys import *
import numpy as np
import random as r
import ping_code as pc
import socket
import struct
import subprocess as sp
import threading
from threading import Thread
import ast
import time
import datetime as dt
import os
import getpass as... |
test_ftplib.py | """Test script for ftplib module."""
# Modified by Giampaolo Rodola' to test FTP class, IPv6 and TLS
# environment
import unittest
import ftplib
import asyncore
import asynchat
import socket
import io
import errno
import os
import threading
import time
try:
import ssl
except ImportError:
ssl = None
from unit... |
main.py | from chess_utils import *
from teams import *
import timer
import protocol
import screen
import opening_screen
import exceptions
import bot
import os
import threading
import socket
import pygame
import random
import string
import logging
SOUNDS_PATH = 'sounds'
team_got_turn = Team(is_white_team=True)
team_doesnt_got_... |
pfsenser.py | from termcolor import colored
from pprint import pprint
import xml.etree.ElementTree as ET
import multiprocessing
import threading
import ipaddress
import itertools
import paramiko
import argparse
import logging
import masscan
import socket
import random
import queue
import time
import json
import xml
import sys
impor... |
2-github-repo-info.py | import time
import threading
import queue
import requests
from github import REPOS, ACCESS_TOKEN
def grab_data_from_queue():
while not q.empty():
repo_url = q.get()
response = requests.get(repo_url, params={'access_token': ACCESS_TOKEN}).json()
repo_info = {
'name': response['n... |
penv.py | import gym
from multiprocessing import Process, Pipe
def worker(conn, env):
while True:
cmd, data = conn.recv()
if cmd == "step":
obs, reward, done, info = env.step(data)
if done:
obs = env.reset()
conn.send((obs, reward, done, info))
elif... |
analyzer.py | from __future__ import division
import logging
try:
from Queue import Empty
except:
from queue import Empty
# from redis import StrictRedis
from time import time, sleep, strftime, gmtime
from threading import Thread
from collections import defaultdict
# @modified 20190522 - Task #3034: Reduce multiprocessing Ma... |
brbroadcast.py | import json
import socket
import threading
from byzantinerandomizedconsensus.base.broadcast import Broadcast
class BRBroadcast(Broadcast):
"""
Implements a Byzantine Fault Tolerant Reliable Broadcast protocol.
"""
SEND = 1
ECHO = 2
READY = 3
def __init__(self, total_nodes, faulty_nodes,... |
vio-experimental.py | import json
from typing import Any, Callable, Dict
import signal
import sys
import threading
import time
from loguru import logger
import paho.mqtt.client as mqtt
#try:
from vio_library import VIO # type: ignore
#except ImportError:
# from .vio_library import VIO
class VIOModule(object):
def __init__(self):... |
reader.py | # Copyright 2012-2019, Damian Johnson and The Tor Project
# See LICENSE for licensing information
"""
Utilities for reading descriptors from local directories and archives. This is
mostly done through the :class:`~stem.descriptor.reader.DescriptorReader`
class, which is an iterator for the descriptor data in a series ... |
trezor.py | from binascii import hexlify, unhexlify
import traceback
import sys
from qtum_electrum.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException
from qtum_electrum.qtum import (TYPE_ADDRESS, TYPE_SCRIPT, qtum_addr_to_bitcoin_addr)
from qtum_electrum.bip32 import deserialize_xpub, convert_bip32_path_to_li... |
test_rest_tracking.py | """
Integration test which starts a local Tracking Server on an ephemeral port,
and ensures we can use the tracking API to communicate with it.
"""
import mock
from subprocess import Popen
import os
import sys
import posixpath
import pytest
from six.moves import urllib
import socket
import shutil
from threading import... |
spacexlaunch.py | import dateutil.parser
from flask import Flask, render_template, url_for
from bs4 import BeautifulSoup
import requests
import arrow
import os
import threading
import time
import json
app = Flask(__name__)
wiki_page = "https://en.wikipedia.org/wiki/List_of_Falcon_9_and_Falcon_Heavy_launches"
next_date = ""
n_in_4_wee... |
detector.py | #importing the necessory libraries
from tensorflow.keras.models import model_from_json
from tensorflow.python.keras.backend import set_session
import cv2
from model import MacroFacialExpressionsDetection
import numpy as np
import tensorflow as tf
import threading
import os
import sys,time
config = tf.compat... |
util.py | import threading
import ctypes
import sys
import os
import ida_kernwin
import PyQt5.QtCore
import PyQt5.QtWidgets
# Helper for registering actions
def register_action(name, shortcut=''):
def handler(f):
# 1) Create the handler class
class MyHandler(ida_kernwin.action_handler_t):
def _... |
__init__.py | """
"""
import time
from datetime import datetime
import threading
import mongoengine as db
from pymongo import errors
from sentiment_scraper.models.article import Article
from sentiment_scraper.utils import article_matcher
from sentiment_scraper.utils import article_scraper
def update_matches(articles, analyze_al... |
02_multiprocess.py | from multiprocessing import Pool, Process
def f(x):
return x*x
def f_2(name):
print("hello", name)
if __name__ == "__main__":
p = Process(target=f_2, args=('bob',))
p.start()
p.join()
|
benchmark_hf.py | import argparse
import pandas as pd
import math
import os
from multiprocessing import Process
import torch
from typing import Callable
from transformers import HfArgumentParser, PyTorchBenchmark, PyTorchBenchmarkArguments
import logging
import timeit
logger = logging.getLogger()
class CustomizedPyTorchBenchmark(PyTor... |
session_debug_testlib.py | # Copyright 2016 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... |
__init__.py | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
r"""
A Python module to maintain unique, run-wide *dMRIPrep* settings.
This module implements the memory structures to keep a consistent, singleton config.
Settings are passed across processes via filesyst... |
1114_print_in_order.py | # -*- coding: utf-8 -*-
from unittest.mock import Mock, call
from threading import Barrier, Thread
from typing import Callable
class Foo:
def __init__(self):
self.fb = Barrier(2)
self.sb = Barrier(2)
def first(self, printFirst: 'Callable[[], None]') -> None:
printFirst()
self... |
main.py | def exit(exit_code):
global drivers,locks
try:
with locks[3]:
try:drivers
except NameError:pass
else:
for driver in drivers:
try:Process(driver).terminate()
except:pass
except:pass
finally:
if exit_code:
print_exc()
stdout.write('\r[INFO] Exitting with exit code %d\n'%exit_code)
_e... |
rebound.py | ##########
## GLOBALS
##########
import urwid
import re
import sys
import os
from bs4 import BeautifulSoup
import requests
from queue import Queue
from subprocess import PIPE, Popen
from threading import Thread
import webbrowser
import time
from urwid.widget import (BOX, FLOW, FIXED)
import random
SO_URL = "https://... |
FlaskMain.py | #!/usr/bin/python
import math
import threading
import os
import time
import datetime
import sys
import logging
from flask import Flask, render_template, redirect, url_for, request, send_from_directory, session
import BokehGraphCreator as GraphCreater
sys.path.append('../Tools/')
import ScaleInfoReaderWriter as Scale... |
multiprocessing_semaphore.py | #
"""Multiple concurrent access to a resource
"""
# end_pymotw_header
import random
import multiprocessing
import time
class ActivePool:
def __init__(self):
super(ActivePool, self).__init__()
self.mgr = multiprocessing.Manager()
self.active = self.mgr.list()
self.lock = multiproces... |
tfrecord.py | # coding:utf-8
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... |
__init__.py | import contextlib
import datetime
import errno
import functools
import inspect
import os
import re
import signal
import socket
import subprocess
import sys
import tempfile
import threading
from collections import namedtuple
from enum import Enum
from warnings import warn
import six
import yaml
from six.moves import co... |
hotplug.py | # SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2021, Arm Limited and contributors.
#
# 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
#
# ... |
train.py | from enviroment.concept_game_env import ConceptGameEnv
import torch
import torch.nn.functional as F
import torch.multiprocessing as mp
import torch.optim as optim
from torch.distributions import Categorical
import enviroment.concept_game_api as concept_game_api
import model.model_api as model_api
import config
import t... |
easylist_pac.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'stsmith'
# easylist_pac: Convert EasyList Tracker and Adblocking rules to an efficient Proxy Auto Configuration file
# Copyright (C) 2017 by Steven T. Smith <steve dot t dot smith at gmail dot com>, GPL
# This program is free software: you can redistribute... |
local_backend.py | import json
import os
import socket
import socketserver
import sys
from threading import Thread
import pkg_resources
import py4j
from py4j.java_gateway import JavaGateway, GatewayParameters, launch_gateway
from hail.expr.blockmatrix_type import tblockmatrix
from hail.expr.matrix_type import tmatrix
from hail.expr.tab... |
sensor.py | """Pushbullet platform for sensor component."""
import logging
import threading
from pushbullet import InvalidKeyError, Listener, PushBullet
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_API_KEY, CONF_MONITORED_CONDITIONS
import homeassistant... |
race_condition.py | #!/usr/bin/env python3
import socket
from pwn import *
import threading
import sys
import string
import time
alph = string.ascii_lowercase + string.ascii_uppercase
PORT = 9999
g_host = None
def idg( size = 8, chars = alph ):
return ''.join( random.choice( chars ) for _ in range( size ) )
def sell_weapon( sock ):
... |
Hausdorf.py | # -*- coding: utf-8 -*-
"""
Created on Tue Nov 17 16:11:28 2015
@author: dahoiv
For calulating Hausdorf distance and modified Hausdorf distance with multy threads
"""
# Time-stamp: <Last changed 03-06-2013 11:17:35 by Daniel Hoyer Iversen, dahoiv>
import numpy as np
import scipy.spatial.distance
import time
import... |
main.py | # flake8: noqa F403, F405
from functools import partialmethod
from multiprocessing import Pipe, Process, freeze_support
from os import environ
from os.path import splitext, basename, dirname, join
import sys
import threading
from cefpython3 import cefpython as cef
import PySide2
from PySide2.QtGui import *
from PySide... |
twitchTransFN.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#from googletrans import Translator
from google_trans_new import google_translator, constant
from gtts import gTTS
from playsound import playsound
import os
from datetime import datetime
import threading
import queue
import time
import shutil
import re
import requests
im... |
serve.py | import logging
import os.path
import multiprocessing
import tornado.ioloop
import tornado.web
from tornado.options import options, parse_config_file
from pymongo import MongoClient
from libs import vote, config
# Parse the config file
parse_config_file('settings.conf')
# Database
client = MongoClient(options.db_host,... |
droid.py | import torch
import lietorch
import numpy as np
from droid_net import DroidNet
from depth_video import DepthVideo
from motion_filter import MotionFilter
from droid_frontend import DroidFrontend
from droid_backend import DroidBackend
from trajectory_filler import PoseTrajectoryFiller
from collections import OrderedDic... |
socketconnector.py | import socket
import threading
from zigbear.radio.connector import Connector
class SocketConnector(Connector):
def __init__(self, receive_port, target_port):
super().__init__()
self.target_port = int(target_port)
self.receive_port = int(receive_port)
self.send_socket = socket.sock... |
test_create_files.py | #!/usr/bin/env python
from subprocess import call
import sys
from threading import Thread
from Queue import Queue
queue = Queue()
num = 9
size = 10240 #creates 10MB image
#size = 102400 #creates 100MB image
def createImage(i,q,dest = "/tmp"):
"""creates N 10mb identical image files"""
global num
globa... |
test_nat_association_disassociation.py | import pytest
import allure
import os
import time
import pandas as pd
import threading
#pytestmark = [pytest.mark.advance, pytest.mark.multiassodisasso, pytest.mark.nat]
setup_params_general = {
"mode": "NAT",
"ssid_modes": {
"wpa2_personal": [
{"ssid_name": "ssid_wpa2_2g", "appliedRadios"... |
tamper.py | #!/usr/bin/python
import sys
import struct
import os
from os.path import expanduser
import threading
import json
import time
import re
import urllib2
import uuid
import Queue
from netlib.odict import ODictCaseless
import subprocess
from subprocess import call
import tempfile
def send_message(message):
message = '{... |
animus_robot_client.py | import animus_client as animus
import animus_utils as utils
import random
import time
import threading
import logging
import numpy as np
import cv2
from dotenv import load_dotenv
import animus_wrapper.proto_converters
import json
class AnimusRobot:
def __init__(self):
self.log = utils.create_logge... |
ExternalMain.py | '''
@desc:内网穿透(映射)服务器端
@author: Martin Huang
@time: created on 2019/6/14 20:48
@修改记录:
2019/07/12 => 增加DEBUG选项 默认False 改为True可显示更多信息
'''
import select
import socket
import time
from threading import Thread
#pycharm
#DEBUG 参数
DEBUG = False
#内网穿透服务器端子线程类
class MappingSubServer:
def __init__(self,connA,connB,serverB):
... |
managers.py | #
# Module providing the `SyncManager` class for dealing
# with shared objects
#
# multiprocessing/managers.py
#
# Copyright (c) 2006-2008, R Oudkerk
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are m... |
multiprocessing.py | """Multiprocessing Example
Illustrates transaction-safety: multiple workers in separate
processes can run processors on the same database.
"""
from sisyphos import Sisyphos, Processor, Slot, Task
import json
import os
import sqlalchemy
import multiprocessing
import time
from pathlib import Path
class CubeProcessor... |
request_handler.py | """
MAIN THREAD
Handles all the connections, creating new games and requests from clients(s)
"""
import socket
import threading
from player import Player
from game import Game
import json
class Server(object):
PLAYERS = 1
def __init__(self):
self.connection_queue = []
self.game_id = 0
d... |
map_test.py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
wallet_multiwallet.py | #!/usr/bin/env python3
# Copyright (c) 2017-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test multiwallet.
Verify that a danecoind node can load multiple wallet files
"""
from decimal import ... |
base_events.py | """Base implementation of event loop.
The event loop can be broken up into a multiplexer (the part
responsible for notifying us of I/O events) and the event loop proper,
which wraps a multiplexer with functionality for scheduling callbacks,
immediately or at a given time in the future.
Whenever a public API ta... |
test_image_object_embedding.py | # coding : UTF-8
import sys
sys.path.append("../../tests")
import time
import threading
from towhee import pipeline
data_path = "../data_set/object_image/"
embedding_size = 1000
class TestImageObjEmbeddingInvalid:
""" Test case of invalid embedding interface """
def test_embedding_no_image(self, pipeline_na... |
test_coordinator.py | #!/usr/bin/env python
import argparse
import glob
import os
import subprocess
import socket
import sys
import threading
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/lib/gen-py')
sys.path.insert(0, glob.glob('/home/akash/clones/thrift/lib/py/build/lib.*')[1])
from thrift import Thrift
from thrift.pr... |
CustomCloud.py | # CustomCloud.py - Hologram Python SDK Custom Cloud interface
#
# Author: Hologram <support@hologram.io>
#
# Copyright 2016 - Hologram (Konekt, Inc.)
#
#
# LICENSE: Distributed under the terms of the MIT License
from collections import deque
import socket
import sys
import threading
import time
from Cloud import Cloud... |
decorators.py | from functools import wraps
from threading import Thread
def before(f, chain=False):
"""Runs f before the decorated function."""
def decorator(g):
@wraps(g)
def h(*args, **kargs):
if chain:
return g(f(*args, **kargs))
else:
f(*args, **kar... |
pow_server.py | import socket
import sys
import math
import lib.ProtocolUtils as protocolUtils
import threading as thread
def message_handler(conn, addr):
data = protocolUtils.MessageHandler(conn.recv(1024)).message_loads()
print("New operation in queue ", data[0], " ", data[2])
try:
val1 = float(data[0])
... |
feeder.py | import numpy as np
import tensorflow as tf
from sklearn.model_selection import train_test_split
import time
import threading
import os
from .util import is_scalar_input, is_mulaw_quantize
from infolog import log
from datasets import audio
from keras.utils import np_utils
_batches_per_group = 32
_pad = 0
class Feed... |
asyncElectionQ.py | import logging
import sys
import threading
import time
import math
import zmq
import os
import signal
import QueueDevice
from QueueDevice import qdevice
class States(object):
def __init__(self):
self.connect = "CONNECT"
self.elect = "ELECT"
self.coordinate = "COORDINATE"
sel... |
chaos.py | #!/usr/bin/env python3
"""
Hello World, but with more meat.
"""
import sys
import wx
import threading
import time
import psutil
from pymongo import MongoClient
from pymongo.errors import ServerSelectionTimeoutError
from pymongo.errors import PyMongoError
class HelloFrame(wx.Frame):
"""
A Frame that says Hell... |
1.Learning_rate_finder.py | import neptune.new as neptune
import os
import torch.nn as nn
import torch
import torch.nn.functional as F
from torch.optim import SGD, Adam
from torch.utils.data import DataLoader, random_split
from torch.optim.lr_scheduler import CyclicLR
import torch.multiprocessing as mp
import numpy as np
import random
import sys... |
record.py | import json
import queue
import socket
import threading
import time
class generator:
"""生成虚拟数据"""
def __init__(self):
self.timestamp = time.time()
def get_data(self):
time_period = time.time() - self.timestamp
virtual_data = int(time_period) % 10
return [time_period, virt... |
sequence.py | """
Module for exposing Sequence implementation.
"""
import senses.dataproviders.featureprovider as fp
import logging
import multiprocessing
import os
import psutil
class Sequence():
"""
Sequence of data, but buffered by parallel workers, so the queue that we
yield from is hopefully never empty.
"""
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.