source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
portable.py | #!/usr/bin/python
#
# -*- coding: utf-8 -*-
# vim: set ts=4 sw=4 et sts=4 ai:
import ConfigParser
import subprocess
import sys
import threading
import gobject
import pygtk
pygtk.require('2.0')
import gst
import gtk
import gtk.glade
from twisted.internet import error, defer, reactor
from twisted.python import log as... |
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... |
compareRegressionResults.py | #!/usr/bin/env python
# author: Alvaro Gonzalez Arroyo
# email: <alvaro.g.arroyo@gmail.com>
# description: a basic script to compare results of several Jenkins executions
import urllib2
import argparse
import re
import os
import threading
import sys
from collections import defaultdict
from display.table import Table... |
processes.py | import logging
import multiprocessing
import os
import random
import signal
import sys
import threading
import traceback
import westpa.work_managers as work_managers
from . core import WorkManager, WMFuture
log = logging.getLogger(__name__)
# Tasks are tuples ('task', task_id, fn, args, kwargs).
# Results are tuples... |
test_decorator.py | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from concurrent.futures import ThreadPoolExecutor, as_completed
import os
import subprocess
import sys
import threading
import unittest
from maro.communication import Proxy, SessionMessage, dist
from utils import get_random_port, proxy_generator... |
test_jobs.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
#... |
xAPIConnector.py | import json
import socket
import logging
import time
import ssl
from threading import Thread
import yaml
# set to true on debug environment only
DEBUG = True
#default connection properites
DEFAULT_XAPI_ADDRESS = 'xapi.xtb.com'
#DEFAULT_XAPI_PORT = 5124 # Demo
#DEFUALT_XAPI_STREAMING_PORT = 5125 # D... |
platform_utils.py | #
# Copyright (C) 2016 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
image_sectioning.py | import errno
import os
import re
import cv2
import math
import numpy as np
import multiprocessing as mp
from PIL import Image, ImageDraw, ImageFont, ExifTags
path_regex = re.compile('.+?/(.*)$')
def PIL_to_cv2(img_PIL):
return cv2.cvtColor(np.asarray(img_PIL), cv2.COLOR_RGB2BGR)
def write_image(name, data, imgPI... |
netcdf.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# $Id$
#
# Project: GDAL/OGR Test Suite
# Purpose: Test NetCDF driver support.
# Author: Frank Warmerdam <warmerdam@pobox.com>
#
#############################################################... |
kb_ReadsUtilitiesServer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import json
import os
import random as _random
import sys
import traceback
from getopt import getopt, GetoptError
from multiprocessing import Process
from os import environ
from wsgiref.simple_server import make_server
import requests as _requests
from json... |
power_monitoring.py | import random
import threading
import time
from statistics import mean
from cereal import log
from common.params import Params, put_nonblocking
from common.realtime import sec_since_boot
from selfdrive.hardware import HARDWARE
from selfdrive.swaglog import cloudlog
PANDA_OUTPUT_VOLTAGE = 5.28
CAR_VOLTAGE_LOW_PASS_K =... |
pystress.py | __version__ = '0.2.1'
from multiprocessing import Process, active_children, cpu_count, Pipe
import os
import signal
import sys
import time
FIB_N = 100
DEFAULT_TIME = 60
try:
DEFAULT_CPU = cpu_count()
except NotImplementedError:
DEFAULT_CPU = 1
def loop(conn):
proc_info = os.getpid()
conn.send(proc_... |
profiling.py | import json
import logging
import os
import socket
import threading
import tensorflow as tf
from tensorflow.python.client import timeline
if tf.__version__[0] == '2':
logging.info('Adjusting for tensorflow 2.0')
tf = tf.compat.v1
tf.disable_eager_execution()
class Timeliner:
_timeline_dict = None
... |
test_selenium.py | import re
import threading
import time
import unittest
from selenium import webdriver
from app import create_app, db
from app.models import Role, User, Post
class SeleniumTestCase(unittest.TestCase):
client = None
@classmethod
def setUpClass(cls):
# start Chrome
try:
cls.c... |
regrtest.py | #! /usr/bin/env python3
"""
Usage:
python -m test [options] [test_name1 [test_name2 ...]]
python path/to/Lib/test/regrtest.py [options] [test_name1 [test_name2 ...]]
If no arguments or options are provided, finds all files matching
the pattern "test_*" in the Lib/test subdirectory and runs
them in alphab... |
MergeManager.py | import subprocess
import threading
class MergeManager(object):
def __init__(self, video_format, audio_format, file_helper):
self.video_format = video_format
self.audio_format = audio_format
self.file_helper = file_helper
self.thread = None
pass
def merge(self, file_nam... |
with_progress.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
import sys
from urllib.request import urlretrieve
from threading import Thread
def reporthook(blocknum, blocksize, totalsize):
readsofar = blocknum * blocksize
if totalsize > 0:
percent = readsofar * 100.0 / totalsize
if... |
process_limiter.py | # -*- coding: utf-8 -*-
"""
Created on Sat Dec 12 14:29:33 2020
@author: Daniel
"""
import multiprocessing as mp
import time as t
def p_limit(processes, p_max):
"""
Runs a limited number of custom processes running at one time.
Parameters
----------
processes : list
List of processes.
... |
streamGL.py | import numpy
import cv2
from threading import Thread
import sys
import time
if sys.version_info >= (3, 0):
from queue import Queue
else:
from Queue import Queue
class FStream:
def __init__(self, path):
self.stream = cv2.VideoCapture(path)
self.stopped= False
self.Q = Queue(2... |
add_no_lock.py | #!/usr/bin/python
from multiprocessing import Process, Value
# adding without using lock
# gives erroneous output
def add(val):
val.value += 1
def main():
val = Value('i', 0)
processes = [Process(target=add, args=(val, )) for _ in range(200)]
for p in processes:
p.start()
for p in ... |
client-cli.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import socket
import os
import json
import hashlib
import threading
import curses
import sys
from datetime import datetime
from signal import SIGTERM
from re import match as re_match
from argparse import ArgumentParser
from getpass import getpass
from random import randin... |
socks2http.py | import asyncore
import socket
import socks
import traceback
from threading import Thread
from Queue import Queue
VERSION = 'socks2http/0.01'
HTTPVER = 'HTTP/1.1'
SOCKS_SERVER_ADDR = '127.0.0.1'
SOCKS_SERVER_PORT = 8087
conn_q = Queue()
def connection_worker():
while True:
c = conn_q.get()
try:
c.c... |
miniterm.py | #!/home/pi/mycroft-core/.venv/bin/python
#
# Very simple serial terminal
#
# This file is part of pySerial. https://github.com/pyserial/pyserial
# (C)2002-2015 Chris Liechti <cliechti@gmx.net>
#
# SPDX-License-Identifier: BSD-3-Clause
import codecs
import os
import sys
import threading
import serial
from serial.to... |
is_bst.py | #!/usr/bin/env python3
"""Check whether binary search tree
Test whether a binary search tree data structure is implemented correctly.
Given a binary search tree with integers as its key, test whether it is a
correct binary search tree. Check whether the given binary tree structure
satisfies the following condition:
... |
camera.py | from datetime import datetime
from picamera import PiCamera
from pathlib import Path
from PyQt5.QtCore import pyqtSignal, QObject
from threading import Lock, Thread
from src.cameratimerbackend import RepeatedTimer
class FileNameHelper():
def __init__(self):
# set default save directory, make folder if d... |
test_docxmlrpc.py | from DocXMLRPCServer import DocXMLRPCServer
import httplib
import sys
from test import test_support
threading = test_support.import_module('threading')
import time
import socket
import unittest
PORT = None
def make_request_and_skipIf(condition, reason):
# If we skip the test, we have to make a request because the... |
__init__.py | # Copyright 2021, Battelle Energy Alliance, LLC
# Python Packages
import os
import logging
import json
import time
import environs
from flask import Flask, request, Response, json
import deep_lynx
import threading
# Repository Modules
from .deep_lynx_query import query_deep_lynx
from .deep_lynx_import import import_t... |
stacoan.py | #!/bin/python
import codecs
import hashlib
import os
import sys
import webbrowser
import configparser
import argparse
import threading
import json
import multiprocessing
from threading import Thread
from multiprocessing import Process
from time import time
from helpers.logger import Logger
from helpers.project import... |
splash.py | """Silly module mostly meant as an easter-egg."""
import threading
import time
from .. import term
from ..term import text
_banner = r'''
.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:.
) _____ _ _ )
( | _ |___ _ _ _ ___ __... |
build_imagenet_data.py | # 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 required by applicable law or a... |
test_json.py | # Standard library imports...
from http.server import BaseHTTPRequestHandler, HTTPServer
from threading import Thread
import os
# Third-party imports...
import requests
import json
import unittest
from unittest.mock import Mock
from convert_alert import convert_sd_to_ms
from main import send_to_teams
http_port = 60... |
pantsd_integration_test.py | # Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import glob
import os
import signal
import threading
import time
import unittest
from textwrap import dedent
from typing import List, Optional
import psutil
import pytest
from pants.test... |
uiFrontend.py |
import dbApi
import scanner.runState
import logging
import os.path
import queue
import threading
import time
import sys
import tqdm
class UiReadout(object):
def __init__(self, hashQueue, monitorQueue):
self.log = logging.getLogger("Main.UI")
self.hashQueue = hashQueue
self.processingHashQueue = monitorQueu... |
hw_thread_sbox.py |
from threading import Thread, Lock
#dictionary of async objects:
'''
at beginning/creation, a dictionary (maybe) of all potential threading objects
will be created to house the thread functions, etc...
i
'''
'''
https://stackoverflow.com/questions/15729498/how-to-start-and-stop-thread
'''
bproc = {}
#will con... |
main_window.py | import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
import electrum_dash
from electrum_dash import WalletStorage, Wallet
from electrum_dash_gui.kivy.i18n import _
from electrum_dash.contacts import Contacts
from electrum_dash.paymentrequest import In... |
network_monitor.py | #!/usr/bin/env python
import optparse
import pymnl
import traceback
import time
import re
import sys
import threading
import uuid
from pymnl.nlsocket import Socket
from pymnl.message import Payload
from pymnl.attributes import AttrParser
from struct import calcsize, unpack
from utils.utils_log import utils_log
from uti... |
passive_proxy_scraper.py | import requests, threading, time, ctypes
## CONFIG ##
title_update_delay = .1
def title():
while True:
ctypes.windll.kernel32.SetConsoleTitleW(f"cVenge's Passive Proxy Scraper | Valid: {valid} | Invalid: {invalid} | Scraped: {scraped} |")
time.sleep(title_update_delay)
def menu():
wh... |
preproceesing.py | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from multiprocessing import Process,Queue
from time import time
import seaborn as sns
import math
import json
from tqdm import tqdm
sns.set_style('darkgrid')
def analyze_dataset(path):
line = [str(i) for i in range(15)]
... |
cnn_util.py | # coding=utf-8
# Copyright 2019 The Google Research 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 applicab... |
qiushi_thread.py | #coding:utf-8
import requests
from lxml import etree
import json
from queue import Queue
import threading
class Qiushi(object):
"""
使用queue的存取形式取代了return
启动的时候启动三个线程,每个线程分别进行while true的向队列中放url, resp_data, data
第一个线程不停的存url队列,第二个线程不停的区url队列进行生产resp_data,
第三个线程不停的从第二个队列中区resp_data进行s... |
log.py | # coding:utf-8
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... |
compare_WalltoallCNOT_adam.py |
import multiprocessing
import importlib
import qiskit
import numpy as np
import sys
sys.path.insert(1, '../')
import qtm.encoding
import qtm.fubini_study
import qtm.ansatz
import qtm.constant
import qtm.base
def run_walltoall(num_layers, num_qubits):
thetas = np.ones(num_layers * 3 * num_qubits)
psi = 2*np.... |
combine.py | #!/usr/bin/python
import threading
import select
import sys
import time
import operator
import queue
input_queue = queue.Queue()
results = {}
def print_result_as_str(result):
result_str = ""
for i in range(0, len(result), 2):
value = int(result[i:i+2].strip(), 16)
if value <= 32 or value >= 1... |
adjustScreen.py | import win32gui
import win32con
import threading
import time
# input boxes for x, y, width, height set up
# by default: screenwidth, screenheight used for width height
# dropdown for selectin app
signal_foreground = threading.Event()
def waitOnSignal(hwnd, x,y,width,height):
# TODO: fix wait till WM protocol arriv... |
02_sectclear_detect.py | import time
import os
from pynput.keyboard import Key, Listener, KeyCode
from pynput import mouse, keyboard
from windowcapture import WindowCapture
import cv2
from threading import Thread
os.chdir(os.path.dirname(os.path.abspath(__file__)))
class ScreenshotGrabber5Sec():
def __init__(self) -> None:
self.l... |
Arena.py | from pytorch_classification.utils import Bar, AverageMeter
import multiprocessing as mp
import numpy as np
import time, copy
from utils import *
class Arena():
"""
An Arena class where any 2 agents can be pit against each other.
"""
def __init__(self, player1, player2, game, display=None, num_workers=1... |
ossh_server.py | from threading import Thread
from jnpr.junos import Device
from jnpr.junos.utils.config import Config
from jnpr.junos.exception import ConnectError
from jnpr.junos.utils.sw import SW
from jnpr.junos.exception import LockError
from jnpr.junos.exception import UnlockError
from jnpr.junos.exception import ConfigLoadError
... |
02_breakout_es.py | #!/usr/bin/env python3
import gym
import ptan
import time
import argparse
import numpy as np
import collections
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch import multiprocessing as mp
from torch import optim
from tensorboardX import SummaryWriter
NOISE_STD = 0.05
LEARNING_RATE ... |
helpers.py | """
This file contains various helpers and basic variables for the test suite.
Defining them here rather than in conftest.py avoids issues with circular imports
between test/conftest.py and test/backend/<backend>/conftest.py files.
"""
import functools
import logging
import multiprocessing
import os
import subprocess... |
test_runner.py | #
# Copyright (c) 2021, NVIDIA CORPORATION. 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 appl... |
2_Multiprocessing.py | # 2 Using multi processing Python
import time
import multiprocessing
# Create simple function that sleep in 1 second
def do_something():
print('Sleeping 1 second ..')
time.sleep(1)
print('Done Sleeping')
if __name__ == '__main__':
start = time.perf_counter()
# Create 2 multiproc... |
benchmark.py | from multiprocessing import Process
import psutil
import time
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
def monitor(target, bounds, num_particles, max_iter, costfunc, M):
worker_process = Process(target=target, args=(M, bounds, num_particles, max_iter, costfunc))
worker_process.... |
node.py | import threading
import time
import utils
from config import cfg
FOLLOWER = 0
CANDIDATE = 1
LEADER = 2
class Node():
def __init__(self, fellow, my_ip):
self.addr = my_ip
self.fellow = fellow
self.lock = threading.Lock()
self.DB = {}
self.log = []
self.staged = None... |
interface.py | from Tkinter import *
from subprocess import Popen
from tkFileDialog import askopenfilename
import threading
import thread
import Image, ImageTk
import time
import sys
import signal
import os
import kirk
import scapy.all as sca
import scapy_ex
import channel_hop
import pickle
import numpy as n
fingerprint = {}
radiota... |
LearnGUI_V2.py | from tkinter import *
from tkinter import messagebox, filedialog
from Modules import PublicModules as libs
from Modules import LSTM_Config as cf
import cv2
import threading
from PIL import Image
from PIL import ImageTk
from Modules.MyComponents import *
from tkcalendar import Calendar
from Modules.MyThreading import My... |
dataset_generator.py | # coding=utf-8
# Copyright 2020 The TF-Agents 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
scheduler.py | import logging
import threading
import time
from datetime import datetime
class SimpleTaskScheduler:
""" Simple task scheduler
Schedules a task every chosen intervall (seconds)
NB: If the task does not finish at all, the first time, there will not be raised an exception
:raises Exception:... |
grid_search.py | """
Gridsearch implementation
"""
import os
from hops import hdfs as hopshdfs
from hops import tensorboard
from hops import devices
from hops import util
import pydoop.hdfs
import threading
import six
import datetime
run_id = 0
def _grid_launch(sc, map_fun, args_dict, direction='max', local_logdir=False, name="no-n... |
bf_manager.py | from multiprocessing import Process
from bf8 import start, BFAlgo8, load_progress
if __name__ == '__main__':
while True:
values = BFAlgo8.generate_all_values()
progress = load_progress()
print('Cur progress: {}/{}'.format(progress, len(values)))
if progress == len(values):
break
p = Process... |
test_threaded_import.py | # This is a variant of the very old (early 90's) file
# Demo/threads/bug.py. It simply provokes a number of threads into
# trying to import the same module "at the same time".
# There are no pleasant failure modes -- most likely is that Python
# complains several times about module random having no attribute
# ra... |
main.py | #
# Copyright (c) 2019 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
transfer_supports.py | import os
import io
import sys
import html
import socket
import urllib
from os.path import isfile, isdir
from functools import partial
from http.server import test, SimpleHTTPRequestHandler
from http import HTTPStatus
from multiprocessing import Process
__all__ = ['startTransferSever', 'get_local_ip', 'TransferSeverSt... |
test_framework.py | from __future__ import print_function
class AssertException(Exception):
pass
def format_message(message):
return message.replace("\n", "<:LF:>")
def display(type, message, label="", mode=""):
print("\n<{0}:{1}:{2}>{3}".format(
type.upper(), mode.upper(), label, format_message(message)))
def ... |
networking.py | """
Defines helper methods useful for setting up ports, launching servers, and
creating tunnels.
"""
from __future__ import annotations
import http
import json
import os
import socket
import threading
import time
import urllib.parse
import urllib.request
from typing import TYPE_CHECKING, Optional, Tuple
import fastap... |
camera.py | from threading import Thread, Lock
import cv2
class CameraStream(object):
"""
Threaded class for capturing camera stream quickly in real time, media decoder: FFMPEG
objective: to capture each frame smoothly without any delay
output: return each frame
"""
def __init__(self, src=0... |
test_task.py | import os
import threading
import pytest
from ddtrace import compat
from ddtrace.internal import nogevent
from ddtrace.profiling.collector import _task
TESTING_GEVENT = os.getenv("DD_PROFILE_TEST_GEVENT", False)
def test_get_task_main():
# type: (...) -> None
if _task._gevent_tracer is None:
asser... |
chatClient.py | #!/usr/bin/env python3
from socket import AF_INET, socket, SOCK_STREAM
from threading import Thread
import sys
def receive():
"""Handles receiving of messages."""
while True:
try:
msg = client_socket.recv(BUFSIZ).decode("utf8")
sys.stdout.flush()
print('{}\n'.format... |
A3C_RNN.py | """
Asynchronous Advantage Actor Critic (A3C) + RNN with continuous action space, Reinforcement Learning.
The Pendulum example.
Using:
tensorflow
gym
"""
import multiprocessing
import threading
import tensorflow as tf
import numpy as np
import gym
import os
import shutil
import matplotlib.pyplot as plt
GAME = 'Pen... |
k2_blockdevice_api.py | """ This is k2_blockdevice_api docstring """
import logging
import platform
import uuid
import threading
import bitmath
from flocker.node.agents import blockdevice
from zope.interface import implementer
from twisted.python import filepath
from kaminario_flocker_driver.utils.k2_api_client import K2StorageCenter... |
udf.py | """Fonduer UDF."""
import logging
from multiprocessing import Manager, Process
from queue import Queue
from threading import Thread
from typing import Any, Collection, Dict, List, Optional, Set, Type, Union
from sqlalchemy import inspect
from sqlalchemy.orm import Session, scoped_session, sessionmaker
from fonduer.me... |
multimedia.py | # !/usr/bin/env python3
# Autor: Hernández Albino Edgar Alejandro
# Maceda Nazario Luis Martín
# Bibliotecas a utilizar
import pygame
import threading
import tkinter as tk
from tkinter import*
import webbrowser
import vlc
import os
# Para añadir los encabezados a cada sección
def title(frame, message):
... |
__init__.py | # -*- coding: utf-8 -*-
#
# Copyright (c) 2016, ParaTools, Inc.
# 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 must retain the above copyright notice,
# t... |
run_server.py | import argparse
import os
from multiprocessing import Process
from common import client_ai_teaming, pairing_clients
from config import (DEFAULT_DATA_SAVE_PATH, DEFAULT_SERVER_ADDR,
DEFAULT_SERVER_PORT)
from network import Server, send
from tasks.affective_task import ServerAffectiveTask
from tasks.... |
__init__.py |
###############################################################################
# DO NOT MODIFY THIS FILE #
###############################################################################
import inspect
import logging
import sys
import time
from collections import n... |
reverseSplice.py | from Bio import SeqIO
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
import csv
from datetime import datetime
import multiprocessing
from multiprocessing import Queue
import logging
import re
import io
import traceback
logging.basicConfig(level=logging.DEBUG, format='%(message)s')
PROT_THRESH = 5000000
S... |
fn_api_runner.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... |
__main__.py | import sys
import time
import config
import asyncio
from db import es_util
from controller import server
try:
import uvloop as async_loop
except ImportError:
async_loop = asyncio
def __handle_args():
if (len(sys.argv)) < 2:
return
for i in range(1, len(sys.argv), 2):
key = sys.argv[i][... |
test_server_async.py | #!/usr/bin/env python
from pymodbus.compat import IS_PYTHON3
import unittest
if IS_PYTHON3: # Python 3
from unittest.mock import patch, Mock, MagicMock
else: # Python 2
from mock import patch, Mock, MagicMock
from pymodbus.device import ModbusDeviceIdentification
from pymodbus.server.asynchronous import ModbusT... |
test_ftplib.py | """Test script for ftplib module."""
# Modified by Giampaolo Rodola' to test FTP class and IPv6 environment
import ftplib
import threading
import asyncore
import asynchat
import socket
import io
from unittest import TestCase
from test import support
from test.support import HOST
# the dummy data returned by server ... |
Video_Send.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# pip install opencv-python
# pip install -U wxPython (problemas en Debian)
#
from __future__ import print_function
import time
import cv2
import numpy as np
import paho.mqtt.client as paho
import threading
import sys
import wx
import wx.lib.newevent
import Video_Send... |
cliente.py | import threading
import sys
import socket
import pickle
import os
class Cliente():
def __init__(self, host=socket.gethostname(), port=59989):
self.sock = socket.socket()
self.sock.connect((str(host), int(port)))
hilo_recv_mensaje = threading.Thread(target=self.recibir)
hilo_recv_mensaje.daemon = True
hilo_... |
oauth_server.py | """Simple bottle server to receive authorization callback."""
import logging
import os
import signal
from threading import Thread
from typing import Any, NoReturn
from wsgiref.simple_server import WSGIRequestHandler, make_server
import bottle
_LOGGER = logging.getLogger(__name__)
CON = None
SERVER = None
# Enable no... |
add_geoinfo.py | """
需要离线添加一些ip的信息
by swm 2020/04/24
"""
import queue
import threading
import json
import time
import uuid
from pathlib import Path
import argparse
import maxminddb
class AddInfo(object):
def __init__(self):
self.parser = argparse.ArgumentParser()
self.parser.add_argument("pthreads", help="55", t... |
job_control.py | import collections
import logging
import threading
class Job:
def execute(self): pass
def request_stop(self): pass
class Agent:
"""
The name serves as the unique identifier. When the job finishes, the
callback is invoked with self (this Agent) as the only parameter.
"""
def __init__(self... |
tests.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import errno
import os
import shutil
import sys
import tempfile
import time
import unittest
from datetime import datetime, timedelta
try:
import threading
except ImportError:
import dummy_threading as threading
from django.core.cache import cach... |
test_base.py | #!/usr/bin/env python
# Copyright (c) 2014, Facebook, Inc.
# 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. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
from... |
server.py | #Code based on https://github.com/ST0263/st0263-20212/blob/main/LabSocketsMultiThread/ServerLab.py
#!/usr/bin/env python3
import socket
import threading
import constants
import connection
# Defining a socket object...
server_socket = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
server_address = constants.IP_SERV... |
test_ecu.py |
# for standalone-test
import sys
sys.path.append(".")
import unittest
import time
import threading
try:
# Python27
import Queue as queue
except ImportError:
# Python35
import queue
import j1939
class AcceptAllCA(j1939.ControllerApplication):
"""CA to accept all messages"""
def __init__(sel... |
test.py | # -*- coding: utf-8 -*-
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2020 Megvii Inc. All rights reserved.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT ARRANTI... |
test_threading.py | """
Tests for the threading module.
"""
import test.support
from test.support import verbose, import_module, cpython_only, unlink
from test.support.script_helper import assert_python_ok, assert_python_failure
import random
import sys
import _thread
import threading
import time
import unittest
import weakref
import os... |
main.py | from logging import debug, exception
from flask import Flask, request
import os
import asyncio
import threading
import ssl
import aiohttp
import nest_asyncio
import json
from openleadr.client import OpenADRClient
from openleadr.utils import report_callback
from openleadr.enums import MEASUREMENTS
nest_asyncio.apply()
... |
killThreadTest.py | import os
import sys
import time
import threading
from signal import signal, SIGINT
import subprocess
import multiprocessing
threads = 10
threadL=[]
def shareOrder(iter):
proc = subprocess.Popen(["script -c \"~/onionshare/dev_scripts/onionshare --website hello.txt\" -f output" + str(iter) + ".txt"], stdout=subproc... |
deploy_contrail_vm.py | #!/usr/bin/env python
from os import system, path
from sys import exit
from threading import Thread
from time import sleep
from argparse import ArgumentParser
from getpass import getpass
import tarfile
import urllib2
from pyVim import connect
from pyVmomi import vim
from manage_dvs_pg import get_obj
def get_args():
... |
main.py | # MIT License
# Copyright (c) 2021 SUBIN
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish,... |
scheduler_job.py | # pylint: disable=no-name-in-module
#
# 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, Versio... |
semaphore.py | import threading
import time
# For signaling, the semaphore is initialized to 0; for mutual exclusion, the initial value is 1; for multiplexing, the initial value is a positive number greater than 1.
semaphore = threading.Semaphore(0)
def consumer():
print("The begining of consumer function")
semaphore.acqui... |
test_debug.py | import importlib
import inspect
import os
import re
import sys
import tempfile
import threading
from io import StringIO
from pathlib import Path
from unittest import mock
from django.core import mail
from django.core.files.uploadedfile import SimpleUploadedFile
from django.db import DatabaseError, connection
from djan... |
GUI_DD.py | import tkinter as tk
from threading import Thread
import pyttsx3
from comtypes.safearray import numpy
from PIL import ImageTk, Image
from scipy.spatial import distance
import PIL
import cv2
import dlib
from imutils import face_utils
import face_recognition
import os
import csv
import GUI_BAR
import GUI_USERS
from date... |
recipe-576684.py | #!/usr/bin/env python
def run_async(func):
"""
run_async(func)
function decorator, intended to make "func" run in a separate
thread (asynchronously).
Returns the created Thread object
E.g.:
@run_async
def task1():
do_something
@run_async
def task2():
do_something_too
t1 = task1... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.