source
stringlengths
3
86
python
stringlengths
75
1.04M
downloader.py
import datetime import errno import heapq import json import logging import re import sqlite3 import sys import threading import time import timeit import traceback import typing from functools import wraps from pathlib import Path from typing import Generator, List, Union from facebook_business.adobjects import user,...
test_proxy.py
# -*- coding: utf-8 -*- # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright (C) 2014 Yahoo! 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 # # ...
ppo_mp.py
import numpy as np import pydart2 as pydart from Examples.sfv_crossover.skate_env import SkateDartEnv from collections import namedtuple from collections import deque import random import time import os from multiprocessing import Process, Pipe import torch from torch import nn, optim import torch.nn.functional as ...
visualization-live.py
from vispy import scene from vispy.scene import XYZAxis, LinePlot, Node, Mesh, TurntableCamera, Markers import numpy as np from vispy.visuals.transforms import MatrixTransform import math import threading import time import logging import cflib.crtp from cflib.crazyflie import Crazyflie from cflib.crazyflie.log import ...
chkstat.py
#!/usr/bin/env python import threading import Queue import socket import json import sys def apiread(ip,port,command,retry): time_out = 0 while True: time_out += 1 if time_out > retry: return None try: s = socket.socket(socket.AF_INET,socket.SOCK_STREAM) s.settimeout(time_out) s.connect((ip,int(por...
QATdx_adv.py
# coding:utf-8 # # The MIT License (MIT) # # Copyright (c) 2016-2019 yutiansut/QUANTAXIS # # 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 limit...
select_ticket_info.py
# -*- coding=utf-8 -*- import datetime import random import os import socket import sys import threading import time import TickerConfig import wrapcache from agency.cdn_utils import CDNProxy, open_cdn_file from config import urlConf, configCommon from config.TicketEnmu import ticket from config.configCommon import sea...
server.py
import socket from json import dumps, loads from header_structs import difuse_request, difuse_response import os from sys import argv from threading import Thread from hashlib import sha1 from base64 import b64encode, b64decode import select import logging import signal import sys # TODO: add file migration functiona...
test_server.py
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the 'license' file acc...
env_wrappers_2.py
""" Modified from OpenAI Baselines code to work with multi-agent envs """ import numpy as np from multiprocessing import Process, Pipe from baselines.common.vec_env import VecEnv, CloudpickleWrapper def worker(remote, parent_remote, env_fn_wrapper): parent_remote.close() env = env_fn_wrapper.x() while Tru...
actor.py
# -*- coding: utf-8 -*- # # @Author: Florian Briegel (briegel@mpia.de # @Date: 2021-07-06 # @Filename: __init__.py # @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause) from __future__ import annotations import asyncio from contextlib import suppress from clu.actor import AMQPActor from cluplus...
data_collection_class.py
import serial import RPi.GPIO as gpio import time import pandas as pd import threading import numpy as np class data_collection: def __init__(self, coms_chan, ouput_csv, cols): self.ouput_csv = ouput_csv # name of output csv file self.ser = serial.Serial(coms_chan, 9600, timeout=30) # establish com...
game.py
import json import random import player import event import room as roomFile import ser from threading import Thread # id -> room rooms = {} def saferDictGet(d, key, default=None): return default if key not in d else d[key] # load json with open('rooms.json', 'r') as f: data = json.load(f) for r in data:...
pexpect_runner.py
#!/usr/bin/python import sys import pexpect import os import threading import signal import time import Queue import wx import PexpectRunnerConsolImpl def sighandler(signum, frame): # print "Signaled: %d" %signum if signum == signal.SIGCHLD: sys.exit(1) else: text_queue.put("SIGQUIT") ...
test_prometheus.py
import threading import time import requests from prometheus_client import Histogram from prometheus_client import Summary from prometheus_client import start_http_server from sklearn_instrumentation import SklearnInstrumentor from sklearn_instrumentation.instruments.prometheus import PrometheusHistogram from sklearn...
client.py
import requests import sys import time import threading html=""" <!DOCTYPE html> <html dir="ltr" lang="en" style="font-size: 15px;"><head><meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0,viewport-fit=cover"> <link rel="preconnect" href="//abs.twim...
nanocat.py
#! /usr/bin/python3 import sys import socket import getopt import threading import subprocess listen = False command = False upload = False execute = "" target = "" upload_destination = "" port = 0 def usage(): text = """ ----Welcome to My NanoCat Version--- * Usage: nnc.py -t target_host -p port * -l --listen...
simulation_1.py
''' Created on Oct 12, 2016 @author: mwitt_000 ''' from src.Network import network_1 from src.Link import link_1 import threading from time import sleep ##configuration parameters router_queue_size = 0 # 0 means unlimited simulation_time = 1 # give the network sufficient time to transfer all packets before quitting ...
engine.py
# Copyright 2017 LinkedIn Corporation. All rights reserved. Licensed under the BSD-2 Clause license. # See LICENSE in the project root for license information. import os import time import psutil import signal import logging import importlib import setproctitle import inspect import pkgutil import multiprocessing as m...
tieba_signin_server.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import pprint import http.cookiejar as cookiejar import requests import pickle import execjs import time import random import getpass import sys, os from threading import Thread from io import BytesIO from bs4 import BeautifulSoup baiduRSAjs = """ function BarrettMu(t) {...
imgaug.py
from __future__ import print_function, division, absolute_import import random import numpy as np import copy import numbers import cv2 import math from scipy import misc, ndimage import multiprocessing import threading import sys import six import six.moves as sm import os from skimage import draw if sys.version_info...
check_requirements.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import import logging import sublime import sublime_plugin from re import sub from threading import Thread from ..api import deviot from ..libraries.I18n import I18n from ..libraries.syntax import Syntax from ..libraries.thread_progress i...
motor.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- """ .. module:: motor :platform: Unix :synopsis: the top-level submodule of T_System that contains the classes related to T_System's Servo Motors. .. moduleauthor:: Cem Baybars GÜÇLÜ <cem.baybars@gmail.com> """ import time # Time access and conversions import thread...
test_distributed_sampling.py
import dgl import unittest import os from dgl.data import CitationGraphDataset from dgl.distributed import sample_neighbors from dgl.distributed import partition_graph, load_partition, load_partition_book import sys import multiprocessing as mp import numpy as np import backend as F import time from utils import get_lo...
test_pantsd_integration.py
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). import datetime import itertools import os import re import signal import threading import time import unittest from textwrap import dedent import pytest from pants.testutil.pants_run_in...
hmc.py
#!/usr/bin/env python3 # Copyright 2021 Christian Henning # # 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...
installwizard.py
import os import sys import threading import traceback from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * from electrum import Wallet, WalletStorage from electrum.util import UserCancelled, InvalidPassword from electrum.base_wizard import BaseWizard, HWD_SETUP_DECRYPT_WALLET from elec...
__init__.py
# -*- coding: utf-8 -*- # pylint: disable=broad-except, bare-except, invalid-name import base64 from datetime import datetime, timedelta import json try: import asyncio except: pass import socket import struct import threading import time from .cloud import Cloud from .block import Block from...
__init__.py
"""Hermes MQTT server for Rhasspy wakeword with Raven""" import asyncio import logging import queue import re import socket import threading import time import typing from pathlib import Path from rhasspyhermes.audioserver import AudioFrame from rhasspyhermes.base import Message from rhasspyhermes.client import Genera...
gimbalWasp01.py
import cv2 import time import numpy import random from multiprocessing import Process from multiprocessing import Queue from picamera.array import PiRGBArray from picamera import PiCamera from adafruit_servokit import ServoKit kit = ServoKit(channels=8) kit.servo[0].angle = 110 # y kit.servo[1].angle = 90 # x #...
3.1_edf_bankers_NS.py
from functools import reduce from sys import * import numpy as np import random as r import ping_code as pc import socket import struct import subprocess as sp import threading from threading import Thread import ast import time import datetime as dt import os import psutil import getpass as gp from netifaces import in...
ab.py
#!/usr/bin/python # encoding: utf-8 # Copyright 2017 Google Inc. # # Use of this source code is governed by a BSD-style license that can be found # in the LICENSE file. # # This is an A/B test utility script used by calmbench.py # # For each bench, we get a distribution of min_ms measurements from nanobench. # From th...
pycore.py
"""Serial communication protocol with Reachy Luos Gate.""" import sys import time import struct from logging import Logger from collections import defaultdict, namedtuple from threading import Event, Thread from typing import Dict, Iterable, List, Optional, Type, Tuple from serial import Serial from serial.threaded ...
test_ohd-sjtu_ohdet.py
# -*- coding:utf-8 -*- from __future__ import absolute_import from __future__ import print_function from __future__ import division import os import sys import tensorflow as tf import cv2 import numpy as np import math from tqdm import tqdm import argparse from multiprocessing import Queue, Process sys.path.append("....
sut.py
#!/usr/bin/env python # Any copyright is dedicated to the Public Domain. # http://creativecommons.org/publicdomain/zero/1.0/ import socket from threading import Thread import time class MockAgent(object): def __init__(self, tester, start_commands = None, commands = []): if start_commands: sel...
eslint.py
#!/usr/bin/env python """ eslint.py Will download a prebuilt ESLint binary if necessary (i.e. it isn't installed, isn't in the current path, or is the wrong version). It works in much the same way as clang_format.py. In lint mode, it will lint the files or directory paths passed. In lint-patch mode, for upload.py, i...
qtserverprocess.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) 2011 daniel (daniel.kappler@gmail.com) # # This program 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 Foundation, either version 3 of the License, or ...
helpers.py
"""High-level functions to help perform complex tasks """ from __future__ import print_function, division import os import multiprocessing as mp import warnings from datetime import datetime import platform import struct import shutil import copy import time from ast import literal_eval import traceback import sys im...
ws.py
import websocket import threading import gzip import json from datetime import datetime from urllib import parse import hmac import base64 from hashlib import sha256 import time from huobi.utils.logger import logger class Ws: def __init__(self, host: str, path: str, sub_str: dict, call_back_fun, ...
precompute_layout_locations.py
import json import os import threading import time import sys sys.path.append(os.path.join('/home/jiasenl/code/alfred')) sys.path.append(os.path.join('/home/jiasenl/code/alfred', 'gen')) import cv2 import numpy as np import constants from utils import game_util from env.thor_env import ThorEnv N_PROCS = 1 lock = thr...
app.py
from flask import Flask, request, Response from PIL import Image import base64 import numpy as np import cv2 import threading from time import sleep current_image = None app = Flask(__name__) counter = 0 def show_image(): while True: if current_image is None: print("Json was not accepted") ...
sender.py
import asyncio import os import signal import ssl from multiprocessing import Process, Queue, Event import traceback import aiohttp from async_timeout import timeout from proxypooler import config from proxypooler.ext import validator_sub_queue, logger from proxypooler.errors import ProxyPoolerStoppedError send_que...
downloader.py
# -*- coding: utf-8 -*- import logging import sys import threading import time import traceback import pandas as pd from alpha_vantage_downloader.config import api_map def get_logger(): logger = logging.getLogger('AlphaVantage Downloader') logger.setLevel(logging.INFO) if not len(logger.handl...
main_one_worker.py
import sys, os from multiprocessing import Process import torch from codes.f_main.federation_main import utils device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') if __name__ == "__main__": utils.make_output_folders() utils.ask_file_removal(device) stderr = sys.stderr sys.stderr = ...
tkinter_threading_fail.py
import tkinter as tk from tkinter.messagebox import showinfo from threading import Thread from time import sleep, localtime class Window(tk.Toplevel): def __init__(self, parent): super().__init__(parent) tk.Entry(self, textvariable=parent.variable).pack() class App(tk.Tk): def __init__(self, ...
service.py
# coding: utf-8 """ API Service """ import os import signal import uvicorn from sugarapi import apirouter, MasterRef from sugarapi.endpoints.systems import apirouter as systems_api_router from sugarapi.endpoints.jobs import apirouter as jobs_api_router from multiprocessing import Process, Pipe class APIService: "...
web.py
# Electrum - lightweight Bitcoin client # Copyright (C) 2011 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 limitation the rights t...
GPSstats.py
# -*- encoding: utf-8 -*- from socket import * from deepstream import get, post from datetime import datetime from time import time, sleep import threading, sys #, time ,pygame , RPi.GPIO as GPIO, numpy as np import math import numpy as np # Arduino address and connection info address = ("192.168.1.177", 5000) client...
db.py
# -*- coding: utf-8 -*- # Copyright 2014 matrix.org # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
test_gc.py
import unittest from test.support import (verbose, refcount_test, run_unittest, strip_python_stderr, cpython_only, start_threads, temp_dir, requires_type_collecting) from test.support.script_helper import assert_python_ok, make_script import os import sys import time...
save_data.py
## Default python libraries import os, sys, time, copy from os.path import basename, dirname, splitext, join, isdir, isfile from threading import Thread import numpy as np import cv2 ## Custom from helpers import VideoRecord from CustomSocket import Client ## Real sense API import pyrealsense2 as rs ''' How to run: ...
recaiusspeechapi.py
# -*- coding: utf-8 -*- """Transcoder with TOSHIBA RECAIUS API.""" import threading import queue import time import numpy as np from logzero import logger import requests import model.key AUTH_URL = 'https://api.recaius.jp/auth/v2/tokens' VOICE_URL = 'https://api.recaius.jp/asr/v2/voices' class Transcoder: """...
minion.py
# -*- coding: utf-8 -*- ''' Routines to set up a minion ''' # Import python libs from __future__ import absolute_import from __future__ import print_function import copy import errno import fnmatch import hashlib import logging import multiprocessing import os import re import salt import signal import sys import threa...
test_failure_3.py
import threading import os import sys import random import string import ray import numpy as np import pytest import time from ray._private.test_utils import SignalActor from ray.data.impl.progress_bar import ProgressBar @pytest.mark.parametrize( "ray_start_cluster_head", [{ "num_cpus": 5, "obj...
txsclient.py
# -*- coding: utf-8 -*- # $Id: txsclient.py $ # pylint: disable=C0302 """ Test eXecution Service Client. """ __copyright__ = \ """ Copyright (C) 2010-2017 Oracle Corporation This file is part of VirtualBox Open Source Edition (OSE), as available from http://www.virtualbox.org. This file is free software; you can redi...
memory_profiler_setup.py
import logging import os import sys import json import threading import tempfile from fluent import handler from memory_profiler import memory_usage from pympler import summary, muppy from enum import Enum from collections import namedtuple from pympler_setup_helper import _is_pympler_profiling_value_on, _set_pympler_p...
audit_service.py
from __future__ import annotations import datetime import logging import threading from dataclasses import dataclass, field from datetime import date from queue import Empty, PriorityQueue from bot.TS3Auth import AuthRequest, AuthorizationNotPossibleError from bot.config import Config from bot.connection_pool import ...
vnlhang.py
# encoding: utf-8 import urllib import hashlib import requests from Queue import Queue, Empty from threading import Thread from time import sleep LHANG_API_ROOT ="https://api.lhang.com/v1/" FUNCTION_TICKER = ('ticker.do', 'get') FUNCTION_DEPTH = ('depth.do', 'get') FUNCTION_TRADES = ('trades.do', 'get') FUNCTION_...
pydev_rpc.py
import socket import threading from _pydev_comm.pydev_server import TSingleThreadedServer from _pydev_comm.pydev_transport import TSyncClient, open_transports_as_client, _create_client_server_transports from _shaded_thriftpy.protocol import TBinaryProtocolFactory from _shaded_thriftpy.thrift import TProcessor def ma...
multilock.py
import threading import time num = 100 """ 锁通常被用来实现对共享资源的同步访问。为每一个共享资源创建一个Lock对象,当你需要访问该资源时,调用acquire方法来获取锁对象 (如果其它线程已经获得了该锁,则当前线程需等待其被释放),待资源访问完后,再调用release方法释放锁 """ def fun_sub(): global num # num -= 1 num2 = num time.sleep(0.001) num = num2-1 if __name__ == '__main__': print('开始测试同步锁 at...
gcore_box.py
# Author: Yi Hong # Date: 2019.01.29 import curses import threading import time import webbrowser from gaycore.config import BOX_HEIGHT, BOX_WIDTH, PAD_HEIGHT, PAD_WIDTH, AUDIO_API from gaycore.player import Player from gaycore.utils import ( get_audio_info, recent_func, chunkstring, likes_func, co...
ThreadingBatches.py
import threading import time class ThreadingBatches(object): """ Threading example class The run() method will be started and it will run in the background Will run next( GENERATOR ) in this thresh and using CPU while GPU training until the application exits. """ batch_thread = None def _...
status.py
# ============================================================================= # # EZID :: status.py # # Periodic status reporting. # # This module should be imported at server startup so that its daemon # thread is started. # # Author: # Greg Janee <gjanee@ucop.edu> # # License: # Copyright (c) 2013, Regents of t...
admin_pwr.py
#!/usr/bin/env python2.7 import RPi.GPIO as GPIO import time import os import subprocess from threading import Thread import socket import sys import syslog # Connect the socket to the port where the server is listening server_address = '/var/run/uds_led' GPIO.setmode(GPIO.BOARD) POWER_BUTTON_PIN = 15 ADMIN_BUTTON_P...
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...
test_smtplib.py
# expected: fail import asyncore import email.utils import socket import smtpd import smtplib import StringIO import sys import time import select import unittest from test import test_support try: import threading except ImportError: threading = None HOST = test_support.HOST def server(evt, buf, serv): ...
hl_detector.py
""" interface_wrapper.py - EXCALIBUR high level API for the ODIN server. Alan Greer, DLS """ import sys import traceback import logging import json from datetime import datetime import time import threading import getpass is_py2 = sys.version[0] == '2' if is_py2: import Queue as queue else: import queue as que...
local_elastic_agent_test.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import json import multiprocessing as mp import os import shutil import signal import temp...
version.py
# Adapted from https://github.com/snap-stanford/ogb/blob/master/ogb/version.py import os import logging from threading import Thread __version__ = '2.0.0' try: os.environ['OUTDATED_IGNORE'] = '1' from outdated import check_outdated # noqa except ImportError: check_outdated = None def chec...
world_10.py
# -------------------------------------------------------- # WorldExpo Dataset # Copyright (c) 2018 Fudan-VTS # Licensed under The MIT License [see LICENSE for details] # Written by liwenxi # -------------------------------------------------------- import numpy as np from scipy.io import loadmat import glob import torc...
server.py
import argparse from six import BytesIO from datetime import datetime from PIL import Image import locale import numpy as np import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' from object_detection.utils import label_map_util # https://github.com/tensorflow/hub/blob/master/examples/colab/tf2_object_detection.ip...
Meridian_Console_v20220506d.py
# #!/usr/bin/python3 # coding: UTF-8 # もしくは #!/usr/bin/env python など環境に合わせて # Izumi Ninagawa & Meridian project # 2022.02.05 UDP通信動作は安定。 # 2022.02.05 COMMAND WINDOWのPOWERチェックボックスでサーボ電源ON # 2022.02.05 上記サーボ電源ON中にスライドバー操作でサーボ動作(ただしスライドバーが小さいため大まかな動作確認のみに利用可) # 2022.04.05 コードを少し整理整頓 # 2022.04.14 各経路でのエラーの検知と表示の機能を搭載 # 20...
helpers.py
""" Helper functions file for OCS QE """ import base64 import random import datetime import hashlib import json import logging import os import re import statistics import tempfile import threading import time import inspect from concurrent.futures import ThreadPoolExecutor from itertools import cycle from subprocess i...
Estres.py
from tools.Peticion import Peticion from tools.Analisis import Analisis from operator import itemgetter import threading import time import json class Singleton(type): #Evita que en algun caso extremo exista otra instancia de la clase en ejecucion def __init__(cls, name, bases, dct): cls.__instance = None ...
joints_monitor.py
import yarp from pyicub.core.logger import YarpLogger from pyicub.controllers.position import PositionController from pyicub.helper import iCub import xml.etree.cElementTree as ET from xml.dom import minidom import os import sys from threading import Thread from concurrent.futures.thread import ThreadPoolExecutor cla...
websocketconnection.py
import threading import websocket import gzip import ssl import logging from urllib import parse import urllib.parse from binance_f.base.printtime import PrintDate from binance_f.impl.utils.timeservice import get_current_timestamp from binance_f.impl.utils.urlparamsbuilder import UrlParamsBuilder from binan...
threads.py
import ctypes import threading import six import sys import time def get_current_thread_id(): return threading._get_ident() if six.PY2 else threading.get_ident() # Nasty hack to raise exception for other threads def _lowlevel_async_raise(thread_obj, exception=None): NULL = 0 found = False target_tid...
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 re import subprocess import sys import sysconfig import textwrap import time import unittest from test import support from te...
robot_update_thread.py
import threading from . import time_util import time # One slight problem here is that time.time() precision is to 16 ms on windows (slow) as opposed to 1 ms on # linux and mac (much better). Moral of the story: SWITCH TO LINUX def _update_thread(robot, max_update_per_sec, warn_if_low_threshold): max_ups = time_u...
daemon.py
# Copyright (C) 2017 DataArt # # 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, ...
dfu.py
#!/usr/bin/env python """ Tool for flashing .hex files to the ODrive via the STM built-in USB DFU mode. """ from __future__ import print_function import argparse import sys import time import threading import platform import struct import requests import re import io import os import usb.core import fibre import odriv...
codec.py
# # Copyright (c) 2016-2017, The OpenThread 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 re...
multiprocessing_example.py
import queue # imported for using queue.Empty exception from multiprocessing import Process, Queue, current_process from basic_examples import time def do_job(tasks_to_accomplish, tasks_that_are_done): while True: try: ''' try to get task from the queue. get_nowait() function...
rest_primitives.py
# coding=utf-8 # Licensed Materials - Property of IBM # Copyright IBM Corp. 2016,2017 import logging import requests import queue import threading import time import json import re from pprint import pformat import streamsx.topology.schema logger = logging.getLogger('streamsx.rest') def _exact_resource(json_rep, id...
poller.py
import sys import threading from clientconfig import CONFIG from sky import sky_thread from printer import printer_thread from weather import weather_thread """ Point this program to your server e.g. "python poller.py https://your-url.herokuapp.com password_here" ...
main.py
import asyncio import sys import settings if __name__ == "__main__": user_settings = settings.load_user_settings() settings.set_settings(user_settings) if sys.platform == 'win32': loop = asyncio.ProactorEventLoop() asyncio.set_event_loop(loop) from communication import server, pubsub, topics from int...
ssl_test.py
#!/usr/bin/env python """Tests for API client + HTTPS server integration.""" from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals import datetime import io import os import socket import threading from absl import app from cryptography import x509 from cryptog...
test_examples.py
import itertools import multiprocessing import os import runpy import sys from os import path as osp import pytest def run_main(*args): # patch sys.args sys.argv = list(args) target = args[0] # run_path has one difference with invoking Python from command-line: # if the target is a file (rather t...
xla_client_test.py
# Lint as: python3 # 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 ...
test.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ __author__ = 'AJay' __mtime__ = '2020/2/1 0001' """ import queue import re import threading import requests from faker import Faker from lxml import etree user_agent = Faker('zh-CN').user_agent() def get_header(): return { 'User-Agent': user_agent, ...
label_sync.py
# ElectrumSV - lightweight Bitcoin client # Copyright (C) 2014 Thomas Voegtlin # Copyright (C) 2019-2020 The ElectrumSV Developers # # 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 re...
flask.py
""" Flask backend """ import json import logging import threading from flask import Flask, request, send_from_directory, Response from . import utils from .httpbased import HttpContext, HttpHandler, run_event_loop from .remote_access import start_remote_access_service from .utils import make_applications, cdn_validat...
__init__.py
from flask import Flask, request from functools import wraps import requests import jwt import json import datetime from passlib.hash import sha256_crypt import os from pymongo import MongoClient from bson.objectid import ObjectId import multiprocessing as mp from .server import SeatingListener from cryptography.fernet...
deploy_api.py
import json import threading import tornado.web from app.service import token_service from app.domain.task import Task from app.service import umm_client_async from app.service import deploy_service from app.utils import mytime class DeployApi(tornado.web.RequestHandler): async def post(self, *args, **kwargs): ...
VMMonitor.py
import os import sys sys.path.append(os.getcwd()) import multiprocessing from Controller.setting import * from Controller.Common import common_log from Controller.ControllerManager import Manager _DEBUG = True # ------------------------------------------------------------------------------------------ def _log(pre...
ser.py
from threading import Thread, RLock, Condition from serial import Serial from datetime import datetime import time import traceback from modem import ZMODEM import as_event_loop import asyncio from icom_ctrl_msg_id import * from comm_work_data_proc import CommWorkDataPro from collections import deque i...
test_ssl.py
# Test the support for SSL and sockets import sys import unittest from test import support import socket import select import time import datetime import gc import os import errno import pprint import tempfile import urllib.request import traceback import asyncore import weakref import platform import functools from u...
dpp-nfc.py
#!/usr/bin/python3 # # Example nfcpy to wpa_supplicant wrapper for DPP NFC operations # Copyright (c) 2012-2013, Jouni Malinen <j@w1.fi> # Copyright (c) 2019-2020, The Linux Foundation # # This software may be distributed under the terms of the BSD license. # See README for more details. import os import sys import ti...
async_vector_env.py
import multiprocessing as mp from pettingzoo.utils.agent_selector import agent_selector import numpy as np import ctypes import gym from .base_aec_vec_env import VectorAECEnv import warnings import signal import traceback class SpaceWrapper: def __init__(self, space): if isinstance(space, gym.spaces.Discr...
cache_webpages.py
from django.core.management.base import BaseCommand from BeautifulSoup import BeautifulSoup import urllib2 from urlparse import urlparse import threading import sys import time class Command(BaseCommand): args = "<url where eregulations is located> <optional- comma seperated list of regulation locations to be par...