source
stringlengths
3
86
python
stringlengths
75
1.04M
echo_dialog.py
# Software License Agreement (BSD License) # # Copyright (c) 2012, Fraunhofer FKIE/US, Alexander Tiderko # 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 mus...
Sphero.py
""" Tools for controlling a Sphero 2.0. Sphero is the main class, all others define parameter or return classes. Most sphero commands return a Response object, that has two data fields. `response.success` indicates if the operation was successful, and `response.data` is any returned data, when appropriate. """ from...
scope.py
try: from multiprocessing import Process, Queue, Pipe import numpy as np import signal import cv2 import time import os from mss import mss except ImportError as e: print("[+] Some required modules were not found.") print("[+] Installing required modules with pip") os.system("pip...
termuxTrover.py
#!/usr/bin/env python3 import threading import netifaces as ni import numpy as np import math import time import socket import signal import logging import pynmea2 import io import sys # For network tests import requests import urllib.parse localPP = 1 rpiIP = "192.168.142.203" fname = "rtkwaypoints.txt"#"5gwaypoin...
cluster_watcher.py
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
safe_t.py
from binascii import hexlify, unhexlify import traceback import sys from typing import NamedTuple, Any, Optional, Dict, Union, List, Tuple, TYPE_CHECKING from electrum_ltc.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException from electrum_ltc.bip32 import BIP32Node from electrum_ltc import constants...
exchange_rate.py
from datetime import datetime import inspect import requests import sys import os import json from threading import Thread import time import csv import decimal from decimal import Decimal from .bitcoin import COIN from .i18n import _ from .util import PrintError, ThreadJob # See https://en.wikipedia.org/wiki/ISO_42...
pexpect_runner.py
#!/usr/bin/env python3 import sys import pexpect import os import threading import signal import time import Queue import wx import PexpectRunnerConsolImpl def sighandler(signum, frame): # print "Signaled: %d" %signum if signum == signal.SIGCHLD: sys.exit(1) else: text_queue.put("SIGQU...
servidorPYCHAT.py
import socket import threading import sys import pickle class Servidor(): """docstring for Servidor""" def __init__(self, host="localhost", port=4000): self.clientes = [] self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.bind((str(host), int(port))) self.sock.listen(10) self.sock.se...
fmos_spontaneous.py
''' FMOS Spontaneous - Freely Moving Olfactory Search - RECORDS SPONTANEOUS BEHAVIOR Written: Teresa Findley, tfindley@uoregon.edu Last Updated: 04.26.2021 --Records tracking data via OSC communication with custom code in Bonsai (open source computer vision software -- https://bonsai-rx.org/) --Records signal...
movielens.py
import logging import random import threading from datetime import datetime import numpy as np from scipy import sparse from sklearn.preprocessing import MinMaxScaler from .utils import Indexer, create_sparse, timestamp_delta_generator rating_threshold = 4 actor_threshold = 3 def generate_indexer(user_rates_movies...
test_basic.py
# coding: utf-8 from __future__ import absolute_import from __future__ import division from __future__ import print_function import collections from concurrent.futures import ThreadPoolExecutor import json import logging import os import random import re import setproctitle import shutil import six import socket impor...
realtime_altitude.py
#!/usr/bin/env python3 ''' Real-time plot demo using serial input from Arduino altitude-estimation sketch Dependencies: numpy, matplotlib, https://github.com/simondlevy/RealtimePlotter Copyright (C) 2018 Simon D. Levy ''' import serial from realtime_plot import RealtimePlotter import numpy as np from threading impo...
idle.py
#!/usr/bin/env python # # idle.py - Run functions on an idle loop or in a separate thread. # # Author: Paul McCarthy <pauldmccarthy@gmail.com> # """This module provides functions and classes for running tasks asynchronously, either in an idle loop, or on a separate thread. .. note:: The :class:`IdleLoop` functionalit...
client.py
# Copyright 2020 Unity Technologies # # 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...
config.py
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: r""" A Python module to maintain unique, run-wide *nibabies* settings. This module implements the memory structures to keep a consistent, singleton config. Settings are passed across processes via filesyst...
abstract_common_factory.py
# Copyright 2020-2020 Exactpro (Exactpro Systems 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
multi_inference_20200804111841.py
# coding=utf-8 import os import cv2 import sys import pdb import subprocess import multiprocessing import inference_utils import common def single_process(index, task, gpu): print(("任务%d处理%d张图片" % (index, len(task)))) # 写文件 filename = inference_utils.dump_testfile(task, index) out_str = subproces...
blockchain.py
# Electrum - lightweight Bitcoin client # Copyright (C) 2012 thomasv@ecdsa.org # # 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...
main_window.py
#!/usr/bin/env python3 # # Electrum - lightweight Bitcoin client # Copyright (C) 2012 thomasv@gitorious # # 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 with...
test_user_agent.py
""" Tests for the pandas custom headers in http(s) requests """ import gzip import http.server from io import BytesIO import threading import pytest import pandas.util._test_decorators as td import pandas as pd import pandas._testing as tm class BaseUserAgentResponder(http.server.BaseHTTPRequestHandler): """ ...
os_injector.py
# Copyright European Organization for Nuclear Research (CERN) # # 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 # # Authors: # - Wen Guan, <wen.guan@c...
uploader.py
#-*- coding: utf-8 -*- # stino/uploader.py import threading import time from . import constant from . import compiler from . import console from . import serial from . import pyserial class Uploader: def __init__(self, args, cur_compiler, mode = 'upload'): self.args = args.getArgs() self.mode = mode self.comp...
cluster_coordinator_test.py
# Copyright 2020 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
views.py
# -*- coding: utf-8 -*- # _ # /\ | | # / \ _ __ ___| |__ ___ _ __ _ _ # / /\ \ | '__/ __| '_ \ / _ \ '__| | | | # / ____ \| | | (__| | | | __/ | | |_| | # /_/ \_\_| \___|_| |_|\___|_| \__, | # __/ | # ...
thread_RLock.py
""" Race condition Thread safe Dead lock atomic """ from threading import Thread, RLock num = 0 # shared resource lock = RLock() def add(): global num with lock: subtract() for _ in range(100000): num += 1 def subtract(): global num with lock: fo...
queue_threads.py
import unittest import json import time from functools import wraps from threading import Thread, Lock from app import app from data.queue import WorkQueue from initdb import wipe_database, initialize_database, populate_database QUEUE_NAME = "testqueuename" class AutoUpdatingQueue(object): def __init__(self, ...
main.py
import os import threading class IPList: def __init__(self): self.IP_LIST=[] self.MAX_THREAD=500 self._r_th=0 self._slt=[] self._ipl=[] for i in range(1,255): self.IP_LIST+=[f"192.168.178.{i}"] def _check_one(self): if (len(self._slt)==0): return self._r_th+=1 ip=self._slt[0] del self....
A3C_distributed_tf.py
""" Asynchronous Advantage Actor Critic (A3C) with discrete action space, Reinforcement Learning. The Cartpole example using distributed tensorflow + multiprocessing. """ import multiprocessing as mp import tensorflow as tf import numpy as np import gym, time import matplotlib.pyplot as plt UPDATE_GLOBAL_ITER = 10...
ionosphere.py
from __future__ import division import logging import os from os import kill, getpid, listdir from os.path import join, isfile from sys import version_info try: from Queue import Empty except: from queue import Empty from time import time, sleep from threading import Thread from multiprocessing import Process, ...
downloader.py
#!/usr/bin/python3 -OO # Copyright 2007-2021 The SABnzbd-Team <team@sabnzbd.org> # # This program 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 2 # of the License, or (at your option) any late...
simple_server.py
# Copyright 2019 Oleg Butuzov. 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...
test_events.py
"""Tests for events.py.""" import collections.abc import concurrent.futures import functools import io import os import platform import re import signal import socket try: import ssl except ImportError: ssl = None import subprocess import sys import threading import time import errno import unittest from unitt...
scrapper.py
import sys import requests import time import threading import termplotlib as tpl from collections import defaultdict from collections import OrderedDict from bs4 import BeautifulSoup from selenium import webdriver from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.support.ui import WebDri...
connect.py
import threading #---------------------------------------------------------------------------------- """Create a thread to handle the logging in of a user into an email system """ #---------------------------------------------------------------------------------- def connectToMailSystem(): """thread worker ...
server_mode.py
# -*- coding: utf-8 -*- u"""Server Mode for SecureTea. Project: ╔═╗┌─┐┌─┐┬ ┬┬─┐┌─┐╔╦╗┌─┐┌─┐ ╚═╗├┤ │ │ │├┬┘├┤ ║ ├┤ ├─┤ ╚═╝└─┘└─┘└─┘┴└─└─┘ ╩ └─┘┴ ┴ Author: Abhishek Sharma <abhishek_official@hotmail.com> , Jul 28 2019 Version: 1.5.1 Module: SecureTea """ # Import all the modules necessary for...
check_ip.py
#!/usr/bin/env python2 # coding:utf-8 import sys import os import json import threading current_path = os.path.dirname(os.path.abspath(__file__)) root_path = os.path.abspath( os.path.join(current_path, os.pardir, os.pardir, os.pardir)) data_path = os.path.abspath(os.path.join(root_path, os.pardir, os.pardir, 'data'))...
retrieve_request.py
#!/usr/bin/env python """ retrieve_request.py This script is run by the admin to perform a retrieval request. Currently, the MOOSE and ET clients are installed on different servers. It is therefore assumed that all of the data in a retrieval is on a single tape system, but this is not checked by this script. `split_r...
sensor.py
""" Use serial protocol of EMU2 meter to obtain state of the connected meter. For more details about this component, please refer to the documentation at https://github.com/jrhorrisberger/home-assistant/blob/master/custom_components/rainforest/readme.md """ from homeassistant.helpers.entity import Entity import homeas...
generate_tiles.py
#!/usr/bin/env python from math import pi,cos,sin,log,exp,atan from subprocess import call import sys, os from Queue import Queue from pandas import DataFrame import xml.etree.ElementTree as ET import multiprocessing import threading import glob import json import os.path #try: # import mapnik2 as mapnik #except: # ...
plotter.py
import atexit from collections import namedtuple from enum import Enum from multiprocessing import JoinableQueue from multiprocessing import Process import platform from threading import Thread import numpy as np from garage.sampler.utils import rollout __all__ = ['Plotter'] class Op(Enum): STOP = 0 UPDATE...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
depcheck.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2016,2017 Christoph Reiter # # This program 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 2 of the License, or # (at your option) any...
server.py
#!/usr/bin/env python3 import argparse import http.server import time import threading import zmq # constants HTTP_PORT=8090 RADIO_PORT=12345 PUB_PORT=5555 REP_PORT=5556 ####################################################################################################################### # TODO create server cl...
__main__.py
# -*- coding: utf-8 -*- import sys import time import datetime import logging from docopt import docopt import numpy as np from pysilcam import __version__ from pysilcam.acquisition import Acquire from pysilcam.background import backgrounder from pysilcam.process import statextract import pysilcam.oilgas as scog from p...
component.py
# pylint: disable=unused-argument # W0613 Unused argument 'timeout' & 'input' # pylint: disable=redefined-builtin # W0622 Redefining built-in 'input' import os import sys import copy import time import threading as mt import radical.utils as ru from .. import constants as rpc from .. ...
tcpSocket.py
#!/usr/bin/env python3 # Copyright 2019 Nina Marie Wahl and Charlotte Heggem. # Copyright 2019 Norwegian University of Science and Technology. # # 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...
deepracer_memory.py
from threading import Thread import pickle import time import queue import redis import logging from rl_coach.memories.backend.memory import MemoryBackend from rl_coach.core_types import Episode from markov.utils import Logger, json_format_logger, build_system_error_dict from markov.utils import SIMAPP_MEMORY_BACKEND...
cuthes.py
#!/usr/bin/env python3 import json import os import itertools import time import csv import threading import argparse try: from bs4 import BeautifulSoup import requests import requests_futures import lxml except ModuleNotFoundError: os.system('pip3 install bs4') os.system('pip3 install requests...
main.py
from time import sleep #from subprocess import call from multiprocessing.managers import ValueProxy from multiprocessing.synchronize import Event as EventHint from multiprocessing import Process, Event, Manager try: # Change process names to something informational when setproctitle is installed. from setproctitl...
gateway_github.py
#!/usr/bin/python import json import base64 import sys import time import imp import random import threading import queue import os from github3 import login trojan_id = "cfg" trojan_config = "%s.json" % trojan_id data_path = "data/%s/" % trojan_id trojan_modules = [] task_queue = queue.Queue() configured = False ...
DataClient.py
import socket import struct import threading import numpy as np from Online.AmpInterface import AmpDataClient class Neuracle(AmpDataClient): UPDATE_INTERVAL = 0.04 BYTES_PER_NUM = 4 BUFFER_LEN = 4 # in secondes def __init__(self, n_channel=9, samplerate=1000, host='localhost', port=8712): ...
fastTradeV2.py
import logging import asyncio from binance.client import Client from binance_f import RequestClient from binance_f import SubscriptionClient from binance_f.constant.test import * from binance_f.model import * from binance_f.exception.binanceapiexception import BinanceApiException from binance_f.base.printobject import ...
clientPCA.py
import threading # Libreria usada para manejar multiples hilos por proceso import time # Libreria usada para dormir el hilo principal import random import socket # Libreria usada para comunicacion entre procesos import struct # Libreria para manejar bytes como datos desempacados import numpy as n...
core.py
#!/usr/bin/env python from __future__ import absolute_import, division, print_function # HTTP / HTML import tornado import tornado.wsgi import tornado.httpserver # Intercheck from . import utils from . import routes # Python built-in import webbrowser import threading import logging import httplib import socket import ...
app.py
#!/bin/python import logging from multiprocessing import Process from models.metric_manager import MetricManager from kafkawrapper.consumer import consume log = logging.getLogger('file') # Starts the kafka consumer in a different thread def start_consumer(): # with ulca_dataset_validate.test_request_context():...
test_cuda.py
from itertools import repeat, chain, product from typing import NamedTuple import collections import contextlib import ctypes import gc import io import pickle import queue import sys import tempfile import threading import unittest import torch import torch.cuda import torch.cuda.comm as comm from torch.nn.parallel i...
test_Timer.py
#!/usr/bin/env python from __future__ import print_function from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals from future import standard_library standard_library.install_aliases() from builtins import next from builtins import * from builtins import object ...
test_lock.py
""" TestCases for testing the locking sub-system. """ import time import unittest from test_all import db, test_support, verbose, have_threads, \ get_new_environment_path, get_new_database_path if have_threads : from threading import Thread import sys if sys.version_info[0] < 3 : from thr...
drone.py
""" drone.py ==================================== The core module of my drone mav project """ # Import mavutil from pymavlink import mavutil from pymavlink import mavwp from pymavlink.dialects.v10 import ardupilotmega import time #Import threading for reading mavlink messages import threading class MavlinkMessage: ...
wav2tfrd.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf import numpy as np import os from multiprocessing import Manager, Pool #因为队列被多个进程共享,必须使用Manager里面的Queue from threading import Thread from concurrent.futures import ThreadPoolExecutor ...
Listener.py
#!/usr/bin/env python # The MIT License (MIT) # # Copyright (c) 2015 Caian Benedicto <caian@ggaunicamp.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...
trezor.py
import traceback import sys from typing import NamedTuple, Any, Optional, Dict, Union, List, Tuple, TYPE_CHECKING from electrum.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException from electrum.bip32 import BIP32Node, convert_bip32_path_to_list_of_uint32 as parse_path from electrum import constants...
worker_list.py
import time import webbrowser from threading import Thread from grapheneapi.exceptions import NumRetriesReached from PyQt5.QtCore import pyqtSlot from PyQt5.QtGui import QFontDatabase from PyQt5.QtWidgets import QMainWindow from dexbot import __version__ from dexbot.config import Config from dexbot.controllers.wallet...
output.py
from dgdynamic.utils.project_utils import LogMixin, make_directory from dgdynamic.config.settings import config from dgdynamic.utils.plotter import matplotlib_plot from scipy.interpolate import interpolate import threading import time import csv import matplotlib.pyplot as plt import os.path import enum import collecti...
client_runner.py
# Copyright 2016, Google 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 copyright # notice, this list of conditions and the f...
cep_control_lefthand_base.py
import torch import torch.autograd as autograd import numpy as np from cep.utils import torch2numpy, numpy2torch import torch.nn as nn from cep.optimizer import RWR from cep.maps import Map import time, copy # from torch.multiprocessing import Pool # torch.multiprocessing.set_start_method('fork', force=True) # ...
main.py
from flask import Flask, request, send_file from random import choices as rndchoices import bcrypt import yaml from threading import Thread import os import sys # original file does NOT use pytorch, updated one DOES # from backgroundbegone import removeBackground from backgroundbegone2 import removeBackground app = F...
_reloader.py
import fnmatch import os import subprocess import sys import threading import time import typing as t from itertools import chain from pathlib import PurePath from ._internal import _log # The various system prefixes where imports are found. Base values are # different when running in a virtualenv. The s...
accounts.py
# Copyright 1999-2017 Alibaba Group Holding Ltd. # # 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...
server.py
#!/usr/bin/python ''' Created on Aug 26, 2011 @author: IslamM ########################################################################################### # # server.py # # Copyright 2009 Hewlett-Packard Development Company, L.P. # # Hewlett-Packard and the Hewlett-Packard logo are trademarks of # Hewlett...
websocket_remote_control.py
import threading import logging from socketIO_client import BaseNamespace from socketIO_client import SocketIO from pokemongo_bot import inventory class WebsocketRemoteControl(object): def __init__(self, bot): self.bot = bot self.host, port_str = self.bot.config.websocket_server_url.split(':') ...
TestModule.py
from EaselModule import EaselModule from PyQt5.QtGui import QKeyEvent, QMouseEvent, QWheelEvent import threading from time import sleep from tk3dv.common import utilities import GLViewer as glv import PyQt5.QtCore as QtCore class TestModule(EaselModule, argv=None): def __init__(self, argv=None): super().__...
virt_monitor_in_docker.py
import subprocess import prometheus_client import os import sys import operator import time import threading import threadpool from prometheus_client.core import CollectorRegistry from prometheus_client import Gauge,start_http_server,Counter from kubernetes import config from json import loads, dumps sys.path.append(...
mutiprocessing_util.py
from multiprocessing import Process, Manager import numpy as np import os import inspect class MutiProcessor(): def __init__(self, np_data, h_num=1, w_num=1, cube_func=None): if len(np_data.shape) < 2: raise Exception("np_data must at least have dim 2.") self.np_data = np_dat...
tomasan.py
#!/usr/bin/env python # coding=utf-8 # ======== 受信発信両用 ========= import os, sys import RPi.GPIO as GPIO import paho.mqtt.client as paho import paho.mqtt.publish as publish import threading import time import pygame.mixer import wave import time import json time.sleep(0.3) GPIO.cleanup() time.sleep(0.3) # ======= 設定 =...
processtest.py
#codeing=utf-8 # @Time : 2017-10.06 # @Author : J.sky # @Mail : bosichong@qq.com # @Site : www.17python.com # @Title : Python并发编程(上)进程模块multiprocessing模块和Process类 # @Url : http://www.17python.com/blog/34 # @Details : Python并发编程(上)进程模块multiprocessing模块和Process类 # @Other : OS X 10.11.6 # Pyt...
main_window.py
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2012 thomasv@gitorious # # 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 witho...
YouJiaClient.py
""" Copyright 2019 Vincent Qiu Email: nov30th@gmail.com Description: 莱特 LaiTe Devices (laitecn) Host Connection Manager Notice: """ import logging import queue import socket import threading import time from typing import List, Dict _LOGGER = logging.getLogger(__name__) RETRY_SECS = 3 YOUJIA_HOSTS = {} # type: Dict...
process_video.py
#!/usr/bin/env python import sys import os import shutil import math import numpy as np import argparse import contextlib import itertools import signal import subprocess import tempfile import threading try: import queue # Python 3 except ImportError: import Queue as queue # Python 2 sys.dont_write_bytecode = T...
handle.py
import sys import threading from abc import ABCMeta, abstractmethod from collections import namedtuple from enum import Enum import six from dagster import check from dagster.api.list_repositories import sync_list_repositories, sync_list_repositories_grpc from dagster.core.code_pointer import CodePointer from dagster...
DisplayPane.py
import bqplot as bq import ipywidgets as ipy import cv2 import numpy as np from threading import Thread from VisionSystem.DetectionModel import Frame, ColorSpaces from .Interactor.ResultDisplayer import ResultDisplayer from .Interactor.DataSetBrowser import DataSetBrowser from .Interactor.FrameLabeller import FrameLab...
10bot.py
# -*- coding: utf-8 -*- import LINETCR from LINETCR.lib.curve.ttypes import * from datetime import datetime from bs4 import BeautifulSoup import time, random, sys, re, os, json, subprocess, threading, string, codecs, requests, tweepy, ctypes, urllib, urllib2, wikipedia,tempfile,glob,shutil,unicodedata,goslate from gtt...
Commands.py
import threading from ..Environment import env, env_driver from ..Helpers import DummyLogger, DummyThread class Kwargs(object): """ An object used for passing **kwargs with your *args. Example: @has_kwargs def some_controller_func(first_arg, second_arg, some_arg=True, other_arg='NA'): p...
music.py
#!/usr/bin/env python3 from bs4 import BeautifulSoup import pafy from time import sleep from threading import Thread from urllib.parse import * import urllib.request import vlc from topics.topic import TopicAgent from utils.logging.console_logger import ConsoleLogger NAME = "music" COMPARISON_COMMANDS = [ "Play ...
initiate.py
from tkinter import Tk , Label , Button , PhotoImage; from tkinter.ttk import Progressbar; from tkinter.filedialog import asksaveasfile from threading import Thread; from os import remove , fdopen; from sys import getsizeof; from tempfile import mkstemp; from time import time , sleep , strftime , gmtime; import wave; i...
threads01.py
import threading, time def mi_thread(miNumero): while True: print("thread numero", num) time.sleep(miNumero) if __name__ == "__main__": for num in range(1, 10): elThread = threading.Thread(target=mi_thread, args=(num,), daemon=True) # que pasa si saco la coma?x elThread.start(...
threads.py
# # CastPodder thread management code # Copyright (c) 2005-2006 Scott Grayban and the CastPodder Team # # $Id: threads.py 147 2006-11-07 08:17:03Z sgrayban $ """ CastPodder is Copright © 2005-2006 Scott Grayban Read the file Software_License_Agreement.txt for more info. """ __license__ = "Commercial" import threadin...
handler.py
""" This module contains the ControlHandler class. Created on Jan 21, 2016 @author: Nicklas Boerjesson """ import threading from of.common.logging import write_to_log, EC_SERVICE, SEV_ERROR from of.common.messaging.factory import reply_with_error_message from of.common.queue.handler import Handler __author__ = 'N...
multi_echo_server.py
#!/usr/bin/env python3 import socket import time from multiprocessing import Process #define address & buffer size HOST = "" PORT = 8001 BUFFER_SIZE = 1024 #get host information def get_remote_ip(host): print(f'Getting IP for {host}') try: remote_ip = socket.gethostbyname( host ) except socket.ga...
hgbrian_GPU_NW.py
# Approach: for each sequence, call a function modifying hgbrian's NW code # to get the score. import numba from numba import cuda, float32 import numpy as np # for testing import nw_align_mod import time import sys import copy from multiprocessing import Process, Pipe A_SMALL_FLOAT = -100000. # Constant matrices ...
HumanAgent.py
import cv2 import numpy as np import time from threading import Thread try: import pygame from pygame.locals import K_BACKSPACE from pygame.locals import K_COMMA from pygame.locals import K_DOWN from pygame.locals import K_ESCAPE from pygame.locals import K_F1 from pygame.locals import K_LE...
perf2.py
from socket import * import time from threading import Thread sock = socket(AF_INET, SOCK_STREAM) sock.connect(('localhost', 25000)) n= 0 def monitor(): global n while True: time.sleep(1) print(n, 'reqs/s') n = 0 Thread(target=monitor).start() while True: sock.send(b'1') re...
NNPytorchMulti.py
import threading import numpy as np from skmultiflow.core import BaseSKMObject, ClassifierMixin from skmultiflow.utils.utils import * from skmultiflow.neural_networks.utils import * from skmultiflow.drift_detection.base_drift_detector import BaseDriftDetector from skmultiflow.drift_detection import ADWIN import torch...
idf_monitor.py
#!/usr/bin/env python # # esp-idf serial output monitor tool. Does some helpful things: # - Looks up hex addresses in ELF file with addr2line # - Reset ESP32 via serial RTS line (Ctrl-T Ctrl-R) # - Run flash build target to rebuild and flash entire project (Ctrl-T Ctrl-F) # - Run app-flash build target to rebuild and f...
demo.py
#!/usr/bin/env python3 # -*- coding:utf-8 -*- import base64 import cv2 from multiprocessing import Process,Queue from aip import AipFace APP_ID = '******' API_KEY = '******' SECRET_KEY = '******' groupIdList = '******' imageType = "BASE64" client = AipFace(APP_ID, API_KEY, SECRET_KEY) video = cv2.VideoC...
plugin.py
# Copyright (c) 2017 UFCG-LSD and UPV-GRyCAP. # # 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...
event_engine.py
# encoding: UTF-8 # 系统模块 from Queue import Queue, Empty from threading import Thread from time import sleep from collections import defaultdict EVENT_TIMER = 'eTimer' # 计时器事件,每隔1秒发送一次 class EventEngine(object): """ 计时器使用python线程的事件驱动引擎 """ def __init__(self): """初始化事件...
pipes.py
""" "멀티프로세싱"절 예시 `multiprocessing` 모듈의 파이프를 커뮤니케이션 채널로 이용하는 방법을 설명한다. """ from multiprocessing import Process, Pipe class CustomClass: pass def worker(connection): while True: instance = connection.recv() if instance: print(f"CHLD: recv: {instance}") if instance is None: ...
ribo_utils.py
import os import operator import itertools import gzip import numpy as np from scipy import stats import dill as pickle import math import multiprocessing from collections import defaultdict ''' Colorblind safe colors from Bang Wong, Nature Methods 8. 441 (2011) ''' black = (0,0,0) orange = (230/255.0,159/255.0,0) skyB...