source
stringlengths
3
86
python
stringlengths
75
1.04M
main_window.py
#!/usr/bin/env python # # Electrum - lightweight Bitcore 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...
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...
ModuleManager.py
#!/usr/bin/env python3 """ModuleManager.py: This file contains the code for the module managing aspect of the RhysRoom software.""" __author__ = "Rhys Read" __copyright__ = "Copyright 2018, Rhys Read" import logging import os from importlib.machinery import SourceFileLoader import threading MODULE_FOLDER_LOCATION ...
socks5.py
#!/usr/bin/env python3 import argparse import logging import os import platform import signal import struct import sys import threading from socket import AF_INET, SOCK_STREAM, socket from socketserver import BaseServer, StreamRequestHandler, ThreadingTCPServer __author__ = 'Youchao Feng' support_os = ('Darwin', 'Lin...
build_pretraining_dataset.py
# coding=utf-8 # Copyright 2020 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
pyPDFSearch.py
#!/usr/bin/python """ Application for efficiently downloading, managing, and querying a corpus of pdfs - your very own pdf package manager :). """ # Attribution for pdf text extraction: # http://stackoverflow.com/questions/12571905/finding-on-which-page-a-search-string-is-located-in-a-pdf-document-using-python import ...
replay.py
''' Replays recordings saved from the proxy server - simulating the server side of the connection SimConnect proxy server ''' from simconnect.utils import * import sys, socket, time, threading, pickle from simconnect import connection, message class GV: keepRunning = True class ConnectionHandler: nextID = 0 ...
packeter_connections.py
#!/usr/bin/env python """ High amount of parallel connections. @author: David Siroky (siroky@dasir.cz) @license: MIT License (see LICENSE.txt or U{http://www.opensource.org/licenses/mit-license.php}) """ import time import logging import sys import os import threading import multiprocessing import random ...
copy.py
""" functions to allow interactive copy and paste of regions of a minecraft map """ import re from enum import Enum from threading import Thread from time import sleep from typing import Optional from mcipc.rcon.enumerations import CloneMode, Item, MaskMode from mcipc.rcon.je import Client, client from mcwb.types impo...
kb_faprotaxServer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import datetime import json import os import random as _random import sys import traceback from getopt import getopt, GetoptError from multiprocessing import Process from os import environ from wsgiref.simple_server import make_server import requests as _requests from json...
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 or a...
QueueManagerWorker.py
from threading import Thread from queue import Queue from distributor import LambdaRequest import distributor from PingConfig import PingConfig from PingWorker import PingWorker class QueueManagerWorker: targeturl:str = None queue : Queue = None config : PingConfig thread:Thread = None stopping = F...
driver.py
# Copyright 2008-2010 WebDriver committers # Copyright 2008-2010 Google 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 requ...
run.py
import sys import signal import threading import asyncio import aiohttp import conf_loader import notifier import bili_sched import printer import bili_statistics from console_cmd import ConsoleCmd from tasks.login import LoginTask from tasks.live_daily_job import ( HeartBeatTask, # OpenSilverBoxTask, # R...
streaming.py
#!/usr/bin/env python3 # encoding: UTF-8 import os import socket import threading import urllib.parse import pafy import treq from twisted.logger import Logger from twisted.internet import reactor from twisted.web.resource import Resource from twisted.web.server import Site, NOT_DONE_YET from twisted.web.static impo...
test_gateway.py
import functools import time from threading import Thread import numpy as np import pytest from jina import Document, Client, Flow from jina.enums import CompressAlgo from tests import random_docs @pytest.mark.slow @pytest.mark.parametrize('compress_algo', list(CompressAlgo)) def test_compression(compress_algo): ...
commnode.py
import zlib try: import Queue as queue except: import queue import threading, time, sys import os, json, traceback, socket, tempfile, atexit from contextlib import closing try: import xmlrpclib except: import xmlrpc.client as xmlrpclib try: from xmlrpc.server import SimpleXMLRPC...
timeout_guard.py
## @package timeout_guard # Module caffe2.python.timeout_guard import contextlib import threading import os import time import signal import logging from future.utils import viewitems ''' Sometimes CUDA devices can get stuck, 'deadlock'. In this case it is often better just the kill the process automatically. Us...
stereodemo.py
from pymol.wizard import Wizard from pymol import cmd import pymol import types saved = {} class Stereodemo(Wizard): def launch(self,name,pretty_name=None): demo = DemoInfo() if self.last: if hasattr(demo,self.last): getattr(demo,self.last)(cleanup=1) if hasatt...
spider-2.py
#coding=utf-8 import requests from bs4 import BeautifulSoup import os import random import time import multiprocessing as mp import sys #http请求头 Hostreferer = { 'User-Agent':'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)', 'Referer':'https://www.wnacg.com/albums' } same_url = 'https://www.w...
base.py
import hashlib import httplib import os import threading import traceback import socket import urlparse from abc import ABCMeta, abstractmethod from ..testrunner import Stop here = os.path.split(__file__)[0] # Extra timeout to use after internal test timeout at which the harness # should force a timeout extra_timeou...
server_test.py
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
server.py
""" livereload.server ~~~~~~~~~~~~~~~~~ WSGI app server for livereload. :copyright: (c) 2013 - 2015 by Hsiaoming Yang :license: BSD, see LICENSE for more details. """ import os import time import shlex import logging import threading import webbrowser from subprocess import Popen, PIPE from torn...
merra_ma.py
import os import io import warnings from tqdm import tqdm import json import time import random import numpy as np import matplotlib.pyplot as plt import cartopy import cartopy.crs as ccrs import cartopy.io.shapereader as shpreader import cartopy.io.img_tiles as cimgt from netCDF4 import Dataset import multiprocessing ...
server.py
from flask import Flask, render_template, request,jsonify, flash, redirect,request, url_for import random, socket, threading import time cache = {} cache['pm10'] = '' #tcp server TCP_IP = '192.168.1.4' TCP_PORT = 7005 BUFFER_SIZE = 20 def launchServer(): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ...
solver.py
import logging import os import time import numpy as np import multiprocessing try: from generateSamples import load_mlp_generateSamples except ModuleNotFoundError: pass class MLPSolver(object): """The MLP approximation algorithm for semilinear parabolic PDEs.""" def __init__(self, config, mlp):...
dates_test.py
import time t1 = time.time() print("Seconds since epoch =", t1) time.sleep(2) t2 = time.time() print("Seconds since epoch =", t2) if t2 - t1 > 1: print("difference is > 1 sec") else: print("difference is too small") # local_time = time.ctime(seconds) # print("Local time:", local_time) ####################...
test_utility.py
import threading import time import pytest from pymilvus.exceptions import MilvusException from base.client_base import TestcaseBase from base.utility_wrapper import ApiUtilityWrapper from utils.util_log import test_log as log from common import common_func as cf from common import common_type as ct from common.common...
ChatterJi.py
import tkinter as tk import threading from PIL import ImageTk, Image from playsound import playsound #just install pip , if not already present import subprocess subprocess.call("pip install tk", shell=True) subprocess.call("pip install pillow", shell=True) subprocess.call("pip install PIL-tools", shell=True) subproce...
probe.py
from time import time, sleep from inspect import signature from multiprocessing import Process, Queue from collections import defaultdict import atexit SHUTDOWN = "shutdown" ALL_WRITTEN = "all_written" class _Worker: __slots__ = ["pid_queue", "record_queue", "process"] def __init__(self, pid_queue, record_q...
cmdlineframes.py
from __future__ import absolute_import, division, print_function from iotbx.reflection_file_reader import any_reflection_file from cctbx.miller import display2 as display from crys3d.hklview import jsview_3d as view_3d from crys3d.hklview.jsview_3d import ArrayInfo from cctbx import miller from libtbx.math_utils impo...
weiqi_online.py
#!/usr/bin/python3 # 使用Python内建GUI模組tkinter from tkinter import * # ttk覆寫tkinter部分物件,ttk對tkinter進行了優化 from tkinter.ttk import * # deepcopy需要用到copy模組 from MyOwnPeer2PeerNode import MyOwnPeer2PeerNode import copy import tkinter.messagebox import sys import time import threading sys.path.insert(0, '..') # Import the fi...
ClientImportSubscriptions.py
import gc import os import random import threading import time import typing from hydrus.core import HydrusConstants as HC from hydrus.core import HydrusData from hydrus.core import HydrusExceptions from hydrus.core import HydrusGlobals as HG from hydrus.core import HydrusSerialisable from hydrus.core import HydrusThr...
optimizer_tcp_manager.py
import yaml import os import subprocess import socket import json import logging import time import math from threading import Thread from retry import retry from .solver_response import SolverResponse class OptimizerTcpManager: """Client for TCP interface of parametric optimizers This class is used to start...
analysis.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Mar 5 11:56:26 2019 @author: descentis """ import copy import glob import math import os import re import sqlite3 import string import xml.etree.ElementTree as ET from collections import Counter from datetime import datetime from multiprocessing import...
recording_viewer_device_v1.py
# Copyright 2018 Jetperch 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,...
_worker.py
import atexit import threading import os from .internal.logger import get_logger _LOG = get_logger(__name__) class PeriodicWorkerThread(object): """Periodic worker thread. This class can be used to instantiate a worker thread that will run its `run_periodic` function every `interval` seconds. The ...
snapraid-btrfs-runner.py
#!/usr/bin/env python3 import argparse import configparser import logging import logging.handlers import os.path import shutil import subprocess import sys import threading import time import traceback from collections import Counter, defaultdict from io import StringIO # Global variables config = None email_log = Non...
cmd_run.py
import os import time from typing import cast from watchdog.events import FileSystemEventHandler from .. import shared, ui from ..core import WorkItem, WorkItemType, WorkManager from ..core.defaultData import CIO_Types, CIO_SISO from ..ui.command import Command, Namespace, ReturnCode from .helper import assertInited,...
main.py
from utils.search import BaiduEngine from utils.constant import we_load_dict, load_ap import csv import multiprocessing import time import redis import ujson key_set, company_suffix = we_load_dict() ap = load_ap() redis_host = '172.18.18.173' redis_db = 2 pool = redis.ConnectionPool(host=redis_host, port=6379, ...
repl.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals, print_function import signal import threading def main(): import codecs import hashlib import json import os import platform import re import sys try: from urllib.request import build_opener except: f...
race.py
import time import random from threading import Thread from concurrency.utils import t class RandomGen: def __init__(self, num, start=0, end=9): self.num = num self.start = start self.end = end self.random = 0 self.value = 0 def update(self): while True: ...
__init__.py
""" This module sets up endpoints for querying the modules of workflow2. The modules can take a very long time to run, and so I designed this module to run modules in their own process and then terminate that process if connection breaks. We do not want to waste resources by running modules when the answer will not be ...
sensing_interface.py
#!/usr/bin/env python import rospy import rospkg import re import threading import numpy as np from threading import Lock import imp from rosplan_knowledge_msgs.srv import KnowledgeUpdateServiceArray, KnowledgeUpdateServiceArrayRequest from rosplan_knowledge_msgs.srv import GetDomainPredicateDetailsService, GetDomainP...
display_manager.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...
__init__.py
#!/usr/bin/env python # coding: utf-8 # Copyright (c) 2002-2016 "Neo Technology," # Network Engine for Objects in Lund AB [http://neotechnology.com] # # This file is part of Neo4j. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # Y...
apc_console.py
#!/usr/bin/env python ''' CLI Console ''' import cmd import getpass import os import platform import signal import struct import subprocess from subprocess import check_call import sys import threading import zmq import psutil if platform.system() in ['Windows']: APC_HOME = os.environ.get('VOYAGER_PRJ') APC_L...
helper_functions.py
# -*- coding: utf-8 -*- """ Save the Active Document with new current timeStamp. based on https://wiki.documentfoundation.org/Macros/Python_Guide/Documents """ import time import threading # libreoffice import uno from com.sun.star.awt import MessageBoxButtons as MSG_BUTTONS CTX = uno.getComponentContext() SM = CTX...
SequenceScriptParser.py
import json import pathlib import threading import time import random import datetime import copy from PySide6 import QtCore, QtWidgets, QtGui from .Database import DowDatabase from .MimeType import DowMimeType from .Config import DowConfig class DowSequenceScriptParserSignals(QtCore.QObject): setTextSignal = QtCore...
pareto_executor.py
#!/usr/bin/env python import sys import os import datetime import time import threading import random import collections import hashlib try: from mesos.native import MesosExecutorDriver, MesosSchedulerDriver from mesos.interface import Executor, Scheduler from mesos.interface import mesos_pb2 except Impor...
leveler_macro.py
import keyboard import mouse from time import sleep from threading import Thread class LevelerMacro(): __KEYBOARD = 0 __MOUSE = 0 def __init__( self, movement_time=5, jump_charge_time=2, after_jump_time=0.35, trick_cycles=3 ): super(LevelerMacro...
test_rpc.py
import os import time import socket import dgl import backend as F import unittest, pytest import multiprocessing as mp from numpy.testing import assert_array_equal if os.name != 'nt': import fcntl import struct INTEGER = 2 STR = 'hello world!' HELLO_SERVICE_ID = 901231 TENSOR = F.zeros((10, 10), F.int64, F....
nyx_self.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...
multiple-mice.py
#read data from multiple mice, connected to Linux computer from threading import Thread import os.path thread0 = None thread1 = None thread2 = None thread3 = None def run(): global thread0, thread1, thread2, thread3 if thread0 is None: thread0 = run_one('/dev/input/mouse0', "m0") if thread1 is No...
NodeManager.py
#coding:utf-8 from multiprocessing import Queue, Process from multiprocessing.managers import BaseManager import time from ControlNode.DataOutput import DataOutput from ControlNode.UrlManager import UrlManager class NodeManager(object): def start_Manager(self,url_q,result_q): ''' 创建一个分布式管理器 ...
test_utility.py
import threading import pytest from base.client_base import TestcaseBase from base.utility_wrapper import ApiUtilityWrapper from utils.util_log import test_log as log from common import common_func as cf from common import common_type as ct from common.common_type import CaseLabel, CheckTasks from common.milvus_sys im...
camview.py
from ast import arguments import requests from selenium import webdriver from selenium.webdriver.chrome.options import Options import climage import os import cv2 from time import sleep from multiprocessing import Process import argparse # global setup for selenium chrome_options = Options() chrome_options.headless = ...
random_shuffle_queue_test.py
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
env_server.py
import logging, json from flask import Flask, jsonify, request from time import time, sleep from threading import Thread app = Flask(__name__) log = logging.getLogger('werkzeug') log.disabled = True @app.route('/') def hello(): return 'Server is running!' @app.route('/backends') def get_backends(): global b...
test_integration.py
import threading import requests from http.server import HTTPServer from periskop_client.handler import exception_http_handler from periskop_client.models import HTTPContext def err_func(): return 1 / 0 def test_integration(collector, exporter): try: err_func() except Exception as exception: ...
MPLogger.py
# -*- coding: utf-8 -*- # Author : Jin Kim # e-mail : jinkim@seculayer.co.kr # Powered by Seculayer © 2021 Service Model Team, R&D Center. import logging import logging.config from mlps.common.logger.MPLogHandler import MPLogHandler class MPLogger(object): # Static variables DEBUG = "DEBUG" INFO = "INFO...
config_docker.py
#!/usr/bin/env python3 # scripts/config_docker.py # # Import/Export script for Docker.io. # # @author Andrea Dainese <andrea.dainese@gmail.com> # @copyright 2014-2016 Andrea Dainese # @license BSD-3-Clause https://github.com/dainok/unetlab/blob/master/LICENSE # @link http://www.unetlab.com/ # @version 20160719 import...
align+imcomb4object.py
#============================================================ # Python CODE FOR GREGISTERING + IMCOMBINE # JUST RUN AND WRITE INPUT & REF IMAGE # 2017.12.22 Changsu Choi # 2019.05.08 GREGORY S.H. PAEK # 2019.05.21 GREGORY S.H. PAEK #============================================================ import os, sys, glob impor...
tests.py
# Unit tests for cache framework # Uses whatever cache backend is set in the test settings file. import copy import io import os import pickle import re import shutil import tempfile import threading import time import unittest from pathlib import Path from unittest import mock from django.conf import settings from dj...
test_default.py
##################################################################### ## Copyright (c) Autodesk, Inc. All rights reserved ## Written by Forge Partner Development ## ## Permission to use, copy, modify, and distribute this software in ## object code form for any purpose and without fee is hereby granted, ## provided that...
experiment11.py
import numpy as np import strlearn as sl import config11 as config from sklearn.base import clone from tabulate import tabulate import matplotlib.pyplot as plt from strlearn.ensembles import WAE from strlearn.evaluators import TestThenTrain import multiprocessing np.set_printoptions(suppress=True) replications = conf...
run_nvmf.py
#!/usr/bin/env python3 import os import re import sys import json import paramiko import zipfile import threading import subprocess import itertools import time import uuid import rpc import rpc.client import pandas as pd from collections import OrderedDict from common import * class Server: def __init__(self, n...
applications_test.py
import pytest import random import os from multiprocessing import Process, Queue from keras import applications from keras import backend as K MODEL_LIST = [ (applications.ResNet50, 2048), (applications.VGG16, 512), (applications.VGG19, 512), (applications.Xception, 2048), (applications.InceptionV...
test_smtplib.py
import asyncore import base64 import email.mime.text from email.message import EmailMessage from email.base64mime import body_encode as encode_base64 import email.utils import hmac import socket import smtpd import smtplib import io import re import sys import time import select import errno import textwrap import uni...
__init__.py
# -*- coding: utf-8 -*- ''' Set up the Salt integration test suite ''' # Import Python libs from __future__ import print_function import os import re import sys import copy import json import time import errno import signal import shutil import pprint import logging import tempfile import subprocess import multiproce...
run_process.py
import traceback import time import threading import multiprocessing as mp from queue import Empty from pyjoystick.stash import Stash from pyjoystick.utils import PeriodicThread from pyjoystick.run_thread import ThreadEventManager class MultiprocessingEventManager(ThreadEventManager): def __init__(self, event_lo...
click_spinner.py
# -*- coding: utf-8 -*- """ MIT License Copyright (c) 2016 Yoav Ram 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, modi...
worker_base.py
""" Helper methods constant across all workers """ import requests, datetime, time, traceback, json, os, sys, math, logging from logging import FileHandler, Formatter, StreamHandler from multiprocessing import Process, Queue import sqlalchemy as s import pandas as pd from pathlib import Path from urllib.parse import ur...
DataGen_Transformer.py
import csv import os import sys import shutil import time import numpy as np import scipy.io as sio import yaml import argparse from easydict import EasyDict from os.path import dirname, realpath, pardir from hashids import Hashids import hashlib sys.path.append(os.path.join(dirname(realpath(__file__)), pardir)) imp...
test_agent.py
import os import sys import time import json import signal import socket import pickle import threading import contextlib import subprocess from concurrent.futures import ThreadPoolExecutor if sys.version_info < (3, 0, 0): import Queue as queue else: import queue import pytest from agent import agent, fs_plu...
train_dist_onnx.py
import time import argparse import sys import os import threading import torch import torch.distributed as dist import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torch.onnx from math import ceil from random import Random from torch.multiprocessing import Process from torch.autogr...
emulatedmote.py
import logging import time from multiprocessing import get_logger from multiprocessing.process import current_process from threading import Thread from typing import TYPE_CHECKING, Tuple from openvisualizer.simulator.bspemulator.bspboard import BspBoard from openvisualizer.simulator.bspemulator.bspdebugpins import Bsp...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
controller_worker.py
# Copyright 2019, 2020 SAP SE # Copyright 2015 Hewlett-Packard Development Company, L.P. # # 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 # # Unl...
fed_event.py
# Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
mapping_mode.py
#!/usr/bin/env python3 # Copyright 2020, NTRobotics # # 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...
pv.py
import sys import time import random import logging import pytest import threading from functools import wraps import weakref import numpy as np import ophyd.control_layer as cl logger = logging.getLogger(__name__) _FAKE_PV_LIST = [] class FakeEpicsPV(object): _connect_delay = (0.05, 0.1) _update_rate = 0....
qingcloud-marathon.py
#!/usr/bin/env python """Connector of Mesosphere Marathon and QingCloud load balancer.""" import os import json import logging import threading import collections __license__ = ''' The MIT License (MIT) Copyright (c) 2015 Microdog <kainan.zhu@outlook.com> Permission is hereby granted, free of charge, to any person ...
tester.py
#!/usr/bin/python # # tester.py # # This source file is part of the FoundationDB open source project # # Copyright 2013-2018 Apple Inc. and the FoundationDB project 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 ob...
__init__.py
# Copyright 2017 Mycroft AI 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 writin...
serviceSV2TTS.py
import flask from flask import request, jsonify, abort, send_from_directory from scipy.io import wavfile from synthesizer.inference import Synthesizer from encoder import inference as encoder from vocoder import inference as vocoder from pathlib import Path import numpy as np import subprocess import threading import l...
test_sqlite.py
import os import unittest from threading import Thread from unittest.mock import patch from requests_cache.backends.sqlite import DbDict, DbPickleDict from tests.integration.test_backends import BaseStorageTestCase class SQLiteTestCase(BaseStorageTestCase): def tearDown(self): try: os.unlink(...
thread-add-synch.py
"prints 200 each time, because shared resource access synchronized" import threading, time count = 0 def adder(addlock): # shared lock object passed in global count with addlock: count = count + 1 # auto acquire/release around stmt time.sleep(0.5) with add...
Check_State.py
from wakeonlan import send_magic_packet from fabric import Connection import marshal import types import threading from queue import Queue import socket import time import base64 import sys import paramiko.ssh_exception def starting_module(c_q): print("###########################################") print("## ...
test_bz2.py
z test zaimportuj support z test.support zaimportuj bigmemtest, _4G zaimportuj unittest z io zaimportuj BytesIO, DEFAULT_BUFFER_SIZE zaimportuj os zaimportuj pickle zaimportuj glob zaimportuj random zaimportuj subprocess zaimportuj sys z test.support zaimportuj unlink zaimportuj _compression spróbuj: zaimportuj t...
utils.py
"""Helper methods to run the experiment """ import numpy as np import matplotlib.pyplot as plt import threading from channel import Channel from environment import Environment from interaction import Interaction from fish import Fish from observer import Observer def generate_distortion(type='linear', n=10, show=Fa...
common.py
import datetime import glob import os from os import path import socket from subprocess import call, PIPE, STDOUT, Popen import sys # Directory containing this program. PROGDIR = path.dirname(path.realpath(__file__)) # For python_config. sys.path.insert(0, path.join(PROGDIR, "..", "..", "etc")) import tarfile import t...
acecore.py
# -*- coding: utf-8 -*- """ Plexus (c) 2015 enen92 This file contains the acestream console of the addon. Initial versions were coded by Nouismons and so, this file is based on his work. Classes: Logger() -> Log class _TSPlayer(xbmc.Player) -> Inheritance of the xbmc.Player class for acestr...
monitor.py
import os import sys import time import signal import threading import atexit import Queue _interval = 1.0 _times = {} _files = [] _running = False _queue = Queue.Queue() _lock = threading.Lock() def _restart(path): _queue.put(True) prefix = 'monitor (pid=%d):' % os.getpid() print >> sys.stderr, '%s Chan...
webkr4find.py
from multiprocessing import Process _hash = '' #해시 값(초록 문자열)을 입력 PARTS = 10 #csv 파일 개수 #csv 파일에서 해시 값을 찾으면 원본 값을 출력 def find(i): fname = 'hash_'+str(i)+'.csv' f = open(fname, 'r') while True: line = f.readline().strip() if not line: break data = line.split(',') if data[1] == _hash: print(data[0])...
test_io.py
"""Unit tests for the io module.""" # Tests of io are scattered over the test suite: # * test_bufio - tests file buffering # * test_memoryio - tests BytesIO and StringIO # * test_fileio - tests FileIO # * test_file - tests the file interface # * test_io - tests everything else in the io module # * test_univnewlines - ...
split_video.py
from multiprocessing.context import Process import os import glob from moviepy.editor import VideoFileClip path = "../GRID/" origin = "../video_org" file = "GRID_files.txt" def get_duration(filename): clip = VideoFileClip(filename) return clip.duration def run(origins, videos, dests): for i in range(0, l...
executor.py
# Copyright 2018 Google 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
test.py
import os.path as p import random import threading import time import pytest from helpers.cluster import ClickHouseCluster from helpers.test_tools import TSV from helpers.client import QueryRuntimeException from helpers.network import PartitionManager import json import subprocess import kafka.errors from kafka impor...
mock_server.py
"""Mock server only emulates CB rest endpoints but has no functionality""" import socket import threading import re import json import sys from urllib.parse import urlparse from http.server import HTTPServer, BaseHTTPRequestHandler import requests class RequestHandler(BaseHTTPRequestHandler): def do_GET(self): ...