source
stringlengths
3
86
python
stringlengths
75
1.04M
beta_prediction_map.py
import torch import multiprocessing as mp from tqdm import tqdm # deepbio packages from deepbiosphere.scripts.GEOCLEF_Config import paths from multiprocessing import Process import deepbiosphere.scripts.NAIP_Utils as naip import deepbiosphere.scripts.GEOCLEF_Utils as utils if __name__ == '__main__': mp.set_star...
cosmoscli.py
import enum import hashlib import json import tempfile import threading import time import bech32 from dateutil.parser import isoparse from .app import CHAIN from .ledger import ZEMU_BUTTON_PORT, ZEMU_HOST, LedgerButton from .utils import build_cli_args_safe, format_doc_string, interact class ModuleAccount(enum.Enu...
Logger.py
""" Logging utilities and functions. """ from threading import Thread, Event from tkinter import Tk, END, PhotoImage from tkinter.ttk import Treeview, Style from typing import cast, List from src.compiler.Args import Args from src.compiler.Util import Util from src.pyexpressions.abstract.PyExpression import PyExpressi...
error_handling.py
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
prepostshow.py
#!/usr/bin/env python # # Licensed under the BSD license. See full license in LICENSE file. # http://www.lightshowpi.com/ # # Author: Todd Giles (todd@lightshowpi.com) # Author: Chris Usey (chris.usey@gmail.com) # Author: Tom Enos (tomslick.ca@gmail.com) """Preshow and Postshow functionality for the lightshows. Your...
queue_runner_impl.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...
server.py
import socket from queue import Queue import turtle from turtle import Turtle from threading import Thread, current_thread from port import PORT serverSocket = None cmd_queue = Queue() class Move: def __init__(self, parts): self.name = parts[0] self.x = int(parts[1]) self.y = int(parts[2])...
trial_pit.py
import os os.chdir(os.path.dirname(os.path.realpath(__file__))) import numpy as np import torch from torch.autograd import Variable from torchvision import datasets, transforms import torch.multiprocessing as mp import operator from networks import classifierMNISTFC, classifierMNISTCNN #* Learning settings EPOCH...
triggerKeyboard.py
from pykeyboard import PyKeyboardEvent import time from threading import Thread """ shuoGG: 本模块只公开key_trigger接口(装饰器) eg: @key_trigger('ctrl+shift+alt+f8', True) 具体见main函数 """ def key_trigger(key_str, is_trigger_once=True): """ @装饰器key_trigger :param key_str: 快捷键 :param is_trigger_once...
contents.py
import re import time from bs4 import BeautifulSoup import requests from errors import * ERROR_KW = ['your computer or network may be sending automated queries'] ROBOT_KW = ['unusual traffic from your computer network', 'not a robot', '로봇'] EMPTY_KW = ["정보가 없습니다", "no information is available"] def get_element(driv...
serial_connection.py
from logging import getLogger import pathlib import platform import sys import threading import time from textwrap import dedent from thonny.plugins.micropython.bare_metal_backend import ( NORMAL_PROMPT, FIRST_RAW_PROMPT, OUTPUT_ENQ, OUTPUT_ACK, ) from thonny.common import ConnectionFailedException fro...
linkcheck.py
# -*- coding: utf-8 -*- """ sphinx.builders.linkcheck ~~~~~~~~~~~~~~~~~~~~~~~~~ The CheckExternalLinksBuilder class. :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ import codecs import re import socket import threading from os import p...
thermostat.py
### BEGIN LICENSE # Copyright (c) 2016 Jpnos <jpnos@gmx.com> # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Software"), to deal in the Software without # restriction, including without limitation the rights to use, # copy, mo...
multiproc.py
#!/usr/bin/env python3 import multiprocessing def cont(): for i in range(1,51): print('%d' %(i)) def main(): proc = [] cor = multiprocessing.cpu_count() if cor > 0: for i in range(cor + 1): p = multiprocessing.Process(target=cont) p.start() proc.app...
soundhandler.py
# This file is part of the pyBinSim project. # # Copyright (c) 2017 A. Neidhardt, F. Klein, N. Knoop, T. Köllmer # # 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, includi...
start_daytime_editor.py
""" RenderPipeline Copyright (c) 2014-2016 tobspr <tobias.springer1@gmail.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use...
test_pdb.py
# A test suite for pdb; not very comprehensive at the moment. import doctest import os import pdb import sys import types import codecs import unittest import subprocess import textwrap import linecache from contextlib import ExitStack from io import StringIO from test import support # This little helper class is ess...
eval.py
#!/usr/bin/env python import threading import ConfigParser import re import argparse import sys import logging import os import subprocess from signal import signal # tom add 2014-12-23 import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt # end tom add 2014-12-23 def getMsmrDefaultOptions(): defau...
scoringClass.py
from django.shortcuts import render from django.http import HttpResponse from django.conf import settings from rest_framework import permissions from rest_framework.views import APIView from rest_framework.response import Response import requests import json from django.views.decorators.csrf import csrf_exempt # from...
hyperparameters.py
"""a module to help select hyper paramters. Delegates a lot to gaussianprocess.py """ __author__ = "Reed Essick (reed.essick@gmail.com)" #------------------------------------------------- import time import numpy as np try: import emcee except ImportError: emcee = None try: from scipy import optimize ex...
utils.py
"""Utilities shared by tests.""" import collections import contextlib import io import logging import os import re import selectors import socket import socketserver import sys import tempfile import threading import time import unittest import weakref from unittest import mock from http.server import HTTPServer fro...
coverage_testIPv6.py
from Queue import Queue import random import threading import unittest from coapclient import HelperClient from coapserver import CoAPServer from coapthon import defines from coapthon.messages.message import Message from coapthon.messages.option import Option from coapthon.messages.request import Request from coapthon....
snmp.py
# (C) Datadog, Inc. 2010-2019 # All rights reserved # Licensed under Simplified BSD License (see LICENSE) import ipaddress import json import os import threading import time from collections import defaultdict import pysnmp.proto.rfc1902 as snmp_type import yaml from pyasn1.codec.ber import decoder from pysnmp import ...
clientTerminal.py
import npyscreen import socket import random as r import threading import time as t global lastrefresh global temp global messages messages = ["Welcome to PyChat for Terminal", "Type /exit to quit",""] lastrefresh = ["Welcome to PyChat for Terminal", "Type /exit to quit",""] name = input("Please enter your name: ") ...
webrepl_connection.py
import sys import threading from logging import DEBUG, getLogger from queue import Queue from .connection import MicroPythonConnection logger = getLogger(__name__) class WebReplConnection(MicroPythonConnection): """ Problem with block size: https://github.com/micropython/micropython/issues/2497 Star...
upnp.py
import logging import threading from queue import Queue from typing import Optional try: import miniupnpc except ImportError: pass log = logging.getLogger(__name__) class UPnP: thread: Optional[threading.Thread] = None queue: Queue = Queue() def __init__(self): def run(): t...
BarcodeScanner.py
import RPi.GPIO as GPIO import time import threading GPIO.setmode(GPIO.BCM) BB = 17 GPIO.setup(BB,GPIO.OUT) def Scan(): time.sleep(1) GPIO.output(BB,True) time.sleep(1) GPIO.output(BB,False) #code = input() time.sleep(0.1) return 0 #def GetCode(): # code = input("Code:") # ...
test_ts_libmr_failiure.py
import pytest import redis import random from threading import Thread from time import sleep from utils import Env, Refresh_Cluster from test_helper_classes import _get_series_value, calc_rule, ALLOWED_ERROR, _insert_data, \ _get_ts_info, _insert_agg_data from includes import * def testLibmrFail(): env = Env(...
thread_lock_safe.py
""" Race condition Thread safe Dead lock atomic """ from threading import Thread, Lock num = 0 # shared resource lock = Lock() def add(): """ atomic """ global num with lock: for _ in range(100000): num += 1 def subtract(): """ atomic :r...
Hiwin_RT605_ArmCommand_Socket_20190627161333.py
#!/usr/bin/env python3 # license removed for brevity import rospy import os import numpy as np from std_msgs.msg import String from ROS_Socket.srv import * from ROS_Socket.msg import * import math import enum pos_feedback_times = 0 mode_feedback_times = 0 msg_feedback = 1 #接收策略端命令 用Socket傳輸至控制端電腦 import socket ##多執行序 i...
application_test.py
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
RIPv2.py
import random import socket import threading import time import struct import sys import copy sys.path.append("../utils/") import utils INF = 16 class VectorItem(object): def __init__(self, Dest, nextHop, metric): # all is a tuple contain string ip and int port self.Dest = Dest self.next...
follow_waypoints.py
#!/usr/bin/env python import threading import rospy import actionlib from smach import State,StateMachine from move_base_msgs.msg import MoveBaseAction, MoveBaseGoal from geometry_msgs.msg import PoseWithCovarianceStamped, PoseArray ,PointStamped, PoseStamped from std_msgs.msg import Empty from tf import TransformList...
screenshots.py
# -*- coding:utf8 -*- from win32 import win32api, win32gui, win32print from win32.lib import win32con from win32.win32api import GetSystemMetrics import threading import tkinter as tk from PIL import ImageGrab import base64 import os def get_real_resolution(): """获取真实的分辨率""" hDC = win32gui.GetDC(0) # 横向分辨...
servidor_multiproceso.py
import socket import sys import os import time from random import randint from multiprocessing import Process PORT = 5000 OK_MESSAGE = 'Succesful Request!' def handle_with_process(endpoint_socket): print(f'Procesando solicitud en proceso: {os.getpid()}') time.sleep(randint(0, 6)) totalsent = 0 message...
journal.py
# Copyright 2016 Mellanox Technologies, Ltd # 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 # # Unles...
optimizer.py
import math import numpy as np import pydart import action as ac import myworld import cma import multiprocessing from multiprocessing import Process, Queue import mmMath from numpy.linalg import inv dt = 1.0/600.0 skel_file = '/home/jungdam/Research/AlphaCon/pydart/apps/turtle/data/skel/turtle.skel' def obj_func_tra...
test_integration.py
import itertools import logging import os import subprocess import sys import mock import pytest import six import ddtrace from ddtrace import Tracer from ddtrace.internal import agent from ddtrace.internal.runtime import container from ddtrace.internal.writer import AgentWriter from tests.utils import AnyFloat from ...
my_deepzoom_overlay_png.py
#!/usr/bin/python import math, os, optparse, sys from xml.dom import minidom import re import threading import shutil from PIL import Image from my_seadragon_pdf import PyramidComposer class OverlayPyramid(object): def __init__( self, composer, threads_semaphore, path_prefix, png_x, png_y, png_img ): self...
installwizard.py
from electrum import Wallet from electrum_gui.kivy.i18n import _ from kivy.app import App from kivy.uix.widget import Widget from kivy.core.window import Window from kivy.clock import Clock from kivy.factory import Factory import sys import threading from functools import partial import weakref from create_restore i...
tcp.py
# -*- coding: utf-8 -*- ''' TCP transport classes Wire protocol: "len(payload) msgpack({'head': SOMEHEADER, 'body': SOMEBODY})" ''' # Import Python Libs from __future__ import absolute_import, print_function, unicode_literals import errno import logging import msgpack import socket import os import weakref import ti...
preallocator.py
# # preallocator.py - maintains a pool of active virtual machines # import threading, logging, time, copy, os from tangoObjects import TangoDictionary, TangoQueue, TangoIntValue from config import Config # # Preallocator - This class maintains a pool of active VMs for future # job requests. The pool is stored in dic...
distributed_train.py
#!/usr/bin/env python3 -u # Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the LICENSE file in # the root directory of this source tree. An additional grant of patent rights # can be found in the PATENTS file in the same directory. import o...
MsgHandler.py
import SocketServer, threading, netifaces _MsgHandler = None #Note that this is duplicated in videoServer.py def getInterface () : for myIf in ( ['eth0', 'wlan0' ]): try : iface = netifaces.ifaddresses( myIf).get(netifaces.AF_INET) if iface : return iface[0]['addr']...
c8yMQTT.py
''' Created on 05.12.2017 @author: mstoffel ''' import logging from logging.handlers import RotatingFileHandler import threading import paho.mqtt.client as mqtt from threading import Thread import threading import time import re class C8yMQTT(object): def __init__(self,clientId, mqtthost,mqttport,topics): ...
Python-samples-for-slate.py
__author__ = 'vyshakh.babji' import time from rcsdk import RCSDK from threading import Thread from time import sleep from rcsdk.subscription import EVENTS #Instantiating the SDK RC_SERVER_PRODUCTION = 'https://platform.ringcentral.com' RC_SERVER_SANDBOX = 'https://platform.devtest.ringcentral.com' YOUR_APPKEY = '' YO...
clients.py
import io import socket import struct import time import threading import json import logging class BaseClient: def __init__(self, name, board="", id="", server_host="localhost", server_port=2333): self.type = 'base' self.name = name self.board = board if board else "Default" self....
verify.py
#!/usr/bin/env python3 """ Simple tkinter application for verifying voice samples with text prompts. Shows plot of WAV data. Left click to add trim start, right click to add trim end. Play and Verify will respect trimmings. Change prompt in text box to have different text written with Verify. """ import argparse impo...
test_vedbus.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Python import logging import os import gobject import sqlite3 import sys import unittest import subprocess import time import dbus import threading import fcntl from dbus.mainloop.glib import DBusGMainLoop # Local sys.path.insert(1, os.path.join(os.path.dirname(__file__...
__init__.py
import inspect import re import threading from abc import abstractmethod from datetime import datetime, timedelta from i3pystatus import IntervalModule, formatp, SettingsBase from i3pystatus.core.color import ColorRangeModule from i3pystatus.core.desktop import DesktopNotification humanize_imported = False try: i...
integration_test.py
from abc import ( ABCMeta, ) from concurrent.futures.thread import ( ThreadPoolExecutor, ) from contextlib import ( contextmanager, ) import csv import gzip from io import ( BytesIO, TextIOWrapper, ) from itertools import ( chain, ) import json import logging import os from random import ( R...
logplayback.py
#!/usr/bin/env python2 from shm_tools.shmlog.parser import LogParser from datetime import datetime, timedelta from time import time, sleep import sys import termios import argparse from threading import Thread, Event, Lock import libshm.parse import shm ''' Program to play back shared memory log files. See logplayback...
trainer_controller.py
# # Unity ML-Agents Toolkit # ## ML-Agent Learning """Launches trainers for each External Brains in a Unity Environment.""" import os import threading from typing import Dict, Set, List from collections import defaultdict import numpy as np from mlagents.tf_utils import tf from mlagents_envs.logging_util import get_...
defs.py
"""Strong typed schema definition.""" import http.server import json import random import re import socket import socketserver import string from base64 import b64encode from enum import Enum from pathlib import Path from threading import Thread from time import time from typing import Any, Dict, List, Optional, Set, U...
assigning_subscriber_test.py
# Copyright 2020 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
tournament.py
from __future__ import absolute_import from collections import defaultdict from multiprocessing import Process, Queue, cpu_count from tempfile import NamedTemporaryFile import csv import logging import tqdm import warnings from axelrod import on_windows from .game import Game from .match import Match from .match_gene...
Interface.py
import curses from curses.textpad import Textbox, rectangle from curses import wrapper from time import sleep import threading SPACE_CHAR = 32 TITLE_ROW = 0 AUTOSEND_INFO_ROW = 3 MESSAGE_INFO_ROW = 4 KEYMAP_START_ROW = 5 SENDING_ROW = 8 TOPIC_INFO_START_ROW = 13 BROKER_INFO_START_ROW = 14 EXIT_START_ROW = 16 class In...
cli.py
""" This module contains the command line interface for snakeviz. """ from __future__ import print_function import argparse import os import random import socket import sys import threading import webbrowser from pstats import Stats try: from urllib.parse import quote except ImportError: from urllib import qu...
utils.py
# -*- coding: utf-8 -*- """Helper utilities and decorators.""" try: from urlparse import urlparse, urljoin except ImportError: from urllib.parse import urlparse, urljoin from flask import request, redirect, url_for, current_app from flask import flash import hashlib import base64 # import sha3 from ecdsa impo...
application.py
from database import Database from settings import * from API import API def main(ignore_exceptions): if (ignore_exceptions): while True: try: API.main() except SystemExit: import sys sys.exit() except: pas...
thread_work.py
#!/usr/bin/env python # -*- encoding=utf8 -*- from threading import Thread, Timer, Lock from queue import Queue, Full, Empty from time import sleep from socket import socket, AF_INET, SOCK_STREAM from ssh2.session import Session from ssh2.exceptions import * from ftplib import FTP from tkinter import messagebox cl...
threading_daemon_test.py
#!/usr/bin/env python # encoding: UTF-8 import threading import time def worker(): print threading.currentThread().getName(),'starting' time.sleep(3) print threading.currentThread().getName(),'ending' d=threading.Thread(target=worker) d.setDaemon(True) t=threading.Thread(target=worker) d.start() t.star...
test_client.py
import asyncio from collections import deque from contextlib import suppress from functools import partial import gc import logging from operator import add import os import pickle import psutil import random import subprocess import sys import threading from threading import Semaphore from time import sleep import tra...
slycat-timeseries-model.py
# Copyright (c) 2013, 2018 National Technology and Engineering Solutions of Sandia, LLC . Under the terms of Contract # DE-NA0003525 with National Technology and Engineering Solutions of Sandia, LLC, the U.S. Government # retains certain rights in this software. def register_slycat_plugin(context): """Called durin...
notebook_utils.py
#!/usr/bin/env python # coding: utf-8 # In[ ]: import os import shutil import socket import threading import time import urllib import urllib.parse import urllib.request from os import PathLike from pathlib import Path from typing import List, NamedTuple, Optional, Tuple import cv2 import matplotlib import matplotl...
rdd.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...
login.py
import os, sys, time, re, io import threading import json, xml.dom.minidom import copy, pickle, random import traceback, logging try: from httplib import BadStatusLine except ImportError: from http.client import BadStatusLine import requests from pyqrcode import QRCode from .. import config, util...
pettypomodoro.py
#!/usr/bin/env python # -*- coding: UTF-8 -*- ''' author: Joe Zhang git: github.com/JacketPants blog: moe101.top email: joezhang@outlook.com ''' import sys import threading import time class PettyPomodoro(): ''' The PettyPomodoro Class The __init__ can set four parameters pomodoroTime: t...
scripts_regression_tests.py
#!/usr/bin/env python """ Script containing CIME python regression test suite. This suite should be run to confirm overall CIME correctness. """ import glob, os, re, shutil, signal, sys, tempfile, \ threading, time, logging, unittest, getpass, \ filecmp, time, atexit from xml.etree.ElementTree import ParseEr...
invoker.py
"""Abstraction for invoking AWS APIs (a.k.a. operations) and handling responses.""" import logging from queue import Queue from threading import Thread import botocore from opinel.utils.credentials import read_creds from . import config from . import progress from . import store LOGGER = logging.getLogger(__name__)...
core.py
""" Core logic (uri, daemon, proxy stuff). Pyro - Python Remote Objects. Copyright by Irmen de Jong (irmen@razorvine.net). """ from __future__ import with_statement import re, struct, sys, time, os import logging, uuid import hashlib, hmac try: import copyreg except ImportError: import copy_reg as copyreg fr...
utils.py
import sys import gconfig from os import path file_dir = path.dirname(path.abspath(__file__)) build_opts = ['build_ext', '--build-lib', file_dir, '--build-temp', file_dir + '/.cython_build'] _old_argv = sys.argv try: if not gconfig.use_cython: raise ImportError("Cython disabled in config") ...
wintracker.py
#!/usr/bin/python # writes to stdout # this version monitors TWO different interfaces. Output is written as (time,intf1, intf2) # we use the same filter on both interfaces. # dev is no longer a parameter import pcapy import time import threading import sys # TCP HEADER FIELDS TCP_DATAOFFSET = 12 TCP_SEQ_OFFSET = 4 T...
federated_learning_keras_PS.py
from DataSets import RadarData from DataSets_tasks import RadarData_tasks from consensus.consensus_v2 import CFA_process from consensus.parameter_server import Parameter_Server # best use with PS active # from ReplayMemory import ReplayMemory import numpy as np import os import tensorflow as tf from tensorflow import k...
miz_inverse_random.py
import random, time import secp256k1 as ice from time import sleep import time, multiprocessing, random from multiprocessing import pool, Event, Process, Queue, Value, cpu_count n = 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141 def hunt(start, stop, add, cores='all'): try: available_...
util.py
from __future__ import print_function from __future__ import absolute_import from __future__ import division import base64 import colorsys import errno import hashlib import json import getpass import logging import os import re import shlex import subprocess import sys import threading import time import random impor...
dataloader_webcam.py
import os import torch from torch.autograd import Variable import torch.utils.data as data import torchvision.transforms as transforms from PIL import Image, ImageDraw from SPPE.src.utils.img import load_image, cropBox, im_to_torch from opt import opt from yolo.preprocess import prep_image, prep_frame, inp_to_image fro...
statsig_logger.py
import threading, queue from .statsig_event import StatsigEvent _CONFIG_EXPOSURE_EVENT = "statsig::config_exposure" _GATE_EXPOSURE_EVENT = "statsig::gate_exposure" class _StatsigLogger: def __init__(self, net, shutdown_event, statsig_metadata, local_mode): self.__events = list() self.__retry_logs ...
daemon.py
# vim: set filetype=python tabstop=4 shiftwidth=4 expandtab: import multiprocessing import entry import secrets import status if __name__ == "__main__": secrets.open_store() prev_exit = status.START while prev_exit != status.END: handler = status.get_handler(prev_exit) if handler.defer...
test_distro_stream_client.py
#!/usr/bin/python # # Copyright 2002-2021 Barcelona Supercomputing Center (www.bsc.es) # # 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 ...
app.py
# encoding: utf-8 ''' A REST API for Salt =================== .. versionadded:: 2014.7.0 .. py:currentmodule:: salt.netapi.rest_cherrypy.app :depends: - CherryPy Python module. Versions 3.2.{2,3,4} are strongly recommended due to a known `SSL error <https://bitbucket.org/cherrypy/cherrypy/issue/1298/ssl-no...
test_threaded_import.py
# This is a variant of the very old (early 90's) file # Demo/threads/bug.py. It simply provokes a number of threads into # trying to import the same module "at the same time". # There are no pleasant failure modes -- most likely is that Python # complains several times about module random having no attribute # randran...
control_panel_vista_win7.py
# Author : Pavel Vitis "blackdaemon" # Email : blackdaemon@seznam.cz # # Copyright (c) 2010, Pavel Vitis <blackdaemon@seznam.cz> # 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. Redistri...
DimensionOne_kA.py
# -*- coding: utf-8 -*- """ One Dimensional Case. We assume Bob is doing random walk in a one dimensional search space of size n. A location proximity service is available for Alice to query if Bob is within a certain distance from her. Alice can cheat with her location while using this service. Her goal is to locate ...
DIPPID.py
import sys import json from threading import Thread from time import sleep from datetime import datetime import signal # those modules are imported dynamically during runtime # they are imported only if the corresponding class is used #import socket #import serial #import wiimote class Sensor(): # class variable ...
04_shared.py
from timer import Timer import threading class State: def __init__(self): self.n = 0 def dec(s): for _ in range(100000): s.n -= 1 def inc(s): for _ in range(100000): s.n += 1 state = State() print("Begin") t = Timer() td = threading.Thread(target = dec, args=(state,)) ti = thr...
test_gc.py
# expected: fail import unittest from test.test_support import verbose, run_unittest import sys import time import gc import weakref try: import threading except ImportError: threading = None ### Support code ############################################################################### # Bug 1055820 has se...
test_stress.py
import os import sys import threading from time import sleep from RLTest import Env from redisgraph import Graph from base import FlowTestsBase GRAPH_ID = "G" # Graph identifier. CLIENT_COUNT = 100 # Number of concurrent connections. conn = None # Connectio...
YoutubeDL.py
import threading from time import sleep from random import randint import PySimpleGUIQt as sg from pytube import YouTube import glob import subprocess import os from moviepy.editor import * import shutil from pathlib import Path download_directory = "" download_count = 0 file_size = 0 status = '' home_dir = Path.home(...
client.py
import time import redis from multiprocessing import Process from os import path from config import Config from http_req import * from url_gen import * from resp_parse import * # need to make a thread to query periodically class Client(object): def __init__(self, config_file): self.config = Config(path....
window_manager.py
""" Description ----------- A full implementation of a WindowManager for the terminal, building on top of the Widget system. It runs with no external dependencies, and has full mouse support. It is the simplest way to use pytermgui in your applications, as it handles all input and output in a nice and optimized manne...
inference_aleatoric.py
""" Inference script for the yolov3.yolov3_aleatoric class. Produces detection files for each input image conforming to the ECP .json format. The output of this script can be directly used by the ECP evaluation code. """ import json import logging import os import threading import time import numpy as np import tens...
coap.py
import logging.config import os import random import socket import struct import threading from coapthon import defines from coapthon.layers.blocklayer import BlockLayer from coapthon.layers.messagelayer import MessageLayer from coapthon.layers.observelayer import ObserveLayer from coapthon.layers.requestlayer import ...
benchmark_averaging.py
import argparse import math import threading import time import torch import hivemind from hivemind.proto import runtime_pb2 from hivemind.utils.limits import increase_file_limit from hivemind.utils.logging import get_logger, use_hivemind_log_handler from hivemind.utils.networking import LOCALHOST use_hivemind_log_h...
datasets.py
# Dataset utils and dataloaders import glob import logging import math import os import random import shutil import time from itertools import repeat from multiprocessing.pool import ThreadPool from pathlib import Path from threading import Thread import cv2 import numpy as np import torch import torch.nn.functional ...
object_pool.py
import random import time import threading import queue from typing import Union class Connection: def __init__(self): # establish connection, and so on. pass def clear(self, *args): """ clear self instance for next usage """ def query(self, *args): """ execute query """...
test_socket.py
import unittest from test import support import errno import io import itertools import socket import select import tempfile import time import traceback import queue import sys import os import array import contextlib from weakref import proxy import signal import math import pickle import struct import random import...
server.py
""" A high-speed, production ready, thread pooled, generic HTTP server. For those of you wanting to understand internals of this module, here's the basic call flow. The server's listening thread runs a very tight loop, sticking incoming connections onto a Queue:: server = HTTPServer(...) server.start() ->...
Arlo-w-debug.py
## # Copyright 2016 Jeffrey D. Walter # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
batcher.py
#Most of this file is copied form https://github.com/abisee/pointer-generator/blob/master/batcher.py import queue as Queue import time from random import shuffle from threading import Thread import numpy as np import tensorflow as tf from . import config from . import data import random random.seed(1234) class Ex...