source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
training.py | import base64
import multiprocessing
import os
import queue
import urllib
from typing import Optional
from flask import Blueprint
from flask import jsonify
from flask import render_template
from flask import request
from flask_socketio import emit
from tools.sense_studio import project_utils
from tools.sense_studio ... |
exporter.py | #!/usr/bin/python
# vim: tabstop=4 expandtab shiftwidth=4
import argparse
import requests
import re
import time
import threading
from datetime import datetime
from os import environ
# Prometheus client library
from prometheus_client import CollectorRegistry
from prometheus_client.core import Gauge, Counter
from prome... |
py_utils.py | # Lint as: python3
# 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 ... |
collector.py | import collections
import datetime
import gzip
import json
import logging
import time
import threading
import BME280
LOG = logging.getLogger('collector')
class Device:
def __init__(self):
self.bme = BME280.BME280(
'/dev/i2c-1',
# forced mode would be better
p_mode=0x... |
__init__.py | """
Greynir: Natural language processing for Icelandic
Copyright (C) 2021 Miðeind ehf.
This software is licensed under the MIT License:
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"... |
util.py | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2011 Thomas Voegtlin
#
# 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... |
socketClient.py | import time
import socket
import threading
import posix_ipc as ipc
import sys
ADDR = "192.168.11.2"
PORT = 20220
rq = ipc.MessageQueue('/socketClientReceiveQueue', ipc.O_CREAT)
sq = ipc.MessageQueue('/socketClientSendQueue', ipc.O_CREAT)
def recv(sock):
while True:
try:
data = sock.recv(1024)... |
feature_shutdown.py | #!/usr/bin/env python3
# Copyright (c) 2018 The Bitcoin Core developers
# Copyright (c) 2010-2021 The Freicoin Developers
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of version 3 of the GNU Affero General Public License as published
# by the Free Software Foundation.
#
... |
masterControllerGUI.py | import tkinter as tk
import os
import sys
import time
import math
import pickle
import threading
import concurrent.futures
import cameraTrigger
import cameraCalibration as cc
import mocapSolver as solver
import firebase_admin
from firebase_admin import credentials
from firebase_admin import firestore
from firebase_admi... |
bbid.py | # Modification: 7/17/2019
# by: Seth Juarez (Microsoft)
# changes: This code has been modified from the original (https://github.com/ostrolucky/Bulk-Bing-Image-downloader).
# Moved bulk '__main__' code to a separate function in order to make it easily callable from other
# py... |
threading_timeout_dec.py | # -*- coding: utf-8 -*-
import sys
import threading
class TimeoutError(Exception):
pass
class KThread(threading.Thread):
"""A subclass of threading.Thread, with a kill()
method.
Come from:
Kill a thread in Python:
http://mail.python.org/pipermail/python-list/2004-May/260937.html
... |
test_run.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2019 tecnovert
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
"""
basicswap]$ python setup.py test
Run one test:
$ python setup.py test -s tests.basicswap.test_run.... |
controller.py | import traceback
from datetime import datetime
from threading import Thread
from typing import List, Set, Type
from bauh.api.abstract.controller import SearchResult, SoftwareManager, ApplicationContext
from bauh.api.abstract.disk import DiskCacheLoader
from bauh.api.abstract.handler import ProcessWatcher
from bauh.api... |
IQNewsClipThread.py | import os
import time
import logger
import logging
import pandas as pd
from time import sleep
from threading import Thread
from datetime import timedelta, datetime, date
from IQNewsClipScraper import IQNewsClipScraper
from cookies_handler import CookiesHandler
class IQNewsClipThread():
def __init__(self, keys... |
feeder_test.py | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
sim.py | import numpy as np
import matplotlib
#matplotlib.use('Agg')
import matplotlib.pyplot as plt
import torch
import pyro
import pyro.distributions as dist
from datetime import datetime
import os
import multiprocessing
from multiprocessing.managers import BaseManager
import contextlib
import pickle
import lzma
import time
i... |
calculator.pyw | # Written by Rishi
# Completed on 7 July, 2020
import math
from threading import Thread
from time import sleep
from tkinter.__init__ import Tk, Button, Label, Frame, StringVar, BooleanVar, Menubutton, Menu, Toplevel
from tkinter.constants import *
try:
from playsound import playsound
except ModuleNotF... |
local_runner.py | import os
import logging
import pdb
import time
import random
from multiprocessing import Process
import numpy as np
from client import MilvusClient
import utils
import parser
from runner import Runner
logger = logging.getLogger("milvus_benchmark.local_runner")
class LocalRunner(Runner):
"""run local mode"""
... |
demo.py | import time
import os
import numpy as np
import torch
import torchvision
import cv2
import dlib
from torch.autograd import Variable
from collections import OrderedDict
from PIL import Image
from multiprocessing import Process, Queue
from torch.multiprocessing import Process as torchProcess
from torch.multiprocessing im... |
rabbit.py | """
Sprite thanks:
https://opengameart.org/content/knight-sprite
https://opengameart.org/content/bunny-rabbit-lpc-style-for-pixelfarm
https://opengameart.org/content/blood-splats
"""
import multiprocessing
import arcade
import slowclap as sc
SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600
SPRITE_SCALING_PLAYER = 1.0
def... |
impinj_xarray_itemsense_localization.py | from interrogator import *
import requests
import base64
import threading
import json
import sys
from httplib2 import Http
import os
import queue
from time import sleep
import collections
import dateutil.parser
class ImpinjXArray(Interrogator):
def __init__(self, _ip_address, _db_host, _db_password, _cert_path, _d... |
transports.py | from __future__ import annotations
from ..typecheck import *
from typing import IO
from ..import core
from .transport import Transport
import socket
import os
import subprocess
import threading
class Process:
processes: set[subprocess.Popen] = set()
@staticmethod
def cleanup_processes():
for self in Process.pr... |
test_gc.py | import unittest
import unittest.mock
from test.support import (verbose, refcount_test, run_unittest,
cpython_only, start_threads,
temp_dir, TESTFN, unlink,
import_module)
from test.support.script_helper import assert_python_ok, make_scr... |
tests.py | import os
import shutil
import sys
import tempfile
import threading
import time
import unittest
from datetime import datetime, timedelta
from datetime import timezone as datetime_timezone
from io import StringIO
from pathlib import Path
from urllib.request import urlopen
from django.core.cache import cache
from django... |
conftest.py | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2020
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... |
rasterize_test.py | from rasterize import rasterize, find_zombie_processes, merge_options, DEFAULT_CHROME_OPTIONS, rasterize_image_command
import demistomock as demisto
from CommonServerPython import entryTypes
from tempfile import NamedTemporaryFile
import subprocess
import os
import logging
import http.server
import time
import threadin... |
main.py | from game import Game
from ui import CellsUI
from gameconfig import SpawnConfig
from gameconfig import GameConfig
import threading
def run():
while True:
#g.status(10, True)
cells = g.next()
ui.update(cells)
if __name__ == "__main__":
#g = Game(spawnConfig=SpawnConfig.All())
conf =... |
utils.py | '''
This contains the core test helper code used in Synapse.
This gives the opportunity for third-party users of Synapse to test their
code using some of the same helpers used to test Synapse.
The core class, synapse.tests.utils.SynTest is a subclass of unittest.TestCase,
with several wrapper functions to allow for e... |
main_vision_test04b_war.py | """
mlperf inference benchmarking tool
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import array
import collections
import json
import logging
import os
import sys
import threading
import time
from queue import Queue
import mlperf_l... |
test_cli_task.py | # Copyright 2013: Mirantis 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 b... |
raspetarberry_pi_demo_lcd_1602_temp_sensor_dht11_00.py | import time
import Adafruit_DHT
from rpi_lcd import LCD
from datetime import datetime
import multiprocessing
# pinVcc = 3V3 (1)
# pinGnd = GND (9)
pinSignal = 17 # GPIO17 (11)
screen = LCD()
def getDataFromDHT11Once():
try:
humidity, temperature = Adafruit_DHT.read_retry(Adafruit_DHT.DHT11, pinSignal)
return hu... |
bot.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
import sys
from json import load
from random import choice, randint, random
from threading import Thread
from time import sleep, strftime
import ctypes
import colorama
from fake_useragent import UserAgent
import requests
from termcolor import colored
colorama.in... |
test_minigame.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
USED_DEVICES = "4"
import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = USED_DEVICES
import sys
import threading
import time
import tensorflow as tf
import multiproces... |
settings.py | from flask import request, redirect, Response, session
import urllib.parse
import threading
import time
import json
class Settings():
endpoints = ["/api/settings"]
endpoint_name = "api_settings"
endpoint_methods = ["GET", "POST"]
def __init__(self, fhdhr):
self.fhdhr = fhdhr
self.res... |
test_threads.py | #!/usr/bin/env python
from confluent_kafka import Producer
import threading
import time
try:
from queue import Queue, Empty
except:
from Queue import Queue, Empty
class IntendedException (Exception):
pass
def thread_run(myid, p, q):
def do_crash(err, msg):
raise IntendedException()
for... |
tools.py | from re import findall
from threading import Thread
from datetime import datetime
from rubika.client import Bot, Socket
bot = None
socket = None
lockTime = None
class Tools:
def __init__(self, auth):
global bot
global socket
bot = Bot(auth)
socket = Socket(auth)
def antiInsult(self, msg):
return any(word... |
portscanner.py | import argparse
import sys
from socket import *
from threading import Thread,Semaphore
lock=Semaphore(value=1)
def connScan(host,port):
try:
skt=socket(AF_INET,SOCK_STREAM)
skt.connect((host,port))
skt.send(('hello\r\n').encode('utf-8'))
skt.recv(100)
lock.acquire()
... |
data_service_ops_test.py | # Copyright 2020 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... |
facerecog_from_videofile.py | import face_recognition
import cv2
import sys
import os
import re
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QMessageBox, QInputDialog, QLineEdit, QFileDialog, QProgressBar
from PyQt5.QtCore import QBasicTimer
import sys
from subprocess import call
import threading
# This is a demo of running face ... |
pace_util.py | #!python3
import sys, os, time, logging, importlib
from threading import Thread
this_file_dir = os.path.dirname(__file__)
methods_dir = os.path.abspath(this_file_dir)
dropbox_dir = os.path.dirname(methods_dir)
user_dir = os.path.dirname(dropbox_dir)
global_log_dir = os.path.join(dropbox_dir, 'Monitoring', 'log')
LAY... |
region.py | from ParseCampaign import Parser
from Battle import Battle as Arena
from CharacterArray import CharacterArray
import threading
from FormatText import format_text
import Music
import os
clear = lambda: os.system("cls")
class Region:
def __init__(self, filepath=""):
self.region_file = Parser... |
omreegalozMediaPermutationsServer.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... |
test_flush.py | import pytest
from utils.util_pymilvus import *
from common.constants import default_entities
from common.common_type import CaseLabel
from utils.util_log import test_log as log
DELETE_TIMEOUT = 60
default_single_query = {
"data": gen_vectors(1, default_dim),
"anns_field": default_float_vec_fie... |
DataBaseOperations.py | import os
import sqlite3
import threading
import concurrent.futures
class Query:
tag_table = "CREATE TABLE IF NOT EXISTS tag(tag_name VARCHAR(30) UNIQUE, tag_path VARCHAR(100) UNIQUE)"
project_table = "CREATE TABLE IF NOT EXISTS project(id integer primary key, datetime DATETIME , " \
"tag... |
client.py | from cmd import Cmd
from os import path
from random import choice
from string import ascii_lowercase
from server import Node, UNHANDLED # 向RPC Server调用方法,并接收方法的返回数据;
from threading import Thread
from time import sleep
from xmlrpc.client import ServerProxy, Fault
import sys
HEAD_START = 0.1 # 单位为秒
SECRET_LENGTH = 100
... |
statsig_server.py | import asyncio
import threading
from .evaluator import _ConfigEvaluation, _Evaluator
from .statsig_network import _StatsigNetwork
from .statsig_logger import _StatsigLogger
from .dynamic_config import DynamicConfig
from .statsig_options import StatsigOptions
from .version import __version__
RULESETS_SYNC_INTERVAL = 10... |
monitor.py | import functools
import logging
import os
import subprocess
import threading
from dataclasses import dataclass
from typing import TYPE_CHECKING, Callable, List
from dvc.repo.live import create_summary
from dvc.stage.decorators import relock_repo
from dvc.stage.exceptions import StageCmdFailedError
from dvc.ui import u... |
test_subprocess.py | import unittest
from test.support import script_helper
from test import support
import subprocess
import sys
import signal
import io
import locale
import os
import errno
import tempfile
import time
import re
import selectors
import sysconfig
import warnings
import select
import shutil
import gc
import textwrap
try:
... |
market_price.py | #|-----------------------------------------------------------------------------
#| This source code is provided under the Apache 2.0 license --
#| and is provided AS IS with no warranty or guarantee of fit for purpose. --
#| See the project's LICENSE.md for details. --
... |
output_process.py | import logging
import os
import pickle
import time
import json
import cv2
import copy
import numpy as np
from abc import ABC, abstractmethod
from typing import Dict, List
from configs import BACKEND_INTERNAL_CONFIG, NXS_BACKEND_CONFIG, NXS_CONFIG
from nxs_libs.interface.backend.input import (
BackendInputInterfaceF... |
coordinator_test.py | """Tests for Coordinator."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import threading
import time
import tensorflow.python.platform
import tensorflow as tf
def StopInN(coord, n_secs):
time.sleep(n_secs)
coord.request_stop()
def R... |
test_threading.py | # Very rudimentary test of threading module
import test.test_support
from test.test_support import verbose
import random
import re
import sys
thread = test.test_support.import_module('thread')
threading = test.test_support.import_module('threading')
import time
import unittest
import weakref
import os
imp... |
vhy.py | # -*- coding: utf-8 -*-
#My Script by danrfq
#Support by My Beloved Team Ꭲ̡̦͎͇͈̘̻̎̉̅́̒͗ͅϵѧᴍ̸̩̟̗͎̯͙̺̺̜̬̙̟̀̑̓͋̐͆͌̓̒́̒͗͒͑̚͟͜ᎶʀҽѧᴛᏴøᴛ̢͓̹̗̘̠̪̖͗̃̄̅̆̽̀̕͜͞
#i'm Owner Ꭲ̡̦͎͇͈̘̻̎̉̅́̒͗ͅϵѧᴍ̸̩̟̗͎̯͙̺̺̜̬̙̟̀̑̓͋̐͆͌̓̒́̒͗͒͑̚͟͜ᎶʀҽѧᴛᏴøᴛ̢͓̹̗̘̠̪̖͗̃̄̅̆̽̀̕͜͞
import LINETCR
from LINETCR.lib.curve.ttypes import *
from datetime import datetime
i... |
extract.py | #!/usr/bin/python3
from sys import argv
from utils import read_flavour
if len(argv) < 5:
print("This extract x-vectors based on a given model. Run it this way: command <flavour> <model.pt> <source.scp> <target.ark> <device>")
exit(1)
flavour = read_flavour(argv)
model_file = argv[2]
source_scp = argv[3]
targ... |
run_self_contained.py | #!/usr/bin/env python
"""Helper script for running end-to-end tests."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import atexit
import multiprocessing
import os
import socket
import sys
import tempfile
import thr... |
03_using_exist_browser.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File : 03_using_exist_browser.py
@Time : 2021-03-09
@Author : EvilRecluse
@Contact : https://github.com/RecluseXU
@Desc :
通过cmd命令启动chrome浏览器,再让Selenium接管已经打开的浏览器
也许可以规避很多检查
'''
# here put the import lib
from os import system, path
from s... |
spark.py | from __future__ import print_function
import copy
import numbers
import threading
import time
import timeit
from hyperopt import base, fmin, Trials
from hyperopt.utils import coarse_utcnow, _get_logger, _get_random_id
try:
from pyspark.sql import SparkSession
_have_spark = True
except ModuleNotFoundError as ... |
api_server.py | #!/usr/bin/env python
#
# Copyright 2007 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 o... |
StartScan.py | from util import *
from wif import w
from ble import ble
import threading
import time
import os
os.system('sudo systemctl start bluetooth')
#Main function that start every thread to scan bluetooth and wifi, send saves and subscribe to the mqtt server
def Start():
scanble = threading.Thread(target=ble,args=())
scanw... |
test_facial_recognition_server.py | """utest presenter socket server module"""
# -*- coding: UTF-8 -*-
#
# =======================================================================
#
# Copyright (C) 2018, Hisilicon Technologies Co., Ltd. All Rights Reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, ... |
test_execute.py | import asyncio
import tempfile
import time
from threading import Thread
import dagster_pandas as dagster_pd
import pytest
from dagster_dask import DataFrame, dask_executor
from dask.distributed import Scheduler, Worker
from dagster import (
DagsterUnmetExecutorRequirementsError,
InputDefinition,
ModeDefin... |
Tkinter_ROVER_interface.py | import tkinter as tk
from random import randrange,randint
import threading
import time
t1=0.0
speed=0
autonomy = False
running=False
window=tk.Tk()
window.title('RUDRA ROVER')
window.geometry('1280x720')
COLORS = ['snow', 'ghost white', 'white smoke', 'gainsboro', 'floral white', 'old lace',
'linen', ... |
manager.py | from dataclasses import dataclass
import logging
import threading
import time
import traceback
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Iterator
from concurrent.futures.thread import ThreadPoolExecutor
from blspy import G1Element
from chiapos import DiskProver
from ... |
delay_schedule.py | # !/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Copyright 2020 Tianshu AI Platform. 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/LICEN... |
eval_cellular.py | import os
import sys
import numpy as np
import multiprocessing as mp
from ctypes import c_float
import json
import math
import matplotlib.pyplot as plt
import util
import util_empirical
import util_meta
import util_filter
import util_geometry
import constants
import util_features_mp
import util_stats
import util_cache... |
modified remove.bg.py | from itertools import cycle
from shutil import get_terminal_size
from threading import Thread
from time import sleep
import requests
import pandas as pd
df = pd.read_csv("crucials.csv")
remove_bg_api_key = str(df.iloc[0,-1])
img_loc = str(df.iloc[1,-1])
save_loc = str(df.iloc[2,-1])
class Loader:
def... |
server.py | '''*********************************************************************************
TRITON SPARK
SERVER - SMART PARKING LOT SYSTEM
*********************************************************************************'''
#Import the Modules Required
from pubnub import Pubnub
import json
import datetime
from threading impo... |
sharing_states_between_process_01_shared_memory_01.py | from multiprocessing import Process, Value, Array
from typing import Iterable
# Data can be stored in a shared memory map using Value or Array. For example, the following code
# The 'd' and 'i' arguments used when creating num and arr are typecodes of
# the kind used by the array module: 'd' indicates a double preci... |
system.py | # Copyright 2011-2019, Damian Johnson and The Tor Project
# See LICENSE for licensing information
"""
Helper functions for working with the underlying system. These are mostly os
dependent, only working on linux, osx, and bsd. In almost all cases they're
best-effort, providing **None** if the lookup fails.
.. version... |
test_generator_runner.py | # Copyright 2021 Zilliz. 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 agree... |
collections_deque_both_ends.py | #!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2008 Doug Hellmann All rights reserved.
#
"""Burning a candle at both ends.
"""
__version__ = "$Id$"
#end_pymotw_header
import collections
import threading
import time
candle = collections.deque(xrange(5))
def burn(direction, nextSource):
while True:
... |
floodlight_debug_autopwn.py |
import signal
import socket
from threading import Thread
import modules.sdnpwn_common as sdnpwn
from time import sleep
threads = []
socks = []
stopListening = False
def signal_handler(signal, frame):
#Handle Ctrl+C here
print("")
sdnpwn.message("Stopping...Try Ctrl+C once more", sdnpwn.NORMAL)
try:
stopL... |
sensor_interface.py | import copy
import logging
import numpy as np
import os
import time
from threading import Thread
from queue import Queue
from queue import Empty
import carla
from srunner.scenariomanager.carla_data_provider import CarlaDataProvider
from srunner.scenariomanager.timer import GameTime
def threaded(fn):
def wrapper... |
XiaoBing.py | #!/usr/bin/env python3
"""
小冰操作
:author Wang Weiwei <email>weiwei02@vip.qq.com / weiwei.wang@100credit.com</email>
:sine 2017/8/11
:version 1.0
"""
from .MessageEvent import *
import time
import threading
# XIAOBING_ID = 'xiaoice-ms'
XIAOBING_ID = '@4c8d3aed2779105d13455d3a30f8f2d0'
def hava_mp_xia... |
keep_alive.py | from flask import Flask
from threading import Thread
app = Flask('')
@app.route('/')
def home():
return "hello!"
def run():
app.run(host='0.0.0.0',port=8080)
def keep_alive():
t = Thread(target=run)
t.start()
|
server_node_outside.py | """ This script runs a webserver that transmits the data from arduino.
The script runs a web application in a certain PORT. Periodically,
the server polls the ArduMon for data using the SerialDataFetcher. The data
is then sent out as a JSON dictionary to the clients connected.
Clients can connect to the machine runni... |
server.py | import socket, threading
from AES import AESCipher
from key_exchange import DiffieHellman
class Server:
def __init__(self):
# default port is choosen as 5068
self.port=5068
# server ip address is of private ip of host
# change it to public ip to work over internet
self.host=... |
u2p2_thread_test.py | # import sys
import time
import queue
import spidev
import threading
is_on_raspberry_pi = False
with open('/etc/os-release') as os_version_file:
is_on_raspberry_pi = 'raspbian' in os_version_file.read().lower()
spi = None
if is_on_raspberry_pi:
spi = spidev.SpiDev(0, 0) # rasp
print("I'm on Raspberry Pi!... |
number_accuracy_v2.py | # Take the accuracy rate of each picture and take the average
import json
import datetime
from multiprocessing import Process
in_path = r'../../../data/caculate_gd_people/val.json'
prediction_path = r'../../../data/caculate_gd_people/bbox_my_val_4869_results.json'
def cal(annotation_file_path, predict_file_path):... |
test_socket.py | import unittest
from test import support
from test.support import socket_helper
import errno
import collections
import io
import itertools
import socket
import select
import tempfile
import time
import traceback
import queue
import sys
import os
import platform
import array
import contextlib
from weakref import proxy
... |
TAXIIServer.py | import demistomock as demisto
from CommonServerPython import *
from flask import Flask, request, make_response, Response, stream_with_context
from gevent.pywsgi import WSGIServer
from urllib.parse import urlparse, ParseResult
from tempfile import NamedTemporaryFile
from base64 import b64decode
from typing import Callab... |
python_utils.py | # -*- coding: utf-8 -*-
#
# This file is part of PyBuilder
#
# Copyright 2011-2020 PyBuilder Team
#
# 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/l... |
conftest.py | import threading
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
import pytest
class ParameterServerMock(BaseHTTPRequestHandler):
""" mock server for unittest
Parameter Server API: http://wiki.ros.org/ROS/Parameter%20Server%20API
Master Slave APIs: http://wiki.ros.org/ROS/Master_Slave_APIs... |
boss_download_pallets.py | #!/opt/stack/bin/python3
import os
import sys
#try to get wxpython
try:
import wx
except ImportError:
HAS_WX = False
else:
HAS_WX = True
import threading
import time
import subprocess
import stack.roll
import stack.pallet
class DownloadFrame(wx.Frame):
"""This is a test frame for displaying progress of download... |
test_server.py | import asyncio
import json
import os
import time
import urllib.parse
import uuid
import sys
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, Dict, Optional
from unitt... |
__init__.py | """Helper module for sending notifications, depending on the user preference"""
import logging
import threading
from typing import Sequence
from flask import copy_current_request_context
from flask_mail import Message
from sqlalchemy.exc import IntegrityError
from innopoints.extensions import db, mail
from innopoint... |
jetsonvideostream.py | # import the necessary packages
from threading import Thread
import cv2
# Raspberry Pi Camera V2:
# Full resolution: (3280, 2646), FOV: 62.2 deg H, 48.8 deg V
# GStreamer supported full resolution: (3264, 2464), 21 FPS, FOV: 62 deg H, 48.8 deg V
# Preferred resolution: (3264,1848), 28FPS, FOV: 62 deg H, 37 deg V
cl... |
test_insert.py | import threading
import numpy as np
import pandas as pd
import pytest
from pymilvus_orm import Index
from base.client_base import TestcaseBase
from utils.util_log import test_log as log
from common import common_func as cf
from common import common_type as ct
from common.common_type import CaseLabel, CheckTasks
pref... |
main.py | from __future__ import print_function, division
import os
os.environ["OMP_NUM_THREADS"] = "1"
import argparse
import torch
import torch.multiprocessing as mp
from utils import read_config
from model import A3Clstm
from train import train
from test import test
from shared_optim import SharedRMSprop, SharedAdam
#from gym... |
wsdump.py | #!/Users/aruneli/rancher/validation-tests/.venv/bin/python
import argparse
import code
import six
import sys
import threading
import websocket
try:
import readline
except:
pass
OPCODE_DATA = (websocket.ABNF.OPCODE_TEXT, websocket.ABNF.OPCODE_BINARY)
ENCODING = getattr(sys.stdin, "encoding", "").lower()
clas... |
bot.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from threading import Thread
from time import strftime
from rich.console import Console
from rich.live import Live
from rich.table import Table
from api import BrawlS
from config import BUY_BOX_ONE, BUY_BOX_TWO, USER_AGENT, VK_ADMIN_TOKEN
class Bot:
def __init__(se... |
check.py | from PIL import Image
import glob
import os
from tqdm import tqdm
import multiprocessing as mp
dataset_dir="/home/ec2-user/SageMaker/benchmarks/high_resolution"
def clean(start, end):
for i in tqdm(range(start, end)):
filename = "roi_train_im/roi{}.png".format(i)
image_path = os.path.join(dataset_d... |
update.py | #!/usr/bin/env python
# Copyright (C) 2012, Code for America
# This is open source software, released under a standard 3-clause
# BSD-style license; see the file LICENSE for details.
import os
import math
import datetime
import smtplib
from email.mime.text import MIMEText
from threading import Thread
from optparse im... |
redis_utils.py | #!/usr/bin/env python
# __BEGIN_LICENSE__
# Copyright (c) 2015, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All rights reserved.
#
# The xGDS platform is licensed under the Apache License, Version 2.0
# (the "License"); you may not use this fi... |
ControlsWidget.py | import binaryninja
from PySide2 import QtCore
from PySide2.QtCore import Qt
from PySide2.QtWidgets import QApplication, QHBoxLayout, QVBoxLayout, QLabel, QWidget, QPushButton, QLineEdit, QToolBar, QToolButton, QMenu, QAction
from binaryninja import execute_on_main_thread_and_wait
from binaryninjaui import ViewFrame
imp... |
pigrelay.py | import os
import sys
import time
import socket
import logging
import six
import requests
sys.path.append('/home/vagrant/secapp/pigrelay/')
import alert
import json
import yaml
import argparse
import pickle
from Queue import Queue
from threading import Thread
from abc import ABCMeta, abstractmethod
from flask_jsonrpc.... |
multiprocess.py | __author__ = 'nickyuan'
# 要让Python程序实现多进程(multiprocessing),我们先了解操作系统的相关知识。
#
# Unix/Linux操作系统提供了一个fork()系统调用,它非常特殊。普通的函数调用,调用一次,返回一次,
# 但是fork()调用一次,返回两次,因为操作系统自动把当前进程(称为父进程)复制了一份(称为子进程),
# 然后,分别在父进程和子进程内返回。
#
# 子进程永远返回0,而父进程返回子进程的ID。这样做的理由是,一个父进程可以fork出很多子进程,
# 所以,父进程要记下每个子进程的ID,而子进程只需要调用getppid()就可以拿到父进程的ID。
#
# Pyt... |
main.py | """
Main script that runs the D4PG learning algorithm
(https://arxiv.org/pdf/1804.08617)
It features the standard DDPG algorithm with a number
of improvements from other researchers.
Namely:
Distributed rollouts (https://arxiv.org/pdf/1602.01783)
A distributional learner (http://arxiv.org/abs/1... |
test_pants_service.py | # Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import threading
from pants.pantsd.service.pants_service import PantsService
from pants.testutil.test_base import TestBase
class RunnableTestService(PantsService):
def run(self):
... |
reporter.py | import collections
import json
import six
import numpy as np
from threading import Thread, Event
from ..base import InterfaceBase
from ..setupuploadmixin import SetupUploadMixin
from ...utilities.async_manager import AsyncManagerMixin
from ...utilities.plotly_reporter import create_2d_histogram_plot, create_value_mat... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.