source
stringlengths
3
86
python
stringlengths
75
1.04M
tcp_server.py
import socket import threading bind_ip = "0.0.0.0" # localhost bind_port= 9999 server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.bind((bind_ip, bind_port)) server.listen(5) print("[*] Listening on ", bind_ip, bind_port) def handle_client(client_socket): request = client_socket.recv(1024) p...
trezor.py
from binascii import hexlify, unhexlify import traceback import sys from qtum_electrum.util import bfh, bh2u, versiontuple, UserCancelled from qtum_electrum.qtum import (b58_address_to_hash160, xpub_from_pubkey, TYPE_ADDRESS, TYPE_SCRIPT, qtum_addr_to_bitcoin_addr, deserialize_xpub) fro...
exec_command.py
import sublime import os import subprocess import threading import traceback from ..import_helper import RUN_PATH, PACKAGE_PATH from .debug import debug from .get_node_executable import get_node_executable from .utils import error_message, status_message NODE_BIN = None def run_command(command, data=None, callback=...
usermanagement.py
""" Very simple user management for the MicroPsi service The user manager takes care of users, sessions and user roles. Users without a password set can login with an arbitrary password, so make sure that users do not set empty passwords if this concerns you. When new users are created, they are given a role and stor...
bar.py
import time # # import progressbar as p # from progressbar import Bar '''''' # import progressbar as p # # with p.ProgressBar(max_value=100,prefix="* ",suffix=" #") as bar: # for i in range(101): # time.sleep(0.02) # bar.update(i) # * 100% (100 of 100) |##################| Elapsed Time: 0:00:02 T...
main.py
#!/usr/bin/python #----------------------------------------------------------------------- # artichoke: # - A small program which gathers basic information about twitter user habits. # - https://github.com/Sorbus/artichoke #----------------------------------------------------------------------- import config import...
test_transaction.py
#!/usr/bin/env python # test_transaction - unit test on transaction behaviour # # Copyright (C) 2007-2011 Federico Di Gregorio <fog@debian.org> # # psycopg2 is free software: you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published # by the Free Software Foundat...
twisterlib.py
#!/usr/bin/env python3 # vim: set syntax=python ts=4 : # # Copyright (c) 2018 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import contextlib import string import mmap import sys import re import subprocess import select import shutil import shlex import signal import threading import concurrent.fu...
inputhook.py
""" Similar to `PyOS_InputHook` of the Python API, we can plug in an input hook in the asyncio event loop. The way this works is by using a custom 'selector' that runs the other event loop until the real selector is ready. It's the responsibility of this event hook to return when there is input ready. There are two w...
data_service_ops_test.py
# Copyright 2020 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...
tkgpio.py
from .base import TkDevice, SingletonMeta from .base import PreciseMockTriggerPin, PreciseMockFactory, PreciseMockChargingPin from gpiozero import Device from gpiozero.pins.mock import MockPWMPin from PIL import ImageEnhance from sounddevice import play, stop import numpy import scipy.signal from tkinter import Tk, Fra...
testsamples.py
from durable.lang import * import threading import time import datetime with ruleset('test'): # antecedent @when_all(m.subject == 'World') def say_hello(c): # consequent print('test-> Hello {0}'.format(c.m.subject)) post('test', { 'subject': 'World' }) with ruleset('none_test'): @when...
io.py
from __future__ import absolute_import import sys import io import threading import time from collections import namedtuple import zlx.int import zlx.record from zlx.utils import sfmt, dmsg, omsg, emsg SEEK_SET = 0 SEEK_CUR = 1 SEEK_END = 2 SEEK_DATA = 3 SEEK_HOLE = 4 def bin_load (path): with open(path, 'rb') ...
pytest_simple_ota.py
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Unlicense OR CC0-1.0 import http.server import multiprocessing import os import socket import ssl import sys from typing import Tuple import pexpect import pytest from pytest_embedded import Dut server_cert = '-----BEGIN CER...
connector.py
#!/usr/bin/env python # # Copyright 2017 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 Apac...
twitter.py
import tweepy import pprint import json import threading import sys import os sys.path.append(os.path.abspath("../../IoTPy/helper_functions")) sys.path.append(os.path.abspath("../../IoTPy/core")) sys.path.append(os.path.abspath("../../IoTPy/agent_types")) sys.path.append(os.path.abspath("../../IoTPy/multiprocessing")...
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...
remote_controller.py
from ryu.base import app_manager from ryu.controller import ofp_event from ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER from ryu.controller.handler import set_ev_cls from ryu.ofproto import ofproto_v1_3 from ryu.lib.packet import packet, arp, ethernet, ipv4, ipv6, ether_types, icmp from ryu.lib impo...
DebugThreading.py
import threading import time as _time import uuid as _uuid import collections as _collections from threading import (active_count, activeCount, Condition, #@UnusedImport current_thread, currentThread, enumerate, #@UnusedImport Event, local, Thread, Timer, settrace...
Hiwin_RT605_ArmCommand_Socket_20190627185530.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...
main.py
#!/usr/bin/env python3 import subprocess import threading import time import cv2 from picamera import PiCamera from picamera.array import PiRGBArray import maze import motors import opencv import pid_from_github class MainClass: def __init__(self): self.w, self.h, self.framerate = 128, 96, 50 se...
cli.py
# encoding: utf-8 from __future__ import print_function import collections import csv import multiprocessing as mp import os import datetime import sys from pprint import pprint import re import itertools import json import logging from optparse import OptionConflictError import traceback from six import text_type f...
dbt_integration_test.py
# # Copyright (c) 2021 Airbyte, Inc., all rights reserved. # import json import os import random import re import shutil import socket import string import subprocess import sys import threading import time from typing import Any, Dict, List from normalization.destination_type import DestinationType from normalizati...
wifi.py
import time import epd2in7b import RPi.GPIO as GPIO import qrcode import PIL.Image as Image import PIL.ImageFont as ImageFont import PIL.ImageDraw as ImageDraw import textwrap import threading COLORED = 1 UNCOLORED = 0 def generate_qr_image(ssid, key): qr = qrcode.QRCode( version=2, error_correcti...
fixtures.py
# coding: utf-8 # Original work Copyright Fabio Zadrozny (EPL 1.0) # See ThirdPartyNotices.txt in the project root for license information. # All modifications Copyright (c) Robocorp Technologies Inc. # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License") # you may not use this file e...
threading.py
from threading import Thread import file_server def main(): Thread(target=file_server.main).start() server = Server() server.run()
deal_data_Class.py
#!/usr/bin/env python # coding: utf-8 import numpy as np import os import queue from functools import reduce import glob from shutil import copyfile, move from multiprocessing import Process from tqdm import tqdm class GenPcdFile(object): """ 根据obj和pts文件生成pcd文件,用于训练 格式为 x y z pt_label n ==> xyz表示坐标, pt_label...
test_classify_pp.py
# Copyright 2019 Xilinx Inc. # Copyright 2019 Xilinx 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 ...
MultiThreadRunner.py
import logging import threading class MultiThreadMapper: def __init__(self, fun, data: list): self.consume_lock = threading.Lock() self.input = data self.input_len = len(data) self.output = [None] * self.input_len self.pos = 0 self.fun = fun self.logger = lo...
__main__.py
#!/usr/bin/env python3 import threading import connexion from swagger_server import encoder from movement_enactor.dme_monitor import DMEsymmetricds from config import conf from clients.redis_client import RedisClient def main(): dmm = DMEsymmetricds() app = connexion.App(__name__, specification_dir='./swagg...
spowatch.py
# * spowatch v1.3.1 # ! I donot encourage to use this. It is for educational purposes only. # ! upgrade to Spotify Premium # & Max CPU usage in my case <0.8% occasionally and <40 MB RAM [36.5 MB actual value] # * updates ''' -> 4/20/2021 no need of any watch files. -> 4/20/2021 watch files when deleted cause an error....
determine_the_current_thread.py
import threading import time """ Associo Threads a funções Nomeio Threads Pego o nome de threads nomeadas """ # my modification: thread id's def first_function(): print ('thread id: ', threading.get_ident(), threading.currentThread().getName() + str(' is Starting \n')) time.sleep(2) pri...
__init__.py
import random import threading import time import sys from pkg_resources import resource_filename __version__ = '0.0.1' def generate_the_cagezzz(): """ Function to parse the image file and generate a list of cagezzz for display """ with open(resource_filename('cagezzz','cagezzz.txt'), 'r') as f: ...
leaderelection_test.py
# Copyright 2021 The Kubernetes 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 ...
escapecontext.py
import time from .customthreading import KillableThread class Context(object): def __init__(self) -> None: self.threads = list() def contextless(self, obj, _passback=None, _threaded=False): # escapes with context becouse if _threaded: with obj as contextobj: _passba...
test_zzz_redis_sentinel_failover.py
from __future__ import ( absolute_import, unicode_literals, ) import sys import threading import time from typing import Dict from pysoa.client.client import Client from pysoa.common.transport.errors import TransientPySOATransportError from tests.functional import call_command_in_container def _progress(pr...
rev.py
#!/usr/bin/python # -*- coding: utf-8 -*- # -- import Modules -- import os import sys import json import random import requests import platform import threading py_version = platform.python_version() if int(py_version[0]) == 2: from Queue import Queue if int(py_version[0]) == 3: from queue import Queue # -- Co...
fft_viz.py
#!/usr/bin/env python import rospy from mmWave.msg import data_frame from rospy.numpy_msg import numpy_msg import numpy as np import cv2 import sys import threading import pprint VERBOSE=False class FrameBuffer(): #DoubleBuffer for for vis def __init__(self, framesize=(256,256)): self.buff = [np.zeros...
tcp.py
#!/usr/bin/env python # -*- coding: utf-8 -*- #Created by Alvin. Zixuan tongjirc #MAY. 1th 2019 import time,sys,math,re import threading import PyQt5 import rospy import std_msgs import socket import gurobipy import filterpy import time import math import tf import routePlan import numpy as np import mpc from PyQt5 i...
sticker.py
#!/usr/bin/env python import logging import config import tickersources import threading import time from datetime import datetime as dt from colorsys import hsv_to_rgb from PIL import ImageFont from scrollable import Scrollable import os import scrollphathd dir = os.path.dirname(__file__) logging.basicConfig(format...
HiwinRA605_socket_ros_test_v1_20190627172800.py
#!/usr/bin/env python3 # license removed for brevity #接收策略端命令 用Socket傳輸至控制端電腦 import socket ##多執行序 import threading import time ## import sys import os import numpy as np import rospy import matplotlib as plot from std_msgs.msg import String from ROS_Socket.srv import * from ROS_Socket.msg import * import HiwinRA605_s...
worker.py
"""SniTun worker for traffics.""" import asyncio import logging from multiprocessing import Process, Manager, Queue from threading import Thread from typing import Dict, Optional, List from socket import socket from .listener_peer import PeerListener from .listener_sni import SNIProxy from .peer_manager import PeerMan...
python_ls.py
# Copyright 2017 Palantir Technologies, Inc. from functools import partial import logging import os import socketserver import threading from pyls_jsonrpc.dispatchers import MethodDispatcher from pyls_jsonrpc.endpoint import Endpoint from pyls_jsonrpc.streams import JsonRpcStreamReader, JsonRpcStreamWriter from . imp...
renderer.py
import os import subprocess import threading __global_phonogram_renderer = None class PhonogramRenderer: def __init__(self): # javac -encoding utf-8 -classpath kuromoji.jar TokenizerCaller.java # java -classpath ./kuromoji.jar;./TokenizerCaller.class; TokenizerCaller self.proc = subproces...
reload.py
import sublime import sublime_plugin import os import posixpath import threading import builtins import functools import importlib import sys import traceback from inspect import ismodule from contextlib import contextmanager from .debug import StackMeter try: from package_control.package_manager import PackageMa...
_a4c_start.py
from cloudify import ctx from cloudify.exceptions import NonRecoverableError from cloudify.state import ctx_parameters as inputs import subprocess import os import re import sys import time import threading import platform from StringIO import StringIO from cloudify_rest_client import CloudifyClient from cloudify im...
MLPApi.py
# -*- encoding: utf-8 -*- import sublime import sublime_plugin import os.path from html.parser import HTMLParser from .lib import markdown2 as md2 from .lib.pre_tables import pre_tables from .escape_amp import * from .functions import * from .setting_names import * from .image_manager import CACHE_FILE from random ...
masterI2C.py
import smbus import time import threading bus = smbus.SMBus(1) def sendData(data): slaveAddress = 0x28 intsOfData = list(map(ord, data)) # print(intsOfData) bus.write_i2c_block_data(slaveAddress, intsOfData[0], intsOfData[1:]) def readData(): slaveAddress = 0x28 while True: try: ...
create_tfrecords.py
""" Create the tfrecord files for a dataset. A lot of this code comes from the tensorflow inception example, so here is their license: # 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...
dist_autograd_test.py
import sys import threading import time from enum import Enum import random import torch import torch.nn as nn from datetime import timedelta import torch.distributed as dist import torch.distributed.autograd as dist_autograd import torch.distributed.rpc as rpc import torch.testing._internal.dist_utils from torch.autog...
send_tensor.py
# stdlib import multiprocessing as mp from multiprocessing import Process import time # third party import torch as th # syft absolute import syft as sy mp.set_start_method("spawn", force=True) # Make sure to run the local network.py server first: # # $ syft-network # def do() -> None: # stdlib import asy...
test_table_read.py
from threading import Barrier, Thread import pytest from deltalake import DeltaTable, Metadata def test_read_simple_table_to_dict(): table_path = "../rust/tests/data/simple_table" dt = DeltaTable(table_path) assert dt.to_pyarrow_dataset().to_table().to_pydict() == {"id": [5, 7, 9]} def test_read_simpl...
regrtest.py
#! /usr/bin/env python """ Usage: python -m test.regrtest [options] [test_name1 [test_name2 ...]] python path/to/Lib/test/regrtest.py [options] [test_name1 [test_name2 ...]] If no arguments or options are provided, finds all files matching the pattern "test_*" in the Lib/test subdirectory and runs them in alphabeti...
__init__.py
import enum import serial import time import threading import logging LOG = logging.getLogger('pymindwave') class device_error(Exception): pass class request_denied(Exception): pass class checksum_mismatch(Exception): pass class wrong_token_error(Exception): pass class read_timeout(Exception): ...
main.py
import json import os import re import time import threading import requests from decimal import * from http.cookies import SimpleCookie from requests.cookies import cookiejar_from_dict from termcolor import cprint from buff2steam.c5 import C5 from buff2steam.buff import Buff from buff2steam.steam import Steam # t...
network.py
# -*- coding: utf-8 -*- # Copyright 2018 Martin Bammer. All Rights Reserved. # Licensed under MIT license. #cython: language_level=3, boundscheck=False """Network logging support.""" #c cdef gc import time import struct import socket import gc from collections import deque from threading import Thread, E...
video_processing_parallel.py
# importing required libraries import cv2 import time from threading import Thread # library for implementing multi-threaded processing # defining a helper class for implementing multi-threaded processing class WebcamStream: def __init__(self, stream_id=0): self.stream_id = stream_id # default is 0 for ...
test_debug.py
import importlib import inspect import os import re import sys import tempfile import threading from io import StringIO from pathlib import Path from unittest import mock, skipIf from django.core import mail from django.core.files.uploadedfile import SimpleUploadedFile from django.db import DatabaseError, connection f...
scheduler.py
#!/usr/bin/env python3 """ Scheduler """ import os import glob import time import queue import threading from job import Job from trace_dict import TraceDict from trace_record import TraceRecord from result import Result class Scheduler: """ Creates benchmark jobs and runs jobs (in parallel) """ def...
thead.py
import threading import time def worker(message): for i in range(5): print(message) time.sleep(1) t = threading.Thread(target=worker, args=("thread sendo executada",)) t.start() while t.isAlive(): print("Aguardando thread") time.sleep(5) print("Thread morreu") print("Finalizando program...
listen.py
#!/usr/bin/env python3 """A simple handshake and encryption test. This script will listen on port 9736 for incoming Thor Network protocol connections, perform the cryptographic handshake, send 10k small pings, and then exit, closing the connection. This is useful to check the correct rotation of send- and receive-keys...
main.py
import time start = time.time() from tkinter import * from tkinter import messagebox from PIL import ImageTk, Image from tkinter import filedialog import threading import pytesseract import cv2 import numpy as np from shutil import copy from tkinter.filedialog import asksaveasfile from docx2pdf import convert from os i...
__main__.py
from __future__ import division, unicode_literals, print_function, absolute_import # Ease the transition to Python 3 import os import labscript_utils.excepthook try: from labscript_utils import check_version except ImportError: raise ImportError('Require labscript_utils > 2.1.0') check_version('la...
serve.py
#! /usr/bin/env python3 import os import threading from functools import partial from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer from pathlib import Path from time import sleep from selenium import webdriver os.environ["DISPLAY"] = ":0" PORT = 8000 Handler = SimpleHTTPRequestHandler file_path ...
core.py
#!/usr/bin/env python import requests import logging import logging.handlers import os import socket import signal import sys import time import threading from configparser import ConfigParser from rpi_ws281x import PixelStrip from rpi_metar import cron, sources, encoder from rpi_metar.leds import BLACK, YELLOW, WHITE,...
test_http_action.py
import json import threading import six if six.PY2: from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer else: from http.server import HTTPServer, BaseHTTPRequestHandler from unittest_helper import ActionTestBase, capture_stream class HttpActionTest(ActionTestBase): def setUp(self): se...
base.py
# -*- coding: utf-8 -*-# # # February 19 2015, Christian Hopps <chopps@gmail.com> # # Copyright (c) 2015, Deutsche Telekom AG # # 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.ap...
batch_task.py
import os import time import numpy as np from multiprocessing import Process, Queue, Lock lock = Lock() class TaskState(object): def __init__(self, taskname): self.taskname = taskname self.state = {} self.load() def load(self): if not os.path.exists(self.taskname): ...
test_serialization.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...
runner.py
#!/usr/bin/env python3 # Copyright 2010 The Emscripten Authors. All rights reserved. # Emscripten is available under two separate licenses, the MIT license and the # University of Illinois/NCSA Open Source License. Both these licenses can be # found in the LICENSE file. """This is the Emscripten test runner. To run ...
Operator.py
import threading import copy import warnings # a general Operator class class Operator(object): def __init__(self): pass # a genera Unary operator class # raising a value error on appliance # if number of arguments =/= 1 class UnaryOperator(Operator): def __init__(self): pass def apply...
lock.py
# encoding: utf-8 import os from contextlib import contextmanager from redlock import Redlock, Lock REDIS_HOST = os.environ.get('REDIS_HOST', '127.0.0.1') REDIS_PORT = os.environ.get('REDIS_PORT', 6379) REDIS_DB = 1 REDIS_PASSWORD = os.environ.get('REDIS_PASSWORD', 'password') class AcquireLockError(Exception): ...
main.py
from picamera.array import PiRGBArray from picamera import PiCamera import cv2 import numpy as np import sys import RPi.GPIO as GPIO import time import threading # own import lib.pwm_engine_lib as pe import lib.image_processing_lib as ip def manage_dist(min_dist): global flag_dist global th_status while th_status: ...
test_JMXQuery.py
""" Use docker compose file in this directory to spin up the test Kafka/Zookeeper cluster when running these tests: docker-compose -f docker-compose-kafka.yaml up """ import logging, sys import threading from nose.tools import assert_greater_equal from jmxquery import JMXConnection, JMXQuery, MetricType logging...
async_detector.py
#!/usr/bin/env python2.7 import rospy from std_msgs.msg import Int32 from geometry_msgs.msg import PoseStamped, Pose from styx_msgs.msg import TrafficLightArray, TrafficLight from styx_msgs.msg import Lane from sensor_msgs.msg import Image from cv_bridge import CvBridge from light_classification.tl_classifier import TL...
__init__.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' @File : conciseSchedules.py @Author: ChenXinqun @Date : 2019/5/25 17:21 ''' __title__ = 'conciseSchedules' __url__ = 'https://github.com/chenxinqun/conciseSchedules' __version__ = '1.0.3' __author__ = 'ChenXinqun' __author_email__ = 'chenxinqun163@163.com' __maintain...
subscriber.py
import pika import threading import asyncio import uuid from pika.adapters.asyncio_connection import AsyncioConnection import logging import json logger = logging.getLogger(__name__) class Subscriber(threading.Thread): EXCHANGE = '' EXCHANGE_TYPE = '' EXCHANGE_DURABLE = False QUEUE = '' ROUTING_...
testclient.py
import asyncio import http import io import json import queue import threading import typing from urllib.parse import unquote, urljoin, urlparse import requests from starlette.types import ASGIApp, Message, Scope from starlette.websockets import WebSocketDisconnect # Annotations for `Session.request()` Cookies = typ...
periodic_update.py
""" Periodically update bundled versions. """ from __future__ import absolute_import, unicode_literals import json import logging import os import ssl import subprocess import sys from datetime import datetime, timedelta from itertools import groupby from shutil import copy2 from textwrap import dedent from threading...
main.py
import logging import threading import time from gi.repository import Gtk, Gio from gol_gtk.model import GameOfLifeModel from gol_gtk.services import quit_, load_file, next_generation from gol_gtk.widgets.grid import GameOfLiveGrid logger = logging.getLogger(__name__) class GameOfLiveGtk(Gtk.Window): _model =...
camera.py
import threading import binascii from time import sleep from utils import base64_to_pil_image, pil_image_to_base64 # Class to perform encoding and decoding the images captured from camera class Camera(object): def __init__(self): self.to_process = [] self.to_output = [] thread = threading...
TCppServerTestManager.py
# Copyright (c) Meta Platforms, Inc. and 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 law o...
test_dummyaccount_demo.py
import asyncio from threading import Thread import pytest from libp2p.tools.pubsub.dummy_account_node import DummyAccountNode from libp2p.tools.utils import connect def create_setup_in_new_thread_func(dummy_node): def setup_in_new_thread(): asyncio.ensure_future(dummy_node.setup_crypto_networking()) ...
maintenance.py
# -*- coding: utf-8 -*- import json import threading from app.const import * from app.base.configs import tp_cfg from app.base.controller import TPBaseHandler, TPBaseJsonHandler from app.base.db import get_db cfg = tp_cfg() class IndexHandler(TPBaseHandler): def get(self): self.render('m...
app.py
import os import threading import time import logging from flask import Flask, jsonify, request, abort, g, session from flask_httpauth import HTTPBasicAuth from flask_migrate import Migrate from flask_sqlalchemy import SQLAlchemy from flask_socketio import SocketIO from werkzeug.security import generate_password_hash,...
trezor.py
from binascii import hexlify, unhexlify import traceback import sys from electrum_dongri.util import bfh, bh2u, versiontuple, UserCancelled from electrum_dongri.bitcoin import (b58_address_to_hash160, xpub_from_pubkey, TYPE_ADDRESS, TYPE_SCRIPT, is_address) from electrum_dongri import con...
HiddenEye.py
#!/usr/bin/python3 #-*- coding: utf-8 -*- # HiddenEye v1.0 # By:- DARKSEC TEAM # ########################### from time import sleep from sys import stdout, exit, argv from os import system, path from distutils.dir_util import copy_tree import multiprocessing from urllib.request import urlopen, quote, unquote from...
race_with_lock.py
import threading from time import sleep from random import random counter = 0 randsleep = lambda: sleep(0.1 * random()) def incr(n): global counter for count in range(n): with incr_lock: current = counter randsleep() counter = current + 1 randsleep() ...
api.py
#!/usr/bin/python -OO # Copyright 2007-2018 The SABnzbd-Team <team@sabnzbd.org> # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later...
gizzy.py
#!/usr/bin/env python import copy import datetime import functools import logging import inspect import json import optparse as op import os import Queue import re import ssl import socket import StringIO import sys import threading import time import traceback #grant access to gizzylib sys.path.append(os.path.dirna...
process.py
# -*- coding: utf-8 -*- ''' Functions for daemonizing and otherwise modifying running processes ''' # Import python libs from __future__ import absolute_import, with_statement import copy import os import sys import time import errno import types import signal import logging import threading import contextlib import s...
asar_web_server.py
#!/usr/bin/python3 """ file: app.py purpose: Holds the view for the Flask web application and handling of the database. """ from .gui_constants import GUI_CONSTANTS, DANGER, ENVIRONMENT, STATE import datetime from flask import Flask, request, session, g, redirect, url_for, abort, \ render_temp...
datasets.py
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license """ Dataloaders and dataset utils """ import glob import hashlib import json import os import random import shutil import time from itertools import repeat from multiprocessing.pool import Pool, ThreadPool from pathlib import Path from threading import Thread from zipfile im...
error_handling.py
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
manager.py
#!/usr/bin/env python2.7 import os import sys import fcntl import errno import signal from common.basedir import BASEDIR sys.path.append(os.path.join(BASEDIR, "pyextra")) os.environ['BASEDIR'] = BASEDIR if __name__ == "__main__": if os.path.isfile("/init.qcom.rc") \ and (not os.path.isfile("/VERSION") or int(...
threading_semaphore.py
#!/usr/bin/env python # -*- coding:utf-8 -*- # Author:Lyon import threading import time def func(): sm.acquire() print('%s get semaphores' % threading.current_thread().getName()) time.sleep(2) sm.release() if __name__ == '__main__': sm = threading.Semaphore(5) for i in range(10): t = thr...
chaos_commons.py
import os import threading import glob import delayed_assert from chaos import constants from yaml import full_load from utils.util_log import test_log as log def check_config(chaos_config): if not chaos_config.get('kind', None): raise Exception("kind must be specified") if not chaos_config.get('spec'...
tricycle_controller.py
#!/usr/bin/python """ A controller that listens to cmd_vel topics and forwards commands to the tricycle model running in gazebo. Model's definition can be found in simulation/tricycle/model.urdf """ import rospy from math import pi, atan from simple_pid import PID from threading import Thread from geometry_msgs.msg i...
executor.py
#!/usr/bin/env python2.7 from __future__ import print_function import sys import time from threading import Thread from pymesos import MesosExecutorDriver, Executor, decode_data from addict import Dict class MinimalExecutor(Executor): def launchTask(self, driver, task): def run_task(task): u...
pipeline.py
import time import queue import multiprocessing as mp from interface import Source from ring_buffer import RingBuffer from dummies import * from task import * from util import * import pyarrow as pa import numpy as np import pyarrow.plasma as plasma def test1(client): with Graph() as p: Generator("cam", (...