source
stringlengths
3
86
python
stringlengths
75
1.04M
main_window.py
import re import os import sys import time import datetime import traceback from decimal import Decimal import threading import electrum from electrum.bitcoin import TYPE_ADDRESS from electrum import WalletStorage, Wallet from electrum_gui.kivy.i18n import _ from electrum.paymentrequest import InvoiceStore from electr...
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 ...
upnp.py
import logging import threading from queue import Queue from typing import Optional try: import miniupnpc except ImportError: pass log = logging.getLogger(__name__) class UPnP: thread: Optional[threading.Thread] = None queue: Queue = Queue() def __init__(self): def run(): t...
ws_thread.py
import sys import websocket import threading import traceback import ssl from time import sleep import json import decimal import logging from market_maker.settings import settings from market_maker.auth.APIKeyAuth import generate_expires, generate_signature from market_maker.utils import log from market_maker.utils.ma...
asyncio.py
import asyncio import concurrent.futures # noqa: F401 import inspect import os import socket from functools import partial from threading import Thread from typing import ( Callable, Set, Optional, Union, Tuple, cast, Coroutine, Any, Awaitable, TypeVar, Generator) # noqa: F401 from async_generator import asy...
multiramp.py
# -*- coding: utf-8 -*- # # || ____ _ __ # +------+ / __ )(_) /_______________ _____ ___ # | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \ # +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/ # || || /_____/_/\__/\___/_/ \__,_/ /___/\___/ # # Copyright (C) 2014 Bitcraze AB # # Cr...
6B.py
from sys import setrecursionlimit import threading setrecursionlimit(10 ** 9) threading.stack_size(67108864) def main(): file_input = open('map.in', 'r') file_output = open('map.out', 'w') def get_hash(key): prime = 239 hash = 0 power = 1 for i in range(len(key)): ...
jedi_plugin.py
# -*- coding: utf-8 -*- # # Copyright © 2009- The Spyder Development Team # Licensed under the terms of the MIT License # (see spyderlib/__init__.py for details) """ Jedi Introspection Plugin """ import re import os.path as osp import sys import time import threading from spyderlib import dependencies from spyderlib....
microtvm_api_server.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
test_safe_thread.py
from unittest.mock import MagicMock from test.framework.base_unit_test_case import BaseUnitTestCase from app.util.unhandled_exception_handler import UnhandledExceptionHandler from app.util.safe_thread import SafeThread class TestSafeThread(BaseUnitTestCase): def test_exception_on_safe_thread_calls_teardown_call...
example2.py
#!/usr/bin/env python # DAQ_GUI.py - 12/9/2013. Written by David Purdie as part of the openlabtools initiative # A GUI that performs semi real time plotting (updated every 10s) of data sampled from the # ADS1115 chip using the Adafruit Python libraries # Partly adapted from: # http://hardsoftlucid.wordpress.co...
xmas-web.py
#!/usr/bin/env python3 """ Listens to commands via HTTP for controlling a simple Christmas ornament. 0 0 0 0 0 0 00001 111 11 111122222 22 2 2 23 0 1 2 3 4 5 67890 123 45 678901234 56 7 8 90 | | | | | | ||||| ||| || ||||||||| || | | || 04 06 13 21 30 42 43 - y=0 03 05 ...
tests_utils.py
import logging import httpretty import multiprocessing import requests import json import gzip import time import os import signal from typing import Callable from logging.config import fileConfig from src.apis_manager import ApisManager from src.api import Api from src.azure_graph import AzureGraph from src.config_re...
ClientStart.py
#!/usr/bin/env python2 import __builtin__ import os __builtin__.process = 'client' # Temporary hack patch: __builtin__.__dict__.update(__import__('pandac.PandaModules', fromlist = ['*']).__dict__) from direct.extensions_native import HTTPChannel_extensions from direct.extensions_native import Mat3_extensions...
scheduler.py
#### WORK IN PROGRESS... NOT SUPPOSED TO WORK YET USAGE = """ ## Example For any existing app Create File: app/models/scheduler.py ====== from gluon.scheduler import Scheduler def demo1(*args,**vars): print 'you passed args=%s and vars=%s' % (args, vars) return 'done!' def demo2(): 1/0 scheduler = Sch...
backend.py
import ffmpy from threading import Thread import sys import os from time import sleep import tempfile def remove_file(path): try: os.remove(path) return True except Exception as e: e = "Couldn't remove file, {}".format(str(e)) print(e) return False class CustomThread(...
main.py
""" build functions for 1. binding the workers with redis listener(with multiprocessing) for slave 2. dispatcher for master node along with good tqdm 3. general function that wrap around master and slave 3. util function for argparse additional redis settings 4. util main script for listening to certain set of task """...
example.py
## Uncomment for debug d from sys import path path.append('src') from datetime import datetime import logging from time import sleep from loguru import logger from sys import argv from os import cpu_count, environ from fastapi import FastAPI, Response from unified_api_log.gunicorn import InThread from unified_api_log...
enospace.py
#!/usr/bin/python ''' (C) Copyright 2020-2022 Intel Corporation. SPDX-License-Identifier: BSD-2-Clause-Patent ''' import time import threading from apricot import skipForTicket from nvme_utils import ServerFillUp from avocado.core.exceptions import TestFail from daos_utils import DaosCommand from job_manager_util...
test_datapipe.py
# Owner(s): ["module: dataloader"] import copy import http.server import itertools import os import os.path import pickle import random import socketserver import sys import tarfile import tempfile import threading import time import unittest import warnings import zipfile from functools import partial from typing imp...
site_diff_test.py
#!/usr/bin/env python # Copyright 2013 Brett Slatkin # # 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...
__init__.py
""" A library of various helpers functions and classes """ import inspect import sys import socket import logging import threading import time import random from rpyc.lib.compat import maxint # noqa: F401 class MissingModule(object): __slots__ = ["__name"] def __init__(self, name): self.__name = nam...
tests.py
# -*- coding: utf-8 -*- # Unit and doctests for specific database backends. from __future__ import unicode_literals import datetime import re import threading import unittest import warnings from decimal import Decimal, Rounded from django.core.exceptions import ImproperlyConfigured from django.core.management.color ...
compare_num_layer_ghz_multiprocessing_sgd.py
import qiskit import numpy as np import sys import multiprocessing sys.path.insert(1, '../') import qtm.base, qtm.constant, qtm.ansatz, qtm.fubini_study, qtm.encoding import importlib importlib.reload(qtm.base) importlib.reload(qtm.constant) importlib.reload(qtm.ansatz) # Init parameters # For arbitrary initial state...
teller.py
#!/usr/bin/python from requirement import * no_of_teller = 0 class teller: def __init__(self): global no_of_teller no_of_teller+=1 self.power_on = True self.name = 'teller_'+str(no_of_teller) print self.name+' created.' self.txt = open('result/'+self.name,'w') self.timer = 0 self.process ...
docker.py
# -*- encoding: utf-8 -*- from __future__ import nested_scopes, generators, division, absolute_import, \ with_statement, print_function, unicode_literals import logging from subprocess import Popen, PIPE from strings import get_random_string from io import StringIO import threading import subprocess log = loggin...
loop.py
import sys import time import json import threading import traceback import collections try: import Queue as queue except ImportError: import queue from . import exception from . import _find_first_key, flavor_router class RunForeverAsThread(object): def run_as_thread(self, *args, **kwargs): t =...
addr.py
import socket from threading import Thread import json from time import sleep class mAddress: def __init__(self,ip='127.0.0.1',port=[3020,8060]): self.ip=ip self.address=list(range(port[0],port[1])) pass def get_addr(self,num): addr=[] for i in range(num): ...
realtime_kws_server.py
#-*- encoding: utf-8 -*- from flask import Flask, render_template from flask_socketio import SocketIO import socketserver import threading import time ############# socket io parameter ############# app = Flask(__name__) app.config['SECRET_KEY'] = 'secret!' socketio = SocketIO(app) ############# socket with zynq ru...
server.py
"""Module for accessing NetWatch functionality over HTTP. This module provides an HTTP interface for interacting with NetWatch. This allows anything that can issue HTTP requests to work with NetWatch, be that a website, browser extension, standalone GUI, or even a command line utility like cURL. Full API documentati...
test_sync.py
import asyncio import functools import multiprocessing import threading import time from concurrent.futures import ThreadPoolExecutor from functools import wraps from unittest import TestCase import pytest from asgiref.sync import ThreadSensitiveContext, async_to_sync, sync_to_async from asgiref.timeout import timeou...
relay_integration.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...
test_unix_events.py
"""Tests for unix_events.py.""" import collections import contextlib import errno import io import os import pathlib import signal import socket import stat import sys import tempfile import threading import unittest from unittest import mock from test import support if sys.platform == 'win32': ...
conftest.py
# Copyright (c) 2011 Florian Mounier # Copyright (c) 2011 Anshuman Bhaduri # Copyright (c) 2014 Sean Vig # Copyright (c) 2014-2015 Tycho Andersen # # 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 Soft...
football_env_test.py
# coding=utf-8 # Copyright 2019 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to ...
mp3.py
from multiprocessing import Process, Value, Array def f(n, a): n.value = 3.1415927 for i in range(len(a)): a[i] = -a[i] if __name__ == '__main__': num = Value('d', 0.0) arr = Array('i', range(10)) p = Process(target=f, args=(num, arr)) p.start() p.join() print (num.value) ...
parsingYoutubeChannelId.py
import ujson import serviceMongoClient import asyncio import serviceAsyncHttpReqeust from multiprocessing import Process import datetime import aiofiles class ParsingYoutubeChannelId(): googleApiKey = "apikey" def __init__(self): self.db = serviceMongoClient.ServiceMongoClient().getDB() self...
advanced-reboot.py
# #ptf --test-dir ptftests fast-reboot --qlen=1000 --platform remote -t 'verbose=True;dut_username="admin";dut_hostname="10.0.0.243";reboot_limit_in_seconds=30;portchannel_ports_file="/tmp/portchannel_interfaces.json";vlan_ports_file="/tmp/vlan_interfaces.json";ports_file="/tmp/ports.json";dut_mac="4c:76:25:f5:48:80";d...
polybeast_env.py
# Copyright (c) Facebook, Inc. and its affiliates. # # 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...
saltmod.py
# -*- coding: utf-8 -*- ''' Control the Salt command interface ================================== This state is intended for use from the Salt Master. It provides access to sending commands down to minions as well as access to executing master-side modules. These state functions wrap Salt's :ref:`Python API <python-ap...
test_huey_taskqueue.py
# Copyright 2019 ETH Zurich # # 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, sof...
cwipc_view.py
import sys import os import time import threading import time import argparse import traceback import queue from .. import cwipc_window, cwipc_tilefilter, cwipc_write from ._scriptsupport import * class Visualizer: HELP=""" space Pause/resume mouse_left Rotate viewpoint mouse_scroll Zoom in/out mouse_r...
CoffeeScript.py
# aponxi import os import sys import locale import tempfile import functools import threading from os import path from subprocess import PIPE, Popen import sublime import sublime_plugin from sublime_plugin import TextCommand, WindowCommand from .sourcemap import load BABEL_SYNTAX_PATH = os.path.join( sublime.pac...
TwitterPrajnah.py
#!/usr/bin/env python ''' MIT License Copyright (c) 2021 Rajnish Mishra 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,...
services.py
import datetime import sys import time from base64 import b64decode from ripper import context, common, statistic, arg_parser from ripper.attacks import * from ripper.constants import * from ripper.common import get_current_ip, format_dt from ripper.health_check import fetch_host_statuses _ctx = Context() def creat...
proxy.py
"""Monitor proxy changes and automatically apply changes in Qt application""" import dbus import logging import threading import urllib from PyQt5.QtNetwork import QNetworkProxy from dbus.mainloop.glib import DBusGMainLoop from gi.repository import GLib def parse_url(url): if url.startswith('http://'): pa...
__init__.py
import sys import os.path from thonny.plugins.micropython import ( MicroPythonProxy, MicroPythonConfigPage, add_micropython_backend, ) from thonny import get_workbench, ui_utils from thonny.ui_utils import FileCopyDialog, CommonDialog, ems_to_pixels from thonny.misc_utils import find_volume_by_name import s...
wandb_run.py
# # -*- coding: utf-8 -*- from __future__ import print_function import atexit from datetime import timedelta from enum import IntEnum import glob import json import logging import numbers import os import platform import re import sys import threading import time import traceback from types import TracebackType from ...
class_test_v1.py
#!/usr/bin/python # -*- coding: utf-8 -*- import sys import os import glob import serial import serial.tools.list_ports import threading import time import traceback class SerialManeger : bps_default = [9600, 19200, 38400, 57600, 115200, 230400] # クラスの初期化処理 def __init__(self,port,bps,timeout=1): ...
futuGateway.py
# encoding: UTF-8 ''' 富途证券的gateway接入 ''' import json from collections import OrderedDict from threading import Thread from time import sleep from datetime import datetime from copy import copy from futu import (OpenQuoteContext, OpenHKTradeContext, OpenUSTradeContext, RET_ERROR, RET_OK, ...
db_composer.py
# # Licensed to Dagda under one or more contributor # license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright # ownership. Dagda licenses this file to you under # the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance...
Upload.py
from threading import Thread import requests from PyQt5 import QtCore, QtGui, QtWidgets import Util from connector import upload, connector from doctor import SubjectListUi class Upload(object): def __init__(self, name, data): self.name = name self.data = data self.files = ...
AVR_Miner.py
#!/usr/bin/env python3 ########################################## # Duino-Coin Python AVR Miner (v2.5.7) # https://github.com/revoxhere/duino-coin # Distributed under MIT license # © Duino-Coin Community 2019-2021 ########################################## # Import libraries import sys from configparser import ConfigPa...
lib_images_io.py
#!/usr/bin/env python """ Classes for reading images from video, folder, or web camera, and for writing images to video file. Main classes and functions: * Read: class ReadFromFolder class ReadFromVideo class ReadFromWebcam * Write: class VideoWriter * Displa...
Pak.py
#! /usr/bin/env python3 #-*- coding: UTF-8 -*- ### Legal # # Author: Thomas DEBESSE <dev@illwieckz.net> # License: ISC # from Urcheon import Action from Urcheon import Default from Urcheon import FileSystem from Urcheon import Game from Urcheon import MapCompiler from Urcheon import Parallelism from Urcheon import ...
utils.py
# Copyright (c) 2019 Uber Technologies, 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...
Demo_Desktop_Widget_CPU_Graph.py
#!/usr/bin/env python import PySimpleGUI as sg import time import random import psutil from threading import Thread STEP_SIZE = 3 SAMPLES = 300 SAMPLE_MAX = 500 CANVAS_SIZE = (300, 200) g_interval = .25 g_cpu_percent = 0 g_procs = None g_exit = False def CPU_thread(args): global g_interval, g_cpu_percent, g_p...
base_events.py
"""Base implementation of event loop. The event loop can be broken up into a multiplexer (the part responsible for notifying us of I/O events) and the event loop proper, which wraps a multiplexer with functionality for scheduling callbacks, immediately or at a given time in the future. Whenever a public API takes a c...
test_ftplib.py
"""Test script for ftplib module.""" # Modified by Giampaolo Rodola' to test FTP class, IPv6 and TLS # environment import ftplib import asyncore import asynchat import socket import io import errno import os import threading import time try: import ssl except ImportError: ssl = None from unittest import Test...
log_cruncher.py
""" SPDX-License-Identifier: MIT Copyright (C) 2018-2019 Bytemare <d@bytema.re>. All Rights Reserved. """ from multiprocessing import Process, Pool, Manager from os import getpid, path, makedirs, cpu_count from time import sleep from errno import EEXIST from threading import Thread # For correlation coefficient try: ...
test_nvml.py
import multiprocessing as mp import os import pytest pytestmark = pytest.mark.gpu pynvml = pytest.importorskip("pynvml") import dask from distributed.diagnostics import nvml from distributed.utils_test import gen_cluster def test_one_time(): if nvml.device_get_count() < 1: pytest.skip("No GPUs availa...
main_multi_processing2.py
#encoding: utf-8 from multiprocessing import Pool, Process from multiprocessing.managers import BaseManager import os, time, random import HKIPcamera import cv2 import copy import math from loadconfig import * import rospy from sensor_msgs.msg import CompressedImage from cv_bridge import CvBridge, CvBridgeError fro...
util.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...
threading chat Server.py
import threading import socket from urllib import request INITIAL_PORT = 80 ENCODING = 'utf-8' def get_external_ip(): req = request.urlopen('https://api.ipify.org') data = req.read() return data.decode('utf-8') def send(sock: socket.socket): while True: msg = input("send << ") sock....
test_logging.py
#!/usr/bin/env python # # Copyright 2001-2004 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, # provided that the above copyright notice appear in all copies and that # both that copyright n...
decorators.py
from threading import Thread from functools import wraps import time def retry(tries, exceptions=None, delay=0): """ Decorator for retrying a function if exception occurs tries -- num tries exceptions -- exceptions to catch delay -- wait between retries """ exceptions_ = exceptions or (Ex...
copyutil.py
# cython: profile=True # 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 # "...
watchdog.py
#!/usr/bin/python # Copyright (c) Microsoft Corporation # All rights reserved. # # MIT License # # 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 limitatio...
Hiwin_RT605_ArmCommand_Socket_20190627181713.py
#!/usr/bin/env python3 # license removed for brevity import rospy import os import socket ##多執行序 import threading import time import sys import matplotlib as plot import HiwinRA605_socket_TCPcmd as TCP import HiwinRA605_socket_Taskcmd as Taskcmd import numpy as np from std_msgs.msg import String from ROS_Socket.srv imp...
net.py
import socket import sys import time from threading import Thread from queue import Queue class Networker(): def __init__(self, ip, port): self.endFlag = False self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.server_adress = (ip, port) self.message = '' se...
sdca_ops_test.py
# Copyright 2016 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...
consumer_prioritetes.py
import pika from threading import Thread HOST = 'localhost' USER = 'guest' PASSWORD = 'guest' VHOST = '/' MSG = "Test message for RabbitMQ" QUEUE = 'consumer_prio_queue' class RabbitMQ(): def __init__(self, exchange='messages', host='localhost', user='guest', ...
parallel_locust.py
#!/usr/bin/env python3 # __file__: /home/ubuntu/parallel_locust.py # profiling-go.sh calling: # python3 parallel_locust.py $PROFILEE $LOCUST_CLIENT=4 $LOCUST_RUMTIME=300 $LOGFOLDER $STREAM_INDEX='=' import sys import locust.main as locust_main from multiprocessing import Process, Pool, TimeoutError import random impo...
main.py
import tensorflow as tf from data_generator import DataGenerator from models import Model import os,sys import time from mlperf_logging import mllog from threading import Thread ###### npu ###### from npu_bridge.estimator import npu_ops from tensorflow.core.protobuf.rewriter_config_pb2 import RewriterConfig from npu_b...
agents.py
import torch.multiprocessing as mp from pytorch_rl.utils import * class OffPolicyAgent: def __init__(self, algorithm, policy, callbacks, args): self.algorithm = algorithm self.policy = policy self.args = args self.callbacks = callbacks self.replay_buffer = ExperienceReplay(...
_v5_proc_uploader.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # COPYRIGHT (C) 2014-2020 Mitsuo KONDOU. # This software is released under the MIT License. # https://github.com/konsan1101 # Thank you for keeping the rules. import sys import os import time import datetime import codecs import glob import queue import threading impor...
debugger.py
from pyedbglib.hidtransport.hidtransportfactory import hid_transport from pyedbglib.protocols import housekeepingprotocol from pyedbglib.protocols import housekeepingprotocol from pyedbglib.protocols import avr8protocol from pyedbglib.protocols import avr8protocolerrors # Retrieve device info from pymcuprog.deviceinfo...
_logger.py
""" .. References and links rendered by Sphinx are kept here as "module documentation" so that they can be used in the ``Logger`` docstrings but do not pollute ``help(logger)`` output. .. |Logger| replace:: :class:`~Logger` .. |add| replace:: :meth:`~Logger.add()` .. |remove| replace:: :meth:`~Logger.remove()` .. |...
gui.py
#!/usr/bin/env python #/******************************************************************************* # Copyright (c) 2012 IBM Corp. # 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 # h...
pytest_esp_eth.py
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: CC0-1.0 import contextlib import logging import os import socket from collections.abc import Callable from threading import Thread from typing import Iterator import pytest from pytest_embedded import Dut from scapy.all impo...
test_samplers.py
import multiprocessing import pytest import numpy as np import scipy.stats as st import pandas as pd from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor from pyabc.sampler import (SingleCoreSampler, MappingSampler, MulticoreParticleParallelSampler...
plutus.py
# Plutus Bitcoin Brute Forcer # Made by Isaac Delly # https://github.com/Isaacdelly/Plutus # ------------------------------------------------ # Added fastecdsa - June 2019 - Ian McMurray # https://github.com/imcmurray/Plutus-fastecdsa # ------------------------------------------------ # Added convert to pickle from csv...
interface.py
# Copyright (c) 2016 Ansible by Red Hat, Inc. # # 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 Licen...
dataModel.py
import os import threading import time import pymongo import json from bson.objectid import ObjectId from bson.errors import InvalidId from threading import get_ident from watchdog.events import FileSystemEventHandler from watchdog.observers import Observer from db.multiviewmongo import MultiViewMongo from model.syncer...
run.py
#!/usr/bin/env python3 import argparse import queue import os import re import threading import time import subprocess import sys devnull = open(os.devnull, 'w') def check_jobs(value): ivalue = int(value) if ivalue <= 0: raise argparse.ArgumentTypeError('Invalid argument for JOBS: {0}.'.format(value...
server.py
import boto3 from botocore.exceptions import ClientError from configuration import Config import time import paramiko import os from threading import Thread, Event #Create a ec2 object def initInstance(): ec2 = boto3.client("ec2", aws_access_key_id=Config.ACCESS_KEY, a...
vid2img_sthv2.py
import os import threading from tqdm import tqdm import pdb NUM_THREADS = 10 VIDEO_ROOT = '/home/data2/zhengwei/sth-sth-v2/20bn-something-something-v2' # Downloaded webm videos FRAME_ROOT = '/home/data2/zhengwei/sth-sth-v2/20bn-something-something-v2-frames' # Directory for extracted frames def split(l, n):...
__main__.py
import argparse, os, stat, sys from queue import Empty import json import multiprocessing, threading import gc sys.path.append(os.getcwd()) from syzscope.modules import Crawler, Deployer from subprocess import call from syzscope.interface.utilities import urlsOfCases, urlsOfCases, FOLDER, CASE def args_parse(): p...
agents.py
#!/usr/bin/python # vim:fileencoding=utf-8 import sys, time, threading from sensors import Buttons from actuators import StepMotorPair, Leds, Buzzer class Agent: def __init__(self): self.state = "init" self.motors = StepMotorPair("/tmp/motors") self.buttons = Buttons("/tmp/button") self.buzzer = Buzzer("/tmp/...
testBtagSFProducer.py
from __future__ import division, print_function import os, sys import ROOT from PhysicsTools.NanoAODTools.postprocessing.framework.postprocessor import PostProcessor from PhysicsTools.NanoAODTools.postprocessing.framework.datamodel import Collection, Object from PhysicsTools.NanoAODTools.postprocessing.framework.event...
vnokex.py
# encoding: UTF-8 import hashlib import zlib import json from time import sleep from threading import Thread import websocket # OKEX网站 OKEX_USD_SPOT = 'wss://real.okex.com:10441/websocket' # OKEX 现货地址 #OKEX_USD_SPOT = 'wss://47.90.109.236:10441/websocket' # OKEX 现货地址 #OKEX_USD_SPOT = ...
joystick_and_video.py
""" tellopy sample using joystick and video palyer - you can use PS3/PS4/XONE joystick to controll DJI Tello with tellopy module - you must install mplayer to replay the video - Xbox One Controllers were only tested on Mac OS with the 360Controller Driver. get it here -> https://github.com/360Controller/360Cont...
__init__.py
import asyncio import ctypes import json import logging import os from pathlib import Path import shutil import site import tempfile import threading import subprocess import threading import janus from .. import BaseRunner from .inproc import PythonInprocRunner log = logging.getLogger() DEFAULT_PYFLAGS = '' CHILD_...
test_asyncore.py
import asyncore import unittest import select import os import socket import sys import time import warnings import errno import struct from test import test_support from test.test_support import TESTFN, run_unittest, unlink from StringIO import StringIO try: import threading except ImportError: threading = N...
testRunner-res.py
from domainParser import domainReader from domainResolver2 import domainResolver from domainConsumer import domainConsumer import logging from multiprocessing import Process, current_process, active_children if __name__ == "__main__": logger = logging.getLogger() logger.addHandler(logging.StreamHandler()) ...
camera.py
import base64 import io import time from threading import Thread, ThreadError import numpy as np from PIL import Image import cv2 from socketIO_client import BaseNamespace, SocketIO img_np = None socketIO = SocketIO("localhost", 5000) live_namespace = socketIO.define(BaseNamespace, "/live") def receive_events_thre...
poker.py
#modelling game of poker import util from sets import Set from util import Stack #from util import Queue from util import PriorityQueue from random import random from random import shuffle from sets import Set import time import sys import argparse import multiprocessing from multiprocessing import Pool from multiproc...
__init__.py
# coding=utf-8 from __future__ import absolute_import import threading import octoprint.plugin from octoprint.events import Events import re import numpy as np import logging import flask import json class bedlevelvisualizer(octoprint.plugin.StartupPlugin, octoprint.plugin.TemplatePlugin, octoprint.pl...
client.py
import socket import threading import sys def receive(socket, signal): while signal: try: data = socket.recv(4096) print(str(data.decode("utf-8"))) except: print("You have been disconnected from the server") signal = False break def main(...
test_forwarder.py
# -*- coding: utf-8 -*- from multiprocessing import Process import socket import random import os import signal import time import logging import pytest from six.moves import socketserver from greendns.forwarder import Forwarder from greendns.handler_quickest import QuickestHandler from greendns import ioloop from gree...