source
stringlengths
3
86
python
stringlengths
75
1.04M
jigdo_to_iso.py
import os import os.path import subprocess import threading import sys import json import logging import shlex from helpers.call_cmd import call_cmd logger = logging.getLogger(__name__) class ISOMetadata(): def __init__(self): self.iso_path = "unknown" self.version = "unknown" DEFAULT_THREAD_C...
amqp.py
import atexit import socket import time import threading from Queue import Queue from rez.utils import json from rez.utils.data_utils import remove_nones from rez.utils.logging_ import print_error from rez.vendor.amqp import Connection, basic_message _lock = threading.Lock() _queue = Queue() _thread = None _num_pend...
data_utils.py
""" This code is based on https://github.com/fchollet/keras/blob/master/keras/utils/data_utils.py """ import sys import signal import time import numpy as np import threading import multiprocessing try: import queue except ImportError: import Queue as queue # handle terminate reader process, do not print sta...
TensileCreateLibrary.py
################################################################################ # Copyright (C) 2016 Advanced Micro Devices, Inc. All rights reserved. # # 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 th...
batteries.py
import threading import weakref import time import socket import os import collections import heapq from .syncobj import SyncObjConsumer, replicated class ReplCounter(SyncObjConsumer): def __init__(self): """ Simple distributed counter. You can set, add, sub and inc counter value. """ ...
test_concurrent_futures.py
import test.support # Skip tests if _multiprocessing wasn't built. test.support.import_module('_multiprocessing') # Skip tests if sem_open implementation is broken. test.support.import_module('multiprocessing.synchronize') # import threading after _multiprocessing to raise a more relevant error # message: "No module n...
test_add_vectors.py
import time import random import pdb import threading import logging from multiprocessing import Pool, Process import pytest from milvus import Milvus, IndexType, MetricType from utils import * dim = 128 index_file_size = 10 table_id = "test_add" ADD_TIMEOUT = 60 nprobe = 1 epsilon = 0.0001 class TestAddBase: "...
vertex_coloring.py
#!/usr/bin/python3 import sys sys.path.append('../../..') import os import sys import time import threading from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * import vi.app.vertex_coloring import vi.csp import vi.graph import vi.search.graph import vi.search.gac class VertexColoringW...
session_server.py
#!/usr/bin/env python3 # Copyright 1996-2021 Cyberbotics 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 applic...
mapfish.py
from __future__ import absolute_import import os import os.path import re import errno import json import threading import tempfile import subprocess import time from contextlib import closing from copy import deepcopy from zipfile import ZipFile import requests from flask import current_app, render_template from fl...
test_concurrent_futures.py
import test.support test.support.import_module('_multiprocessing') test.support.import_module('multiprocessing.synchronize') test.support.import_module('threading') from test.support.script_helper import assert_python_ok import os import sys import threading import time import unittest import weakref from concurrent im...
utils.py
DYNAMODB = False import infinit.beyond import infinit.beyond.bottle if DYNAMODB: import infinit.beyond.dynamodb else: import infinit.beyond.couchdb import time import bottle import requests import threading import urllib.parse from functools import partial from itertools import chain from datetime import timedel...
main.py
#!/usr/bin/env python #coding=utf8 from Memory.Main import * from Cpu.Main import * from Disk.Main import * from Net.Main import * from Local.Main import * from Raid.Main import * from func import * from urllib2 import Request, urlopen from urllib import urlencode from threading import Thr...
geemap.py
"""Main module for interactive mapping using Google Earth Engine Python API and ipyleaflet. Keep in mind that Earth Engine functions use both camel case and snake case, such as setOptions(), setCenter(), centerObject(), addLayer(). ipyleaflet functions use snake case, such as add_tile_layer(), add_wms_layer(), add_mi...
onedrive.py
from __future__ import print_function import base64 import copy import json import os import re import time import traceback from builtins import object, str from typing import List from pydispatch import dispatcher from requests import Request, Session from empire.server.common import encryption, helpers from empir...
parallel.py
from multiprocessing import Process, Queue import multiprocessing as mp from functools import wraps ########################################################################################## # Parallel + multithreading tools ########################################################################################## ...
V1_Novo_Biorad - b.py
from opentrons.types import Point import json import os import math import threading from time import sleep metadata = { 'protocolName': 'V1_Novo_BioRad', 'adapted by': 'Ricardo Magalhães', 'author': 'Ricardo Magalhães', 'apiLevel': '2.3' } NUM_SAMPLES = 40 # start with 8 samples, slowly increase to 4...
kb_hisat2Server.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from wsgiref.simple_server import make_server import sys import json import traceback import datetime from multiprocessing import Process from getopt import getopt, GetoptError from jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError,\ JSONRPCError, Inva...
vision.py
from tracker.core import * from tracker.camera import Camera from tracker.blob_detector import BlobDetector from tracker.calibrator import Calibrator from tracker.mosse_tracker import MOSSETracker from multiprocessing import Process, Manager msgHeader = "[VISION]: " class Vision(): def __init__(self): self.cam = ...
test_http2_server.py
import logging import threading import time import pytest import requests from localstack.utils.common import get_free_tcp_port, is_port_open, poll_condition from localstack.utils.net import wait_for_port_closed, wait_for_port_open from localstack.utils.server.http2_server import run_server LOG = logging.getLogger(_...
core.py
# -*- coding: utf-8 -*- # # 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 #...
3d_manual_trajopt.py
#!/usr/bin/env python import copy import rospy import moveit_commander import moveit_msgs.msg import geometry_msgs.msg from math import pi from std_msgs.msg import String from sensor_msgs.msg import JointState from moveit_msgs.msg import DisplayTrajectory, RobotTrajectory from trajectory_msgs.msg import JointTrajectory...
node.py
from blockchain import BlockChain from threading import Thread from transaction import Transaction from block import Block import json import time import hashlib from tool import getNextHash, valid_proof_of_work, checkValid import requests import random NUM_TRANS_PER_BLOCK= 1 """ Initialize the node. address: addr...
runner.py
#!/usr/bin/env python3 # Copyright 2010 The Emscripten Authors. All rights reserved. # Emscripten is available under two separate licenses, the MIT license and the # University of Illinois/NCSA Open Source License. Both these licenses can be # found in the LICENSE file. """This is the Emscripten test runner. To run ...
email.py
# -*- coding: UTF-8 -*- __author__ = 'hunter' from threading import Thread from flask import current_app, render_template from flask_mail import Message from . import mail def send_async_email(app, msg): with app.app_context(): mail.send(msg) def send_email(to, subject, template, **kwargs): app = cu...
tpu_estimator.py
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
StupidArtnetServer.py
"""(Very) Simple Implementation of Artnet. Python Version: 3.6 Source: http://artisticlicence.com/WebSiteMaster/User%20Guides/art-net.pdf NOTES - For simplicity: NET and SUBNET not used by default but optional """ import socket from threading import Thread from stupidArtnet.ArtnetUtils import make_address_mask c...
main_win.py
#coding=utf-8 import threading import datetime import base64 import tkinter as tk from tkinter import ttk from .db_instance import set_db, SalaryEmail from .setting_box import AccountPasswordWin, SMTPPortWin, InfoWin, SysSettingWin from .parse_execl import ParseExcel from .send_email import SendEmail impo...
test_data_node_scale.py
import threading import time import pytest from base.collection_wrapper import ApiCollectionWrapper from common.common_type import CaseLabel from common import common_func as cf from customize.milvus_operator import MilvusOperator from scale import constants from pymilvus import connections from utils.util_log import...
build.py
#!/usr/bin/env python # Copyright 2020 The Defold Foundation # Licensed under the Defold License version 1.0 (the "License"); you may not use # this file except in compliance with the License. # # You may obtain a copy of the License, together with FAQs at # https://www.defold.com/license # # Unless required by applica...
data_helper.py
import copy import crc32 import hashlib import json import random import socket # from multiprocessing.process import Process # from multiprocessing.queues import Queue import threading import time import uuid import zlib from random import Random from TestInput import TestInputServer from TestInput import TestInputSin...
portScan.py
''' Created on 2017年8月12日 端口扫描器 @author: liliangang ''' import socket import threading import time import argparse class PortScan: def __init__(self, host="", port=0): self.host = host self.port = port self.availablePort = [] # 扫描端口 def scan(self, host="", port=0): # 默...
blockchain.py
#!/usr/bin/env python # # 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 witho...
mitm_relay.py
#!/usr/bin/env python import sys import socket import ssl import os import requests import argparse import time import string from http.server import HTTPServer, BaseHTTPRequestHandler from threading import Thread from select import select BIND_WEBSERVER = ('127.0.0.1', 49999) BUFSIZE = 4096 __prog_name__ = 'mitm_r...
evaluate_circuit.py
from multiprocessing import Process, Queue from typing import List from tools.person import Person from MPC import MPC from protobuf import Output_pb2 from tests.plain_evaluator import * from fpre.fpre import Fpre from conf import conf import cbmc_parser.create_circuit as cc def user(id: int, create_circuit, input, ...
utils.py
from __future__ import print_function import sys import time import threading import platform import subprocess import os import numpy as np import matplotlib.pyplot as plt from fibre.utils import Event import odrive.enums from odrive.enums import * try: if platform.system() == 'Windows': import win32cons...
base_camera.py
import time import threading try: from greenlet import getcurrent as get_ident except ImportError: try: from thread import get_ident except ImportError: from _thread import get_ident class CameraEvent(object): """An Event-like class that signals all active clients when a new frame is ...
basic.py
# -*- coding: utf-8 -*- """ flask.testsuite.basic ~~~~~~~~~~~~~~~~~~~~~ The basic functionality. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import re import uuid import flask import pickle import unittest from datetime import datetime from threading i...
Schaltserver-Rollos1.1.py
#!/usr/bin/python import paho.mqtt.client as paho import time from threading import Thread import json import urllib import RPi.GPIO as GPIO import socket #Conf BaseURL = "http://172.31.1.205/php/Backend.php" ## ip = [l for l in ([ip for ip in socket.gethostbyname_ex(socket.gethostname())[2] if not ip.startswith("12...
nmea.py
''' nmea.py Converts Sailaway API data to NMEA sentences for communication with nautical charting software. ''' import socket import threading import sys from datetime import datetime, timedelta from rich.console import Console from rich.markdown import Markdown from sailaway import sailaway, saillog fro...
plotCoronavirous.py
#python3 unicode #author:Steven Huang 25/04/20 #function: Query cases of COVID-19 from website #World case statistics by time reference: https://ourworldindata.org/covid-cases # import sys from numpy.lib.npyio import save sys.path.append("..") import os import random import datetime import pandas as pd import numpy as...
getip.py
# *-* coding:utf-8 *-* import requests from bs4 import BeautifulSoup import lxml from multiprocessing import Process, Queue import random import json import time import requests class Proxies(object): """docstring for Proxies""" def __init__(self, page=3): self.proxies =...
train_runner.py
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
patu.py
#!/usr/bin/env python # TODO # breadth-first searching, stopping after a given level # ensure redirects are followed import httplib2 import time import random import sys from BeautifulSoup import BeautifulSoup from multiprocessing import Process, Queue, current_process from urlparse import urlsplit, urljoin, urlunspl...
streaming.py
# -*- coding: utf-8 -*- """ Provide real time audio playback and recording, with special classes to concurrently read input audio. """ import numpy as np import sounddevice as sd import multiprocessing as mp from queue import Empty, Queue from threading import Event from typing import Optional, Callable, List, Type,...
multiprocessing_train.py
import os, sys import random import signal import torch import distributed_utils, options from train import main as single_process_main def main(args): # Set distributed training parameters for a single node. if args.distributed_world_size is None: args.distributed_world_size = torch.cuda.device_cou...
solar-divert.py
#!/usr/bin/env python3 import sense_energy import requests import re import time import config import asyncio from flask import Flask, Response from threading import Thread app = Flask(__name__) runSenseLoop = False def refreshSense(sense): try: sense.get_realtime() except: # assume we are l...
mininet_tests.py
#!/usr/bin/env python3 """Mininet tests for FAUCET.""" # pylint: disable=missing-docstring # pylint: disable=too-many-arguments # pylint: disable=unbalanced-tuple-unpacking import binascii import collections import copy import itertools import ipaddress import json import os import random import re import shutil imp...
server.py
#! /usr/bin/python3 """ Multi-threaded Server """ import threading import socket import sys import logging import json from queue import Queue from typing import Callable, List, Tuple, Union from conn import ( ADDR, DISCONNECT_MESSAGE, SERVER_ADDR, CODEC_FORMAT, send, receive, ) LOG_FORMAT = '%(asctime)s %...
practice6_rx_model_challenge.py
import threading import random from time import sleep from rx.subject import Subject from rx import operators as ops mysubject = Subject() def callback(r): print(r) mysubject.on_next(r) return r def incoming(): for i in range(0, 1000): value = random.randint(0, 10) ...
conftest.py
import pytest import torch from multiprocessing import Process import os import sys import syft from syft.workers.node_client import NodeClient from syft.grid.public_grid import PublicGridNetwork from . import IDS, PORTS import time import requests import json from gevent import pywsgi from geventwebsocket.handler im...
ArancinoStart.py
''' SPDX-license-identifier: Apache-2.0 Copyright (c) 2019 SmartMe.IO Authors: Sergio Tomasello <sergio@smartme.io> 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...
__init__.py
# Copyright The OpenTelemetry 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 ...
installwizard.py
from functools import partial import threading import os from kivy.app import App from kivy.clock import Clock from kivy.lang import Builder from kivy.properties import ObjectProperty, StringProperty, OptionProperty from kivy.core.window import Window from kivy.uix.button import Button from kivy.utils import platform...
test_eap_proto.py
# EAP protocol tests # Copyright (c) 2014-2015, Jouni Malinen <j@w1.fi> # # This software may be distributed under the terms of the BSD license. # See README for more details. import binascii import hashlib import hmac import logging logger = logging.getLogger() import os import select import struct import threading i...
test_poplib.py
"""Test script for poplib module.""" # Modified by Giampaolo Rodola' to give poplib.POP3 and poplib.POP3_SSL # a real test suite import poplib import socket import os import errno import threading import unittest from unittest import TestCase, skipUnless from test import support as test_support from test.support imp...
text_client.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...
pscb.py
import config import wave import pyaudio import time import sys import threading import pygame import os import datetime try: import RPi.GPIO as GPIO DEVICE_MODE = 'pi' except Exception as e: DEVICE_MODE = 'test' from EmulatorGUI import GPIO AUDIO_MODE = 'pygame' class PSCB: sound = False mo...
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...
power_monitoring.py
import random import threading import time from statistics import mean from cereal import log from common.params import Params, put_nonblocking from common.realtime import sec_since_boot from selfdrive.hardware import HARDWARE from selfdrive.swaglog import cloudlog CAR_VOLTAGE_LOW_PASS_K = 0.091 # LPF gain for 5s tau...
lisp-etr.py
#----------------------------------------------------------------------------- # # Copyright 2013-2019 lispers.net - Dino Farinacci <farinacci@gmail.com> # # 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 ...
conftest.py
import os import sys from multiprocessing import Process import pytest import time PYTEST_DIR = os.path.dirname(__file__) ROOT = os.path.dirname(os.path.dirname(PYTEST_DIR)) MLOC_DIR = os.path.join(ROOT, "mloc") sys.path.insert(0, MLOC_DIR) from mloc.mloc import run_mloc # noqa class Env: def __init__(self): ...
estGPUSize.py
#Parts of code in this file have been taken (copied) from https://github.com/ml-jku/lsc #Copyright (C) 2018 Andreas Mayr from __future__ import print_function from __future__ import division import numpy as np import scipy import scipy.sparse import pandas as pd import itertools import pickle import importlib import os...
punctuation_capitalization_dataset.py
# Copyright (c) 2020, 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 appli...
ecu.py
#! /usr/bin/env python # This file is part of Scapy # See http://www.secdev.org/projects/scapy for more information # Copyright (C) Nils Weiss <nils@we155.de> # This program is published under a GPLv2 license # scapy.contrib.description = Helper class for tracking ECU states (ECU) # scapy.contrib.status = loads impo...
bot.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals import glob import logging import os import re import sys from threading import Thread import telegram from telegram import ChatAction from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, run_async, CallbackQue...
worker_handlers.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...
tests.py
# -*- coding: utf-8 -*- # Unit and doctests for specific database backends. from __future__ import unicode_literals import copy import datetime import re import threading import unittest import warnings from decimal import Decimal, Rounded from django.conf import settings from django.core.exceptions import Improperly...
trezor.py
import traceback import sys from typing import NamedTuple, Any from electrum.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException from electrum.bitcoin import TYPE_ADDRESS, TYPE_SCRIPT from electrum.bip32 import BIP32Node, convert_bip32_path_to_list_of_uint32 as parse_path from electrum import const...
ik_check.py
import threading from pyservos.servo_serial import ServoSerial from pyservos.ax12 import AX12 from pyservos.utils import angle2int, le import time import rospy from darknet_ros_msgs.msg import BoundingBoxes,BoundingBox from math import * import numpy as numpy a1 = 6.7 a2 = 4.5 a3= 9.5 a4 = 9.5 a5 = 16.5 offset_angl...
train_roboschool.py
import argparse import os import time from multiprocessing import Process import roboschool import gym import numpy as np import tensorflow as tf import logz import nn import utils from sac import SAC def train_SAC(env_name, exp_name, seed, logdir, reparam=False, two_qf=False, hidden_sizes=64): alpha = { ...
Azubot.py
import numpy as np from azubot_gpio import * import socket from threading import Thread import time class AzubotMotorController: """Representation of a drive motor in the Azubot. An L293D H-Bridge Motor controller is used. For each motor, there are two enable-signals to choose the direction and one pwm sp...
lionchief.py
from contextlib import nullcontext import bluetooth import time import threading # UUID25 = "08590f7e-db05-467e-8757-72f6faeb13d4" class LionChief(object): def __init__(self, mac_address): if not mac_address: raise "LionChief constructor needs mac address" self._mac_ad...
test_connection.py
#!/usr/bin/env python # test_connection.py - unit test for connection attributes # # Copyright (C) 2008-2011 James Henstridge <james@jamesh.id.au> # # psycopg2 is free software: you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published # by the Free Software Foun...
server.py
from serverlib import * import tkinter as tk import tkinter.simpledialog as tkSimpleDialog import socket import threading # ask if user wants a gui or comandline def ask_gui(): gui = input("Do you want a gui? (y/n) ") if gui == "y": return True elif gui == "n": return False else: ...
ClientMasterManager.py
import logging import multiprocessing import os import platform import sys import time import json import trace import traceback from .FedEventSDK import FedEventSDK from .FedLogsSDK import FedLogsSDK sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "../../../"))) sys.path.insert(0, os.path.abspath(os.pa...
walls_node.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import cStringIO import matplotlib # Execute matplotlib.use('Agg') if using image_server # http://matplotlib.org/faq/howto_faq.html#matplotlib-in-a-web-application-server matplotlib.use('Agg') import matplotlib.pyplot as plt from threading import Lock from threading imp...
webserver.py
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import BaseHTTPServer import os import threading class Responder(object): """Sends a HTTP response. Used with TestWebServer.""" def __init__(self, han...
add_aws_ec2_opsview.py
#!/usr/bin/env python import boto3 import requests import json import multiprocessing from multiprocessing import Queue #Initiate a Queue() class data structure as it's thread-safe, it's FIFO, as a way of #sharing data between processes as multiprocessing doesn't share same memory space like threads q = Queue() proce...
test_cache.py
""" Copyright 2017-2018 Government of Canada - Public Services and Procurement Canada - buyandsell.gc.ca 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 ...
test_heartbeat.py
import unittest import os import signal import time from uuid import uuid4 import multiprocessing as mp import swf.exceptions from simpleflow.swf.process.worker.heartbeat import ( HeartbeatProcess, Heartbeater, ) class FakeHeartbeat(object): def __init__(self, max_count=1): self._token = None ...
bte.py
from bluepy.btle import Peripheral, Scanner, DefaultDelegate, ADDR_TYPE_RANDOM, BTLEException, BTLEDisconnectError from queue import Queue from threading import Thread import binascii import logging import traceback import time _LOGGER = logging.getLogger(__name__) # create a delegate class to receive the BLE broadcas...
common.py
#!/usr/bin/python3 # An autogenerated selection of SurpriseDog's common functions relevant to this project. # To see how this file was created visit: https://github.com/SurpriseDog/Star-Wrangler import os import re import sys import time import math import queue import random import secrets import datetime import iter...
helpers.py
import json import os import threading from abc import abstractmethod from queue import Queue, Empty import requests class BaseDownloader(object): def __init__(self, is_tender=True, workers=4, timeout=None): self.queue = Queue() self.lock = threading.Lock() self.downloaded = 0 se...
data_loader.py
import json import os,struct from queue import Queue from threading import Thread from random import shuffle, sample from tensorflow.core.example import example_pb2 import numpy as np def sample_generator(bin_fname, single_pass=False): """ Generator that reads binary file and yield text sample for training or...
channel.py
import contextlib import functools import jqsh.context import queue import threading class Terminator: """a special value used to signal the end of a channel""" def coerce_other(f): @functools.wraps(f) def wrapper(self, other): import jqsh.values return f(self, jqsh.values.from_na...
upload.py
import bpy from bpy.types import Operator from bpy.props import * from os import path, remove as remove_file from queue import Queue import requests from ..globals import (APP_OPERATOR_PREFIX, API_ADDRESS, ION_ADDRESS) def destructure(d, *keys): return [d[k] if k in d else None for k in keys] class UploadMana...
zeromq.py
# -*- coding: utf-8 -*- ''' Zeromq transport classes ''' # Import Python Libs from __future__ import absolute_import, print_function, unicode_literals import os import sys import copy import errno import signal import hashlib import logging import weakref from random import randint # Import Salt Libs import salt.auth...
listen-py.py
import socket import threading import argparse lport = 4444 sock = socket.socket() sock.bind(('0.0.0.0',lport)) sock.listen(1024) socklist = [] numm = None def con(): #主要保存主动上钩的连接 num = 0 print('等待主机加入') while True: (sk, addrport) = sock.accept() #接收连接并返回一个套...
thread_example.py
from threading import Thread n = 0 def add1(N): # Global n and "n=0" above are the same variable # global is needed to change n from the global scope global n while n < N: n = n + 1 print('Add1: %d' % n) class Adder(Thread): def __init__(self, changeN, N): Thread.__init...
dependency_manager.py
import logging import os import threading import traceback import time import shutil from contextlib import closing from collections import namedtuple from typing import Dict, Set import codalab.worker.pyjson from .bundle_service_client import BundleServiceClient from codalab.lib.formatting import size_str from codala...
hannoy.py
import logging import numpy as np from annoy import AnnoyIndex import yaml import os import threading import queue import time class Annoy: def __init__(self, model_location): # set model location self.model_location = model_location # to keep the thread & queue running self.proc...
helpers.py
"""Supporting functions for polydata and grid objects.""" import collections.abc import enum import logging import os import signal import sys import threading from threading import Thread import traceback from typing import Optional import warnings import numpy as np import pyvista from pyvista import _vtk from . ...
search.py
# -*- coding: utf-8 -*- """ chemspipy.search ~~~~~~~~~~~~~~~~ A wrapper for asynchronous search requests. """ from __future__ import print_function from __future__ import unicode_literals from __future__ import division import logging import threading import time try: from lxml import etree except ImportError: ...
static_pipe.py
import collections import copy import hashlib import itertools import multiprocessing import os import random import sys import threading import time import unittest from buffered_pipe import Static_Pipe as Pipe Testing_Types = "LO" if len(sys.argv) > 1: try: Testing_Types = sys.argv[1] except: ...
main.py
import datetime import glob import io import json import locale import logging import os import platform import re import shutil import stat import subprocess import sys import threading import time import timeit import urllib.error import urllib.parse import urllib.request import xml.etree.ElementTree as et import zip...
wake.py
"""Wake word support.""" import json import os import re import shutil import struct import subprocess import threading import time from pathlib import Path from typing import Any, Dict, Iterable, List, Optional, Type from rhasspy.actor import RhasspyActor from rhasspy.audio_recorder import AudioData, StartStreaming, ...
prepare.py
#!/usr/bin/env python2.7 # pylint: disable=bad-indentation, no-member, invalid-name, line-too-long import os import shutil import random import argparse import multiprocessing import cv2 import lmdb import caffe import numpy as np from jfda.config import cfg from jfda.utils import load_wider, load_celeba, load_scutbra...
rman_render.py
import time import os import rman import bpy import sys from .rman_constants import RFB_VIEWPORT_MAX_BUCKETS, RMAN_RENDERMAN_BLUE from .rman_scene import RmanScene from .rman_scene_sync import RmanSceneSync from. import rman_spool from. import chatserver from .rfb_logger import rfb_log import socketserver import thread...
commands.py
### # Copyright (c) 2002-2005, Jeremiah Fincher # Copyright (c) 2009-2010,2015, James McCoy # 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 a...