source
stringlengths
3
86
python
stringlengths
75
1.04M
panel.py
from tkinter import * from tkinter import messagebox import socket import threading import os import time path = os.path.expanduser("~/") host = 'localhost' port = 0 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) class panel: def __init__(self, name="Dev", master=None): try: ...
cameratimerbackend.py
from threading import Timer, Thread from time import time class RepeatedTimer(): def __init__(self, interval, function, timelimit = None, countlimit = None, callback = None): # announce interval to class self.interval = interval # announce target function to class self.function = function ...
EFScheduler.py
#!/bin/env python #coding:utf-8 import subprocess import datetime import time import os import sys import signal import getopt import threading import select SHUTDOWN = False def shutdown(sigNum, frame): global SHUTDOWN SHUTDOWN = True sys.stderr.write('Catch Signal : %s \n\n' % sigNum) sys.stderr.flush() signa...
ur5_2_controller.py
#! /usr/bin/env python2.7 """ This file control ur5_2, handle conveyor belt and placement of boxes from belt to bin. """ import rospy import time import datetime from camera_one.camera_one import Camera1,get_item_details from ur5_moveit.ur5_moveit import Ur5Moveit,define_pose,define_joint_angle_list from iot_client.iot...
pipeline_execute.py
import logging import d3m.runtime import d3m.metadata.base from sqlalchemy.orm import joinedload from d3m.container import Dataset from d3m.metadata import base as metadata_base from alphad3m.schema import database, convert from multiprocessing import Manager, Process logger = logging.getLogger(__name__) @database.w...
walking_simulation.py
#!/usr/bin/env python import os import numpy import pyquaternion import pcl import tf import rospy import rospkg import time import threading import random import ctypes from PIL import Image as pil import pybullet as p import pybullet_data from pybullet_utils import gazebo_world_parser from sensor_msgs.msg import Imu...
producer_consumer.py
NUMBER_OF_PRODUCER_PROCESSES = 5 NUMBER_OF_CONSUMER_PROCESSES = 5 from multiprocessing import Process, Queue import random, hashlib, time, os class Consumer: def __init__(self): self.msg = None def consume_msg(self, queue): while True: print('Got into consumer method, with pid: %...
roonapi.py
from __future__ import unicode_literals import time from .constants import * from .roonapisocket import RoonApiWebSocket from .discovery import RoonDiscovery import threading class RoonApi(): _roonsocket = None _roondiscovery = None _host = None _port = None _token = None _exit = False _zo...
spinner.py
# -*- coding: utf-8 -*- """A minimal non-colored version of https://pypi.org/project/halo, to track list progress""" from __future__ import absolute_import, unicode_literals import os import sys import threading from collections import OrderedDict from datetime import datetime import py threads = [] if os.name == "...
__init__.py
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2018-2019 Fetch.AI Limited # # 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...
debug.py
import code import gc import logging import os import signal import socket import threading import traceback import tracemalloc from types import FrameType from django.conf import settings from django.utils.timezone import now as timezone_now from typing import Optional logger = logging.getLogger('zulip.debug') # I...
gamepadClient.py
''' Simple python script to get Asyncronous gamepad inputs Thomas FLAYOLS - LAAS CNRS From https://github.com/thomasfla/solopython Use: To display data, run "python gamepadClient.py" ''' import inputs import time from multiprocessing import Process from multiprocessing.sharedctypes import Value from ctypes import c_do...
threading.py
from threading import Thread from concurrent.futures import Future def call_with_future(fn, future, args, kwargs): try: result = fn(*args, **kwargs) future.set_result(result) except Exception as exc: future.set_exception(exc) def threaded(fn): def wrapper(*args, **kwargs): ...
check_for_span.py
#!/usr/bin/python """Tool to quickly monitor for SPAN activity on interfaces.""" import os import sys import time import pcapy # Works with Python2 and Python3. Use apt-get or pip, either way import socket import subprocess import multiprocessing import logging, logging.handlers __author__ = 'Nicholas Albright' __...
test__local.py
import gevent.testing as greentest from copy import copy # Comment the line below to see that the standard thread.local is working correct from gevent import monkey; monkey.patch_all() from threading import local from threading import Thread from zope import interface try: from collections.abc import Mapping ex...
local_job_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 us...
pjit_test.py
# Copyright 2021 Google 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
build_imagenet_data.py
# Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
threading_comm.py
import threading from queue import Queue def creator(data, q): """ 생산자 : 쓰레드간 데이터 전송 예제 """ print('Creating data and putting it on the queue') print('\n') for item in data: evt = threading.Event() q.put((item, evt)) print('Waiting for data to be doubled') evt.w...
engine.py
import copy import json import os import platform import queue import shlex import subprocess import threading import time import traceback from typing import Callable, Dict, List, Optional from kivy.utils import platform as kivy_platform from katrain.core.constants import ( OUTPUT_DEBUG, OUTPUT_ERROR, OU...
app.py
#!/usr/bin/python """ app.py - Program to execute command on Multiple Linux Servers Dependency - cryptography, paramiko Input: list of hostnames command Output: Stdout of the Command from each Servers """ import sys, os, string, threading import traceback import paramiko # Great implementation of SSH in...
nullinux.py
#!/usr/bin/env python3 from __future__ import print_function import sys import argparse import datetime from time import sleep from ipparser import ipparser from threading import Thread, activeCount if sys.version_info[0] < 3: from commands import getoutput else: from subprocess import getoutput class nullinu...
create_server.py
import sqlite3 import sys import time import subprocess import os # import requests import threading import ParticleCloud import scheduler import PCA9555 import logging # import logging_tree # from flask import Flask, render_template, request import cherrypy import json conf = { '/': { 'tools.sess...
actor_max_memory_test.py
# Copyright (c) 2018 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 app...
test_recv_save_op.py
# Copyright (c) 2018 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 app...
interact.py
from TTS.text2speech import tts_class from multiprocessing import Process import faiss import time import sqlite3 import csv import random import copy import tensorflow_hub as hub import tensorflow_text import math import numpy as np import pickle from Retriever.Retrieve import retrieve import Utils.functions as utils ...
susi_loop.py
""" Processing logic of susi_linux """ import time import os import re import logging import queue from threading import Thread, Timer, current_thread from datetime import datetime from urllib.parse import urljoin import speech_recognition as sr import requests import json_config import json import speech_recognition f...
pgyr.py
#Hecho por Max Serrano #Sistop-2020-1 #Ejercicio: gatos y ratones #Lenguaje: Python version 3.7 import threading import time import random mutex1 = threading.Semaphore(1) # protege linea_de_platos mutex2 = threading.Semaphore(1) # protege a "comer" platos = threading.Semaphore(0)# protege el plato l_platos = []#plat...
mainloop.py
import gyro import gpstest as gps import ArduinoSlave as mc; import threading import time import servotest as servo; from model_static import sail from os import path def log_sensor_data(): prev = time.time(); output = "sensorlogs/" #Round down to previous 5 minutes. prev = prev - prev%300; if (not...
part_test.py
import sys import threading sys.path.append('../../common') from env_indigo import * def outPrint(str, pid, output): #output = None if output == None: print(str) else: old_out = output[pid] output[pid] = '{0}\n{1}'.format(old_out, str) def insertSmi(db, pid, input_smi, ou...
setup.py
#!/usr/bin/env python #encoding: utf8 import os import re import sys from setuptools import setup from setuptools import find_packages from setuptools.command.test import test as TestCommand try: import colorama colorama.init() from colorama import Fore RESET = Fore.RESET GREEN = Fore.GREEN R...
test_logging.py
# Copyright 2001-2019 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, # provided that the above copyright notice appear in all copies and that # both that copyright notice and this permissio...
test_multiprocessing.py
#!/usr/bin/env python3 # # Unit tests for the multiprocessing package # import unittest import queue as pyqueue import time import io import sys import os import gc import signal import array import socket import random import logging import test.support # Skip tests if _multiprocessing wasn't built. _multiprocessi...
async.py
#!/usr/bin/env python #-*-coding:utf-8-*- from multiprocessing import Process import threading __author__ = 'Allen Woo' ''' decorators ''' def async_thread(f): ''' multiprocessing Process :param f: :return: ''' def wrapper(*args, **kwargs): t =threading.Thread(target=f,args=args, kwarg...
coref_model.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import operator import random import math import json import threading import numpy as np import tensorflow as tf import tensorflow_hub as hub import h5py import util import coref_ops import conll im...
main.py
#!/usr/bin/env python3 # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
manager.py
#!/usr/bin/env python3 import os import time import sys import fcntl import errno import signal import shutil import subprocess import datetime import textwrap from selfdrive.swaglog import cloudlog, add_logentries_handler from common.basedir import BASEDIR, PARAMS from common.android import ANDROID WEBCAM = os.getenv...
utils.py
import jwtoken import threading import os m3ustr = '#EXTM3U x-tvg-url="http://botallen.live/epg.xml.gz" \n\n' kodiPropLicenseType = "#KODIPROP:inputstream.adaptive.license_type=com.widevine.alpha" def processTokenChunks(channelList): global m3ustr kodiPropLicenseUrl = "" if not channelList: pr...
auth.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2012-2021 Snowflake Computing Inc. All rights reserved. # import codecs import copy import json import logging import tempfile import time import uuid from datetime import datetime from os import getenv, makedirs, mkdir, path, remove, removedirs, rmdir fr...
__init__.py
import sys import urllib2 from argparse import ArgumentParser from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer from ConfigParser import RawConfigParser from Queue import Queue from thread import interrupt_main from threading import Thread from time import sleep from traceback import print_exception import ...
top_k_acc.py
import multiprocessing as mp import threading from tqdm import tqdm from joblib import Parallel, delayed def top_k_acc(y_predicted, y_true, class_map, k): '''Calculates the top_k-accuracy for the prediction of xgboost.''' count_matching_species = 0 for i in range(len(y_predicted)): pred = y_predic...
start_api_integ_base.py
from unittest import TestCase, skipIf import threading from subprocess import Popen import time import os import random from pathlib import Path from tests.testing_utils import SKIP_DOCKER_MESSAGE, SKIP_DOCKER_TESTS @skipIf(SKIP_DOCKER_TESTS, SKIP_DOCKER_MESSAGE) class StartApiIntegBaseClass(TestCase): template ...
ls_public_bucket.py
import logging import re import uuid from multiprocessing import Manager, Process, cpu_count, current_process from queue import Empty import boto3 import click import datacube from botocore import UNSIGNED from botocore.config import Config from datacube.index.hl import Doc2Dataset from datacube.utils import changes f...
webhaak.py
import binascii import json import logging import os import subprocess from datetime import datetime, timedelta from functools import update_wrapper from multiprocessing import Process import git import pushover import strictyaml from flask import (Flask, Response, abort, current_app, jsonify, make_response, ...
test_enum.py
import enum import doctest import inspect import os import pydoc import sys import unittest import threading import builtins as bltns from collections import OrderedDict from datetime import date from enum import Enum, IntEnum, StrEnum, EnumType, Flag, IntFlag, unique, auto from enum import STRICT, CONFORM, EJECT, KEEP...
high_availability.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...
util.py
"""Misc. utility functions""" import threading from typing import Any, Callable, cast, Generic, Optional, Set, TypeVar T = TypeVar("T") Callback = Callable[[T], None] class Observable(Generic[T]): """Basic implementation of an observable. Used for passing state down a (possibly) long chain of views and cont...
rl_server_no_training_modified.py
#!/usr/bin/env python from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer import SocketServer import base64 import urllib import sys import os import json import multiprocessing import matplotlib.pyplot as plt os.environ['CUDA_VISIBLE_DEVICES']='' import numpy as np import tensorflow as tf import time import...
transform_replay.py
#!/usr/bin/env python from pysc2.lib import features, point from absl import app, flags from pysc2.env.environment import TimeStep, StepType from pysc2 import run_configs from s2clientprotocol import sc2api_pb2 as sc_pb import importlib import glob from random import randint import pickle from multiprocessing import P...
console.py
""" @copyright: 2013 Single D Software - All Rights Reserved @summary: Provides a console API for Light Maestro. """ # Standard library imports import collections import json import logging import os import re import threading import time # Application imports import wavetrigger # Named logger for this module _log...
stripsim.py
""" stripsim.py Graphical NeoPixel LED strip emulator. Connect target's Neopixel output to NeoPill's (STM32 Bluepill) inputs. Connect PC via USB to NeoPill for Neopixel->USB serial bridge. Find the appropriate COM port to use. This code reads a yaml file for configuration. Each LED is a simple rectangle or ci...
HTTPControl.py
import logging import mimetypes import os import pathlib from http.server import HTTPServer, BaseHTTPRequestHandler from socketserver import ThreadingMixIn from datetime import datetime, timedelta import jinja2 import json import re import threading import time import urllib.parse import math from ww import f logger =...
update_repository_manager.py
""" Determine if installed tool shed repositories have updates available in their respective tool sheds. """ import logging import threading import tool_shed.util.shed_util_common as suc from tool_shed.util import common_util from tool_shed.util import encoding_util log = logging.getLogger( __name__ ) class UpdateRe...
upgrade_test.py
#!/usr/bin/env python3 from argparse import ArgumentParser, RawDescriptionHelpFormatter import glob import os from pathlib import Path import platform import random import shutil import stat import subprocess import sys from threading import Thread, Event import traceback import time from urllib import request import ...
plugin.py
import base64 import re import threading from binascii import hexlify, unhexlify from functools import partial from electrum_zaap.bitcoin import (bc_address_to_hash_160, xpub_from_pubkey, public_key_to_p2pkh, EncodeBase58Check, TYPE_ADDRESS, TYPE_SCRIPT, ...
ScInit.py
import sys, getopt, struct, time, termios, fcntl, sys, os, colorsys, threading, datetime, subprocess, json sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/fbtft') from RenderManager import RenderManager from WanemManager import WanemManager from HttpUtil import HttpUtil from LogReporter import LogReporte...
mainSaberMgt.py
#=============================================================================== # Management application for Saber Lights # Jon Durrant # 14-Jan-2022 #=============================================================================== from flask import Flask,flash, redirect, request, send_from_directory from flask import...
evaluate_dist.py
import sys sys.path.append('.') import os import tqdm import torch import random import shutil import argparse import numpy as np import multiprocessing from collections import defaultdict from torch.utils.data import DataLoader from data.aug import ops from data.dataset import DOTA1_5 from data.aug.compose impor...
train_pg_f18.py
""" Original code from John Schulman for CS294 Deep Reinforcement Learning Spring 2017 Adapted for CS294-112 Fall 2017 by Abhishek Gupta and Joshua Achiam Adapted for CS294-112 Fall 2018 by Michael Chang and Soroush Nasiriany Finished by Haoxiong Liu """ import numpy as np import tensorflow as tf import gym import logz...
concurrency.py
from invoke.vendor.six.moves.queue import Queue from invoke.util import ExceptionWrapper, ExceptionHandlingThread as EHThread from spec import Spec, ok_, eq_ # TODO: rename class ExceptionHandlingThread_(Spec): class via_target: def setup(self): def worker(q): q.put(7) ...
manager.py
#!/usr/bin/env python3 import os import time import sys import fcntl import errno import signal import shutil import subprocess import datetime import textwrap from typing import Dict, List from selfdrive.swaglog import cloudlog, add_logentries_handler from common.basedir import BASEDIR, PARAMS from common.hardware i...
test_cursor.py
# Copyright 2009-present MongoDB, 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 wri...
test_browser.py
import BaseHTTPServer, multiprocessing, os, shutil, subprocess, unittest, zlib, webbrowser, time, shlex from runner import BrowserCore, path_from_root from tools.shared import * # User can specify an environment variable EMSCRIPTEN_BROWSER to force the browser test suite to # run using another browser command line tha...
tesis4.py
from multiprocessing import Process, Queue import mysql.connector import cv2 import numpy as np from datetime import datetime def run_camara(direccion, arreglo_jugadores, cola, indice_proceso_actual): cap = cv2.VideoCapture(direccion) jugador_actual = None continuar1 = True if cap.isOpened(): while continuar...
buttonthread.py
# -*- coding: utf-8 -*- # Copyright (c) 2018 Steven P. Goldsmith # See LICENSE.md for details. """ Use a thread to monitor edge events in background ------------- Should work on any board with a button built in. Just change chip and line value as needed. """ import sys, time, threading from argparse import * from cff...
test_utils.py
# Copyright (c) 2010-2012 OpenStack Foundation # # 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...
openvino_yolov3_MultiStick_test.py
import sys, os, cv2, time, heapq, argparse import numpy as np, math from openvino.inference_engine import IENetwork, IEPlugin import multiprocessing as mp from time import sleep import threading yolo_scale_13 = 13 yolo_scale_26 = 26 yolo_scale_52 = 52 classes = 80 coords = 4 num = 3 anchors = [10,13,16,30,33,23,30,61...
test_generator_mt19937.py
import sys import pytest import numpy as np from numpy.dual import cholesky, eigh, svd from numpy.linalg import LinAlgError from numpy.testing import ( assert_, assert_raises, assert_equal, assert_allclose, assert_warns, assert_no_warnings, assert_array_equal, assert_array_almost_equal, suppress_warnings)...
translate.py
import argparse import io import itertools import multiprocessing import os import subprocess import sys import threading import time import traceback from collections import OrderedDict, deque CMD = 'python translate.py --model {model} {extra}' def count_lines(f): i = 0 if not os.path.exists(f): ret...
clients.py
from . import AlertingClient import re import time import requests from threading import Thread from typing import List, Union, Optional from slackclient import SlackClient from sendgrid import SendGridAPIClient from sendgrid.helpers.mail import Mail from telegram import Bot class AlertingSlackClient(AlertingClient...
main.py
""" SubT Challenge Version 1 """ import gc import os.path import math import threading import copy from datetime import timedelta from collections import defaultdict from io import StringIO import numpy as np from osgar.explore import follow_wall_angle from osgar.lib.mathex import normalizeAnglePIPI from osgar.lib...
nettle.py
#!/usr/bin/python2 import urllib2 import threading import logging from time import sleep class NetTle: def __init__(self, tle_handler, config): self.log = logging.getLogger('boresight') self.tle_handler = tle_handler self.config = config self.satellites = self.config['sats'] ...
threads2.py
# Python program to illustrate the concept # of threading import threading import os def task1(): print("Task 1 assigned to thread: {}".format(threading.current_thread().name)) print("ID of process running task 1: {}".format(os.getpid())) def task2(): print("Task 2 assigned to thread: {}".format(threading....
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 ...
__main__.py
import queue import threading import time from subprocess import Popen from types import SimpleNamespace import os import traceback from haste_storage_client.haste_priority_queue_client import HastePriorityQueueClient from haste.desktop_agent import golden from haste.desktop_agent.golden import get_golden_prio_for_fi...
test_client.py
import asyncio import concurrent.futures import copy import datetime import functools import os import re import threading import warnings from base64 import b64decode, b64encode from queue import Empty from typing import Any from unittest.mock import MagicMock, Mock import nbformat import pytest import xmltodict from...
test_client.py
#!/usr/bin/env python # Copyright 2012 James McCauley # # 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__.py
import sys from signal import signal, SIGINT from threading import Thread try: from Queue import Queue # Python2 except ImportError: from queue import Queue # Python3 from occacc.logger import logger, LOG, ErrorFilter, ErrorMessage from occacc.mqtt import Mqtt from occacc.config import MQTT, CAMERAS, COMMAND_P...
road_speed_limiter.py
import json import select import threading import time import socket import fcntl import struct from threading import Thread from cereal import messaging from common.params import Params from common.numpy_fast import interp, clip from common.realtime import sec_since_boot from selfdrive.config import Conversions as CV ...
server.py
#!/usr/bin/python # -*- coding: utf-8 -*- """ 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 agre...
prep_data.py
import os import numpy as np import pandas as pd from collections import Counter from sklearn.model_selection import train_test_split from sklearn.externals import joblib import json import cv2 from time import time import threading import math DATASET={'CCT':'iWildCam_2019_CCT','iNat':'iWildCam_2019_iNat_Idaho','IDF...
test_executor.py
#!/usr/bin/env python # 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 # "L...
asp_solver.py
import sys import clingo import json import time import traceback import signal from threading import Thread from time import sleep import os class IncrementalSolver: ''' solv_type: 0: 2 solver call with theoric delta 1: continuous calls until solved on theoric delta 2: 1 solver call with o...
video.py
import os import sys import dill from vipy.globals import print from vipy.util import remkdir, tempMP4, isurl, \ isvideourl, templike, tempjpg, filetail, tempdir, isyoutubeurl, try_import, isnumpy, temppng, \ istuple, islist, isnumber, tolist, filefull, fileext, isS3url, totempdir, flatlist, tocache, premkdir, ...
test_telnetlib.py
import socket import selectors import telnetlib import time import contextlib from unittest import TestCase from test import support threading = support.import_module('threading') HOST = support.HOST def server(evt, serv): serv.listen() evt.set() try: conn, addr = serv.accept() conn.close...
app.py
#/usr/bin/python3 # https://github.com/tnware/product-checker # by Tyler Woods # coded for Bird Bot and friends # https://tylermade.net import requests import time import json import random from datetime import datetime import urllib.parse as urlparse from urllib.parse import parse_qs #import webhook_settings #import p...
video_async.py
import threading class VideoCaptureAsync: def __init__(self,camera): self.camera = camera self.grabbed, self.frame = self.camera.read() self.started = False self.read_lock = threading.Lock() def startReading(self): if self.started: print('Started video ...
simple_nn_parallel.py
import numpy as np import tensorflow as tf from tensorflow.keras.datasets import mnist import multiprocessing as mp import ray ray.init() @ray.remote def nn_predictions(model, objects): results = [] for obj in objects: res = model.predict(obj.reshape(1, -1)) results.append(np.argmax(res)) ...
A3C_rnn.py
""" Asynchronous Advantage Actor Critic (A3C), Reinforcement Learning. The BipedalWalker example. View more on [莫烦Python] : https://morvanzhou.github.io/2_tensorflow_old/ Using: tensorflow 1.8.0 gym 0.10.5 """ import multiprocessing import threading import tensorflow as tf import numpy as np import gym import os im...
testrunner.py
# Copyright 2010 Orbitz WorldWide # # 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...
main.py
from crosshair import Crosshair import json import threading def reload_crosshair(c = None): if c: c.allow_draw = False try: with open("config.json", "r") as f: config = json.loads(f.read()) c = Crosshair(config["color"], (config["thickness"], config["length"], config["offs...
tensorboard.py
"Provides convenient callbacks for Learners that write model images, metrics/losses, stats and histograms to Tensorboard" from ..basic_train import Learner from ..basic_data import DatasetType, DataBunch from ..vision import Image from ..vision.gan import GANLearner from ..callbacks import LearnerCallback from ..core i...
distribute_coordinator_test.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...
http.py
# -*- coding: utf-8 -*- """ This module contains some helpers to deal with the real http world. """ import threading import logging import select import socket import time import os import six import webob from six.moves import http_client from waitress.server import TcpWSGIServer def get_free_po...
athenad.py
#!/usr/bin/env python3 import base64 import bz2 import hashlib import io import json import os import queue import random import select import socket import subprocess import sys import tempfile import threading import time from collections import namedtuple from datetime import datetime from functools import partial f...
marathon_lb.py
#!/usr/bin/env python3 """# marathon-lb ### Overview The marathon-lb is a service discovery and load balancing tool for Marathon based on HAProxy. It reads the Marathon task information and dynamically generates HAProxy configuration details. To gather the task information, marathon-lb needs to know where to find Mar...
test.py
# vim: sw=4:ts=4:et import logging import os, os.path import pickle import re import shutil import signal import tarfile import tempfile import threading import time import unittest import uuid from multiprocessing import Queue, cpu_count, Event from queue import Empty import saq, saq.test from saq.analysis import R...
winfstest.py
# winfstest.py # # Copyright (c) 2015, Bill Zissimopoulos. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # 1. Redistributions of source code must retain the above copyright # no...
tunnel-manager.py
#!/usr/bin/env python3 import os, yaml, time from subprocess import Popen, PIPE from multiprocessing import Process import sys def log(prefix, msg): for l in msg.splitlines(): print("{}: {}".format(prefix, l)) def run(cmd, splitlines=False): # you had better escape cmd cause it's goin to the shell ...
test_concurrency.py
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 # For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt """Tests for concurrency libraries.""" import glob import os import random import sys import threading import time from flaky import flaky import coverage from c...