source
stringlengths
3
86
python
stringlengths
75
1.04M
vlc.py
import asynchat import asyncore import os import random import re import socket import subprocess import sys import threading import time import urllib.error import urllib.parse import urllib.request from syncplay import constants, utils from syncplay.messages import getMessage from syncplay.players.basePlayer import...
kahelo.py
from __future__ import print_function import sys import os import re import math import argparse import webbrowser import itertools import random import threading if sys.version_info < (3,): import StringIO else: import io try: import sqlite3 sqlite3_available = True except: sqlite3_available = ...
trezor.py
import traceback import sys from typing import NamedTuple, Any, Optional, Dict, Union, List, Tuple, TYPE_CHECKING from electrum_plcu.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException from electrum_plcu.bip32 import BIP32Node, convert_bip32_path_to_list_of_uint32 as parse_path from electrum_plcu i...
controlbox.py
import matplotlib.pyplot as plt # import numpy as np from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg import PySimpleGUI as sg import matplotlib import serial as ser from serial import SerialException from time import sleep import glob import os # from pathlib import Path from threading import...
pyminer.py
#!/usr/bin/python # # Copyright (c) 2011 The Bitcoin developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # import time import json import pprint import hashlib import struct import re import base64 import httplib import...
logMeteo_IR.py
#!/usr/bin/env python import board import requests import argparse import busio import time import datetime import adafruit_bme280 import threading import RPi.GPIO as GPIO # Import Raspberry Pi GPIO library import subprocess import logging import socket from systemd import journal """ blink the LED for a bit""" def bl...
proxy.py
# # Copyright Cloudlab URV 2020 # # 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 writin...
__init__.py
""" Base classes for job runner plugins. """ import os import time import string import logging import datetime import threading import subprocess from Queue import Queue, Empty import galaxy.jobs from galaxy.jobs.command_factory import build_command from galaxy import model from galaxy.util import DATABASE_MAX_STRI...
scan_latex_sources.py
#! /usr/bin/python # Author: Marcel Simader (marcel.simader@jku.at) # Date: 18.02.2022 # (c) Marcel Simader 2022, Johannes Kepler Universität Linz from typing import Union, List, Optional, Iterator from io import TextIOBase import os, sys import argparse, inspect, pathlib, subprocess, re, shutil, ctypes, glob imp...
discordsocketthread.py
import asyncio import threading import typing from functools import partial as func_partial from legacy import discordsocket class DiscordSocketThread: def __init__(self, token: str = None, discord_socket: discordsocket.DiscordSocket = None, shard_total: int = 1, shard_num: int = 0): i...
util.py
# -*- coding: utf-8 -*- """ (C) 2014-2019 Roman Sirokov and contributors Licensed under BSD license http://github.com/r0x0r/pywebview/ """ import inspect import json import logging import os import re import sys import traceback from platform import architecture from threading import Thread from uuid import uuid4 f...
mp_video.py
''' Copyright 2019 Xilinx Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software di...
storage.py
# # Copyright (c) 2019-2021, ETH Zurich. All rights reserved. # # Please, refer to the LICENSE file in the root directory. # SPDX-License-Identifier: BSD-3-Clause # from flask import Flask, request, jsonify import json, tempfile, os import urllib import datetime import async_task import threading # logging handler ...
voice_controller.py
from homeserver.voice_control.google_speech import GoogleVoiceRecognition from homeserver.voice_control.snowboy.snowboydecoder import HotwordDetector, play_audio_file #make the voicecontrol follow the device interface structure for control from homeserver.interface import DeviceInterface, DeviceTarget # import the ...
server.py
from cryptoran import blockcipher, keyexchange from PigeonConnection import PigeonConnection import socket, select, sys, threading class PigeonServer(PigeonConnection): ''' Multithreaded TCP socket server. Provides encrypted communication ''' def __init__(self, ip: str, port: int, messageHandler: call...
test_classifier_process.py
from pylsl import StreamInfo, StreamOutlet, StreamInlet, resolve_stream from multiprocessing import Process from time import sleep, time from BIpy.bci.classifier_process import ClassifierProcess from BIpy.bci.inlets import ClassifierInlet from BIpy.bci.models import DummyClassifier import math def send_data(): # ...
main.py
# Source: https://github.com/pytorch/examples/tree/master/mnist_hogwild from __future__ import print_function import argparse import torch import torch.nn as nn import torch.nn.functional as F import torch.multiprocessing as mp from torchvision import transforms from load.load import DataLoader from store.cifar10 imp...
train_pg_f18_parallel.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 """ import numpy as np import gym import logz import os import time import inspect from multip...
future_test.py
import sys import traceback import unittest from threading import Thread, Event from hazelcast.future import ( Future, ImmediateFuture, combine_futures, make_blocking, ImmediateExceptionFuture, ) from hazelcast import six from hazelcast.six.moves import range class FutureTest(unittest.TestCase): ...
test_web.py
# -*- coding: utf-8 -*- from datetime import timedelta from datetime import date import threading from django.core.urlresolvers import reverse from django.db import IntegrityError, connection from django.test.client import Client from django.utils import timezone from rest_framework.test import APITransactionTestCase...
server.py
import socket ## used for connecting users together ## import threading ## used to manage each user in a seperate thread ## import pickle ## used to transfer data across the internet, similar to JSON ## from chess.layoutBoardObject import Board ## used to get Board class to get an object and save each game in a list ##...
main.py
import requests import json import numpy as np import pandas as pd import time import datetime import talib import oandapyV20 from oandapyV20.contrib.requests import MarketOrderRequest from oandapyV20.contrib.requests import TakeProfitDetails, StopLossDetails import oandapyV20.endpoints.orders as orders impo...
QSubprocessor.py
import multiprocessing import sys import time import traceback from PySide6.QtCore import * from PySide6.QtGui import * from PySide6.QtWidgets import * from .qtex import * class QSubprocessor(object): """ """ class Cli(object): def __init__ ( self, client_dict ): s2c = multiproc...
main_window.py
import os from PyQt4.QtGui import * from PyQt4.QtCore import QThread from lldbvis.debug import debugger from lldbvis.events import signals from lldbvis.events import dispatcher from lldbvis.gui.widgets import CodeEditor from lldbvis.settings import constants class DebugThread(QThread): def __init__(self, target...
training_scheduler.py
import torch import threading import subprocess import multiprocessing as mp import os pruned_model_path="./pruned_models/vgg19_bn/" retrained_model_path="./retrained_model/vgg19_bn/" ''' 1) initialize bounded producer/consumer queue of size max(num_devices (param), output from torch.cuda.device_count()) ''' def train...
test_client_http.py
import contextlib import select import socket import threading from contextlib import contextmanager import botocore.session from botocore.config import Config from botocore.exceptions import ( ClientError, ConnectionClosedError, ConnectTimeoutError, EndpointConnectionError, ProxyConnectionError, ...
GUI.py
import wx import tools.Estres as Estres import mimetypes import os.path import threading from wx.lib.plot import PlotCanvas from tools.plot import plot import math class Grid(wx.Dialog): # Crea la tabla de contenido que da un formato simetrico a los elementos graficos def __init__(self, gridSize, matrix, *args, **...
__init__.py
# -*- encoding: utf-8 -*- """ _core/async_tasks/__init__.py - provides ASYNC FUNCTIONS | DECORATORS """ from log_config import log, pformat print() log.debug(">>> _core.async_tasks.__init__.py ..." ) log.debug(">>> async ... loading async functions as global variables") from threading import Thread # from flask ...
skill_server.py
#!/usr/bin/env python import os import rospy import threading import numpy as np import csv from flask import Flask from flask_ask import Ask, question, statement from std_msgs.msg import String from ironfish_captain.srv import captain_command app = Flask(__name__) ask = Ask(app, "/") # ROS node, publisher, and para...
test_datastore.py
#!/usr/bin/env python # Datastore testing abstract class # # NOMURA Yoshihide <nomura@pobox.com> import os import sys import unittest from appscale.common.constants import APPSCALE_HOME from appscale.datastore import appscale_datastore from appscale.datastore import helper_functions as hf from appscale.datastore.dbco...
Meridian_console.py
# #!/usr/bin/python3 # coding: UTF-8 # もしくは #!/usr/bin/env python など環境に合わせて # Izumi Ninagawa & Meridian project # 2022.02.05 UDP通信動作は安定。 # 2022.02.05 COMMAND WINDOWのPOWERチェックボックスでサーボ電源ON # 2022.02.05 上記サーボ電源ON中にスライドバー操作でサーボ動作(ただしスライドバーが小さいため大まかな動作確認のみに利用可) # 2022.04.05 コードを少し整理整頓 # 2022.04.14 各経路でのエラーの検知と表示の機能を搭載 # 20...
tentacle.py
import time import threading import logging import pyDatalog import pickle from tp_utils import pipe logger = logging.getLogger(__name__) def data_handler(entity_zoo, data): if len(data) == 0: return opcode, msg = pickle.loads(data) if opcode == 'query_clause': with entity_zoo.lock: ...
parasol.py
# Copyright (C) 2015-2016 Regents of the University of California # # 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...
oppomqtt.py
#!/usr/bin/env python from socket import SO_REUSEADDR, SOCK_STREAM, error, socket, SOL_SOCKET, AF_INET from threading import Thread import paho.mqtt.client as mqtt from oppomessages import OPPOMSG ### CONFIGURATION ############################################################################################...
coverage_test.py
from queue import Queue import random import socket 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 ...
board.py
from connection import SerialConnection, TelnetConnection, ConnectionError from fileops import set_fileops_params from autobool import AutoBool from printing import dprint, eprint, qprint import printing from threading import Thread import time import inspect import traceback import os from blessed import Terminal Q...
_client_application.py
# Copyright 2017 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
ex6_threads_show_ver.py
#!/usr/bin/env python ''' Use threads and Netmiko to connect to each of the devices in the database. Execute 'show version' on each device. Record the amount of time required to do this. ''' from __future__ import print_function, unicode_literals from netmiko import ConnectHandler from datetime import datetime import t...
detect_module.py
import tkinter as tk from tkinter import filedialog import os from pathlib import Path import platform # Linux vs Windows check import numpy as np import matplotlib matplotlib.use('TkAgg') import matplotlib.pyplot as plt from matplotlib.backends.backend_tkagg import (FigureCanvasTkAgg, NavigationToolbar2Tk) from ...
auto-build.py
import inotify.adapters import os import threading import time COUNT = -1 RUN = True def run(): global COUNT while RUN: time.sleep(1) if COUNT == 0: make() COUNT = -1 if COUNT > 0: COUNT = 0 t = threading.Thread(target=run) t.start() ...
test_bot.py
import pytest import pytest_timeout import zipfile import requests import time import yaml import chess import chess.engine import threading import os import sys import stat import shutil import importlib if __name__ == "__main__": sys.exit(f"The script {os.path.basename(__file__)} should only be run...
workers_zmq.py
# -*- coding: utf-8 -*- """ Created on Sat Jun 9 22:28:44 2018 Based on http://mdup.fr/blog/easy-cluster-parallelization-with-zeromq @author: vpekar """ import sys import zmq from multiprocessing import Process import settings from get_logger import get_logger from utils import run_config learner = sys.argv[1] a...
gcsio.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...
Misc.py
## @file # Common routines used by all tools # # Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR> # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the lic...
pyminer.py
#!/usr/bin/python # # Copyright (c) 2011 The Bitcoin developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # import time import json import pprint import hashlib import struct import re import base64 import httplib import...
util.py
# Licensed to the .NET Foundation under one or more agreements. # The .NET Foundation licenses this file to you under the MIT license. # See the LICENSE file in the project root for more information. from __future__ import annotations # Allow subscripting Popen from dataclasses import dataclass, replace from datetime...
botfront_anonymized_tracker_store.py
import logging import jsonpickle import requests import time import os import re from threading import Thread from rasa.core.tracker_store import TrackerStore from rasa.shared.core.trackers import DialogueStateTracker, EventVerbosity from .text_anonymizer import TextAnonymizer from sgqlc.endpoint.http i...
solve_all_sudokus.py
#!/usr/bin/env python3 from grid import SudokuGrid from solver import SudokuSolver import os.path import time import multiprocessing def solve_all(running_times): for l in range(1, 245): g = SudokuGrid.from_file(os.path.join(os.path.dirname(__file__), "..", "sudoku_db.txt", l) start = time.monoto...
__init__.py
import subprocess,threading,sys,os,config import json def popenAndCall(args, shell=True,stdout=sys.stdout,cwd=os.getcwd(),onExit=None): """ Runs the given args in a subprocess.Popen, and then calls the function onExit when the subprocess completes. onExit is a callable object, and popenArgs is a list/t...
main.py
""" Main Program entrypoint. Can be run with `python main.py` Or through the CLI with `scly start` after installing. """ from simplesensor.shared.threadsafeLogger import ThreadsafeLogger from simplesensor.loggingEngine import LoggingEngine from simplesensor.shared.message import Message from importlib import import_m...
dataset.py
"""Data fetching """ # MIT License # # Copyright (c) 2019 Yichun Shi # # 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,...
project_files_monitor_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # pyre-unsafe import os import socket import tempfile import threading import unittest from unittest.mock import MagicMock, patch from .. im...
test__xxsubinterpreters.py
from collections import namedtuple import contextlib import itertools import os import pickle import sys from textwrap import dedent import threading import time import unittest from test import support from test.support import import_helper from test.support import script_helper interpreters = import_helper.import_...
microtvm_api_server.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
socketserverhandler.py
import socket as pythonsocket from threading import Thread from time import sleep import datetime import pickle import datetime import database import reddit import string import random import settings socket = pythonsocket.socket(pythonsocket.AF_INET, pythonsocket.SOCK_STREAM) def startServer(): ...
TRIOU_Extension.py
myDebug = 1 import os, signal, time from threading import Thread, Lock import os import re from xsalome import corba2python import SALOME import SALOMEDS import SALOME__POA import TRIOU_CORBA import TRIOU_CORBA__POA # ------------------------------------------ import warnings if not myDebug: warnings.filterwarn...
myo_multithreading_examp.py
import multiprocessing from pyomyo import Myo, emg_mode # ------------ Myo Setup --------------- q = multiprocessing.Queue() def worker(q): m = Myo(mode=emg_mode.FILTERED) m.connect() def add_to_queue(emg, movement): q.put(emg) m.add_emg_handler(add_to_queue) def print_battery(bat): print("Battery level...
jobshandler.py
from queue import Queue from threading import Thread from ydl_server.logdb import JobsDB, Actions queue = Queue() thread = None done = False def start(dl_queue): thread = Thread(target=worker, args=(dl_queue,)) thread.start() def put(obj): queue.put(obj) def finish(): done = True def worker(dl...
email.py
from threading import Thread from .. import mail from flask_mail import Message from flask import current_app, render_template def send_async_email(app, msg): with app.app_context(): mail.send(msg) def send_email(to, subject, template_txt, template_html=None, **kwargs): app = current_app._get_curren...
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...
udp_test.py
import socket from typing import NamedTuple from multiprocessing import Process import time from urllib.parse import urlparse COUNT = 200000 ADDR = 'tcp://127.0.0.1:5557' class Combi(NamedTuple): recv: int send: int should_multipart: bool should_multipart_hand: bool COMBINATIONS = { 'a': Combi...
fc2.py
import requests,re,subprocess,os,time,random,shutil,traceback,sys from threading import Thread,Timer from websocket import create_connection import json from datetime import datetime from requests.utils import dict_from_cookiejar import http.cookiejar as cj from streamlink import Streamlink from livestreamer import Liv...
cisd.py
#!/usr/bin/env python # Copyright 2014-2019 The PySCF Developers. 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...
run-with-webcam.py
# import the necessary packages from tensorflow.keras.applications.mobilenet_v2 import preprocess_input from tensorflow.keras.preprocessing.image import img_to_array from tensorflow.keras.models import load_model from imutils.video import VideoStream import numpy as np import imutils import cv2 import os from playsound...
test_dht_node.py
import asyncio import heapq import multiprocessing as mp import random import signal from itertools import product from typing import List, Sequence, Tuple import numpy as np import pytest from multiaddr import Multiaddr import hivemind from hivemind import get_dht_time from hivemind.dht.node import DHTID, DHTNode fr...
hfbs_fpga.py
#!/usr/bin/env python import numpy as np import matplotlib.pyplot as plt from scipy.sparse import csr_matrix import os import time import datetime import argparse from multiprocessing import Process, Queue # local imports import utils #flags RUN_FPGA = False VERBOSE = True FIXEDP = True LOOP_OUTSIDE = False NO_GARBA...
test_store.py
# Unit test suite for the RedisStore class. # This test suite now runs in its own docker container. To build the image, run # docker build -f Dockerfile-test -t abaco/testsuite . # from within the tests directory. # # To run the tests execute, first start the development stack using: # 1. export abaco_path=$(pwd) ...
processApproach.py
import random import time import sys from multiprocessing import Process, Queue random.seed() def genList (size): randomList = [] #initialize random list with values between 0 and 100 for i in range(size): randomList.append(random.randint(0,10)) return randomList #return the sum ...
helper.py
# import sys # import os import cv2 import numpy # from datetime import datetime, timedelta # from threading import Thread # import time # import shutil import socket # from pympler import asizeof # from psutil import virtual_memory # import gc # import psutil # # ##### GLOBAL VARIABLES # _is_setup = False _annotate_...
tasks.py
# -*- coding: utf-8 -*- # Copyright (c) 2015 Ansible, Inc. # All Rights Reserved. # Python from collections import OrderedDict, namedtuple, deque import errno import functools import importlib import json import logging import os from io import StringIO from contextlib import redirect_stdout import shutil import stat...
worker.py
# -*- coding: utf-8 -*- """ Created on Wed Nov 30 22:18:02 2020 @author: Soundarya Ganesh """ import sys import random import threading import json from socket import * import time import numpy as np from time import * from datetime import * import os w_id = sys.argv[2] class Task: def __init...
proc.py
import os import sys import logging import ctypes import select import socket import fcntl from time import time from papa import utils, Error from papa.utils import extract_name_value_pairs, wildcard_iter, cast_bytes, \ send_with_retry from papa.server.papa_socket import find_socket from subprocess import Popen, P...
VideoStream.py
import cv2 import threading import time class VideoStream: def __init__(self, src=0, name='VideoStream'): self.stream = cv2.VideoCapture(src) (self.grabbed, self.frame) = self.stream.read() self.name = name self.stopped = False def start(self): # start thread to read frames from video stream t = threadi...
server.py
# Developed By 2017 Computer and Communication Department-Alexandria University graduation project team # # Email: EITS@gmail.com # # Authors: MOHAMED SHERIF,YAMEN EMAD, SHERINE SAMEH # # Copyright (c) EITS TEAM 2017 # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software a...
run-tests.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 "Li...
pre_commit_linter.py
# coding: utf-8 # # Copyright 2014 The Oppia Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
parallel_levenshtein.py
import sys import getopt import multiprocessing INS_COST = 1 DEL_COST = 1 EXC_COST = 1 vLock = multiprocessing.Semaphore(value = 0) hLock = multiprocessing.Semaphore(value = 0) def main(): s = '' t = '' #parse command line options try: opts, args = getopt.getopt(sys.argv[1:], 's:t:') except getopt.GetoptEr...
SendQueue.py
# encoding=utf-8 from StringIO import StringIO from datetime import datetime from threading import Thread import requests import time import speech_recognition as sr import wave from globals import CHANNELS, FORMAT, RATE class SendQueue(object): # _url = "https://api.telegram.org/bot{}/sendVoice" # _url = "https...
test_ipc.py
""" :codeauthor: Mike Place <mp@saltstack.com> """ import errno import logging import os import threading import pytest import salt.config import salt.exceptions import salt.ext.tornado.gen import salt.ext.tornado.ioloop import salt.ext.tornado.testing import salt.transport.client import salt.transport.ipc impor...
foo-upgraded.py
import sys import os import argparse from setup.settings import hparams, preprocessing import math sys.path.append(os.path.dirname(os.path.realpath(__file__))) sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/nmt") from nmt import nmt import tensorflow as tf import colorama from threading import Thread f...
streaming.py
# Tweepy # Copyright 2009-2019 Joshua Roesslein # See LICENSE for details. # Appengine users: https://developers.google.com/appengine/docs/python/sockets/#making_httplib_use_sockets from __future__ import absolute_import import json import logging import re import requests import ssl import sys from threading import...
process.py
"""Provide process tools.""" import asyncio import signal from multiprocessing import Pipe, Process from multiprocessing.connection import Connection from time import sleep from typing import TYPE_CHECKING, Any, Callable, Dict, Tuple from cpias.const import LOGGER from cpias.exceptions import CPIASError if TYPE_CHECK...
resample_dataset.py
import os, sys, yaml import numpy as np from pathlib import Path import random import threading import argparse sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),"../../.."))) from meshcnn.models.layers.mesh_prepare import fill_from_file,remove_non_manifolds, build_gemm surfaceTypes = ['Plane'...
zergling_actor.py
import copy import queue import time import uuid from collections import namedtuple from threading import Thread from typing import List, Dict, Callable, Any, Tuple from easydict import EasyDict from collections import deque import torch from ctools.data import default_collate, default_decollate from ctools.torch_uti...
__init__.py
"""Hermes MQTT server for Rhasspy wakeword with Porcupine""" import asyncio import logging import queue import socket import struct import threading import typing from pathlib import Path from rhasspyhermes.audioserver import AudioFrame from rhasspyhermes.base import Message from rhasspyhermes.client import GeneratorT...
Client.py
import threading import common from config import logs as log from config.config import * from models.Message import * class Client: client = None address = None session_id = None # You can add any variable which you want here def __init__(self, c, addr, session_id): self.client = c ...
decorator.py
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
test_waitable.py
# Copyright 2018 Open Source Robotics Foundation, 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...
sound.py
import RPi.GPIO as GPIO import subprocess import time from os import listdir import threading ''' SCRIPT LOGIC: When a button is pressed, do the following: Play a sound for 20 minutes. If a sound is already playing, play the next sound in the directory. If at end of sound list, stop playing. ''' ''' CONSTANTS ''' #...
slurm.py
""" DMLC submission script, SLURM version """ # pylint: disable=invalid-name from __future__ import absolute_import import subprocess, logging from threading import Thread from . import tracker def get_mpi_env(envs): """get the slurm command for setting the environment """ cmd = '' for k, v in envs.it...
main.py
"""\ Main wxGlade module: defines wxGladeFrame which contains the buttons to add widgets and initializes all the stuff (tree, frame_property, etc.) @copyright: 2002-2007 Alberto Griggio @copyright: 2011-2016 Carsten Grohmann @copyright: 2016-2021 Dietmar Schwertberger @license: MIT (see LICENSE.txt) - THIS PROGRAM COM...
_run.py
from profil3r.core.colors import Colors import threading def run(self): self.print_logo() # Get arguments from the command line self.parse_arguments() self.menu() self.get_permutations() # Number of permutations to test per service print(Colors.BOLD + "[+]" + Colors.ENDC + " {} permutati...
api.py
#!/usr/bin/python3 -OO # Copyright 2007-2019 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...
mpc.py
import os.path import re import time import threading import _thread from functools import wraps import win32con, win32api, win32gui, ctypes, ctypes.wintypes #@UnresolvedImport @UnusedImport from syncplay import constants from syncplay.messages import getMessage from syncplay.players.basePlayer import BasePlayer fr...
test_dispatcher.py
from __future__ import print_function, division, absolute_import import errno import multiprocessing import os import platform import shutil import subprocess import sys import threading import warnings import inspect import pickle import weakref from itertools import chain try: import jinja2 except ImportError: ...
primitives.py
"""Test the protocol.stacks module.""" # Builtins import threading import time # Packages from phyllo.io.threading.primitives import CancellableSemaphore def test_semaphore(): """Test CancellableSemaphore.""" semaphore = CancellableSemaphore() def run_consumer(): while semaphore.acquire(): ...
query_expressions.py
''' Created on Mar 16, 2015 @author: brecht ''' import abc from multiprocessing import Pipe from multiprocessing.process import Process from cassandra.cluster import Cluster import array import sys from multiprocessing.synchronize import Event class Expression(object): __metaclass__ = abc.ABCMeta @abc.a...
pn_initial_ztp_withthread.py
#!/usr/bin/python """ PN CLI Zero Touch Provisioning (ZTP) """ # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your optio...
test_cpp_tcp_client.py
import multiprocessing as mp from pathlib import Path import subprocess from unittest.mock import MagicMock import msgpack from libmuscle.mcp.tcp_server import TcpServer from libmuscle.mcp.message import Message from libmuscle.post_office import PostOffice from ymmsl import Reference, Settings def tcp_server_proce...
protocol_astrohaven_simulator.py
import datetime import queue from serial import serialutil import threading import time from panoptes.pocs.dome import astrohaven from panoptes.utils import serial_handlers from panoptes.pocs.utils.logger import get_logger Protocol = astrohaven.Protocol CLOSED_POSITION = 0 NUDGE_OPEN_INCREMENT = 1 NUDGE_CLOSED_INCREM...