source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
pydualsense.py |
# needed for python > 3.8
import os, sys
from sys import platform
if platform.startswith('Windows') and sys.version_info >= (3,8):
os.add_dll_directory(os.getcwd())
import hidapi
from .enums import (LedOptions, PlayerID, PulseOptions, TriggerModes, Brightness, ConnectionType) # type: ignore
import threading
clas... |
maderad.py |
import logging
import os
import platform
import subprocess
import sys
import tempfile
import time
import random
import string
import multiprocessing
import traceback
import jinja2
import click
from madera.consumer.topic_watcher import launch
class Process(multiprocessing.Process):
def __init__(self, *args, **k... |
wait.py | #
# Copyright 2016-2021 Razorbill Instruments Ltd.
# This file is part of the Razorbill Lab Python library which is
# available under the MIT licence - see the LICENCE file for more.
#
"""
Various functions for waiting for some condition to be true before continuing
the experiment. If the calling code is running in a ... |
test_client.py | import asyncio
import base64
import contextlib
import json
import os
import signal
import string
import subprocess
import tempfile
import threading
import time
import unittest.mock
import urllib.parse
import grpclib
import pytest
import tenacity
import aetcd3.exceptions
import aetcd3.rpc as rpc
import aetcd3.utils as... |
tree.py | import os, threading
import tkinter.ttk as ttk
import tkinter as tk
class Tree(ttk.Treeview):
def __init__(self, master, double_click=None, single_click=None, startpath=None, *args, **kwargs):
super().__init__(master, *args, **kwargs)
self.master = master
self.base = master.base
se... |
test_InfluxDBClient.py | import http.server
import json
import os
import threading
import unittest
from influxdb_client import InfluxDBClient, Point
from influxdb_client.client.write_api import SYNCHRONOUS, ASYNCHRONOUS, WriteOptions, WriteType
class InfluxDBClientTest(unittest.TestCase):
def tearDown(self) -> None:
if self.cli... |
multi_client.py | """Run the client an N processes"""
import os
from multiprocessing import Process
import single_client
from utils.helpers import str_to_int
FF_ID = str_to_int(os.environ['FIRST_FRAME_ID'])
LF_ID = str_to_int(os.environ['LAST_FRAME_ID'])
F_IDS = list(range(FF_ID, LF_ID))
PROCESSES_COUNT = str_to_int(os.environ['PROCES... |
cli.py | # -*- coding: utf-8 -*-
"""
flask.cli
~~~~~~~~~
A simple command line application to run flask apps.
:copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details.
"""
from __future__ import print_function
import ast
import inspect
import os
import platform
import re
import... |
login.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Dusan Klinec, ph4r05, 2018
import requests
import argparse
import time
import re
import os
import logging
import coloredlogs
import threading
from requests.auth import HTTPBasicAuth
from fadmin.trace_logger import Tracelogger
from fadmin import shell_ping
logge... |
darknet2.py | #!python3
'''
##############################
### Receive Video stream #####
### from Android client #######
### Use yolo to do detect ####
## (return a message to the mobile device) ##
##############################
'''
from ctypes import *
import math
import random
import os
import socket
import time
import cv2
impor... |
PC_Miner.py | #!/usr/bin/env python3
"""
Duino-Coin Official PC Miner 2.75 © MIT licensed
https://duinocoin.com
https://github.com/revoxhere/duino-coin
Duino-Coin Team & Community 2019-2021
"""
from time import time, sleep, strptime, ctime
from hashlib import sha1
from socket import socket
from multiprocessing import L... |
main.py | import warnings
warnings.simplefilter('ignore')
import serial
import sys
from multiprocessing import Value, Process
from run_webcam import openpose_start
from mapping import mapping
# プロセス1 ... 関節位置の取得
# プロセス2 ... マッピング & シリアル通信
password = str(input("Password : "))
if password != "Hello, Mr.CoBOT.":
print("INVA... |
coinbaseproWebSocket.py | import cbpro
from decimal import *
import logging
import sys
import dateutil.parser
import time
from multiprocessing import Process, Event
# Init logger
logger = logging.getLogger('coinbaseproTestLogger')
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler(sys.stdout)
ch.setLevel(logging.DEBUG)
formatter = loggi... |
coap.py | import logging.config
import random
import socket
import struct
import threading
import xml.etree.ElementTree as ElementTree
import os
import re
from coapthon import defines
from coapthon.client.helperclient import HelperClient
from coapthon.layers.blocklayer import BlockLayer
from coapthon.layers.cachelayer import C... |
athenad.py | #!/usr/bin/env python3
import base64
import hashlib
import io
import json
import os
import queue
import random
import select
import socket
import threading
import time
from collections import namedtuple
from functools import partial
from typing import Any
import requests
from jsonrpc import JSONRPCResponseManager, dis... |
data_utils.py | # Copyright 2018 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... |
better_pics_from_google.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys, os, re, io
import requests, queue, threading
from PIL import Image
# Using google script seeks better quality copies of given images.
# Parses given dir with images, seeks similar with google and if there is a similar enough pic with bigger width, script repl... |
__init__.py | import os
import pathlib
import subprocess
from pathlib import Path
from queue import Queue
from threading import Thread
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from uvicorn import Config, Server
from jina import __version__, __resources_path__
from jina.logging.logger import Ji... |
gaussian_device_manager.py | import cupy as cp
import numpy as np
import sys
from threading import Event, Thread
from typing import List, Tuple, Callable
from gpucsl.pc.helpers import transform_to_pmax_cupy, postprocess_pmax_cupy, timed
from gpucsl.pc.kernel_management import Kernels
WorkerFunction = Callable[
[int, "GaussianDeviceManager"],... |
btmaketorrentgui.py | #!/usr/bin/env python
# Written by Bram Cohen
# modified for multitracker by John Hoffman
# see LICENSE.txt for license information
from BitTornado import PSYCO
if PSYCO.psyco:
try:
import psyco
assert psyco.__version__ >= 0x010100f0
psyco.full()
except:
pass
from sys import a... |
daemon_test.py | import os
import json
import time
import threading
import pytest
from wampy.peers import Client
from tuxeatpi_common.cli import main_cli, set_daemon_class
from tuxeatpi_nlu_nuance.daemon import NLU
from tuxeatpi_common.message import Message
from click.testing import CliRunner
def shutdown(self):
super(NLU, se... |
ultimate.py | # -*- coding: utf-8 -*-
import os
import sys
import threading
import time
from glob import glob
import config
sys.path.append(os.path.join(sys.path[0], "../../"))
import schedule # noqa: E402
from instabot import Bot, utils # noqa: E402
bot = Bot(
comments_file=config.COMMENTS_FILE,
blacklist_file=config... |
common.py | """Test the helper method for writing tests."""
import asyncio
from collections import OrderedDict
from datetime import timedelta
import functools as ft
import json
import os
import sys
from unittest.mock import patch, MagicMock, Mock
from io import StringIO
import logging
import threading
from contextlib import contex... |
__init__.py | #
# Copyright 2013-2015 eNovance <licensing@enovance.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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
serve.py | # 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 required by appli... |
main_window.py | import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
from electrum_atom.bitcoin import TYPE_ADDRESS
from electrum_atom.storage import WalletStorage
from electrum_atom.wallet import Wallet
from electrum_atom.paymentrequest import InvoiceStore
from elec... |
plugin.py | # DSC/Honeywell EnvisaLink 3 & 4 Alarm interface Plugin
#
# Author: Dnpwwo & Wagner Oliveira, 2019
#
"""
<plugin key="EnvisaLink" name="DSC/Honeywell Alarm via EnvisaLink" author="dnpwwo & Wagner Oliveira" version="3.0" wikilink="https://github.com/guino/Domoticz-DSCEnvisalink-Plugin" externalli... |
oits_runner.py | from django.core.management.base import BaseCommand
from django.conf import settings
from oits_params.models import OitsParams
from results_viewer.models import TrajectoryResult
from pathlib import Path
from multiprocessing import Process
import json
import os
import sys
import time
import zipfile
class Command(BaseCo... |
test_server.py | import asyncio
import json
import os
import time
import urllib.parse
import uuid
from contextlib import ExitStack
from http import HTTPStatus
from multiprocessing import Process, Manager
from multiprocessing.managers import DictProxy
from pathlib import Path
from typing import List, Text, Type, Generator, NoReturn, Dic... |
tl_detector.py | #!/usr/bin/env python
import rospy
from std_msgs.msg import Int32
from geometry_msgs.msg import PoseStamped, Pose
from styx_msgs.msg import TrafficLightArray, TrafficLight
from styx_msgs.msg import Lane
from sensor_msgs.msg import Image
from cv_bridge import CvBridge
from light_classification.tl_classifier import TLCla... |
hltv.py | # Most of this script came from https://scorebot-secure.hltv.org/scorebotClientApi.js?v5, property of HLTV.org
# This is just a simple Telegram bot querying their data, publicly available @ HLTV.org during matches.
from socketIO_client import SocketIO # instale "socketIO-client" via pip pra funcionar
from reborn ... |
dag_processing.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
#... |
rse.py | # Copyright 2014-2018 CERN for the benefit of the ATLAS collaboration.
#
# 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... |
z_train_abstractive.py | #!/usr/bin/env python
"""
Main training workflow
"""
from __future__ import division
import argparse
import glob
import os
import random
import signal
import time
import torch
from pytorch_transformers import BertTokenizer
import distributed
from models import data_loader, model_builder
from models.data_loader i... |
sync.py | #
# Copyright (C) 2008 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... |
main_window.py | import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
import asyncio
from typing import TYPE_CHECKING, Optional, Union, Callable, Sequence
from electrum.storage import WalletStorage, StorageReadWriteError
from electrum.wallet_db import WalletDB
from el... |
test_partition.py | import threading
import time
from multiprocessing import Pool, Process
import pytest
from utils import utils as ut
from common.constants import default_entities, default_fields
from common.common_type import CaseLabel
from utils.util_log import test_log as log
TIMEOUT = 120
default_nb = ut.default_nb
default_tag = ut.... |
worker.py | import attr
from threading import Thread, Event
from time import time
from ....config import deferred_config
from ....backend_interface.task.development.stop_signal import TaskStopSignal
from ....backend_api.services import tasks
class DevWorker(object):
prefix = attr.ib(type=str, default="MANUAL:")
report... |
hdl_listener.py | import asyncio
import threading
import logging
import hdl_component
logger = logging.getLogger(__name__)
class HDLListener(asyncio.DatagramProtocol):
def __init__(self, host, port, components_ctl):
self.transport = None
self.host = host
self.port = port
self.components_ctl = com... |
http.py | import socket
import requests
from lxml.html import fromstring
import datetime
import sys
import ipaddress
import threading
import os
BLUE, RED, WHITE, YELLOW, MAGENTA, GREEN, END = '\33[1;94m', '\033[1;91m', '\33[1;97m', '\33[1;93m', '\033[1;35m', '\033[1;32m', '\033[0m'
class ThreadManager(object):
i = 0
d... |
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... |
test_redundant_router.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 u... |
test_vyos_rebooting_create_vm.py | '''
Test for tracking http://dev.zstack.io/browse/ZSTAC-5595
@author: SyZhao
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.operations.node_operations as node_ops
import zstackwoodpecker.z... |
example4-quees.py | import threading
import time
import queue
from datetime import datetime
# vytvoření fronty
q = queue.Queue()
# simulace konzumenta
def consumer():
while True:
job = q.get()
print(f'Starting consuming {job} [{datetime.utcnow().strftime("%H:%M:%S.%f")[:-3]}]')
time.sleep(0.4)
print(... |
periodic_auto_refresh.py | # Copyright 2020 Google LLC
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
"""
The code in this file provides a drop-in replacement for spanner_v1.Transaction,
but one that auto-refreshes every 8.5 se... |
supervisor.py | from .execute import *
from .constants import REMOTEBOT_PORT
from multiprocessing import Process
import bz2
import asyncio
import marshal
current_process = None
def __dummy__():
print("Dummy code, should not see")
pass
def run_routine(payload):
try:
echo.__ip__ = payload["monitor_ip"]
ec... |
jsonrpc.py | """
Copyright (c) 2016 Sourcegraph
Copyright (c) 2019 Seven Bridges. See LICENSE
This code is assembled and reorganized
Retrieved from: https://github.com/sourcegraph/python-langserver/blob/master/langserver/jsonrpc.py
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and a... |
artifact_service.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 use ... |
tktasks.py | #!/usr/bin/env python
"""Desktop Tasks app using Tkinter.
This uses a background thread to be notified of incoming changes.
It demonstrates, among others:
- How to call await() in a loop in a background thread efficiently:
Use make_cursor_map() to feed the 'deltamap' return value back
into the 'datastores' param... |
testMarshal.py | """Testing pasing object between multiple COM threads
Uses standard COM marshalling to pass objects between threads. Even
though Python generally seems to work when you just pass COM objects
between threads, it shouldnt.
This shows the "correct" way to do it.
It shows that although we create new threads to use the ... |
dirichlet_distributions.py | """Statistical Manifold of Dirichlet distributions with the Fisher metric."""
import logging
import math
import multiprocessing
from scipy.integrate import odeint
from scipy.integrate import solve_bvp
from scipy.stats import dirichlet
import geomstats.backend as gs
import geomstats.errors
from geomstats.algebra_util... |
server_tests.py | #!/usr/bin/python2.7
# Copyright 2012 Google 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 ... |
main BETA.py | import serial # For Bluetooth
from nanpy import (ArduinoApi, SerialManager) # For Arduino
import RPi.GPIO as GPIO # For Raspberry Pi
from threading import Thread
from time import sleep, time
import os
# Bluetooth Serial Conniction
ser = serial.Serial('/dev/ttyS0', 9600, timeout = 0)
# Arduino Nanpy Conniction
connect... |
test_profile.py | from __future__ import annotations
import dataclasses
import sys
import threading
from collections.abc import Iterator, Sequence
from time import sleep
import pytest
from tlz import first
from distributed.compatibility import WINDOWS
from distributed.metrics import time
from distributed.profile import (
call_sta... |
__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Han Xiao <artex.xh@gmail.com> <https://hanxiao.github.io>
import sys
import threading
import time
import uuid
import warnings
from collections import namedtuple
from functools import wraps
import numpy as np
import zmq
from zmq.utils import jsonapi
__all__ = ['__versio... |
ssh_utils.py | #!/usr/bin/env python
#
# Copyright (c) Greenplum Inc 2008. All Rights Reserved.
#
# This file contains ssh Session class and support functions/classes.
import cmd
import os
import sys
import socket
import threading
from gppylib.commands.base import WorkerPool, REMOTE, ExecutionError
from gppylib.commands.unix import ... |
test_deadlock.py | from fast_map import fast_map
from threading import Thread, Lock
import time
def f(x):
global lock_G
print('f entered with x =', x)
with lock_G:
print('lock_G was acquired, x =', x)
time.sleep(1)
return x
def release_lock_after_delay(lock):
time.sleep(1)
lock.release()
lock_G... |
Action.py | import time
from modules.base.Configuration import *
from modules.base.Instances import *
from plugins.dfplayer.Platform import Platform
import threading
@configuration
class DFPlayerActionConfiguration(ActionConfiguration):
'''Configuration settings for the DFPlayer'''
@validator('platform')
def check_p... |
generate_tolerance_label.py | """ Tolerance label generation.
Author: chenxi-wang
"""
import os
import sys
import numpy as np
import time
import argparse
import multiprocessing as mp
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT_DIR = os.path.dirname(BASE_DIR)
sys.path.append(os.path.join(ROOT_DIR, 'utils'))
from data_utils impor... |
client.py | #!/usr/bin/env python3
# Hydrus is released under WTFPL
# You just DO WHAT THE FUCK YOU WANT TO.
# https://github.com/sirkris/WTFPL/blob/master/WTFPL.md
try:
if True:
import sys
print(f"In venv?: {hasattr(sys, 'real_prefix') or sys.base_prefix != sys.prefix}")
import locale
try: ... |
reader.py | # Copyright (c) 2019 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 required by appli... |
PiVideoStream.py | """
Additional driver intallation (V4L2)
Execute in the terminal:
sudo modprobe bcm2835-v4l2
"""
# import the necessary packages
from picamera.array import PiRGBArray
from picamera import PiCamera
from threading import Thread
import cv2
class PiVideoStream:
def __init__(self, resolution = (480, 320), framerate=32... |
learner.py | from typing import Tuple
import glob
import os
import shutil
import signal
import threading
import time
from collections import OrderedDict, deque
from os.path import join
from queue import Empty, Queue, Full
from threading import Thread
import numpy as np
import psutil
import torch
from torch.nn.utils.rnn import Pack... |
base_test.py | # -*- coding: utf-8 -*-
import copy
import datetime
import json
import threading
import elasticsearch
import mock
import pytest
from elasticsearch.exceptions import ConnectionError
from elasticsearch.exceptions import ElasticsearchException
from elastalert.enhancements import BaseEnhancement
from elastalert.enhanceme... |
common_xmr.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2020-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 sys
import json
import shutil
import signal
import logging
import unittest
import... |
run_ensemble.py | from elegantrl.train.run_parallel import *
from elegantrl.train.run_tutorial import *
import random as rd
'''run.py'''
def train_and_evaluate_em(args): # keep
args.init_before_training() # necessary!
args_cwd = args.cwd
process = list()
mp.set_start_method(method='spawn', force=True) # force all t... |
tpgarchivingwidget.py | #!/usr/bin/env python
#############################################################################
##
# This file is part of Taurus
##
# http://taurus-scada.org
##
# Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
##
# Taurus is free software: you can redistribute it and/or modify
# it under the terms of t... |
Binance_Detect_Moonings.py | """
Disclaimer
All investment strategies and investments involve risk of loss.
Nothing contained in this program, scripts, code or repositoy should be
construed as investment advice.Any reference to an investment's past or
potential performance is not, and should not be construed as, a recommendation
or as a guarantee... |
main.py | import random
import threading
import time
import kbInput
import puzzle
import Gesture_Detector
import GD2
from Sound_Manager import Sound_Manager
Game = None
class Game2048():
def __init__(self):
self.gesture = None
self.new_gesture_flag = False
self.flag = False
self.GD = None
... |
test_ssl.py | # Test the support for SSL and sockets
import sys
import unittest
import unittest.mock
from test import support
from test.support import import_helper
from test.support import os_helper
from test.support import socket_helper
from test.support import threading_helper
from test.support import warnings_helper
import sock... |
pickletester.py | import collections
import copyreg
import dbm
import io
import functools
import os
import math
import pickle
import pickletools
import shutil
import struct
import sys
import threading
import unittest
import weakref
from textwrap import dedent
from http.cookies import SimpleCookie
try:
import _testbuffer
except Impo... |
close_btn.py | import imghdr
import multiprocessing as mp
import os
import random
import uuid
import numpy as np
import requests
import torch
import yaml
from PIL import Image, ImageOps
from torchvision.transforms import transforms
from datasets.utils import get_transform
from tools.progbar import progbar
class CloseButton:
d... |
main.py | from tkinter.ttk import Progressbar
from tkinter import scrolledtext
from tkinter import filedialog
from tkinter import ttk
from tkinter import *
from methods import *
import methods
import threading
# init window #
window = Tk()
window.title("Whatsend v0.3 - prerelease") #window name
window.resizable(False, F... |
foo.py | # Python 3.3.3 and 2.7.6
# python fo.py
from threading import Thread
# Potentially useful thing:
# In Python you "import" a global variable, instead of "export"ing it when you declare it
# (This is probably an effort to make you feel bad about typing the word "global")
i = 0
def incrementingFunction():
glob... |
weblinks.py | from flask import Flask, request
from threading import Thread
import re
import json
import pymongo
import os
username = os.environ["DB_USERNAME"]
password = os.environ["DB_PASSWORD"]
database = f"mongodb+srv://{username}:{password}@cluster0.buvu1.mongodb.net/database?retryWrites=true&w=majority"
database = pymongo.Mon... |
daysim_direct_exe.py | import os
import pandas as pd
import math
import multiprocessing
import shutil
import time
import csv
import ntpath
from OCC import BRepGProp, GProp, TopoDS, BRep
from OCC.StlAPI import StlAPI_Reader
from OCCUtils import Topology
from pyliburo import gml3dmodel
from interface2py3d import pyptlist_frm_occface
import p... |
expo.py | """
GPS DEMONSTRATION
v.1
written by: Manuel Dionne
credit to: the internet
"""
import pyglet
from pyglet.gl import *
from pyglet.window import key
from pyglet.window import mouse
import primitives
import sys
import threading
import socket
from decimal import *
from threading import Thread
from utils i... |
benchmark.py | #!/usr/bin/env python
# Python benchmark for gamq
import time
import socket
import threading
# Global variables
HostAddress = "localhost"
HostPort = 48879
Protocol = ""
AckMessages = False
NumberOfMessages = 0
# Helper function to check if a number is valid
def isNumber(givenObject):
try:
int(givenObjec... |
nvvl_eval.py | if __name__ == '__main__':
from torch.multiprocessing import set_start_method
set_start_method('spawn', force=True)
import argparse
import os
import torch
import torch.nn as nn
import torch.optim as optim
from torch.autograd import Variable
from rbpn import Net as RBPN
from functools import red... |
refseq_importerServer.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... |
zap_curve_auth.py | import os
import tempfile
import threading
import time
from signal import SIGINT, SIGTERM, signal
from agents import Agent, Message
class NotificationBroker(Agent):
def setup(
self,
name=None,
pub_address=None,
sub_address=None,
private_key=None,
client_certificate... |
app_test.py | #!/usr/bin/python3
# Start a Qt application, and use an asynchronous thread to "click" on the GUI.
import time
import threading
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QLabel, QWidget, QHBoxLayout, QVBoxLayout, QPushButton, QApplication
from picamera2.previews.qt import QGlPicamera2
f... |
email.py | from flask_mail import Message
from flask import current_app
from app import mail
from threading import Thread
def send_async_email(app, msg):
with app.app_context():
mail.send(msg)
def send_email(subject, sender, recipients, text_body):
msg = Message(subject, sender=sender, recipients=recipients)
msg.body = te... |
test_unix_events.py | """Tests for unix_events.py."""
import collections
import contextlib
import errno
import io
import os
import pathlib
import signal
import socket
import stat
import sys
import tempfile
import threading
import unittest
from unittest import mock
from test import support
from test.support import socket_helper
if sys.plat... |
plugin.py | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# --------------------------------------------------------------------------
import atexit
import gzip
import json
import multiprocessing as mp
import os
import sys
import tempfile
imp... |
test_dataloader.py | # Owner(s): ["module: dataloader"]
import math
import sys
import errno
import multiprocessing
import os
import ctypes
import faulthandler
import torch
import gc
import time
import signal
import unittest
import itertools
import warnings
import tempfile
from torch import multiprocessing as mp
from torch.utils.data impor... |
test_arrow.py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... |
radio.py | import vlc
import threading, json, os
class Radio:
def __init__(self, config):
self.radio_station_url = ''
self.radio_station_name = ''
self.backgroundthread = None
self.config = config
self.language = config["config"]['setup']['language']
self.messages = config["lan... |
server.py | import socket
import threading
import json
class ThreadedServer:
def __init__(self, config):
self.host = config["host"]
self.port = config["port"]
self.timeout = config["timeout"]
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM);
self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1);
... |
L_CameraTrack.py | # import the necessary packages
import cv2
import imutils
from threading import Thread, Lock
import time
# Async webcam
class VideoCaptureAsync:
def __init__(self, src = 0, width = 960, height = 540) :
self.stream = cv2.VideoCapture(src)
c = cv2.waitKey(10)
self.stream.set(cv2.CAP_PROP_FRAME_WIDTH, width)
se... |
pabotlib.py | # Copyright 2014->future! Mikko Korpela
#
# 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 agree... |
standalone.py | """Support for standalone client challenge solvers. """
import collections
import functools
import http.client as http_client
import http.server as BaseHTTPServer
import logging
import socket
import socketserver
import threading
from typing import List
from acme import challenges
from acme import crypto_util
logger =... |
conftest.py | import os
import random
import shutil
import threading
from textwrap import dedent
import pytest
import stbt_rig
try:
# Needed for timeout argument to wait on Python 2.7
import subprocess32 as subprocess
except ImportError:
import subprocess
@pytest.fixture(scope="function", name="tmpdir")
def fixture_... |
manager.py | #!/usr/bin/env python3
import datetime
import os
import signal
import subprocess
import sys
import traceback
from multiprocessing import Process
import cereal.messaging as messaging
import selfdrive.crash as crash
from common.basedir import BASEDIR
from common.params import Params, ParamKeyType
from common.text_window... |
doa 2.py | import pickle
import marshal
import os
import socket
import subprocess
import sys
import tempfile
import threading
class PythonFileRunner(object):
"""A class for running python project files"""
def __init__(self, pycore, file_, args=None, stdin=None,
stdout=None, analyze_data=None):
... |
server.py | import threading
import server_logic
# from logic import constrictor
# from logic import royale
# from logic import squad
# from logic import standard
# from logic.wrapped import wrapped
from logic.human.wrapped import wrapped
from threading import Thread
from classes.GameData import GameData
from flask import request
... |
other.py | #!/usr/bin/env python2.7
from flask import Flask, render_template, send_file, redirect
from flask.ext.socketio import SocketIO, send, emit
import threading
import time
import os, shutil, re
from lib import *
app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret!'
socketio = SocketIO(app)
@socketio.on('connect', ... |
test.py | #! /usr/bin/env python3
#
# Copyright 2019-2020 Garmin Ltd. or its subsidiaries
#
# 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 r... |
helper.py | import asyncio
import functools
import json
import math
import os
import random
import re
import sys
import threading
import time
import uuid
import warnings
from argparse import ArgumentParser, Namespace
from contextlib import contextmanager
from datetime import datetime
from itertools import islice
from pathlib impor... |
_channel.py | # Copyright 2016 gRPC 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 writing... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.