source
stringlengths
3
86
python
stringlengths
75
1.04M
hogwild_trainer.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from typing import Any, Tuple import torch import torch.multiprocessing as mp from pytext.common.constants import Stage from pytext.config import PyTextConfig from pytext.config.pytext_config import ConfigBase from pytext.met...
parameterize_batch.py
import copy import argparse import time import numpy as np from io import StringIO import itertools import os import sys from jax.config import config as jax_config # this always needs to be set jax_config.update("jax_enable_x64", True) from scipy.stats import special_ortho_group import jax import rdkit from rdkit im...
test_worker.py
import json import logging import time import threading from multiprocessing import Queue try: from queue import Empty except ImportError: from Queue import Empty import boto3 from moto import mock_sqs from mock import patch, Mock from pyqs.worker import ManagerWorker, ReadWorker, ProcessWorker, BaseWorker, M...
worldcup_live.py
#coding: utf-8 ''' World Cup Live ''' # Available colors: # Fore: BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE # Back: BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET. # Style: DIM, NORMAL, BRIGHT, RESET_ALL # TODO: Remove mocks. # TODO: Show groups. from multiprocessing import Process, Lock fro...
test_capi.py
# Run the _testcapi module tests (tests for the Python/C API): by defn, # these are all functions _testcapi exports whose name begins with 'test_'. import os import pickle import random import subprocess import sys import time import unittest from test import support try: import _posixsubprocess except ImportErro...
unicorn_binance_websocket_api_manager.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # File: unicorn_binance_websocket_api/unicorn_binance_websocket_api_manager.py # # Part of ‘UNICORN Binance WebSocket API’ # Project website: https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api # Documentation: https://oliver-zehentleitner.github.io/uni...
test_add_image_progress.py
''' New Integration test for add image progress. @author: quarkonics ''' import zstackwoodpecker.test_util as test_util import zstackwoodpecker.test_lib as test_lib import zstackwoodpecker.operations.volume_operations as vol_ops import zstackwoodpecker.operations.resource_operations as res_ops import zsta...
dataset_collect.py
import time import requests import multiprocessing import numpy as np from deepgtav.messages import Start, Stop, Scenario, Commands, frame2numpy, Dataset from deepgtav.client import Client import pickle i = 100 # 设置数据集编号 set_time = 24 # 设置模拟器中的时间。24小时制 weather = 'EXTRASUNNY' # 设置模拟器中的天气。可以为雨天..... location = [124...
tsproxy.py
#!/usr/bin/python """ Copyright 2016 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable l...
test_logging.py
from __future__ import ( absolute_import, unicode_literals, ) import gc from logging import ( WARNING, Formatter, LogRecord, ) import logging.handlers import socket import threading import unittest import six from pysoa.common.logging import ( PySOALogContextFilter, RecursivelyCensoredDic...
tracker.py
from app.handlers.entry_handler import EntryHandler, AmazonCrawler #from app.crawler.amazon_crawler import AmazonCrawler import smtplib import threading import time class Tracker(): def __init__(self): self.entry_handler = EntryHandler() def send_mail(self, URL, title, initial_price, new_price, user...
__init__.py
""" Plugin for Pyramid apps to submit errors to Rollbar """ from __future__ import absolute_import from __future__ import unicode_literals import copy import functools import inspect import json import logging import os import socket import sys import threading import time import traceback import types import uuid imp...
main_client.py
#!/usr/bin/env python3 import time, json, socket, queue, os, threading, gtts import speech_recognition as sr waitingForConf = False lastQuestion = None readyToReceive = False triggerWord = 'Jean-marie' sock = None def callback(recognizer, audio): try: text = recognizer.recognize_google(audio, languag...
__init__.py
from application import Application from hardware import SERIAL_PORT, DEFAULT_SERIAL_SPEED import os import threading import logging from flask import Flask, send_from_directory, jsonify, request from serial.serialutil import SerialException from flask_socketio import SocketIO from .. import Plugin import time...
shelvery_invoker.py
import boto3 import os import json import logging from typing import Dict from threading import Thread from shelvery.runtime_config import RuntimeConfig from shelvery.aws_helper import AwsHelper from shelvery.queue import ShelveryQueue class ShelveryInvoker: """Helper to orchestrate execution of shelvery operati...
chnbase.py
# MIT License # Copyright (c) 2018 Kyle Cooper and Susan Hunter # 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, ...
emanemanager.py
""" emane.py: definition of an Emane class for implementing configuration control of an EMANE emulation. """ import copy import logging import os import threading from core import CoreCommandError, CoreError, constants, utils from core.api.tlv import coreapi, dataconversion from core.config import ConfigGroup, Config...
api.py
# -*- coding: utf-8 -*- """ api ~~~ Implements API Server and Interface :author: Feei <feei@feei.cn> :homepage: https://github.com/wufeifei/cobra :license: MIT, see LICENSE for more details. :copyright: Copyright (c) 2017 Feei. All rights reserved """ import errno import json import...
compile_json.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import Queue import threading import keyvi import argparse import os import gzip import unicodedata, re control_chars = ''.join(map(unichr, range(0,32))) control_char_re = re.compile('[%s]' % re.escape(control_chars)) def remove_control_chars(s): return co...
ibmstt2.py
import re import logging, traceback from websocket import create_connection from watson_developer_cloud import AuthorizationV1, SpeechToTextV1 import json import threading import sys, os import time from configparser import SafeConfigParser ###### try: parser = SafeConfigParser() parser.read(sys.argv[1] + "/.....
main.py
# -*- coding: utf-8 -*- import os, sys, subprocess, threading, time, random import socketserver, http.server from queue import Queue, Empty import urllib class FFMpeg: def __init__(self, addr): self.addr = addr self.fragSize = 8192 self.opts = None self.buffer = Queue() ...
notifications.py
""" Standalone module for sending emails. No dependencies outside of the Python standard library. Author: Valtteri Rajalainen """ import smtplib import ssl import base64 import sys import typing from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart from threading import Thread # for ...
e2e.py
""" This is an end to end release test automation script used to kick off periodic release tests, running on Anyscale. The tool leverages app configs and compute templates. Calling this script will run a single release test. Example: python e2e.py --test-config ~/ray/release/xgboost_tests/xgboost_tests.yaml --test-...
dx_provision_dsource.py
#!/usr/bin/env python # Corey Brune - Feb 2017 # Description: # Create and sync a dSource # # Requirements # pip install docopt delphixpy # The below doc follows the POSIX compliant standards and allows us to use # this doc to also define our arguments for the script. """Create and sync a dSource Usage: dx_provision...
PC_Miner.py
#!/usr/bin/env python3 ########################################## # Duino-Coin Python PC Miner (v2.4) # https://github.com/revoxhere/duino-coin # Distributed under MIT license # © Duino-Coin Community 2019-2021 ########################################## # Import libraries import sys from configparser import Co...
main.py
import tkinter from tkinter import ttk from tkinter import font from tkinter import filedialog import math import re import json import subprocess import requests try: from bs4 import BeautifulSoup # usually don't get imported when running as root except Exception: pass import random import threading import sys i...
lisp.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...
login.py
import argparse import json import multiprocessing import os import platform import re import shutil import signal import stat import subprocess import time import traceback import urllib import uuid import zipfile from os.path import expanduser import psutil import requests import yaml from fedml.cli.edge_deploymen...
visualization_server.py
import threading import logging from flask import Flask, render_template, request, jsonify ''' This file holds the code for the MATRX RESTful API. External scripts can send POST and/or GET requests to retrieve state, tick and other information, and send userinput or other information to MATRX. The API is a Flask (Py...
ujicoba.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2012-2014 Matt Martz # 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....
batch.py
import tkinter from tkinter import * from tkinter import ttk import threading import time from tkinter import filedialog, messagebox from imageProcess import ImageProcess import os class Batch(): def __init__(self, master, treeview, save_path, dirname): self.save_path = save_path self.dirname = di...
train.py
#!/usr/bin/env python from worker import * from network import * import threading from time import sleep flags = tf.app.flags FLAGS = flags.FLAGS flags.DEFINE_boolean('is_approaching_policy', False, 'If learning approaching policy.') flags.DEFINE_integer('max_episodes', 100000, 'Maximum episodes.') flags.DEFINE_inte...
poll_all_nodes.py
#!/usr/bin/env nxshell import threading import org.netxms.client.TextOutputListener from Queue import Queue from threading import Thread class ProgressCallback(org.netxms.client.TextOutputListener): def messageReceived(self, text): print(self.tag + ": " + text.strip()) pass def onError(self):...
utils.py
try: if platform.system() == "Windows": colorama.init() except ImportError: print("Could not init terminal features.") sys.stdout.flush() pass if sys.version_info < (3, 3): class TimeoutError(Exception): pass else: TimeoutError = TimeoutError def get_serial_number_str(device): if hasattr(device, "serial_numb...
listen.py
import errno import socket from ..context import context from ..log import getLogger from ..timeout import Timeout from .sock import sock log = getLogger(__name__) class listen(sock): """Creates an TCP or UDP-socket to receive data on. It supports both IPv4 and IPv6. The returned object supports all the...
arduino_relay.py
#!/usr/bin/env python from __future__ import print_function #import time from math import pi # import traceback import os import sys import time import threading # import cPickle as pickle from functools import partial #from math import pi, sin, cos #import numpy as np import rospy import tf #import tf2_ros #http://do...
server.py
import os, sys sys.path.append("/Users/Pichau/Documents/projects/Http-Server/src/server/http") import socket import logging import threading import conf from random import randint from request import RequestParser, Path from errors import HttpBaseError from datetime import datetime class SocketServer(object): @...
meanfield_montecarlo_multi.py
#!/usr/bin/env python3 import multiprocessing import numpy import sys sys.path.append("..") from meanfield_share import calc_meanfield_montecarlo def calc_meanfield_multi(q,P,R,c,p,init,b,rand_seed): numpy.random.seed(rand_seed) overlap,cor=calc_meanfield_montecarlo(P,R,c,p,init,b) q.put((c,overlap,cor))...
server_test.py
import json import os import threading import traceback from asyncio import set_event_loop_policy from unittest import TestCase from unittest.mock import patch, MagicMock import requests from parameterized import parameterized from tornado.ioloop import IOLoop from tornado.web import create_signed_value from auth.aut...
console.py
# -*- coding: utf-8 -*- """ This module gives access to the console. """ if __host__ is not widget: from rubicon.objc import * from _get_variables_hierarchy import get_variables_hierarchy from code import interact import stopit import pdb if __platform__ is iOS: import _codecompletion from...
_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...
test.py
import time import zmq import threading import sys groupname = "test" latestNumber = None received = 0 subscribers = 0 firstReceived = 0 numberOfSubscribers = 1024 def recv(): global latestNumber, received, firstReceived ctx = zmq.Context() socket = ctx.socket(zmq.SUB) socket.setsockopt(zmq.SUBSC...
tx_test.py
from multiprocessing import Process import time, os, threading def start_tx(name): os.system('python3 {name}'.format(name=name)) def kill_tx(name): temp_filename = 'tmp_pid' os.system('ps -ef | grep {name} > {temp_filename}'.format(name=name,temp_filename=temp_filename)) with open(temp_filename, 'r') ...
message-broker.py
import datetime import json import os import sys import paho.mqtt.client as mqtt import multiprocessing import grpc import fxgateway_pb2 import fxgateway_pb2_grpc if sys.version_info >= (3, 0): from http.server import BaseHTTPRequestHandler, HTTPServer else: from BaseHTTPServer import BaseHTTPRequestHandler, H...
bytecore.py
#!/usr/bin/python from __future__ import absolute_import import sys try: import queue except ImportError: import Queue as queue import threading import logging import collections from .bytetask import ByteTask from .tuner import Tuner from .profiler import Profiler import os class ByteCore(object): """T...
subproc_vec_env.py
from copy import deepcopy import multiprocessing from collections import OrderedDict import gym import numpy as np import time from .base_vec_env import VecEnv, CloudpickleWrapper from .tile_images import tile_images from .util import flatten_obs def _worker(remote, parent_remote, env_fn_wrapper): parent_remot...
__init__.py
# Copyright (c) 2015 Niklas Rosenstein # # 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, modify, merge, publish, ...
sync.py
# Copyright (C) 2008 The Android Open Source Project # # 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 ...
test_docxmlrpc.py
from xmlrpc.server import DocXMLRPCServer import http.client import sys from test import support threading = support.import_module('threading') import time import socket import unittest PORT = None def make_request_and_skipIf(condition, reason): # If we skip the test, we have to make a request because # the s...
flighttracker.py
#!/usr/bin/env python3 # # Copyright (c) 2020 Johan Kanflo (github.com/kanflo) # # 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...
client.py
import os import time import queue import signal import typing import getpass import logging import threading import json from typing import Any, Dict, List, Type, Callable, Optional, DefaultDict from collections import defaultdict from pytglib import VERSION from pytglib.utils import AsyncResult from pytglib.tdjson i...
asr_server.py
#by marvin 2021.03.09 # simple speech recognition http api server # # WARNING: # right now, this supports a single client only - needs a lot more work # to become (at least somewhat) scalable # # Decode WAV Data # --------------- # # * POST `/decode` # * args (JSON encoded dict): # * "audio" : array ...
TestIndications.py
#!/usr/bin/python # # Simple indication receiver using Twisted Python. HTTP post requests # are listened for on port 5988 and port 5899 using SSL. # # Requires Twisted Python and # import sys import optparse from twisted.internet import reactor, ssl from twisted.web import server, resource import pywbem import threa...
test_system.py
# Copyright 2016 Google LLC All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
multigpu.py
#-*- coding: utf-8 -*- #File: multigpu.py #Author: yobobobo(zhouboacmer@qq.com) import numpy as np import tensorflow as tf from tensorgo.utils import logger from tensorgo.train.config import TrainConfig from tensorgo.tfutils.gradient import record_variable, update_variable, \ compute_worker_gradient, apply_worker...
dataengine_configure.py
#!/usr/bin/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 A...
common_utils.py
r"""Importing this file must **not** initialize CUDA context. test_distributed relies on this assumption to properly run. This means that when this is imported no CUDA calls shall be made, including torch.cuda.device_count(), etc. torch.testing._internal.common_cuda.py can freely initialize CUDA context when imported....
sink.py
import sys import time import datetime import zmq import json from encryption import AES256 import env as env from DatabaseConnection import DatabaseConnection from systemlog import SystemLog from inbox import Inbox from outbox import Outbox import os from threading import Thread class Sink: data = None def ...
server_multi_new.py
import socket import sys import threading import time from queue import Queue NUMBER_OF_THREADS = 2 JOB_NUMBER = [1, 2] queue = Queue() all_connections = [] all_address = [] # Create a Socket ( connect two computers) def create_socket(): try: global host global port global s host ...
algorithm.py
import numpy as np import pandas as pd import attr import time from tqdm.auto import tqdm from optimistic import experiment as objective from .plotting import Plotter from threading import Thread from ipywidgets import Text from parametric import Parameter @attr.s class Algorithm: ''' A base class for parameter sp...
main.py
from threading import Thread import queue from scapy.all import * import netifaces from tabulate import tabulate import random, os, time from multiprocessing import Process def channel_hopper(): while True: try: channel = random.randrange(1,15) os.system("iw dev %s s...
server.py
import logging import os import threading from flask.helpers import make_response, send_file from training.train import AtomicCounter, Trainer from training.snake import Snake import os from flask import Flask from flask import request import server_logic app = Flask(__name__) state = server_logic.State(os.getenv(...
test_utils.py
"""Module for testing the natcap.invest.utils module..""" import codecs import unittest import os import tempfile import shutil import logging import threading import warnings import re import glob import textwrap from pygeoprocessing.testing import scm import pygeoprocessing.testing from osgeo import g...
process_replay.py
#!/usr/bin/env python3 import os import threading import importlib import shutil if "CI" in os.environ: tqdm = lambda x: x else: from tqdm import tqdm from cereal import car, log from selfdrive.car.car_helpers import get_car import selfdrive.manager as manager import cereal.messaging as messaging from common.para...
test_run_server.py
import asyncio import json from live2p.start_live2p import start_live2p import logging from datetime import datetime from glob import glob from pathlib import Path import multiprocessing import websockets import time import threading ip = 'localhost' port = 6000 init_folder = 'e:/caiman_scratch/ori_20210209_seed' data...
camera_filter.py
"""Filters a video stream. Class CameraFilter - Crops, rotates and scales a videostream Functions in CameraFiler: __init__(self) - Initialize variables __del__(self) - Deletes the thread update(self, camera_yaw , camera_pitch, camera_zoom) - Updates variables stop(self) - Stops the camera filter s...
process.py
# -*- coding: utf-8 -*- # Import python libs from __future__ import absolute_import import os import sys import time import signal import logging import multiprocessing import threading # Import salt libs import salt.defaults.exitcodes import salt.utils # Import 3rd-party libs import salt.ext.six as six from salt.e...
runGame.py
import os import threading from time import sleep PATH_SERVER = "server" AGENTS = "default-broker,TUC_TAC,DiCaprio" # Key: Agent's name. Value: [Agent's path, Binaries] # AGENT_INFO = {"TUC_TAC": ["brokers/TUC_TAC", "TUC_TAC_2020.jar"], # "DiCaprio": ["brokers/DiCaprio", "DiCaprio-1.7.0.jar"], #...
server4.py
import socket import sys import time from thread import * import threading port = 6003 clients = [] here = {} guest_cnt = -1 shutdown = False help_mess = "type /p for getting all the people connected to the server\n" \ "type /m [NAME] for sending a message to a certain user\n" \ "type anythi...
resize.py
import os import sys import logging import argparse from tqdm import tqdm import multiprocessing from multiprocessing import Queue, Pool, Process from PIL import Image from PIL import ImageFile ImageFile.LOAD_TRUNCATED_IMAGES = True logger = logging.getLogger("ImageResizer") logger.setLevel(logging.INFO) formatter = ...
athenad.py
#!/usr/bin/env python3 import base64 import hashlib import io import json import os import sys import queue import random import select import socket import threading import time from collections import namedtuple from functools import partial from typing import Any import requests from jsonrpc import JSONRPCResponseM...
QQZoneFriendSpider.py
from src.spider.QQZoneSpider import QQZoneSpider from urllib import parse import json import pandas as pd from src.util import util import math import threading import datetime from src.util.constant import FINISH_FRIEND_INFO_ALL, STOP_FRIEND_INFO_SPIDER_KEY, WEB_SPIDER_INFO, \ FRIEND_INFO_PRE, FRIEND_INFO_COUNT_KE...
sentiment_analysis.py
"""Generate account statements. This module will create statement records for each account. """ import os import threading import psycopg2 from transformers import pipeline from api.services.transformers import overall_sentiment_transformers from flask import Flask import config from utils.logger import setup_loggin...
test_distributed.py
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2020 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTI...
droid.py
import torch import lietorch import numpy as np from droid_net import DroidNet from depth_video import DepthVideo from motion_filter import MotionFilter from droid_frontend import DroidFrontend from droid_backend import DroidBackend from trajectory_filler import PoseTrajectoryFiller from collections import OrderedDic...
wrappers.py
# Copyright 2017 The TensorFlow Agents 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 ag...
main_processes.py
#!/usr/bin/env python from multiprocessing import Manager, Process from datetime import datetime import time import progressbar import touchphat from pilconvert import palette_convert from tpf_60 import sensing from plot_graphs import plot_graph from inky_write import show_image from stat_calc import calc_statistics f...
test_ffi.py
import sys, py from pypy.module.pypyjit.test_pypy_c.test_00_model import BaseTestPyPyC class Test__ffi(BaseTestPyPyC): def test__ffi_call(self): from rpython.rlib.test.test_clibffi import get_libm_name def main(libm_name): try: from _rawffi.alt import CDLL, types ...
test_creator.py
from __future__ import absolute_import, unicode_literals import difflib import gc import json import logging import os import shutil import stat import subprocess import sys import zipfile from collections import OrderedDict from itertools import product from stat import S_IREAD, S_IRGRP, S_IROTH from textwrap import ...
queue_operations.py
import queue import threading def my_subscriber(queue_p): while True: item = queue_p.get() if item is None: break print("{} removed {} from the queue".format(threading.current_thread(), item)) print("Queue Size is now: {}".format(queue_p.qsize())) queue_p.task_d...
test_io.py
from __future__ import division, absolute_import, print_function import sys import gzip import os import threading import time import warnings import io import re import pytest from tempfile import NamedTemporaryFile from io import BytesIO, StringIO from datetime import datetime import locale import numpy as np impor...
proxy.py
#!/usr/bin/env python """ Proxy for integration of resources between OpenStack's Ceilometer and Zabbix This proxy periodically checks for changes in Ceilometer's resources reporting them to Zabbix. It is also integrated OpenStack's Nova and RabbitMQ for reflecting changes in Projects/Tenants and Instances """ ########...
sender.py
# This class is responsible for handling all asynchronous http # communication import sys from time import sleep from datetime import datetime from threading import Thread, enumerate import logging import requests if sys.version[0] == '2': import Queue as queue else: import queue as queue MAX_BULK_SIZE_IN_...
test_logging.py
from __future__ import division import logging import threading import av.error import av.logging from .common import TestCase def do_log(message): av.logging.log(av.logging.INFO, 'test', message) class TestLogging(TestCase): def test_adapt_level(self): self.assertEqual( av.logging.a...
executeframe.py
from tkinter import ttk import tkinter as tk from eosim.config import GuiStyle, MissionConfig, OutputConfig from eosim import config import random from tkinter import messagebox import json import orbitpy import tkinter.filedialog, tkinter.messagebox from instrupy.public_library import Instrument from instrupy.util im...
restore.py
''' Copyright 2014 Hewlett-Packard 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, softwar...
_coreg_gui.py
# -*- coding: utf-8 -*- """Traits-based GUI for head-MRI coregistration. Hierarchy --------- This is the hierarchy of classes for control. Brackets like [1] denote properties that are set to be equivalent. :: CoregFrame: GUI for head-MRI coregistration. |-- CoregModel (model): Traits object for estimating the he...
daemon.py
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2015 Thomas Voegtlin # # 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...
test_direct_invocations.py
''' python-lambda-local: Test Direct Invocations (command-line and direct). Meant for use with py.test. Copyright 2015-2020 HENNGE K.K. (formerly known as HDE, Inc.) Licensed under MIT ''' import json import argparse from multiprocessing import Process import os from lambda_local.main import run as lambda_run from la...
test_operator.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...
tello_commands.py
# # Tello Python3 Control Demo # # http://www.ryzerobotics.com/ # # 1/1/2018 # # ** Original Ryze SDK file to issue commands to the drone. Not a dependency import threading import socket import sys import time import platform host = '' port = 9000 locaddr = (host,port) # Create a UDP socket sock = socket.socke...
litex_term.py
#!/usr/bin/env python3 # # This file is part of LiteX. # # Copyright (c) 2015-2020 Florent Kermarrec <florent@enjoy-digital.fr> # Copyright (c) 2015 Sebastien Bourdeauducq <sb@m-labs.hk> # Copyright (c) 2016 whitequark <whitequark@whitequark.org> # SPDX-License-Identifier: BSD-2-Clause import sys import signal import...
test_export.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 ...
proxy.py
import sys import socket import threading def server_loop(local_host,local_port,remote_host,remote_port,receive_first): """ Server loop function, will print out local conenction info and uses a thread to talk to the remote host """ server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ...
rdbot.py
import asyncio import threading from mi.ext import commands, tasks from mi.framework import Note from mi.framework.router import Router from roboduck import * # Load Misskey configuration config = configparser.ConfigParser() config.read(Path(__file__).parent.joinpath('bot.cfg')) uri = "https://" + config.get("misske...
dataloader.py
import ujson import gzip import numpy as np import random import threading import time from path_to_data import image_path_to_image_and_distribution_tensor class DataLoader(object): SATURATION_THRESHOLD = 0.1 OUTPUT_IMAGE_SIZE = 64 INPUT_IMAGE_SIZE = 256 TRAIN_SOURCE = '../dataset_indexes/imagenet_tra...
rest_api_endpoint.py
""" Copyright (c) 2015 SONATA-NFV and Paderborn University 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 ap...
nanomsg.py
import pynng from .common import * class NanomsgRPCServer: @staticmethod def ping(): return 'pong' @staticmethod def new_req(name: str, *args, **kwargs): return json.dumps(dict(name=name, args=args, kwargs=kwargs)).encode() def __init__(self, url): self.url = url ...
syslog.py
# -*- coding: utf-8 -*- """Syslog utility for tests.""" import logging import threading from six.moves import socketserver logger = logging.getLogger(__name__) class SyslogUDPHandler(socketserver.BaseRequestHandler): """Syslog UDP dummy handler.""" outputHandle = None def handle(self): """Han...
trex_tui.py
from __future__ import print_function import termios import sys import os import time import threading from collections import OrderedDict, deque from texttable import ansi_len import datetime import readline if sys.version_info > (3,0): from io import StringIO else: from cStringIO import StringIO from ....