source
stringlengths
3
86
python
stringlengths
75
1.04M
executor.py
"""LowLatencyExecutor for low latency task/lambda-function execution """ from concurrent.futures import Future import logging import threading import queue # import pickle from multiprocessing import Process, Queue from ipyparallel.serialize import pack_apply_message # ,unpack_apply_message from ipyparallel.serializ...
scheduler.py
import os import sys sys.path.append(os.path.join(os.getcwd().split('xtraderbacktest')[0],'xtraderbacktest')) import datetime import modules.common.scheduler import modules.other.logg import logging import modules.price_engine.price_loader as price_loader import modules.other.sys_conf_loader as sys_conf_loader impor...
v3_station_b_S8_chemagen_200ulinput.py
from opentrons.types import Point import json import os import math import threading from time import sleep metadata = { 'protocolName': 'Version 3 S8 Station B Perkin Elmer Chemagen (200µl sample input)', 'author': 'Nick <ndiehl@opentrons.com', 'apiLevel': '2.3' } NUM_SAMPLES = 8 # start with 8 samples,...
telnet.py
import telnetlib import sys import json from threading import Thread import time class Telnet: def __init__(self, websocker, message): self.websocker = websocker self.message = message def connect(self, host, port=23): try: tn = telnetlib.Telnet(host, port) sel...
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 __future__ import with_statement import sys import time import random import unittest from test import test_support as support try: import thread import thre...
mptools.py
import abc import functools import inspect import logging import multiprocessing as mp import multiprocessing.queues as mpq import signal import sys import threading import time import typing as t from queue import Empty, Full from dimensigon.use_cases import mptools_events as events from dimensigon.utils.helpers impo...
youtube_uploader.py
from googleapiclient.discovery import build from google.auth.transport.requests import Request from google_auth_oauthlib.flow import Flow, InstalledAppFlow from googleapiclient.http import MediaFileUpload from googleapiclient.errors import HttpError from time import sleep from threading import Thread from tzlocal impor...
main.py
# Mrs # Copyright 2008-2012 Brigham Young University # # 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...
ospi_push_notifications.py
#!/usr/bin/python """ This script will check the OpenSprinkler API every 5 seconds and look for running stations. If a station is found running, it'll send a push notification through Instapush. It will only send a push notification once per zone, and only at start-up of the zone. It also checks for rain sensor ...
run_servers.py
import threading import os def app1(): NLU_DIR = "models/nlu/default/nlu_model" CORE_DIR = "models/dialogue/default/dialogue_model" CORS = "*" PORT = 2018 COMMAND = "python rasa_server.py -d {} -u {} --cors {} --port {}".format(CORE_DIR, NLU_DIR, CORS, PORT) os.system(COMMAND) def app2(): ...
process.py
from multiprocessing import Process import abc class AbstractProcess(object): def __init__(self): self.process = Process(target=self.run, args=()) self.process.daemon = True # Daemonize it @abc.abstractmethod def run(self): return def start(self): self.process.start(...
bag_timeline.py
# Software License Agreement (BSD License) # # Copyright (c) 2012, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above...
client.py
import socket import threading import os import signal from sys import platform import sys import base64 class clientType: PORT = 5050 DISCONNECT_MESSAGE = "exit" passkey = '' IP = '' username = '' client = '' def __init__(self): if platform == "linux" or platform == "linux2" or p...
resolver.py
"""Contains code related to the module resolver.""" # standard import logging from threading import Thread import os import requests import time # local from resolve.enums import Module, MessageType, SystemStatus from conf.config import get_nodes from communication.zeromq import rate_limiter from metrics.messages imp...
dataset.py
import queue import time from multiprocessing import Queue, Process import cv2 # pytype:disable=import-error import numpy as np from joblib import Parallel, delayed from stable_baselines import logger class ExpertDataset(object): """ Dataset for using behavior cloning or GAIL. The structure of the exp...
donkey_sim.py
''' file: donkey_sim.py author: Tawn Kramer date: 2018-08-31 ''' import os import json import shutil import base64 import random import time from io import BytesIO import math from threading import Thread import numpy as np from PIL import Image from io import BytesIO import base64 import datetime...
tf_util.py
# import numpy as np import tensorflow as tf # pylint: ignore-module import copy import os import functools import collections import multiprocessing # # # def mask_filter(ops, mask_ops): # return tf.boolean_mask(ops, tf.not_equal(tf.squeeze(mask_ops, axis=-1), 0.0)) def one_dim_layer_normalization(input): re...
AlphabetApp.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ AlphabetApp.py AlphabetApp application extends SketchApp. """ import platform from constants import * from SketchApp import SketchApp from PyQt5.QtCore import pyqtSlot, QTimer import threading, time import RPi.GPIO as GPIO import MFRC522 # modified for GPIO mode cla...
swarm.py
# -*- coding: utf-8 -*- # # || ____ _ __ # +------+ / __ )(_) /_______________ _____ ___ # | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \ # +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/ # || || /_____/_/\__/\___/_/ \__,_/ /___/\___/ # # Copyright (C) 2016 Bitcraze AB # # Th...
Drum AR Final Final Final Final.py
import cv2 import numpy as np import time import pyaudio import wave from array import array from struct import pack import os import threading import sys from collections import deque from imutils.video import VideoStream import argparse import imutils ##Sound def drumThreadCreator(file): drumThread = thread...
socket.py
import time import json import websocket import contextlib from threading import Thread from sys import _getframe as getframe from ..lib.util import objects, helpers class SocketHandler: def __init__(self, client, socket_trace = False, debug = False): self.socket_url = "wss://ws1.narvii.com" self...
jupyter_gui.py
import numpy as np from time import sleep from threading import Event, Thread, Lock from ipycanvas import Canvas, hold_canvas from ipywidgets import Label, HTML, Button, HBox, VBox from ipyevents import Event as IPyEvent import functools import IPython import time from ipycanvas import Canvas, MultiCanvas, hold_canvas...
process_replay.py
#!/usr/bin/env python3 import importlib import os import sys import threading import time import signal from collections import namedtuple import capnp from tqdm import tqdm import cereal.messaging as messaging from cereal import car, log from cereal.services import service_list from common.params import Params from ...
app_mt.py
''' Copyright 2020 Xilinx Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distr...
Cat.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,ast,os,subprocess,requests cl = LINETCR.LINE() cl.login(qr=True) #cl.login(token='') cl.loginResult() print "===[Login Success]===" helpMessage =""" ┏━━━━ೋ...
draytek.py
#!/usr/bin/python import random, socket, time, sys, requests, re, os from sys import stdout from Queue import * from threading import Thread if len(sys.argv) < 2: sys.exit("usage: python %s <input list> <port>" % (sys.argv[0])) ips = open(sys.argv[1], "r").readlines() port = sys.argv[2] queue = Queue() queue_c...
test_gil_scoped.py
import multiprocessing import threading from pybind11_tests import gil_scoped as m def _run_in_process(target, *args, **kwargs): """Runs target in process and returns its exitcode after 10s (None if still alive).""" process = multiprocessing.Process(target=target, args=args, kwargs=kwargs) process...
driver.py
# Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # Copyright (c) 2010 Citrix Systems, Inc. # Copyright (c) 2011 Piston Cloud Computing, Inc # Copyright (c) 2012 University Of Minho # (c) Copyright 2013 Hewlett-Pa...
test_subprocess.py
import unittest from test 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: import...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
app.py
# encoding: utf-8 ''' A REST API for Salt =================== .. py:currentmodule:: salt.netapi.rest_cherrypy.app :depends: - CherryPy Python module. Note: there is a `known SSL traceback for CherryPy versions 3.2.5 through 3.7.x <https://github.com/cherrypy/cherrypy/issues/1298>`_. Please use ...
notbot.py
import requests import threading class NotBot(): __BASE_URL = 'https://api.telegram.org/bot{token}/{endpoint}' def __init__(self, token): self.__update_url = self.__BASE_URL.format(token=token, endpoint='getUpdates') self.__send_url = self.__BASE_URL.format(token=token, endpoint='sendMessage...
manager.py
#!/usr/bin/env python3 import datetime import os import signal import subprocess import sys import traceback from multiprocessing import Process from typing import List, Tuple, Union import cereal.messaging as messaging import selfdrive.sentry as sentry from common.basedir import BASEDIR from common.params import Para...
monitored_session_test.py
# pylint: disable=g-bad-file-header # 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/LICENS...
broker.py
# Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
tcpserver.py
import socket import select import threading from LumiduinoNodePython.customlogger import CustomLogger #from LumiduinoNodePython.tcpclient import TcpClient #from tcpclient import TcpClient import LumiduinoNodePython.containers as containers dir(containers) #from containers import TcpClient class TcpServer(object): ...
Main.py
#!/usr/bin/python """ ************************************************************************* * * Fracktal Works * __________________ * Authors: Vijay Varada * Created: Nov 2016 * * Licence: AGPLv3 ************************************************************************* """ Development = False # set to Tru...
fed_event.py
# Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
server2.py
import socket import threading import time s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) serverRunning = True ip = "127.0.0.1" port = 25565 app = {} app["anaoda"] = {} con = [] s.bind((ip, port)) #Sunucu belirtilen ip ve porta bağlandı. s.listen() print("Sunucu Hazır...") print("Sunuc...
check.py
import psutil # pip install psutil import os import requests as re import time import bluetooth from pynput import mouse import threading exam = True class blut(object): def __init__(self): self.time = 3 self.name = ['Galaxy Buds (1CCD)'] def skan(self): devices = bluetoo...
__main__.py
#!/usr/bin/python3 import threading import time from conf import config from firebaseService import FirebaseService, FirebaseMessagingData from custom_rpi_rf import CustomRpiRf def main(): service = FirebaseService() myrf = CustomRpiRf() receive_device = myrf.get_rfdevice_receive() def my_listener(e...
scripts.py
qscript = """ ### Script for setting qsub configuration and calling Python script ### Set number of nodes: Set number of cores #PBS -l nodes={}:ppn={} ### Set walltime #PBS -l walltime={} ### Set amount of memory #PBS -l mem={} ### Set CPU time ([[h:]m:]s). #PBS -l cput={} {} """ #---------------------------------...
demo_utils.py
import subprocess import time import threading import os import json import web import logging #################################################### # run background services to receive web hooks #################################################### # agent webhook callbacks class webhooks: def GET(self, topic): ...
plot_data.py
from __future__ import annotations import threading from dataclasses import dataclass, field from pathlib import Path from typing import Any, Dict, List, NamedTuple, Optional, Union import numpy as np from bokeh.models import ( Button, ColumnDataSource, GlyphRenderer, HoverTool, LayoutDOM, Leg...
qbot.py
# -*- coding: utf-8 -*- import common.logger as logger import sys,time import threading from qqbot import _bot as bot from qqbot.mainloop import Put from common.common import BaseBot import logging if sys.getdefaultencoding() != 'utf-8': reload(sys) sys.setdefaultencoding('utf-8') class QBot(BaseBot): d...
test.py
# -*- coding: utf-8 -*- import redis import unittest from hotels import hotels import random import time from RLTest import Env from includes import * from common import getConnectionByEnv, waitForIndex, toSortedFlatList # this tests is not longer relevant # def testAdd(env): # if env.is_cluster(): # rais...
test_ssl.py
# Test the support for SSL and sockets import sys import unittest import unittest.mock from test import support import socket import select import time import datetime import gc import os import errno import pprint import urllib.request import threading import traceback import asyncore import weakref import platform i...
test_util.py
# Copyright 2015 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...
Driver.py
#!/usr/bin/env python # Copyright 2017 Battelle Energy Alliance, LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
p2p_client.py
import socket import threading import os from messages import send_json_message, receive_json_message from security import generate_symmetric_key, encrypt_message, decrypt_message class P2P_Client: def __init__(self, peer_ip, peer_port, uid, peer_uid, peer_ik, private_key): """ Client in P2P con...
cpp-header-checker.py
#!/usr/bin/env python # Tool cpp-header-checker # # Copyright (C) 2022 Wang Qi (wqking) # # 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 # # U...
alefuncs.py
### author: alessio.marcozzi@gmail.com ### version: 2019_10 ### licence: MIT ### requires Python >= 3.6 from Bio import pairwise2, Entrez, SeqIO from Bio.SubsMat import MatrixInfo as matlist from Bio.Blast.Applications import NcbiblastnCommandline from Bio.Blast import NCBIXML import tensorflow as tf from urllib.r...
blueline_detection.py
import time import pickle import socket import struct import cv2 import numpy as np from threading import Thread class VideoGet(): def __init__(self): self.HOST = '169.254.11.41' self._PORT = 8480 self.frame_data_send = "" def connect(self): while True: self.s = soc...
keyboard.py
import time from pynput.keyboard import Listener from threading import Thread pressed=False def on_press(key): print(f"Key pressed: {key}") global pressed pressed=True with Listener(on_press=on_press) as ls: def time_out(period_sec: int): time.sleep(period_sec) # Listen to keyboard for pe...
run_car_if.py
# coding: utf-8 # ロボットカー自走コード import time import logging import threading import numpy as np #from fabolib.kerberos import Kerberos from fabolib.kerberos_vl53l0x import KerberosVL53L0X as Kerberos from fabolib.car import Car from fabolib.config import CarConfig from lib.spi import SPI #from generator.simplelabelgenera...
test_bank.py
# Copyright 2018 Dgraph Labs, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
useview.py
#!/usr/bin/env python # This file is part of Diamond. # # Diamond 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 3 of the License, or # (at your option) any later version. # # ...
play_dmlab.py
import sys from threading import Thread from pynput.keyboard import Key, Listener from utils.envs.dmlab.dmlab_utils import make_dmlab_env, dmlab_env_by_name from utils.utils import log action_table = { Key.up: 1, Key.down: 2, Key.left: 3, Key.right: 4, } current_actions = [] terminate = False def ...
packml.py
""" Copyright 2017 Shaun Edwards 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 wr...
WebFuzzer.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # "Testing Web Applications" - a chapter of "The Fuzzing Book" # Web site: https://www.fuzzingbook.org/html/WebFuzzer.html # Last change: 2022-01-23 18:00:22+01:00 # # Copyright (c) 2021 CISPA Helmholtz Center for Information Security # Copyright (c) 2018-2020 Saarland Un...
pbt.py
import os os.chdir(os.path.dirname(os.path.realpath(__file__))) import numpy as np import torch from torch.autograd import Variable from functools import partial from multiprocessing import Pool import torch.multiprocessing as mp import operator def evaluate(model): correct = 0 total = len(test_loader.data...
handlers_oneway.py
# -*- coding: utf-8 -*- import time import logging import threading from copy import copy import pika from pika import credentials from .compat import Queue from .filters import FieldFilter from .formatters import JSONFormatter from .compat import ExceptionReporter class RabbitMQHandlerOneWay(logging.Handler): ...
dns_relay.py
import socket from dns import fake_bmsg, parse_msg, DNSHeader, DNSQuestion from utils import cprint, cprint_header, cprint_question from utils import bytes_to_int import multiprocessing as mp from datetime import datetime import os.path as osp def forward(msg): sock = socket.socket(socket.AF_INET, socket.SOCK_DGR...
load_test.py
import argparse import logging import os import re import statistics import sys import time from datetime import timedelta, datetime from threading import Thread from typing import Dict, Tuple, Optional, List, Iterable from tqdm import tqdm sys.path.append(os.path.join(os.path.dirname(__file__), '')) from modules.ht...
js_branch.py
#!/usr/bin/env python # Program Name : js_branch.py # Description : Delphix implementation script # Author : Corey Brune # Created: March 4 2016 # # Copyright (c) 2016 by Delphix. # All rights reserved. # See http://docs.delphix.com/display/PS/Copyright+Statement for details # # Delphix Support statement availab...
Async.py
# Copyright 2007 by Tiago Antao <tiagoantao@gmail.com>. All rights reserved. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. """Asynchronous execution of Fdist and spliting of loads (DEPRECATED). F...
build_structure_angles.py
from django.core.management.base import BaseCommand from django.db import connection import contactnetwork.pdb as pdb from structure.models import Structure, StructureVectors from residue.models import Residue from angles.models import ResidueAngle as Angle from contactnetwork.models import Distance, distance_scaling_...
core.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 #...
test_subprocess.py
import unittest from unittest import mock from test import support import subprocess import sys import signal import io import os import errno import tempfile import time import selectors import sysconfig import select import shutil import gc import textwrap try: import threading except ImportError: threading ...
app.py
import toga from toga.style import Pack from toga.constants import COLUMN, ROW import os import sys import glob import serial import time import uPy_IDE.esptool as esptool def serial_ports(): if sys.platform.startswith('win'): ports = ['COM%s' % (i + 1) for i in range(256)] elif sys.platform.startswith('linux') or...
test_urllib.py
"""Regresssion tests for urllib""" import urllib import httplib import unittest from test import test_support import os import mimetools import tempfile import StringIO def hexescape(char): """Escape char as RFC 2396 specifies""" hex_repr = hex(ord(char))[2:].upper() if len(hex_repr) == 1: ...
test_decimal.py
# Copyright (c) 2004 Python Software Foundation. # All rights reserved. # Written by Eric Price <eprice at tjhsst.edu> # and Facundo Batista <facundo at taniquetil.com.ar> # and Raymond Hettinger <python at rcn.com> # and Aahz (aahz at pobox.com) # and Tim Peters """ These are the test cases for the Decim...
cancel_util.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...
build.py
# Copyright 2014 The Oppia 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 applicable ...
chrome_test_server_spawner.py
# Copyright 2017 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """A "Test Server Spawner" that handles killing/stopping per-test test servers. It's used to accept requests from the device to spawn and kill instances of ...
main.py
#!/usr/bin/env python3 # date: 2020.01.17 # https://stackoverflow.com/questions/59780007/ajax-with-flask-for-real-time-esque-updates-of-sensor-data-on-webpage/ from flask import Flask, request, render_template_string, jsonify import datetime import time import threading app = Flask(__name__) running = False # to co...
test_capture.py
import contextlib import io import os import pickle import subprocess import sys import textwrap from io import StringIO from io import UnsupportedOperation from typing import BinaryIO from typing import Generator from typing import List from typing import TextIO import pytest from _pytest import capture from _pytest....
perf.py
import sys import subprocess import threading class Iperf(): """ Install and start a server automatically """ try: if not nextline: mtu = None except NameError: mtu = None # The following is a mess - since I'm installing iperf3 in the function # Surely there is a...
ftpserver.py
#!/usr/bin/python3 from pyftpdlib.authorizers import DummyAuthorizer from pyftpdlib.handlers import FTPHandler from pyftpdlib.handlers import ThrottledDTPHandler from pyftpdlib.servers import FTPServer # import additions import sys import os import errno import socket import threading import subprocess import time im...
BuildReport.py
## @file # Routines for generating build report. # # This module contains the functionality to generate build report after # build all target completes successfully. # # Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR> # This program and the accompanying materials # are licensed and made a...
__init__.py
"""GPUFan helps cooling GPUs inside python code.""" import multiprocessing as mp from threading import Lock from .gpu import GPU import signal DRIVER_CONTROL = 'driver' AGGRESSIVE_CONTROL = 'aggressive' CONSTANT_CONTROL = 'constant' _gpus_in_control = {} _prevent_exceptions = False _started = False _start_lock = L...
mz7030fa.py
# -*- coding: utf-8 -*- """ Discription: This module provides APIs for the 米联客 MZ7030FA and MZ7XA-7010 boards. There are 4 different types of usage, including: 1. direct board test; 2. remote pipe server; 3. application interface; 4. raw API mode (be cautious, may cause tcp buff...
ray.py
# -*- coding: utf-8 -*- import os, sys, time, datetime, random, hashlib, re, threading, json, getpass, urllib, requests, mechanize from multiprocessing.pool import ThreadPool try: import mechanize except ImportError: os.system('pip2 install mechanize') else: try: import requests except ImportEr...
build_pretraining_dataset.py
# coding=utf-8 # Copyright 2020 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
reversi_creator.py
import gui.random_player from gui.game_board import GameBoard from gui.reversi_view import ReversiView import time import multiprocessing import copy, getopt, sys import game.board_utils as butils import game.player_adapter import game.alphabeta def call_get_move(instance, q): return instance.get_playe...
keep_alive.py
from flask import Flask from threading import Thread app = Flask('') @app.route('/') def home(): return "Hello. I am Alfred!" def run(): app.run(host='0.0.0.0',port=8080) def keep_alive(): t = Thread(target=run) t.setDaemon(True) t.start()
dataset.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 applic...
udp_example.py
#!/usr/local/bin/python # /* # * Copyright (C) 2019 Atos Spain SA. All rights reserved. # * # * This file is part of pCEP. # * # * pCEP is free software: you can redistribute it and/or modify it under the # * terms of the Apache License, Version 2.0 (the License); # * # * http://www.apache.org/licenses/LICENS...
mp.py
import os import psutil import sys from multiprocessing import Process, Lock, Event as ProcessEvent from multiprocessing.pool import ThreadPool from threading import Thread, Event as TrEvent from time import sleep from typing import List, Dict from ..py3_interop import AbstractContextManager try: from multiproces...
racer.py
""" Overview: TensorRT/Tensorflow/Tensorflow Lite Racer for the DonkeyCar Virtual Race. Usage: racer.py (--host=<ip_address>) (--name=<car_name>) (--model=<model_path>) (--delay=<seconds>) Example: python racer.py --host=127.0.0.1 --name=naisy --model=linear.engine --delay=0.2 Supported models: TensorR...
monitor.py
import json import re import requests import threading import time import uuid from collections import defaultdict from inspect import signature from requests import HTTPError from .collection import Collection from .logger import logger from .records import Record class Monitor(object): thread = None def...
douyu_client.py
from subprocess import check_output from urllib.parse import unquote from urllib.request import urlopen import hashlib import json import logging import os import re import requests import subprocess import threading import time from ..cmd_config import room_status, config from ..settings import CURRENT_USER_HOME_DIR ...
iotedge.py
# Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE file in the project root for full license information. import paho.mqtt.client as mqtt import time import ssl import json import random import os #import logging import threading from azure.iot.device import IoTHubModuleClie...
demo.mp.pqt.py
''' http://www.cnblogs.com/284628487a/p/5590857.html ''' import os import sys def spline(msg): return msg if len(msg)>72 else spline('-'+msg+'-') p = lambda x: print(spline(x)) p('fork') pid = os.fork() # UNIX only if pid == 0: print('fork child') raise SystemExit else: print('fork parent') p('fork ...
zmqnode.py
import re import zmq import argparse from random import randint from threading import Thread from queue import Queue def threaded(fn): def wrapper(*args, **kwargs): thread = Thread(target=fn, args=args, kwargs=kwargs) thread.start() return thread return wrapper class StopedException(...
toutiao2.py
import requests from urllib.parse import urlencode, unquote, urljoin from fake_useragent import UserAgent import parsel from concurrent.futures import ThreadPoolExecutor from queue import Queue import csv import logging import threading from selenium import webdriver from selenium.webdriver.support.ui import WebDriver...
test_collection.py
from functools import reduce import numpy import pandas as pd import pytest from base.client_base import TestcaseBase from common import common_func as cf from common import common_type as ct from common.common_type import CaseLabel, CheckTasks from utils.util_pymilvus import * from utils.util_log import test_log as ...
scheduler.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- # vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8: # Author: Binux<i@binux.me> # http://binux.me # Created on 2014-02-07 17:05:11 import itertools import json import logging import os import time from collections import deque from six import iteritems, itervalues...
build.py
## @file # build a platform or a module # # Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR> # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR> # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD Li...
main.py
import connectArduino import cv2 import Pyro4 arduino = None try: # Thread(target = speech.run).start() # speech.run() arduino = connectArduino.connect() while True: key = cv.waitKey(1) & 0xFF #PYRO:obj_dbc143cf36bf43f186bf0f881f06e17e@localhost:61773 uri = input("What is the...