source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
rabit_tracker.py | """
Tracker script for rabit
Implements the tracker control protocol
- start rabit jobs
- help nodes to establish links with each other
Tianqi Chen
"""
import sys
import os
import socket
import struct
import subprocess
import random
import time
from threading import Thread
"""
Extension of socket to handle recv an... |
metrics.py | import threading
import time
class Message:
def __init__(self, host, raw):
self.created = time.time()
self.host = host
self.raw = raw
if raw is None:
self.size = 0
else:
self.size = len(raw)
class MessageList:
def __init__(self):
self.byt... |
ircbot.py | '''Todo:
* Add multiple thread support for async_process functions
* Potentially thread each handler function? idk
'''
import sys
import socket
import re
import threading
import logging
import time
if sys.hexversion < 0x03000000:
#Python 2
import Queue as queue
BlockingIOError = socket.error
else:
imp... |
train.py | #!/usr/bin/env python
import os
import json
import tensorflow.contrib.slim as slim
import datetime
import random
import time
import argparse
import os
import threading
from scipy import misc
import tensorflow as tf
import numpy as np
from distutils.version import LooseVersion
if LooseVersion(tf.__version__) >= LooseVe... |
imagewriter.py | import os
from queue import Queue
from threading import Thread
import cv2 as cv
import numpy as np
from vision.utils import box_utils_numpy as box_utils
class ImageWriter:
def __init__(
self,
video_path,
queue_sz,
output_path,
create_output_folder=True,
extension=... |
updater_long.py | import os
import sys
import time
import sqlite3
import zipfile
import pythoncom
import pandas as pd
from PyQt5 import QtWidgets
from PyQt5.QAxContainer import QAxWidget
from multiprocessing import Process, Queue, Lock
sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
from login.manuallogin im... |
test_event_ping_no_response.py | # -*- coding: utf-8 -*-
__author__ = 'Marcin Usielski'
__copyright__ = 'Copyright (C) 2020, Nokia'
__email__ = 'marcin.usielski@nokia.com'
import time
from moler.events.unix.ping_no_response import PingNoResponse
from moler.util.moler_test import MolerTest
import datetime
def test_event_ping_no_response(buffer_con... |
queue.py | #!/usr/bin/env python
#-*- coding: utf-8 -*-
"""
* @ Scout for Python
##############################################################################
# Author: YWJT / ZhiQiang Koo #
# Modify: 2020-03-13 #
#############... |
test_io.py | """Unit tests for the io module."""
# Tests of io are scattered over the test suite:
# * test_bufio - tests file buffering
# * test_memoryio - tests BytesIO and StringIO
# * test_fileio - tests FileIO
# * test_file - tests the file interface
# * test_io - tests everything else in the io module
# * test_univnewlines - ... |
vectorized_env_executor.py | import numpy as np
import pickle as pickle
from multiprocessing import Process, Pipe
import copy
from simAdapter import terrainRLSim
from meta_policy_search.envs.normalized_env import normalize
class MetaIterativeEnvExecutor(object):
"""
Wraps multiple environments of the same kind and provides functionality... |
exchange_rate.py | from datetime import datetime
import inspect
import requests
import sys
from threading import Thread
import time
import csv
from decimal import Decimal
from .bitcoin import COIN
from .i18n import _
from .util import PrintError, ThreadJob
# See https://en.wikipedia.org/wiki/ISO_4217
CCY_PRECISIONS = {'BHD': 3, 'BIF':... |
main.py | import sys
import os
import shutil
import random
from multiprocessing import Process, Manager
import pandas as pd
from parse import *
from pyswip import Prolog
from commits import *
APP_NAME = "museuMonitor"
DAP = "dap(A,P,R,Infs,Time).".format(APP_NAME)
DAP_CR = "dapCR(A,NP,NR,Infs,Time).".format(APP_NAME)
INFR_FIL... |
vegeta_stress.py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the Apache 2.0 License.
import infra.network
import infra.e2e_args
import subprocess
import threading
import time
import generate_vegeta_targets as TargetGenerator
from loguru import logger as LOG
VEGETA_BIN = "/opt/vegeta/vegeta"
def print... |
main_test.py | import unittest
import multiprocessing
import time
import server, client
class MainTest (unittest.TestCase):
"""
This test runs the server in a shell subprocess and after a second
it runs the client in another shell subprocess. Afterwards, it kills
both processes and run assertions on the output.
T... |
asyn.py | import asyncio
import asyncio.events
import functools
import inspect
import io
import os
import re
import sys
import threading
from contextlib import contextmanager
from glob import has_magic
from .callbacks import _DEFAULT_CALLBACK
from .exceptions import FSTimeoutError
from .spec import AbstractBufferedFile, Abstrac... |
wrapper_window.py | import abc
from typing import Any
from gbvision.constants.types import Frame
from .window import Window
from gbvision.models.system import EMPTY_PIPELINE
from threading import Thread
class WrapperWindow(Window, abc.ABC):
"""
A window class that uses an object (wrap_object) and reads frames from it in to disp... |
dbapi_test.py | from datetime import datetime, date, timezone
from numpy.random import randint, uniform
from math import floor
from queue import Queue
from subprocess import Popen
from time import sleep
import threading, sys, os
sys.path.append(os.path.abspath(__file__).rsplit('tests/', 1)[0] + '/pysqream/')
import dbapi, pytest
q =... |
client.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2009 Christopher Lenz
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
from datetime import datetime
import os
import os.path
import shutil
import time
import tempfile
imp... |
zip_crack-GIL-Thread-Effect.py | #!/usr/bin/python
# Created by c@caine
# On: 13/02/2017
# --- Preamble --- #
import sys
import zipfile
from threading import Thread
# --- Declarations --- #
zip_file = sys.argv[1]
unzip_me = zipfile.ZipFile(zip_file)
word_list = sys.argv[2]
# --- Functions --- #
def extract_file (unzip_me, password):
try:
unzip... |
musiccontrol.py | # Music Control...
# Music Player:
# from glob import glob
from re import I
from tkinter import *
from tkinter import filedialog
from traceback import *
from win32com.client import Dispatch
import time,eyed3,threading
import os, sys
from sys import *
from os import *
import time
# from time import *
# do n... |
pixiv.py | #!/usr/bin/env python3
"""
pixiv
Usage:
pixiv.py
pixiv.py <id>...
pixiv.py -r [-d | --date=<date>]
pixiv.py -u
Arguments:
<id> user_ids
Options:
-r Download by ranking
-d <date> --date <date> ... |
axel.py | # axel.py
#
# Copyright (C) 2010 Adrian Cristea adrian dot cristea at gmail dotcom
#
# Based on an idea by Peter Thatcher, found on
# http://www.valuedlessons.com/2008/04/events-in-python.html
#
# This module is part of Axel and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
#
#... |
tcr.py | # -*- coding: utf-8 -*-
import LINETCR
from LINETCR.lib.curve.ttypes import *
from datetime import datetime
import time,random,sys,json,codecs,threading,glob,re
cl = LINETCR.LINE()
#cl.login(qr=True)
cl.login(token="token")
cl.loginResult()
ki = LINETCR.LINE()
#ki.login(qr=True)
ki.login(token="token")
ki.loginResul... |
verify.py | from tkinter import *
from tkinter.ttk import *
import time
from queue import Queue
from threading import Thread
from views import ViewHasBackButton
from statement import HistoryStatement
from rsa import RSAKeypair
from hash import sha256
from common import signed_message_to_bytes
ZEROS_32 = bytearray([... |
__main__.py | # Copyright (c) 2020 Andika Wasisto
# Modified by Tobias Raayoni Last
#
# 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, ... |
recipe-577083.py | #! /usr/bin/env python
"""
silence.py
Peter Waller
March 2010
"""
from __future__ import with_statement
from contextlib import contextmanager, nested
from threading import Thread
from tempfile import mkdtemp
from os.path import join as pjoin
from os import (dup, fdopen, open as osopen, O_NONBLOCK, O_RDONLY, remove,... |
8_rms_wait_die_Speak.py | # Author Emeka Ugwuanyi Emmanuel
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
from threading import Thread
import threading
import ast
import time
import os
import psutil
import datetime as dt
import getp... |
multiprocessor.py | from concurrent.futures import ThreadPoolExecutor
from .utils import CountUpDownLatch
import threading
import logging
import multiprocessing
import os
import logging.handlers
from .exceptions import FileNotFoundError
try:
from queue import Empty # Python 3
import _thread
except ImportError:
... |
test_redrock.py | import redis
import time
import threading
import random
import threading
POOL = redis.ConnectionPool(host='127.0.0.1',
port='6379',
db=0,
decode_responses=True,
encoding='utf-8',
... |
postproc.py | #!/usr/bin/python3 -OO
# Copyright 2007-2019 The SABnzbd-Team <team@sabnzbd.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any late... |
trans_client.py | # coding:utf-8
"""
UDP客户端,尝试连接服务端。
当建立连接后发送指定数据。
"""
import asyncio
import hashlib
import json
import os
import random
import threading
import time
class FilePart:
"""文件信息类"""
def __init__(self, name, size, part, total, data):
self.name = name
self.size = size
self.part = part
... |
utils_test.py | from __future__ import annotations
import asyncio
import copy
import functools
import gc
import inspect
import io
import logging
import logging.config
import os
import queue
import re
import shutil
import signal
import socket
import subprocess
import sys
import tempfile
import threading
import uuid
import warnings
imp... |
main_window.py | import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
import electrum
from electrum.bitcoin import TYPE_ADDRESS
from electrum import WalletStorage, Wallet
from electrum_gui.kivy.i18n import _
from electrum.paymentrequest import InvoiceStore
from electr... |
offic.py | import cv2 as cv
import time
import numpy as np
import multiprocessing as mp
from multiprocessing import Process
def st(z):
r = z[0]**2-(z[1]**2)
i = z[0]*z[1]*2
return r, i
def f(z, c):
s = st(z)
r = s[0]+c[0]
i = s[1]+c[1]
return r, i
def mon(r, i, n=100):
z = (0, 0)
c = (r, ... |
formats.py | from __future__ import print_function, division, absolute_import
import os
import stat
import struct
import sys
import tarfile
import threading
import time
import zipfile
import zlib
from contextlib import closing
from io import BytesIO
from multiprocessing.pool import ThreadPool
from .compat import Queue, on_win
fr... |
tutorial_performancesettings.py | """
mss.tutorials.tutorial_performancesettings
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This python script generates an automatic demonstration of how to change the performance of flight track in table
view such as managing fuel capacity, etc.
This file is part of mss.
:copyright: Copyright ... |
greatfet_uart.py | #!/usr/bin/env python3
#
# This file is part of GreatFET.
#
from __future__ import print_function, absolute_import
import os
import sys
import time
import queue
import select
import threading
import greatfet
from greatfet import GreatFET
from greatfet.utils import from_eng_notation, GreatFETArgumentParser
from grea... |
utils.py | import jwtoken
import threading
m3ustr = "#EXTM3U \n\n"
kodiPropLicenseType = "#KODIPROP:inputstream.adaptive.license_type=com.widevine.alpha"
def processTokenChunks(channelList):
global m3ustr
kodiPropLicenseUrl = ""
if not channelList:
print("Channel List is empty ..Exiting")
exit(1)
... |
sim.py | import copy
import inspect
import itertools
from functools import partial
import numpy as np
import os
import random
import threading
import time as ttime
import uuid
import weakref
import warnings
from collections import deque, OrderedDict
from tempfile import mkdtemp
from .signal import Signal, EpicsSignal, EpicsS... |
iptables_cmd_invoke.py | import os
import time
import json
import socket
import requests
import threading
import pandas as pd
from configparser import ConfigParser
start_global = 0.0
api_invoke_add = []
api_invoke_delete = []
rule_apply = []
total_time = []
global_time = []
type_test = []
def change_format_float_list(old_list):
new_lis... |
net_engine.py | import marshal
import random
import select
import socket
import threading
import time
import urllib.error
import urllib.request
import stun
import env
def poll(sock):
return select.select([sock], [], [], 0)[0] != []
def any_actions(actions):
return any(acts for _, acts in actions)
class NetEngine:
late... |
oclogs.py | #!/usr/bin/env python3
import logging
import os
import json
import arrow
import requests
import crayons
import click
import time
import random
from threading import Thread
try:
from slackclient import SlackClient
except Exception:
pass
logging.basicConfig()
COLOR_KEYS = ('red', 'green', 'blue', 'yellow', '... |
bot.py | """
AUTO_BOT bot file
Developers: Andrey Kozlovsky, Stanislav Ermokhin
License information for external libraries is provided in a separate text file.
"""
import datetime
import schedule
import time
import telebot
from telebot import types
from threading import Thread
from config import API_TELEGRAM_TOKEN as TOKE... |
scrubdash.py | #!/usr/bin/env python3
"""
This module contains the entry point for the CLI script and the PyPI
console script
"""
import argparse
import yaml
import logging
from multiprocessing import Process, Queue
from scrubdash.asyncio_server.asyncio_server import AsyncioServer
from scrubdash.dash_server.dash_server import star... |
test_ftplib.py | """Test script for ftplib module."""
# Modified by Giampaolo Rodola' to test FTP class, IPv6 and TLS
# environment
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 unittest import Test... |
environment.py | # coding: utf-8
from user_service import app, init_app
import threading
from sqlalchemy import create_engine
from user_service.core import BaseModel
from user_service import db
from user_service.models import User
from user_service.tests.integration.config import basedir
import os
# Tornado imports
from tornado.wsgi im... |
shell.py | import sys
import shlex
import os
from multiprocessing import Process
SHELL_STATUS_RUN = 0
SHELL_STATUS_STOP = 1
def tokenize(string) :
return shlex.split(string)
def run_proc(name):
print('运行子进程%s(%s)......'%(name,os.getpid()))
def execute(cmd_tokens) :
p = Process(target=run_proc,args=(cmd_tokens[0],)... |
connection_test.py | import demistomock as demisto
from Active_Directory_Query import main
import socket
import ssl
from threading import Thread
import time
import os
import pytest
import json
from IAMApiModule import *
from unittest.mock import patch
BASE_TEST_PARAMS = {
'server_ip': '127.0.0.1',
'secure_connection': 'None',
... |
scripts.py | import netaddr
from scapy.all import *
import time
import threading
import paramiko
linux_host = []
lock = threading.Lock()
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
def find_linux_hosts(ip_addr):
''' this function will use scapy to send packet to destination hos... |
test_wrapper.py | # Copyright 2017 The Nuclio Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... |
run_enso.py | #! /usr/bin/env python
# vim:set tabstop=4 shiftwidth=4 expandtab:
# -*- coding: utf-8 -*-
__updated__ = "2019-05-14"
import atexit
atexit_register = atexit.register
atexit_functions = []
def my_atexit_register(func, *args, **kwargs):
global atexit_functions
atexit_functions.append((func, args, kwargs))
... |
initialize_nodes.py | from http.server import HTTPServer
from node import get_handler
from threading import Thread
import time
import requests
# The condition argument is for you to know when everything is running
def do_stuff(host, nodes, edges, condition_ready=None, condition_done=None):
servers = list(HTTPServer((host, port), get_h... |
algo_six.py | from functools import reduce
import numpy as np
import random as r
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 psutil
from netifaces import interfaces, ifaddresses, AF_INET
import paho.mqtt.client as mqtt... |
fake.py | # This file is Copyright (c) 2010 by the GPSD project
# BSD terms apply: see the file COPYING in the distribution root for details.
"""
gpsfake.py -- classes for creating a controlled test environment around gpsd.
The gpsfake(1) regression tester shipped with GPSD is a trivial wrapper
around this code. For a more int... |
train.py | #!/usr/bin/env python
"""Train models."""
import os
import signal
import torch
import onmt.opts as opts
import onmt.utils.distributed
from onmt.utils.logging import logger
from onmt.train_single import main as single_main
from onmt.utils.parse import ArgumentParser
def main(opt):
ArgumentParser.validate_train_o... |
runCtaTrading.py | # encoding: UTF-8
import sys
reload(sys)
sys.setdefaultencoding('utf8')
import multiprocessing
from time import sleep
from datetime import datetime, time
from vnpy.event import EventEngine2
from vnpy.trader.vtEvent import EVENT_LOG
from vnpy.trader.vtEngine import MainEngine, LogEngine
from vnpy.trader.gateway impor... |
debugger_v2_plugin_test.py | # Copyright 2019 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... |
webstreaming.py | """
Web based Sign Language Predictor
USAGE:
python webstreaming.py --ip 127.0.0.1 --port 8000
"""
# import all the necessary packages
from ClassifierNet import Net
from imutils.video import VideoStream
from flask import Response
from flask import Flask
from flask import render_template
import threading
import argpa... |
thread_05_1.py | import threading
Q=1000000
thread_list = []
def drink(max):
global Q
for i in range(0, max):
Q-=1
for i in range(0, 2):
thread_inst = threading.Thread(target=drink, args=(500000,))
thread_list.append(thread_inst)
thread_inst.start()
for thread in thread_list:
thread.join()
print(Q) |
launch_experiment.py | import argparse
from datetime import datetime
import itertools
import multiprocessing
import os
import random
import sys
import time
import doodad as dd
import doodad.mount as mount
from doodad.easy_sweep.hyper_sweep import run_sweep_doodad, Sweeper
import doodad.easy_sweep.launcher as launcher
from experiment_utils ... |
bazel_build.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2016 The Tulsi 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/LICE... |
main.py | from pymodbus.client.sync import ModbusTcpClient
import sys
import time
from time import gmtime, strftime
import signal
import threading
import pandas as pd
import logging
logging.basicConfig()
log = logging.getLogger()
log.setLevel(logging.INFO)
class ProccessControlMonitor(object):
def __init__(self):
e = En... |
main.py | # -----------------------------------------------------------
# Keroline Voice Assistant
#
# This module implements the functionality of the assistant
#
# Text_input() or voice_input is called from app.py then in search_command
# starts searching by keywords and the required method is called from classes
# Commands an... |
contextutil.py | # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import logging
import os
import shutil
import signal
import sys
import tempfile
import termios
import threading
import time
import uuid
import zipfile
from contextlib import closing, conte... |
spam.py | import requests
import csv
import random
import datetime
import threading
names = []
with open("data/names.csv", newline='') as f:
for l in csv.reader(f, delimiter=','):
names.append(l[0])
passwords = []
with open("data/passwords.csv", newline='') as f:
for l in csv.reader(f, delimiter=','):
p... |
main_class_based_backup.py | #!/usr/bin/python
import time
import threading
import time
import nmap
import multiprocessing
import os
import sys
import ConfigParser
#import mysql.connector
import MySQLdb
import atexit
import IPtable
import texttable as tt
import Simple_Logger
r = '\033[31m' #red
b = '\033[34m' #blue
g = '\033[32m' #green
y =... |
OSCSceneController.py | import yaml
import sys
import os
from threading import Timer, Thread
from pythonosc import osc_server, dispatcher, udp_client
import itertools
import argparse
import datetime
import time
parser = argparse.ArgumentParser(description='Route OSC packets corresponding to scenes')
parser.add_argument('--no-gui', action='st... |
tts.py | import time
import pyttsx3
import queue
from threading import Thread
# using pyttsx3 for voices
# more info at: https://github.com/nateshmbhat/pyttsx3
class TalkBot:
def __init__(self, config=None):
if config is None:
config = {}
self.engine = pyttsx3.init()
self.engine.set... |
server.py | import os
import urllib
import posixpath
from abc import ABCMeta, abstractmethod
from threading import Thread
from SocketServer import ThreadingTCPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
from ModExternalMinimap.lib.websocket_server import WebsocketServer
class ConcurrentServer(object):
__me... |
runner.py | # -*- coding: utf-8 -*-
#
# Finite State Machine
#
# Written in 2021 by Moky <albert.moky@gmail.com>
#
# ==============================================================================
# MIT License
#
# Copyright (c) 2021 Albert Moky
#
# Permission is hereby granted, free of charge, to a... |
nb_inventory.py | # Copyright (c) 2018 Remy Leone
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = """
name: nb_inventory
plugin_type: inventory
author:
- Remy Leone (@s... |
qt_visualizer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Visualize the drone position using SPIRIT.
"""
from __future__ import division
from collections import deque
import os
import time
import threading
import numpy as np
from OpenGL import GL, GLU, GLUT
from PyQt5 import QtGui
import pygame as pg
import rospkg
import ... |
basicswap.py | # -*- coding: utf-8 -*-
# Copyright (c) 2019-2022 tecnovert
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
import os
import re
import sys
import zmq
import json
import time
import base64
import random
import shutil
import struct... |
base.py | import ast
import os
import time
import atexit
from logging import StreamHandler
from logging.handlers import SocketHandler
import threading
import warnings
from terra import settings
import terra.compute.utils
from terra.executor import Executor
from terra.logger import (
getLogger, LogRecordSocketReceiver, SkipStd... |
activity.py | # -*- coding: utf-8 -*-
"""
Activity
========
Activities are self generated classes to which you can pass an identifier,
and a list of tasks to perform. The activities are in between the decider and
the tasks.
For ease, two types of task runners are available: Sync and Async. If
you need something more specific, you ... |
tree-height.py | # python3
import sys
import threading
sys.setrecursionlimit(10**7) # max depth of recursion
threading.stack_size(2**27) # new thread will get stack of such size
class TreeHeight:
def read(self):
self.n = int(sys.stdin.readline())
self.parent = list(map(int, sys.stdin.readline().split... |
test_asyncore.py | import asyncore
import unittest
import select
import os
import socket
import sys
import time
import warnings
import errno
from test import support
from test.support import TESTFN, run_unittest, unlink
from io import BytesIO
from io import StringIO
try:
import threading
except ImportError:
threading = None
HO... |
dvrk_mtm_test.py | #!/usr/bin/env python
# Author: Anton Deguet
# Date: 2017-07-22
# (C) Copyright 2017-2022 Johns Hopkins University (JHU), All Rights Reserved.
# --- begin cisst license - do not edit ---
# This software is provided "as is" under an open source license, with
# no warranty. The complete license can be found in licen... |
context.py | import argparse
import atexit
import datetime
import logging
import os
import shlex
import signal
import sys
import threading
import time
from typing import Dict, Optional
import requests
from monitoring.monitorlib import ids, rid, scd, versioning
from monitoring.tracer.resources import ResourceSet
ENV_OPTIONS = 'T... |
cpuinfo.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Copyright (c) 2014-2021 Matthew Brennan Jones <matthew.brennan.jones@gmail.com>
# Py-cpuinfo gets CPU info with pure Python 2 & 3
# It uses the MIT License
# It is hosted at: https://github.com/workhorsy/py-cpuinfo
#
# Permission is hereby granted, free of charge, to any... |
test_double_spend.py | # Copyright BigchainDB GmbH and BigchainDB contributors
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
# Code is Apache-2.0 and docs are CC-BY-4.0
# # Double Spend testing
# This test challenge the system with double spends.
import os
from uuid import uuid4
from threading import Thread
import queue
import big... |
rdma.py | # Windows Azure Linux Agent
#
# Copyright 2016 Microsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... |
test_ctypes.py | from ctypes import *
import sys
import threading
import numpy as np
from numba import unittest_support as unittest
from numba.compiler import compile_isolated
from numba import jit, types, errors
from numba.typing import ctypes_utils
from .support import MemoryLeakMixin, tag, TestCase
from .ctypes_usecases import *
... |
uavcan_ip_interface.py | #!/usr/bin/env python3
"""
UAVCAN to TUN network adapter.
"""
import argparse
import os
import struct
import sys
import fcntl
import uavcan
import subprocess
import time
import logging
from queue import Queue, Empty
import threading
DSDL_DIR = os.path.join(os.path.dirname(__file__), "../uavcan_data_types/cvra")
def... |
alert_events.py | import pika
import json
import iot_logging
from threading import Thread
from datetime import datetime
import boto3
from flask import render_template
from flask_mail import Message
from iot_api import app
from iot_api import mail
from iot_api import rabbit_parameters
from iot_api.user_api.model import User, Alert, Al... |
scratch_to_bot.py | #! /usr/bin/python
# Connect to Scratch, read any broadcasts and handle any that are intended for the Camera bot
import time
import py_websockets_bot
import scratch
import time
import socket
import platform
import subprocess
import psutil
import threading
import logging
logging.basicConfig(level=logging.DEBUG,
... |
stim_thread.py | from time import time, sleep
from ble_client import StimClient
from threading import Thread
from multiprocessing import Process, Manager
CHUNK_SIZE = 20 # samples
STIM_FREQUENCY = 20 # Hz
STIM_PERIOD = 1 / STIM_FREQUENCY
class StimThread(Thread):
def run(self):
"""
Play stim by buffering & send... |
test_pye_performance.py | # Copyright 2015 Falldog Hsieh <falldog7@gmail.com>
# Modifications copyright 2021 Andrey Martyanov <andrey@martyanov.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 a copy of the License at
#
# http://www.a... |
dispatcher.py | # Copyright (c) 2019-2020 SAP SE or an SAP affiliate company. All rights reserved. This file is
# licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the L... |
client.py | import socket
from threading import Thread
def send():
while True:
message = input()
conn.send(message.encode('utf-8'))
def get():
while True:
data = conn.recv(16384)
data = data.decode('utf-8')
print(data)
conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
co... |
rocket.py | # -*- coding: utf-8 -*-
# This file is part of the Rocket Web Server
# Copyright (c) 2011 Timothy Farrell
# Modified by Massimo Di Pierro
# Import System Modules
from __future__ import print_function
import sys
import errno
import socket
import logging
import platform
from gluon._compat import iteritems, to_bytes, St... |
tee_popen.py | # -*- coding: utf-8 -*-
# TeePopen is a reader from stdout and stderr of subprocess.Popen into
# pipes to return to ansible and into unix socket to send to werf logger (logboek).
#
# stdout from subprocess.Popen (original_popen)
# |
# | looped read by TeeSplitter and write into 2 streams:
# ↓--------------------------... |
wxagent.py | # encoding=utf-8
from multiprocessing.connection import Listener
from threading import Thread
import itchat
from itchat.content import TEXT
import pdb
import json
import re
import urllib
import urllib2
from conf import WECHATGROUP, SDPURL, SDPAPIKEY, OPMURL, OPMAPIKEY, LISTENERHOST, LISTENERPORT, TULINGKEY
address = ... |
test_search.py | import time
import pdb
import copy
import logging
from multiprocessing import Pool, Process
import pytest
import numpy as np
from pymilvus import DataType
from utils.utils import *
from common.constants import *
uid = "test_search"
nq = 1
epsilon = 0.001
field_name = default_float_vec_field_name
binary_field_name = d... |
tasks.py | import contextlib
import shutil
import threading
import time
from .colors import CYAN, GREEN, RED, YELLOW
from ..utils.threading import ExceptionalThread
UP_ONE = "\033[A\033[1000D"
CLEAR_LINE = "\033[2K"
console_lock = threading.Lock()
class Task:
"""
Something that can be started (by being created), hav... |
train_pg.py | import numpy as np
import tensorflow as tf
import gym
import logz
import scipy.signal
import os
import time
import inspect
from multiprocessing import Process
#============================================================================================#
# Utilities
#====================================================... |
test_capi.py | # Run the _testcapi module tests (tests for the Python/C API): by defn,
# these are all functions _testcapi exports whose name begins with 'test_'.
from collections import OrderedDict
import os
import pickle
import random
import re
import subprocess
import sys
import textwrap
import threading
import time
import unitt... |
server.py | from flask import Flask, render_template
from flask_socketio import SocketIO
import dronekit
import sys
import socket
import threading
import time
import signal
# Allow us to reuse sockets after the are bound.
# http://stackoverflow.com/questions/25535975/release-python-flask-port-when-script-is-terminated
socket.sock... |
test_local_task_job.py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... |
echo_02_threads.py | # echo_02_threads.py
import socket
import threading
def run_server(host='127.0.0.1', port=55555):
sock = socket.socket()
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.bind((host, port))
sock.listen()
while True:
client_sock, addr = sock.accept()
print('Connection... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.