source
stringlengths
3
86
python
stringlengths
75
1.04M
periodic_executor.py
# Copyright 2014-2015 MongoDB, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you # may not use this file except in compliance with the License. You # may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
manager.py
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2022 Valory AG # Copyright 2018-2021 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # ...
spinner.py
# Copyright 2020 The Pigweed 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
test_c10d_common.py
# Owner(s): ["oncall: distributed"] import copy import os import sys import tempfile import threading import time from datetime import timedelta from itertools import product from sys import platform from contextlib import suppress import torch import torch.distributed as dist if not dist.is_available(): print("...
node.py
import orjson as json import queue import socket from threading import Thread from queue import Queue import select import time import numpy as np import tensorflow as tf from node_state import NodeState, socket_recv, socket_send import zfpy import lz4.frame # port 5000 is data, 5001 is model architecture, 5002 is ...
interface.py
# coding: utf-8 # Módulo da interface # Esse módulo tem como objetivo construir a interface gráfica do programa # Autor: Marcos Castro from Tkinter import * # funções Tkinter from tkFileDialog import askopenfilename # função para escolher arquivo from compactador import * # módulo compactador import tkMessageBox # me...
test_threads.py
# This file is part of h5py, a Python interface to the HDF5 library. # # http://www.h5py.org # # Copyright 2008-2013 Andrew Collette and contributors # # License: Standard 3-clause BSD; see "license.txt" for full license terms # and contributor agreement. """ Tests the h5py.File object. """ from __futu...
ddos_dissector.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ############################################################################### # Concordia Project # # This project has received funding from the European Union’s Horizon # 2020 Research and Innovation program under Grant Agreement No 830927. # # Joao Ceron - joaocer...
local_timer_test.py
# 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 multiprocessing as mp import signal import time import unittest import unittest.mock as mock import torch....
tanksimulatortest4.py
import tkinter as tk from tkinter import * #import pygame import time import tkinter.messagebox import threading import RPi.GPIO as GPIO root=Tk() root.title("Tank Simulator") root.configure(bg="powder blue") #root.resizable(width=True,height=True) root.geometry("1920x1080") GPIO.setmode(GPIO.BOARD) GPIO.setup(40,GPI...
serial_data_producer.py
import glob import struct import sys import threading import serial from src.data_producer import DataProducer from src.realtime.checksum_validator import ChecksumValidator from src.rocket_packet.rocket_packet_parser import RocketPacketParser from src.rocket_packet.rocket_packet_repository import RocketPacketReposito...
keypad.py
""" `keypad` - Support for scanning keys and key matrices =========================================================== See `CircuitPython:keypad` in CircuitPython for more details. * Author(s): Melissa LeBlanc-Williams """ import time import threading from collections import deque import digitalio class Event: "...
server.py
import socket import threading import time print(socket.gethostname()) PORT=5060 FORMAT='utf-8' SERVER_NAME=socket.gethostname() IP_ADRESS=socket.gethostbyname(SERVER_NAME) ADRESS_DEF=(IP_ADRESS,PORT) DISCONNECT_MESSAGE='!DISCONECT' CLIENT_LIST=set() server=socket.socket(socket.AF_INET, socket.SOCK_STREAM) server....
mypool.py
# -*- coding: utf-8 -*- from multiprocessing import Process, Pipe, cpu_count class MyPool: proc_num = cpu_count() def __init__(self, proc_num): self.proc_num = proc_num def map(self, func, args): def pipefunc(conn, arg): conn.send(func(arg)) conn.close() ...
runtests.py
#!/usr/bin/env python from __future__ import print_function import atexit import base64 import os import sys import re import gc import heapq import locale import shutil import time import unittest import doctest import operator import subprocess import tempfile import traceback import warnings import zlib import glo...
train.py
#!/usr/bin/env python # # This code is based on CEDR: https://github.com/Georgetown-IR-Lab/cedr # It has some modifications/extensions and it relies on our custom BERT # library: https://github.com/searchivarius/pytorch-pretrained-BERT-mod # (c) Georgetown IR lab & Carnegie Mellon University # It's distributed under th...
run-dpdk-test.py
#!/usr/bin/env python3 # Copyright 2013-present Barefoot Networks, 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 b...
main.py
from multiprocessing import Process from trade import arbitrage def main(): procs = [ Process(target=arbitrage, args=(ex, )) for ex in ['Bittrex', 'Kraken'] ] for p in procs: p.start() for p in procs: p.join() if __name__ == '__main__': main()
rdd.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
app.py
# encoding: utf-8 ''' A REST API for Salt =================== .. versionadded:: 2014.7.0 .. py:currentmodule:: salt.netapi.rest_cherrypy.app :depends: - CherryPy Python module. Version 3.2.3 is currently recommended when SSL is enabled, since this version worked the best with SSL in internal testing....
VPython.py
#!/usr/bin/env python """ @author Micah Huth """ import importlib import threading import glob import os import platform import warnings from time import perf_counter, sleep import imageio from roboticstoolbox.backends.Connector import Connector _GraphicsCanvas3D = None _GraphicsCanvas2D = None _GraphicalRobot = None...
tunneling.py
""" This file provides remote port forwarding functionality using paramiko package, Inspired by: https://github.com/paramiko/paramiko/blob/master/demos/rforward.py """ import select import socket import sys import threading from io import StringIO import warnings import paramiko DEBUG_MODE = False def handler(chan,...
conftest.py
from multiprocessing import Process import os import signal from time import sleep from typing import List import pytest @pytest.fixture def run_cli(capfd): """Run a command in the `optimade-client` CLI (through the Python API).""" def _run_cli(options: List[str] = None, raises: bool = False) -> str: ...
main.py
from flask import Flask, render_template from flask_socketio import SocketIO, send, emit import json import time import random import threading # Required for server-side emit() to work import eventlet eventlet.monkey_patch() app = Flask(__name__) app.config['SECRET_KEY'] = 'dreamchaser' socketio = SocketIO(app) @a...
usercog.py
import io from datetime import datetime, timedelta from threading import Thread import discord import jikanpy import timeago from discord.ext import tasks, commands from jikanpy import Jikan from tqdm import tqdm from naotomori.util import jikanCall class UserCog(commands.Cog): """ UserCog: handles all the ...
multiprocess.py
import multiprocessing import os import signal import time HANDLED_SIGNALS = ( signal.SIGINT, # Unix signal 2. Sent by Ctrl+C. signal.SIGTERM, # Unix signal 15. Sent by `kill <pid>`. ) class Multiprocess: def __init__(self, config): self.config = config self.workers = config.workers ...
concurrent_file_search.py
import os from os.path import isdir, join from threading import Lock, Thread mutex = Lock() matches = [] def file_search(root, filename): print("Searching in:", root) child_threads = [] for file in os.listdir(root): full_path = join(root, file) if filename in file: mutex.acqui...
run_unittests.py
#!/usr/bin/env python3 # Copyright 2016-2017 The Meson development team # 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 ...
test_http.py
import os import sys import time from threading import Thread from unittest2 import TestCase from wsgiref.simple_server import make_server try: import json except ImportError: import simplejson as json from mesh.standard import * from mesh.transport.http import * from fixtures import * server = HttpServer([p...
observable.py
import queue, threading class Observable: """ Basisklasse für Objekte, die mit dem Observer-Pattern überwacht werden könnnen. Kann entweder von einer Klasse geerbt werden, damit diese das Observer-Pattern realisiert oder als eigenständiges Objekt verwendet werden, um einen zentralen Event-Broker zu...
camera.py
from threading import Thread import time import io from logging import getLogger from picamera import PiCamera # pylint: disable=import-error class Camera(): """Wrapper class for Pi camera""" TIMEOUT = 5 PICTURE_FORMAT = 'jpeg' DEFAULT_RESOLUTION = '1280x720' def __init__(self, register: object...
sailui_publish_sensors.py
# encoding: utf8 """ SailUI - GPS data from serial port parsed and send to InfluxDB MIT License Copyright (c) 2021 HadrienLG 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, ...
utils.py
#!/usr/bin/python # -*- coding: utf-8 -*- import sys import os import base64 import time import binascii import select import pathlib import platform import re from subprocess import PIPE, run from colorama import Fore, Style,init from pyngrok import ngrok import socket import threading import itertools import queue ...
webserver.py
# Licensed to the Software Freedom Conservancy (SFC) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The SFC licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
serialization.py
# Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
data_streamer.py
__author__ = "Your name" __email__ = "Your email" __version__ = "0.1" import json from datetime import datetime from threading import Thread import time import subprocess import requests class DataStreamer(object): """ Docstring here """ def __init__(self, message_queue): """ :para...
application.py
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
base.py
import argparse import base64 import copy import itertools import json import multiprocessing import os import re import sys import threading import time import uuid import warnings from collections import OrderedDict from contextlib import ExitStack from typing import ( TYPE_CHECKING, Dict, List, Optio...
service.py
# Copyright 2017 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
test_logging.py
# Copyright 2001-2021 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 notice and this permissio...
httpserver.py
#!/usr/bin/env python3 import socket import os import http.client import subprocess import sys import gzip import threading import time import signal PORT = -1 ORIGIN_PORT = 8080 ORIGIN_HOST = '' SOCK = None DNS_KEY = 'jds1D41HPQ2110D85ef92jdaf341kdfasfk123154' ''' Will be called as follows: ./httpserver -p <port>...
proxy.py
import asyncio import threading from abc import ABCMeta, abstractmethod import mitmproxy.http import mitmproxy.tcp import mitmproxy.websocket from mitmproxy.options import Options from mitmproxy.proxy.config import ProxyConfig from mitmproxy.proxy.server import ProxyServer from mitmproxy.tools.dump import DumpMaster ...
bridger.py
#! /usr/bin/python import sys, os import paramsparser import PAFutils import math import random import time from datetime import datetime # To enable importing from samscripts submodule SCRIPT_PATH = os.path.dirname(os.path.realpath(__file__)) sys.path.append(os.path.join(SCRIPT_PATH, 'samscripts/src')) # import util...
server.py
import socket import select import threading import json import sys import os from processLayer import ProcessLayer class Server: def __init__(self, host = '', port = 5000, pending_conn = 5, blocking = True): self.SERVER_IS_ALIVE = True #Flag de controle self.host ...
presubmit_support.py
#!/usr/bin/env python # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Enables directory-specific presubmit checks to run at upload and/or commit. """ from __future__ import print_function __versio...
test_runner.py
#!/usr/bin/env python3 # Copyright (c) 2014-2019 The Bitcoin Core developers # Copyright (c) 2017-2020 The Bitcoin developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Run regression test suite. This module calls down int...
workflow_runner.py
# -*- coding: utf-8 -*- import os import threading import random from mdstudio_workflow import __twisted_logger__ from mdstudio_workflow.workflow_common import WorkflowError, validate_workflow from mdstudio_workflow.workflow_spec import WorkflowSpec if __twisted_logger__: from twisted.logger import Logger lo...
naglosnienie.py
import datetime import time import threading import THutils import wzmacniacze import Kodi import os import logging import liriki import playlista import radia import ulubione import spotify_odtwarzacz import spotify_klasa import constants from copy import deepcopy ADRES_KODI = 'http://127.0.0.1:8088/jsonrpc' CZAS_ODS...
plugin.py
#!/usr/bin/env python3 # # Electron Cash - a lightweight Bitcoin Cash client # CashFusion - an advanced coin anonymizer # # Copyright (C) 2020 Mark B. Lundeberg # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to d...
codeSend.py
#coding=utf-8 import os import json import gevent import sys,codecs,subprocess,pexpect,time,threading reload( sys ) sys.setdefaultencoding('utf-8') #强制规范必要文件 def mkfile(): f={'./exclude.txt':666,'./config.json':666} for i,v in f.items(): if os.path.exists(i)==False: open(i,'wa+').close() os.system("chmod "+v...
launch_process.py
# 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 except in complia...
KISSInterface.py
from .Interface import Interface from time import sleep import sys import serial import threading import time import RNS class KISS(): FEND = 0xC0 FESC = 0xDB TFEND = 0xDC TFESC = 0xDD CMD_UNKNOWN = 0xFE CMD_DATA = 0x00 CMD_TX...
http_new.py
from __future__ import print_function from builtins import str from builtins import object import logging import base64 import sys import random import string import os import ssl import time import copy import json import sys from pydispatch import dispatcher from flask import Flask, request, make_response, send_from_...
__init__.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import datetime import json import logging import os import random import re import sys import time import Queue import threading from geopy.geocoders import GoogleV3 from pgoapi import PGoApi from pgoapi.utilities import f2i, get_cell_ids import cell_w...
ddnetQQbot.py
from qqbot import _bot as bot import time import csv import requests import json import threading #from multiprocessing import Process, Lock from getServerInfo import Server_Info servers_CHNTom = [[('119.29.57.22', 8304), 0], [('119.29.57.22', 8403), 0], [('119.29.57.22', 7321), 0],...
PersonTracking.py
#Algorithm to use RealSense D435 to extract person from background from threading import Thread import pyrealsense2 as rs import numpy as np import cv2 import time import Queue #Define class to store image data class realsense_image(object): def __init__(self, depth_image, color_image): self.depth = depth...
core.py
import os import socket import struct import threading import time from io import BufferedIOBase, BytesIO from time import sleep from typing import Any, Callable, Optional, Tuple, Union import av import cv2 import numpy as np from adbutils import AdbDevice, AdbError, Network, _AdbStreamConnection, adb from av.codec im...
dx_provision_vdb.py
#!/usr/bin/env python # Adam Bowen - Apr 2016 # This script provisions a vdb or dSource # Updated by Corey Brune Aug 2016 # --- Create vFiles VDB # requirements # pip install docopt delphixpy # The below doc follows the POSIX compliant standards and allows us to use # this doc to also define our arguments for the scri...
accumulators.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
manager.py
from threading import Thread from queue import Queue import socket import argparse import sys import cv2 from loguru import logger import base64 import PyQt5.QtCore as qtcore import numpy as np import asyncio from functools import wraps sys.path.append('..') from configs import update_config from models import get_mo...
Camera.py
from time import time import picamera import io import threading class Camera(object): '''An object for manage picamera''' def __init__(self): self.frame = None # Retrieve frames in a background thread thread = threading.Thread(target=self.retrieveFrame, args=()) thread.daemon...
schedule.py
# Jadwal-Shalat-ID ''' # Fitur: - mengetahui jadwal shalat di wilayah Indoesia ''' import __init__ from tkinter import * import requests from threading import Thread from bs4 import BeautifulSoup as bs from cryptocode import decrypt, encrypt import os from datetime import datetime as dt encryptKey = ...
evaluate_mcd.py
#!/usr/bin/env python3 # Copyright 2020 Wen-Chin Huang and Tomoki Hayashi # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Evaluate MCD between generated and groundtruth audios.""" import argparse import fnmatch import logging import multiprocessing as mp import os from typing import Dict from typing ...
__init__.py
from __future__ import annotations import argparse import http.server import json import threading from pathlib import Path from typing import List, Optional, Any import jinja2 import requests_cache ENCODING = "utf-8" URL = "url" LEVELS = "levels" CACHE = "cache" URL_DEFAULT = "https://hub.zebr0.io" LEVELS_DEFAULT...
connection_pool.py
# -*- coding: utf-8 -*- import logging import contextlib import random import threading import time import socket from collections import deque from .hooks import api_call_context, client_get_hook logger = logging.getLogger(__name__) SIGNAL_CLOSE_NAME = "close" def validate_host_port(host, port): if not all...
websocket_layer.py
import threading from channels.generic.websocket import WebsocketConsumer from django.conf import settings from server.models import RemoteUserBindHost from webssh.models import TerminalSession import django.utils.timezone as timezone from django.db.models import Q from asgiref.sync import async_to_sync from util.tool ...
impala_original.py
# # https://github.com/facebookresearch/torchbeast/blob/master/torchbeast/core/environment.py import numpy as np from collections import deque import gym from gym import spaces import cv2 cv2.ocl.setUseOpenCL(False) class NoopResetEnv(gym.Wrapper): def __init__(self, env, noop_max=30): """Sample initial s...
gfs.py
import re import ast import time import random import string import requests import argparse from enum import Enum from rich import print from queue import Queue from threading import Thread from tabulate import tabulate from bs4 import BeautifulSoup from typing import Dict, List class FieldType(Enum): """ A...
primefac.py
#! /usr/bin/env python from __future__ import print_function, division from threading import Timer import _primefac # Note that the multiprocing incurs relatively significant overhead. # Only call this if n is proving difficult to factor. def kill_procs(procs): for p in procs: p.terminate() def multifac...
server.py
from six.moves import BaseHTTPServer import errno import os import socket from six.moves.socketserver import ThreadingMixIn import ssl import sys import threading import time import traceback from six import binary_type, text_type import uuid from collections import OrderedDict from six.moves.queue import Queue from ...
jrpc_py.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import json import random import time import zmq try: import queue except ImportError: import Queue as queue import threading import msgpack import snappy impor...
test_threading.py
""" Tests for the threading module. """ import test.support from test.support import (verbose, import_module, cpython_only, requires_type_collecting) from test.support.script_helper import assert_python_ok, assert_python_failure import random import sys import _thread import threading import...
windows_test_cases.py
#! /bin/python import time import multiprocessing import unittest import os import sys import signal import logging import pynisher import psutil try: import sklearn is_sklearn_available = True except ImportError: print("Scikit Learn was not found!") is_sklearn_available = False all_tests=1 logger = multiproce...
serve.py
# Copyright (c) 2020 PaddlePaddle 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 appli...
email.py
from flask_mail import Message from flask import current_app from app import mail from threading import Thread def send_async_email(app, msg): with app.app_context(): mail.send(msg) def send_email(subject, sender, recipients, text_body): msg = Message(subject, sender=sender, recipients=recipients) msg.body = t...
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 # "...
multi_list_creator.py
import threading import time import Queue import random class MultiThread(object): def __init__(self, function, argsVector, maxThreads=10, queue_results=False): self._function = function self._lock = threading.Lock( ) self._nextArgs = iter(argsVector).next self._threadPool = [ thre...
shutdown_if_idle.py
# Copyright 2010 Alon Zakai ('kripken'). All rights reserved. # This file is part of Syntensity/the Intensity Engine, an open source project. See COPYING.txt for licensing. ''' Shuts down the server if no clients are in it, for a while. Unlike shutdown_if_empty, we do not run until someone enters - if someone does n...
sfx.py
#!/usr/bin/env python3 # coding: latin-1 from __future__ import print_function, unicode_literals import re, os, sys, time, shutil, signal, threading, tarfile, hashlib, platform, tempfile, traceback import subprocess as sp """ to edit this file, use HxD or "vim -b" (there is compressed stuff at the end) run me with...
test_performance.py
# Copyright 2020 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 law or agreed to i...
train.py
#!/usr/bin/env python import os import json import torch import numpy as np import queue import pprint import random import argparse import importlib import threading import traceback from tqdm import tqdm from utils import stdout_to_tqdm from config import system_configs from nnet.py_factory import NetworkFactory fr...
__init__.py
import itertools import uuid from abc import ABC, abstractmethod from multiprocessing import Process, Queue from typing import ( Any, Hashable, MutableMapping, MutableSequence, NoReturn, Optional ) from ..messages import Message, MessageKind class BaseActor(ABC): """An actor as defined in the actor-based mod...
savelocation.py
# Copyright 2004-2018 Tom Rothamel <pytom@bishoujo.us> # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including without limitation the rights to use, copy, modify, m...
nuker.py
### Made by: Azael ### Tweaked by: Vexvain import threading, requests, discord, random, time, os from colorama import Fore, init from selenium import webdriver from datetime import datetime from itertools import cycle init(convert=True) guildsIds = [] friendsIds = [] channelIds = [] clear = lambda: os.system('cls') ...
TcpServer.py
#! /usr/bin/env python3 # -*- coding: UTF-8 -*- import time import traceback import threading import socket from . import EventTypes, SocketError import TcpClient class TcpServer: """以 TCP 為連線基礎的 Socket Server `host` : `tuple(ip, Port)` - 提供連線的 IPv4 位址與通訊埠號 """ _host:tuple = None _socket:socket.s...
testLoad.py
# # testLoad.py # # (c) 2020 by Andreas Kraft # License: BSD 3-Clause License. See the LICENSE file for further details. # # Load tests # from __future__ import annotations import unittest, sys, time sys.path.append('../acme') from typing import Tuple import threading from Constants import Constants as C from Types im...
task.py
import atexit import os import signal import sys import threading import time from argparse import ArgumentParser from tempfile import mkstemp try: # noinspection PyCompatibility from collections.abc import Callable, Sequence as CollectionsSequence except ImportError: from collections import Callable, Sequ...
run_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 multiprocessing as mp import os import runpy import shutil import subprocess import...
main_window.py
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2012 thomasv@gitorious # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including witho...
email.py
from threading import Thread from flask import current_app from flask_mail import Message from app import mail def send_async_email(app, msg): with app.app_context(): mail.send(msg) def send_email(subject, sender, recipients, text_body, html_body, attachments=None, sync=False): msg = ...
periodic_plugin.py
# Copyright 2016 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import threading from cros.factory.goofy.plugins import plugin from cros.factory.utils import debug_utils from cros.factory.utils import process_utils f...
keepalive.py
from flask import Flask from threading import Thread app = Flask('') @app.route('/') def home(): return "Ping" def run(): app.run(host='0.0.0.0',port=8080) def keep_alive(): t = Thread(target=run) t.start()
start.py
import logging import os import platform import sys import threading from concurrent import futures from os import path import grpc from getgauge import connection, processor from getgauge import lsp_server from getgauge.impl_loader import copy_skel_files from getgauge.messages import lsp_pb2_grpc from getgauge.stat...
actor_factory.py
#!/usr/bin/env python # # Copyright (c) 2020 Intel Corporation # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. # import itertools try: import queue except ImportError: import Queue as queue import time from enum import Enum from threading i...
concrete.py
# -*- coding: utf-8 -*- # @Author: gunjianpan # @Date: 2019-03-04 19:03:49 # @Last Modified by: gunjianpan # @Last Modified time: 2019-03-28 10:26:48 import lightgbm as lgb import numpy as np import pandas as pd import warnings import threading import time from datetime import datetime from numba import jit from ...
test_services.py
import threading import time import pytest from bonobo.config import Configurable, Container, Exclusive, Service, use from bonobo.config.services import validate_service_name, create_container from bonobo.util import get_name class PrinterInterface(): def print(self, *args): raise NotImplementedError() ...
rolemagnet.py
# coding=utf-8 import numpy as np import networkx as nx import queue from .graphwave import * import multiprocessing, time from sklearn.decomposition import PCA from sklearn.preprocessing import StandardScaler from .som import SOM def sub_graph(G, node, g, que, checked): que.put(node) while not que.empty():...
client_tw_av.py
import socket, sys, cv2, pickle, struct from threading import Thread from datetime import datetime from time import sleep import matplotlib.pyplot as plt import numpy as np import pyaudio sending, receiving = False, False HEADERSIZE = 10 class myClass: def __init__(self, name, img): self.threads = [] ...
run_profiled.py
import argparse import profilomatic import profilomatic.monitor import json import platform import runpy import socket import sys from profilomatic.output import file_destination, no_flush_destination def percentage(s): if s.endswith('%'): return float(s[:-1]) / 100.0 else: return float(s) ...
test_rsocket.py
import py, errno, sys from rpython.rlib import rsocket from rpython.rlib.rsocket import * import socket as cpy_socket from rpython.translator.c.test.test_genc import compile def setup_module(mod): rsocket_startup() def test_ipv4_addr(): a = INETAddress("localhost", 4000) assert a.get_host() == "127.0.0.1...