source
stringlengths
3
86
python
stringlengths
75
1.04M
check.py
# -*- coding:utf-8 -*- from PythonMiddleware.notify import Notify from PythonMiddleware.graphene import Graphene from PythonMiddlewarebase.operationids import operations import sys import pymongo import datetime from time import sleep from collections import deque from threading import Thread, Lock from prometheus_cl...
multiprocessing_wall_process_fytype.py
from multiprocessing import * from ctypes import * from fython.fytypes import * x = Real(value=1) print(x[:]) def f(): print(1) print(x[:]) x[:] *= 10 print(x[:]) print(2) if __name__ == '__main__': p = Process(target=f) p.start() p.join() print(3, x[:], p.exitcode)
transform.py
import os import json import multiprocessing import random input_data_path = "/data/disk2/private/zhx/scm/data/all/split" output_data_path = "/data/disk2/private/zhx/scm/data/data/pretrain" os.makedirs(output_data_path, exist_ok=True) q = multiprocessing.Queue() bq = multiprocessing.Queue() file_list = [] cnt = 0 for...
mainUI.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'mainUI.ui' # # Created by: PyQt5 UI code generator 5.13.0 # # WARNING! All changes made in this file will be lost! import os import sys import threading import time import numpy import addFont import cv2 import numpy as np from PIL import Im...
test_client.py
import os import socket import threading import time import msgpack import pytest from pynats import NATSClient @pytest.fixture def nats_url(): return os.environ.get("NATS_URL", "nats://127.0.0.1:4222") def test_connect_and_close(nats_url): client = NATSClient(nats_url, socket_timeout=2) client.conne...
chatserver.py
# chat-server.py import socket import datetime import threading import random PORT = 8500 BUFSIZE = 4096 #SERVERIP = 'localhost' # YOUR IP SERVERIP = '159.65.135.242' clist = [] # Client List cdict = {} pvroom = {} pvdict = {} allroomnumber = [] allroomnumber.append(10001) # create default room pvd...
ha_tool.py
# -*- coding: utf-8 -*- # HA - Tool version 2.1 # Lukas Krämer # MIT License # 2021 import os import re from shutil import move as move from sys import exit as sys_exit import threading from time import sleep as sleep from datetime import datetime import pandas as pd import sqlalchemy from dotenv import...
component.py
# pylint: disable=unused-argument # W0613 Unused argument 'timeout' & 'input' # pylint: disable=redefined-builtin # W0622 Redefining built-in 'input' # pylint: disable=global-statement # W0603 global `_components` import os import sys import copy import time import threading as mt import radical.utils ...
conftest.py
import pytest import time from context import HGECtx, HGECtxError, EvtsWebhookServer, HGECtxGQLServer, GQLWsClient import threading import random from datetime import datetime import sys import os def pytest_addoption(parser): parser.addoption( "--hge-urls", metavar="HGE_URLS", help="csv li...
1mtc_south.py
from __future__ import print_function from pyfrac.utils import pyfraclogger from pyfrac.control import keyboard from pyfrac.acquire import capture import multiprocessing import atexit import json import pika import time import os import logging logging.getLogger('pika').setLevel(logging.DEBUG) logger = pyfraclogger.py...
agent.py
# -*- coding:utf-8 -*- import math import time import numpy as np import torch import torch.multiprocessing as mp from tbase.agents.base.base_agent import BaseAgent from tbase.agents.base.explore import explore, simple_explore from tbase.common.cmd_util import make_env from tbase.common.logger import logger from tba...
fact_proj.py
from functionalities.rsa import RSA_key from Crypto.Util import number from functionalities.sqroot import sqroot import multiprocessing from time import perf_counter from functionalities.time_format import time_format from functionalities.prime_test import gen_primes import json class RSA_cracker(): """Class for t...
static.py
import datetime import telegram from threading import Thread from utility.setting import system_path f = open(f'{system_path}/utility/user.txt') lines = f.readlines() bot = lines[2].strip() user_id = lines[3].strip() f.close() def telegram_msg(text): try: telegram.Bot(bot).sendMessage(chat_id=user_id, te...
LR4.py
""" Licensed under the Unlicense License; you may not use this file except in compliance with the License. You may obtain a copy of the License at https://unlicense.org Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BAS...
__init__.py
#!/usr/bin/env python # encode: utf-8 import collections import itertools import json import logging import multiprocessing import subprocess import sys from multiprocessing import Queue from time import time import numpy import websocket from . import ffmpeg from . import utils log = logging.getLogger(__name__) lo...
Painter.py
import time import cv2 import HandTrackingModule as htm import numpy as np import random from util3d import runtime_init, draw_line, draw_ball, draw_dot, draw_cuboid from interaction import * from gen3d import gen3d, trace3d from math import floor from queue import Queue from threading import Thread import azure.cognit...
thread_example.py
import threading import keyboard import time import numpy as np import sys import sys, time from bledevice import scanble, BLEDevice STOP = 0 MOVE_FWD = 1 MOVE_BWD = 2 MOVE_R = 3 MOVE_L = 4 IDLE = 9 F = 5 S = 6 Mon = 7 Moff = 8 direction = 1; state = 0 keycode = "" Device1 = BLEDevice("DD:43:89:16:43:81") Device2 =...
app.py
import asyncio import functools import json import logging import os.path import threading import time import schedule from lokbot.async_farmer import AsyncLokFarmer from lokbot.farmer import LokFarmer from lokbot import project_root, builtin_logger def find_alliance(farmer: LokFarmer): while True: alli...
test_basic.py
import re import sys import time import uuid from datetime import datetime from threading import Thread import pytest import werkzeug.serving from werkzeug.exceptions import BadRequest from werkzeug.exceptions import Forbidden from werkzeug.exceptions import NotFound from werkzeug.http import parse_date from werkzeug....
websocket30402.py
#ref: https://gist.github.com/rich20bb/4190781 # # Set COMM Port (see: ser.port) # # Usage: # [Anaconda2] C:\Users\cruncher>python websocket30402.py import time import struct import socket import hashlib import base64 import sys from select import select import re import logging from threading import Thread import sig...
server.py
import asyncio import multiprocessing import os import secrets import socket import stat import sys import traceback from collections import deque from functools import partial from inspect import isawaitable from ipaddress import ip_address from signal import SIG_IGN, SIGINT, SIGTERM, Signals from signal import signa...
system.py
# Copyright 2014-2019 Chris Cummins <chrisc.101@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 a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
SyncServiceClient.py
""" SyncServiceClient is a client SDK of the Sync-Service written in Python Exported classes: Client and MetaData """ import json import shutil import sys import threading import string import time from UnixSocketSupport import ExtendedPoolManager import urllib3 """ MetaData is used to represent the metadata o...
build_database.py
#!/usr/bin/env python3 # Copyright (c) 2021 Burak Can # # This software is released under the MIT License. # https://opensource.org/licenses/MIT """Build allowed documents database for emrtd_face_access""" import argparse import threading import PySimpleGUI as sg from smartcard.Exceptions import CardConnectionExcep...
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 ...
resource_owner_grant.py
import json import logging import os import signal import sys import urllib2 from multiprocessing.process import Process from urllib2 import HTTPError from wsgiref.simple_server import make_server sys.path.insert(0, os.path.abspath(os.path.realpath(__file__) + '/../../../')) from oauth2.compatibility import parse_qs...
agent_a3c_hg.py
#!/usr/bin/env python from __future__ import print_function import numpy as np import cv2 import tensorflow as tf import threading import sys import time import os def MakeDir(path): try: os.makedirs(path) except: pass lab = False load_model = False train = True test_display = False test...
cw-2.py
from __future__ import print_function class AssertException(Exception): pass _print = print '''Fix the dreaded Unicode Error Trap''' def print(*args, **kwargs): from sys import stdout sep = kwargs.get('sep', ' ') end = kwargs.get('end', '\n') file = kwargs.get('file', stdout) def _repl...
run.py
import socket import time import threading import hashlib import json from base64 import b64encode, b64decode from flask import Flask, jsonify, request from Crypto.Cipher import AES class Run: def __init__(self): self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.s.setsockopt(socket....
interaction_view.py
import enum import logging from threading import Thread from PySide2 import QtWidgets, QtCore from .view import BaseView try: import nclib except ImportError: nclib = None try: import keystone except ImportError: keystone = None try: import archr except ImportError: archr = None _l = logging...
dataset_test.py
# Lint as: python3 # Copyright 2019 DeepMind Technologies Limited. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
ssh_interactive_commnds.py
from __future__ import print_function from __future__ import absolute_import from builtins import range from builtins import object import sys import os import select import socket import paramiko import threading import multiprocessing import time from . import commands import subprocess from fabric.api import * from ...
gpsd_fake.py
import time import socket import threading VERSION_HEADER = b'{"class":"VERSION","release":"3.17","rev":"3.17","proto_major":3,"proto_minor":12}\n' WATCH_COMMAND = b'?WATCH={"enable":true,"json":true}\n' GPSD_OUTPUT = """ {"class":"DEVICES","devices":[{"class":"DEVICE","path":"/dev/ttyO4","driver":"NMEA0183","activate...
GardenManager.py
#GardenManager.py from AnalogProbe import * from Pump import * from MCP3008 import MCP3008 from tkinter import * import time import threading upperLimit = 10.50 #Starting pH for upper limit lowerLimit = 8.50 #Starting pH for lower limit def addToUpperLimit(): global upperLimit if(upperLimit < 13.9): ...
test_session.py
import os import threading import time import socket import pytest import cherrypy from cherrypy._cpcompat import ( copykeys, json_decode, HTTPConnection, HTTPSConnection ) from cherrypy.lib import sessions from cherrypy.lib import reprconf from cherrypy.lib.httputil import response_codes from cherrypy.test i...
feature_shutdown.py
#!/usr/bin/env python3 # Copyright (c) 2018 The Bitcoin Core developers # Copyright (c) 2018-2021 The EMRALS Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test emralsd shutdown.""" from test_framework.test_fra...
vec_env.py
import numpy as np from multiprocessing import Process, Pipe def worker(remote, parent_remote, env): parent_remote.close() env.create() try: done = False while True: cmd, data = remote.recv() if cmd == 'step': if done: ob, info = e...
server.py
# Copyright 2015 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...
server_message.py
import threading import socket host = '127.0.0.1' port = 55554 server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.bind((host, port)) server.listen() clients = [] nicknames = [] def broadcast(message): for client in clients: client.send(message) def handle(client): while True: ...
fio_rebuild.py
import fio import initiator import json import lib import pos.env import target import threading import time import traceback from datetime import datetime def create_fio(tc, now_date, init, test_target, time_based): skip_workload = False fio_cmdset = [] rw = tc[0] bs = tc[1] iodepth = tc[2] t...
context_test.py
import shutil import tempfile import threading try: import greenlet except ImportError: greenlet = None try: import stackless except ImportError: stackless = None from pytest import mark, raises from sqlalchemy_imageattach.context import (ContextError, current_store, ...
imceventhandler.py
# Copyright 2013 Cisco Systems, 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 writin...
robolink.py
# Copyright 2015 - RoboDK Inc. - https://robodk.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 a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agr...
chunked_upload.py
# -*- coding: utf-8 -*- from __future__ import division from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals from future import standard_library standard_library.install_aliases() from builtins import str from builtins import next from builtins import ran...
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...
interface.py
#!/usr/bin/python3 -OO # Copyright 2007-2020 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 late...
encoder.py
#!/usr/bin/env python # # Copyright (c) 2014-2016 Hayaki Saito # # 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, m...
analysis_subprocess.py
##################################################################### # # # /analysis_subprocess.py # # # # Copyright 2013, Monash University ...
test_gateway.py
import functools import time from threading import Thread import numpy as np import pytest from jina import Document from jina.enums import CompressAlgo from jina.flow import Flow from tests import random_docs @pytest.mark.parametrize('compress_algo', list(CompressAlgo)) def test_compression(compress_algo, mocker):...
sub.py
from time import time import message_filters from std_msgs.msg import String from geometry_msgs.msg import TransformStamped import rospy def callback(s1,s2): print('b') print(s1.header.frame_id) print(s2.header.frame_id) t1 = TransformStamped() t2 = TransformStamped() def callback1(s1): t1 = s1 ...
test_run_modules.py
# # NEON AI (TM) SOFTWARE, Software Development Kit & Application Development System # # All trademark and other rights reserved by their respective owners # # Copyright 2008-2021 Neongecko.com Inc. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the foll...
image_server.py
import socket import threading #---------<CONFIG>-----------# HEADER = 64 # number of bytes in header - will be used to convey how many bytes will be sent later PORT = 5050 SERVER = "192.168.5.11"#"localhost"#192.168.5.11" # replace with LAN IPv4 address ADDR = (SERVER , PORT) FORMAT = 'utf-8' DISCONNECT_MESSAGE = "!D...
datasets.py
import pyrealsense2 as rs import glob import math import os import random import shutil import time from pathlib import Path from threading import Thread import cv2 import numpy as np import torch from PIL import Image, ExifTags from torch.utils.data import Dataset from tqdm import tqdm from utils.utils import xyxy2...
fake_ssh.py
#!/usr/bin/env python """Fake SSH Server Utilizing Paramiko""" import argparse import threading import socket import sys import os import traceback import paramiko import json from getmac import get_mac_address import email_alerts def load_auth_file(filename): with open(filename, "r") as auth_file: auth =...
kinesisanalyticsv2_demo.py
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 """ Purpose Shows how to use the AWS SDK for Python (Boto3) with Amazon Kinesis and version 2 of the Amazon Kinesis Data Analytics API to create an application that reads data from an input stream, uses SQL code...
views.py
import os import json import logging from datetime import date from threading import Thread from django.shortcuts import render, get_object_or_404 from django.http import HttpResponseRedirect, HttpResponseForbidden, \ HttpResponseNotFound from django.contrib.auth import authenticate, login, logout from django.urls...
fn_api_runner.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...
core.py
""" ************ MQTTany Core ************ :Author: Michael Murton """ # Copyright (c) 2019-2021 MQTTany contributors # # 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, i...
scripts_regression_tests.py
#!/usr/bin/env python """ Script containing CIME python regression test suite. This suite should be run to confirm overall CIME correctness. """ import glob, os, re, shutil, signal, sys, tempfile, \ threading, time, logging, unittest, getpass, \ filecmp, time from xml.etree.ElementTree import ParseError LIB...
past.py
"""An interpreter for My Unreliable Past programs https://esolangs.org/wiki/My_Unreliable_Past """ import logging import string import sys import threading from random import choice, random, randrange from esolang import INTERPRETERS logger = logging.getLogger(__name__) if sys.version_info.major < 3: chr = uni...
executorselenium.py
import os import socket import sys import threading import time import traceback import urlparse import uuid from .base import (ExecutorException, Protocol, RefTestExecutor, RefTestImplementation, TestExecutor, TestharnessEx...
test_pooling.py
# Copyright 2009-present 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 wri...
Android-Termux-scrypt.py
"""The companion app for my Android Termux scrypt""" from socket import socket, AF_INET, SOCK_STREAM import threading import pyaes import sys import subprocess import os import time PORT = 8888 PORT2 = 8889 # This needs changed to a file IP = '0.0.0.0' try: PASSWORD = open('password.conf', 'r').read() except: ...
pyminer.py
#!/usr/bin/python # # Copyright (c) 2011 The Bitcoin developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # import time import json import pprint import hashlib import struct import re import base64 import httplib import...
scanner.py
# Copyright (c) 2021-2025 Penetrum LLC <contact@penetrum.com> (MIT License) from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import json import shutil import pathlib import binascii import threading import platform from stat import ( S_IREAD,...
Bego.py
# -*- coding: utf-8 -*- #baru import LINETCR from LINETCR.lib.curve.ttypes import * from datetime import datetime from PyDictionary import PyDictionary from bs4 import BeautifulSoup from mergedict import MergeDict from mergedict import ConfigDict from gtts import gTTS from pyowm import OWM from enum import Enum #from ...
test_tune_restore.py
# coding: utf-8 import signal from collections import Counter import os import shutil import tempfile import time from typing import List import unittest import skopt import numpy as np from hyperopt import hp from nevergrad.optimization import optimizerlib from zoopt import ValueType from hebo.design_space.design_spa...
main_view.py
import os import sys import torch from PyQt5 import QtWidgets from PyQt5.QtGui import QPixmap, QMovie from PyQt5.QtWidgets import QMainWindow from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot from torchvision.utils import save_image from PIL import Image from views.main_view_ui import Ui_MainWindow class Stream(...
train_A3C.py
from __future__ import print_function from __future__ import division import threading import multiprocessing import os import argparse from time import sleep import tensorflow as tf from env_doom import Doom from net import Net from worker import Worker from utils import print_net_params_number def main(args): ...
test_api.py
#!/usr/bin/python ############################################################################## # Copyright 2016-2017 Rigetti Computing # # 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 ...
localads_mwm_to_csv.py
import csv import ctypes import logging import os import sys from multiprocessing import Pool from multiprocessing import Process from multiprocessing import Queue from zlib import adler32 from mwm import MetadataField from mwm import Mwm from mwm.ft2osm import read_osm2ft HEADERS = { "mapping": "osmid fid mwm_id...
test_output.py
import subprocess import sys import pytest import re import ray from ray._private.test_utils import run_string_as_driver_nonblocking @pytest.mark.skipif(sys.platform == "win32", reason="Failing on Windows.") def test_autoscaler_infeasible(): script = """ import ray import time ray.init(num_cpus=1) @ray.remote...
process_replay.py
#!/usr/bin/env python3 import importlib import os import sys import threading import time import signal from collections import namedtuple import capnp from tqdm import tqdm import cereal.messaging as messaging from cereal import car, log from cereal.services import service_list from common.params import Params from ...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
fault_tolerance_test.py
# Lint as: python3 # 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 requ...
connector.py
from socket import socket,AF_INET,SOCK_STREAM,gethostbyname,gethostname,SOL_SOCKET,SO_REUSEADDR from threading import Thread,Lock from time import sleep from exe.proto import * import traceback xlock=Lock() s=socket(AF_INET,SOCK_STREAM) s.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) s.bind(('',5132)) s.listen(10) def a...
hub.py
import socket from threading import Thread, Lock from .common import generateSocket from .transport import Transport ################# ### CONSTANTS ### ################# from .constants import PORT, TIMEOUT, SIZE from .constants import MAX_RETRIES ############################################################### ###...
utils.py
# coding: utf-8 # This file is a part of VK4XMPP transport # © simpleApps, 2014. """ Contains useful functions which used across the modules """ import threading import xmpp import urllib from socket import error from writer import * isNumber = lambda obj: (not execute(int, (obj,), False) is None) def execute(hand...
transfer.py
import argparse import json import os import queue import threading import time import uuid from argparse import RawTextHelpFormatter from datetime import datetime from pathlib import Path try: from watchdog.events import PatternMatchingEventHandler from watchdog.observers import Observer except ImportError: ...
test_tpe.py
from unittest import TestCase, main import os, pty import curses.ascii import threading from faker import Faker from payment_card_identifier import VISA from telium.payment import TeliumData from telium import * class FakeTeliumDevice: def __init__(self): self._master, self._slave = pty.openpty() ...
proxy.py
import sys import socket import threading # this is a pretty hex dumping function directly taken from # http://code.activestate.com/recipes/142812-hex-dumper/ def hexdump(src, length=16): result = [] digits = 4 if isinstance(src, unicode) else 2 for i in xrange(0, len(src), length): s = src[i:i+l...
run.py
from OnlineHeart import OnlineHeart from Silver import Silver from LotteryResult import LotteryResult from Tasks import Tasks from connect import connect from rafflehandler import Rafflehandler import asyncio from login import login from printer import Printer from statistics import Statistics from bilibili import bili...
clientserver.py
#!/usr/bin/python3.4 # -*- coding: utf-8 -*- # vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab # 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 ...
__init__.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import bisect import difflib import gc import http.client import hashlib import heapq import lz4.frame import math import mmap import operator import os import re import ...
load_ui.py
from tkinter import * import tkinter as tk from tkinter import messagebox import time from tkinter import filedialog import main import ntpath from tkinter.ttk import Progressbar import time import threading from tkinter import HORIZONTAL import subprocess import os class Splash(tk.Toplevel): def __init__(self, pa...
socket_wait.py
from . import log import socket import threading import time HOST = '127.0.0.1' # 标准的回环地址 (localhost) PORT = 65432 # 监听的端口 (非系统级的端口: 大于 1023) logger = log.logger def wait_signal_and_run(events_to_run): logger.info('正在判斷信號是否為True。。。') while True: time.sleep(1) for func in events_to_run: ...
test_read_only_job_plugin.py
# Copyright 2022 The AI Flow Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
base.py
import subprocess import json from threading import Lock, Thread import io import os import sys import locale try: from json import JSONDecodeError except ImportError: JSONDecodeError = ValueError executable_path = os.path.join( os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'executable'...
ytdl.py
import os if "downloads" not in os.listdir(): os.mkdir("downloads") import threading import queue import youtube_dl import player ydl_opts = { "format": "bestaudio/best" } ydl = youtube_dl.YoutubeDL(ydl_opts) q = queue.Queue() def worker(): while True: item = q.get() ...
tello.py
import threading import socket import time import datetime import struct import sys import os from . import crc from . import logger from . import event from . import state from . import error from . import video_stream from . utils import * from . protocol import * from . import dispatcher log = logger.Logger('Tello...
path.py
from __future__ import absolute_import, unicode_literals import logging import os import stat import string import threading from mopidy import compat, exceptions from mopidy.compat import queue, urllib from mopidy.internal import encoding, xdg logger = logging.getLogger(__name__) XDG_DIRS = xdg.get_dirs() def ...
test_timeoutqueue.py
# Copyright (c) 2001-2007 Twisted Matrix Laboratories. # See LICENSE for details. """ Test cases for timeoutqueue module. """ import time from twisted.python import timeoutqueue from twisted.trial import unittest, util from twisted.internet import reactor, interfaces timeoutqueueSuppression = util.suppress( me...
SerialClient.py
##################################################################### # Software License Agreement (BSD License) # # Copyright (c) 2011, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions ...
producer_workload_burst.py
import requests import time from kafka import KafkaProducer from function_chains_pb2 import LambdaFunction, ChainNode, ChainState import numpy as np import json import datetime from threading import Thread concurrency = 1 def main(): # NOTE: you can set invoke count of each function below the chain definitions (t...
fib_process.py
import time import multiprocessing from multiprocessing import Process def fib(number): if number <= 1: return 1 return fib(number - 2) + fib(number - 1) if __name__ == '__main__': processes = [] for _ in range(5): p = Process(target=fib, args=(30,)) processes.append(p) start =...
daemon_thread.py
#!/usr/bin/env python3 import logging import threading import time def thread_function(name): logging.info("Thread %s: starting", name) time.sleep(2) logging.info("Thread %s: finishing", name) if __name__ == "__main__": format = "%(asctime)s: %(message)s" logging.basicConfig(format=format, level...
pycroservices.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Copyright 2016 Satoyuki Tsukano 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 U...
test.py
import argparse import atexit import crc16 import serial import sys import time import threading import traceback magicpacket = [0xde, 0xad, 0xbe, 0xef] parser = argparse.ArgumentParser() parser.add_argument("-p", "--port", help="Serial port name") parser.add_argument("-b", "--baud", help="Baud rate for serial port",...
onosnet.py
#!/usr/bin/python import itertools import os import signal import sys from argparse import ArgumentParser from subprocess import call from threading import Thread from time import sleep import gratuitousArp from mininet.cli import CLI from mininet.examples.controlnet import MininetFacade from mininet.link import TCLin...
map_stage_op_test.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...