source
stringlengths
3
86
python
stringlengths
75
1.04M
test_with_dummy_instance.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals, print_function import itertools as it, operator as op, functools as ft import unittest, contextlib, hashlib, atexit, signal, threading, select, errno import os, sys, io, time, subprocess, tempfile, shutil, socket if sys.version_info.major > 2: unicode =...
mainwindow.py
# -*- coding: utf-8 -*- # # Copyright © Spyder Project Contributors # Licensed under the terms of the MIT License # (see spyder/__init__.py for details) """ Spyder, the Scientific Python Development Environment ===================================================== Developped and maintained by the Spyder Pro...
frame_top.py
from tkinter import Frame, Label, Button, messagebox, filedialog as fd from tkinter.constants import DISABLED, E, NORMAL, RAISED, SUNKEN, X import pandas import requests from threading import Thread import json from messages import messages from utils import config from ibuki import Ibuki class TopFrame(Frame): d...
transaction_test.py
import time from threading import Thread import hazelcast import hazelcast.transaction from hazelcast.errors import TransactionError from tests.base import SingleMemberTestCase class TransactionTest(SingleMemberTestCase): @classmethod def configure_client(cls, config): config["cluster_name"] = cls.cl...
microservice.py
import argparse import importlib import json import logging import multiprocessing as mp import os import sys import threading import time from distutils.util import strtobool from typing import Callable, Dict from seldon_core import __version__, persistence from seldon_core import wrapper as seldon_microservice from ...
comstation.py
import threading import typing import nacl.signing import time import typing as tp import logging.config from .istation import IStation, StationData, STATION_VERSION, Measurement from ..drivers.sds011 import SDS011_MODEL, SDS011 from collections import deque from connectivity.config.logging import LOGGING_CONFIG logg...
threadpools.py
from polltask.tasks.thin_device.db.api import API from xmlrpclib import ServerProxy from oslo_config import cfg from Queue import Queue from polltask import logger import subprocess import threading import socket LOG = logger.get_default_logger(__name__) CONF = cfg.CONF CONF.import_opt('addrip', 'polltask.tasks.thin_d...
__main__.py
import curses import sys import threading import re import castero from castero import helpers from castero.config import Config from castero.database import Database from castero.display import Display from castero.player import Player def main(): database = Database() # update fields in help menu text ...
test_failure.py
import json import logging import os import sys import tempfile import threading import time import numpy as np import pytest import redis import ray import ray.ray_constants as ray_constants from ray.cluster_utils import Cluster from ray.test_utils import ( relevant_errors, wait_for_condition, wait_for_e...
ThreadTests.py
############################################################################## # # Copyright (c) 2002 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOF...
client.py
from ftpserver import FTP_HOST, FTP_PORT import socket from threading import Thread import os import tkinter as tk from tkinter import * from tkinter import font from tkinter.font import * from tkinter import filedialog from ftplib import FTP import re FTP_HOST = '192.168.15.141' FTP_PORT = 21 BUFFERSIZE = 4096 filen...
server.py
import socket import threading import time # Address HOST = '' # server address, bind self PORT = 8089 # 9999 print('Host:', HOST, 'Port :', PORT) # Configure socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((HOST, PORT)) print('bind ok') s.listen(3) # Max number of clients print('Waiting for connec...
build_mscoco_data.py
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
baseline_racer_image_benchmarker.py
from argparse import ArgumentParser import airsimneurips as airsim import time import utils import threading import numpy as np import cv2 from baseline_racer import BaselineRacer class BaselineRacerImageBenchmarker(BaselineRacer): def __init__(self, img_benchmark_type = 'simGetImage', dr...
test_codegen_vulkan.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...
node_3.py
import socket import multiprocessing as mp import time import json node_id = 3 #stored_string = "" nodes = [1,2,3,4,5] manager = mp.Manager() node_wise_write_update = manager.list([0]*5) stored_string = manager.list([""]) node_status = [0,0,0,0,0] leader_node_id = 0 start = time.time() def conver...
gimbalWasp02.py
import cv2 import sys import time import numpy import random from multiprocessing import Process from multiprocessing import Queue from picamera.array import PiRGBArray from picamera import PiCamera from adafruit_servokit import ServoKit kit = ServoKit(channels=8) kit.servo[0].angle = 110 # y kit.servo[1].angle = 9...
dlXossip.py
####################################################################################################################### # Image Downloader # #This code is to get links to images from image boards and download it responsibly # # Input variables: #-->Forum Thread number #-->Thread Start Page Number #-->Thread End...
multiple_vn_vm_test.py
# Need to import path to test/fixtures and test/scripts/ # Ex : export PYTHONPATH='$PATH:/root/test/fixtures/:/root/test/scripts/' # # n specific tests, # You can do 'python -m testtools.run -l tests' # Set the env variable PARAMS_FILE to point to your ini file. Else it will try to pick params.ini in PWD # import os fr...
emu.py
import asyncio import sys, socket import threading controller_ip = ('192.168.100.2', 5555) def udpProcess(): global controller_ip UDP_HOST = '' UDP_PORT = 5555 def print_response(conn, e): global controller_ip conn.bind(('0.0.0.0', 5556)) print("Init udp reader") whil...
pman.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import abc import time import os import threading import zmq from webob import Response import psutil import queue from functools import partial import platform import multiprocessing import inspect import json import ast import sh...
mongotriggers.py
from .mongodtriggers import MongodTrigger import threading """Class for manipulating notifications from MongoDB """ class MongoTrigger(object): def __init__(self, conn, since=None): """Creates MongoTriggers instance The object uses a defered context to provide notification on a differen...
process.py
"""diesel's async I/O event hub meets multiprocessing. Let's you run CPU intensive work in subprocesses and not block the event hub while doing so. """ import multiprocessing as mp import traceback from diesel import runtime from diesel import core from diesel.util.queue import Queue def spawn(func): """Spawn ...
test_threading.py
# expected: fail # Very rudimentary test of threading module import test.test_support from test.test_support import verbose, cpython_only from test.script_helper import assert_python_ok import random import re import sys thread = test.test_support.import_module('thread') threading = test.test_support.import_module('t...
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...
collectionModule.py
""" Sample structure for a collection point module. This module describes the basic uses of SimpleSensor. To make your own module, this is a good place to start. """ from simplesensor.collection_modules.nfc_bcard_reader import moduleConfigLoader as configLoader from simplesensor.shared import Message, ThreadsafeLogger...
test_component.py
#!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 import unittest from rapidsms.component import Component, Receiver import threading, time class TestComponent(unittest.TestCase): def test_router (self): c = Component() self.assertEquals(c.router, None, "no router set yet") c._router = "(...
experimental.py
from __future__ import absolute_import, print_function import audioop # Operates on sound fragments consisting of signed integer samples 8, 16 or 32 bits wide, stored in Python strings. import datetime # Supplies classes for manipulating dates and times in both simple and complex ways import multiprocessing # A pac...
Mandelbrot.py
import sys, random, math from PyQt5.QtWidgets import * from PyQt5.QtCore import Qt from PyQt5.QtGui import QPainter, QColor from multiprocessing import Process xMin = -3 xMax = 3 yMin = -3 yMax = 3 #widthScale = 3 #heightScale = 3 zoomLevel = 4 class Mandelbrot(QWidget): def __init__(self): super().__ini...
demo_threads2.py
# Python program to illustrate the concept # of threading # importing the threading module import threading import time def print_cube(num): """ function to print cube of given num """ time.sleep(5) print("Cube: {}".format(num * num * num)) def print_square(num): """ function to print s...
gui.py
# -*- coding: utf-8 -*- """ Graphical User interface for the SNN conversion toolbox. Features -------- - Allows setting parameters and what tools to use during an experiment. - Performs basic checks that specified parameters are valid. - Preferences can be saved and reloaded. - Tooltips explain the fu...
retrieval.py
from cadmus.retrieval.get_request import get_request from cadmus.parsing.xml_response_to_parse_d import xml_response_to_parse_d from cadmus.parsing.doctype import doctype from cadmus.evaluation.evaluation_funct import evaluation_funct from cadmus.retrieval.complete_html_link_parser import complete_html_link_parser from...
test_case.py
import asyncio import datetime import logging import threading import unittest from asyncio import Queue as AsyncQueue from time import sleep from typing import Any, Dict import grpc import grpc_testing from cryptography import x509 from cryptography.hazmat.primitives import hashes, serialization from cryptography.haz...
depart.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- import pypot.robot import time import json import math import sys import threading import time import queue from serial import Serial def dist(a,b): return math.sqrt((a*a)+(b*b)) def get_y_rotation(x,y,z): radians = math.atan2(x, dist(y,z)) r...
audio_service.py
import os import re import time import wave import commons import pyaudio import multiprocessing import network_service as nS def search_device(): pa = pyaudio.PyAudio() audio_device = None # for i in range(0, pa.get_device_count()): # print(pa.get_device_info_by_index(i)) for i in range(0, pa...
server.py
# server.py # Run http server for bitcoin mixing service # # HingOn Miu # https://docs.python.org/3/library/http.server.html import io import random import string import json import time import socket import threading from socketserver import ThreadingMixIn from http.server import HTTPServer, BaseHTTPRequestHandler f...
main.py
# coding: UTF-8 import sys import time import itertools import json import numpy as np from numpy.fft import fft from collections import deque import threading as th import flask as fl from flask import Flask, render_template, request, Response, redirect, url_for from server import MuseServer from search_yt_by_word im...
params.py
#!/usr/bin/env python3 """ROS has a parameter server, we have files. The parameter store is a persistent key value store, implemented as a directory with a writer lock. On Android, we store params under params_dir = /data/params. The writer lock is a file "<params_dir>/.lock" taken using flock(), and data is stored in...
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...
__init__.py
import operator, math, queue, threading, pickle from nltk.tokenize import RegexpTokenizer from nltk.stem import PorterStemmer from nltk.corpus import stopwords as stopwords_from_nltk # stopwords from nltk # {‘ourselves’, ‘hers’, ‘between’, ‘yourself’, ‘but’, ‘again’, ‘there’, ‘about’, ‘once’, ‘during’, ‘out’, ‘very’,...
exchange_rate.py
from datetime import datetime import inspect import requests import sys import os import json from threading import Thread import time import csv import decimal from decimal import Decimal from .bitcoin import COIN from .i18n import _ from .util import PrintError, ThreadJob # See https://en.wikipedia.org/wiki/ISO_42...
BlindSQLiBooleanBased.py
import requests from queue import Queue from threading import Thread import threading from time import sleep db =[] def inject_simple(url:str,query:str,queue): reference = 'Blad3' for i in range(1, 10): for j in range(ord('a'), ord('u') + 1): montagem =f"{url} and substring( ( {query} ), {str(i)...
example_userdata_stream.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # File: example_userdata_stream.py # # Part of ‘UNICORN Binance WebSocket API’ # Project website: https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api # Documentation: https://oliver-zehentleitner.github.io/unicorn-binance-websocket-api # PyPI: https://p...
sender.py
import redis import re import time import json import logging import random from threading import Thread from . import defaults from . import common from .pipeline import ( from_pipeline, send_to_pipeline_execute, ) from .utils import ( checked_order, check_connect_worker ) class Sender(common.Init...
gdb_test.py
# pyOCD debugger # Copyright (c) 2015-2020 Arm Limited # SPDX-License-Identifier: Apache-2.0 # # 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...
rplidar-save.py
'''Simple and lightweight module for working with RPLidar rangefinder scanners. Usage example: >>> from rplidar import RPLidar >>> lidar = RPLidar('/dev/ttyUSB0') >>> >>> info = lidar.get_info() >>> print(info) >>> >>> health = lidar.get_health() >>> print(health) >>> >>> for i, scan in enumerate(lidar.iter_scans()):...
server.py
import uvicorn from fastapi import FastAPI from pydantic import BaseModel import os import logging import json from google.protobuf import any_pb2 import grpc import time from threading import Thread import sys import redis import cache import service_pb2 import service_pb2_grpc import boto3 s3client = None app = Fa...
window.py
import pygame import pygame_menu import sys import time import queue import clientNetwork as cn from threading import Thread pygame.init() pygame.display.set_caption('BUBBLE TROUBLE ONLINE') surface = pygame.display.set_mode((800, 600)) username = 'default' clock = pygame.time.Clock() playerId = -1 withId = -1 rivalU...
dense_update_ops_no_tsan_test.py
# Copyright 2015 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. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
ArnoldRenderTest.py
########################################################################## # # Copyright (c) 2012, John Haddon. All rights reserved. # Copyright (c) 2013, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that ...
eye_cam.py
#!/usr/bin/python from __future__ import absolute_import, division, print_function, unicode_literals """ Example showing what can be left out. ESC to quit""" import demo import pi3d import numpy as np import picamera import picamera.array import threading import time import io from math import cos, sin, radians SIZE ...
MessageHandler.py
########################################################################## # # Copyright (c) 2007-2013, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redis...
dqn_atari.py
#!/usr/bin/env python3 import ptan import argparse import torch.optim as optim import torch.multiprocessing as mp from tensorboardX import SummaryWriter from lib import dqn_model, common, atari_wrappers PLAY_STEPS = 4 def make_env(params): env = atari_wrappers.make_atari(params['env_name']) env = atari_wr...
variable_scope.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...
object_detection_tf_multiprocessing.py
import os import tarfile import tensorflow as tf import multiprocessing from multiprocessing import Queue import time import argparse import logging import numpy as np import cv2 from myutil import downloadutil, fps_measure, queue_seq from object_detection.utils import label_map_util from object_detection.utils impo...
trustedcoin.py
#!/usr/bin/env python # # Electrum - Lightweight Bitcoin Client # Copyright (C) 2015 Thomas Voegtlin # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including without...
test_focuser.py
import time import pytest from threading import Thread from pocs.focuser.simulator import Focuser as SimFocuser from pocs.focuser.birger import Focuser as BirgerFocuser from pocs.focuser.focuslynx import Focuser as FocusLynxFocuser from pocs.camera.simulator import Camera from pocs.utils.config import load_config pa...
screenshot.py
#!/usr/bin/env python # @license # Copyright 2020 Google 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 applicab...
mult-tcpServer.py
#!/usr/bin/env python import socket import multiprocessing #create a function that handles the data received from the client def clientHandler(client_socket,client_ip, client_port): data ="test" while data: data = client_socket.recv(1024) print "Received %s from Client %s:%d" %(data, client_ip, client_port) ...
listener.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author: Vargas Hector <vargash1> # @Date: Sunday, April 10th 2016, 11:18:37 pm # @Email: vargash1@wit.edu # @Last modified by: vargash1 # @Last modified time: Tuesday, April 12th 2016, 5:06:34 am import multiprocessing from vraspi import ultrasonic, motion, light, t...
payment_service.py
# Copyright © 2019 Province of British Columbia # # 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...
uart_file_capture.py
## Script para capturar archivos o datos entrantes por puerto serial from functions.serial_ports import * import serial import threading import time import sys import os import hashlib ## Parameters # BAUDRATE = 1041666 BAUDRATE = 115200 DATASIZE = 26240 # bytes PORT = 'COM30' in_buf = bytes('', 'utf-8') # buffer d...
patcher_test.py
import os import shutil import sys import tempfile import six import tests base_module_contents = """ import socket import urllib print("base {0} {1}".format(socket, urllib)) """ patching_module_contents = """ from eventlet.green import socket from eventlet.green import urllib from eventlet import patcher print('pa...
worker.py
import argparse import copy import os import sys import os.path import glob import json import random import shutil import subprocess import tempfile import traceback import logging import uuid import socket from time import sleep, gmtime, strftime import datetime import threading from flask import Flask import arch...
train_ensemble.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 socket import error as SocketError import errno import re from tqdm import tqdm from utils import stdout_to_tqdm from config impo...
pyi.py
import tkinter as tk import psycopg2 import pickle import time, calendar, requests, datetime try: conn = psycopg2.connect(database="postgres", user="postgres", password="Contec123", host="10.10.100.120") print("connected") except: print ("I am unable to connect to the database") motions = [] stationMotions = {} ...
client_server_test.py
# # # # @rpc.client() # # class PingClientStub(RPCClient): # # # # @rpc.method(PingMessageRequest, PingMessageResponse) # # def ping(self, ping_message): # # pass # # # # @rpc.server() # # class PingServer(RPCServer): # # # # @rpc.handler(PingMessageRequest, PingMessageResponse) ...
main.py
import subprocess, os, sys, random, threading, socket, time, SocketServer import SSDPServer import LocastService from templates import templates from functools import partial from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer from multiprocessing import Process def clean_exit(): sys.stderr.flush() ...
server.py
#!/usr/bin/env python """ Dummy server used for unit testing. """ from __future__ import print_function import errno import logging import os import random import string import sys import threading import socket from tornado.platform.auto import set_close_exec import tornado.wsgi import tornado.httpserver import tor...
nplayer.py
import threading,time,traceback,json,sys,os os.chdir(os.path.dirname(os.path.abspath(sys.argv[0]))) #switch to script directory import child def sanitize(path): #to prevent directory traversal return path.replace("/","").replace("\\","") mode = "" #parser for args: -d = debug mode, -p path = ...
worker_test.py
# -*- coding: utf-8 -*- # # Copyright 2012-2015 Spotify AB # # 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...
test_joinablequeue_simple_inverted.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # @autor: Ramón Invarato Menéndez # @version 1.0 import multiprocessing from quick_queue.quick_queue import QJoinableQueue """ Execute this script to see result in console Add some values to QJoinableQueue """ def _process(qjq): qjq.put("A") qjq.put("B") ...
icub.py
#!/usr/bin/python # The MIT License (MIT) # # Copyright (c) 2017 Massimiliano Patacchiola # # 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 ...
api_test.py
#!/usr/bin/env vpython # Copyright 2014 The LUCI Authors. All rights reserved. # Use of this source code is governed under the Apache License, Version 2.0 # that can be found in the LICENSE file. # Disable 'Access to a protected member', Unused argument', 'Unused variable'. # pylint: disable=W0212,W0612,W0613 # pylint...
socket-preview-progs.py
""" same socket, but talk between independent programs too, not just threads; server here runs in a process and serves both process and thread clients; sockets are machine-global, much like fifos: don't require shared memory """ from socket_preview import server, client # both use same port number import sys, ...
chat.py
import os import time from threading import Thread, Lock from queue import deque from . import utils from . import config def notice(txt, color=False): "print notice" if color: txt = config.Col.WARNING + txt + config.Col.ENDC print(txt) def stats(txt, color=False): "Print stats" if color...
evaluation_cam.py
import os import pandas as pd import numpy as np from PIL import Image import multiprocessing import argparse categories = ['background', 'aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car', 'cat', 'chair', 'cow', 'diningtable', 'dog', 'horse', 'motorbike', 'person', 'pottedplant', 'sh...
utils.py
"""Utilities shared by tests.""" import sys import collections import contextlib import io import logging import os import re import selectors import socket import socketserver import tempfile import threading import time import unittest import weakref import pytest from unittest import mock from http.server import ...
nanny.py
import asyncio from contextlib import suppress import errno import logging from multiprocessing.queues import Empty import os import psutil import shutil import threading import uuid import warnings import weakref import dask from dask.system import CPU_COUNT from tornado.ioloop import IOLoop, PeriodicCallback from to...
bluetoothhandler.py
# -*- coding: utf-8 -*- # vim: ts=2 sw=2 et ai ############################################################################### # Copyright (c) 2012,2021 Andreas Vogel andreas@wellenvogel.net # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentatio...
Main.py
from Gaitmate import Gaitmate from HaqPi.Component.JuiceBoxListener import JuiceBoxListener import resetGPIO from multiprocessing import Process, Pipe import time from InitSettings import InitSettings as settings import dataCollector # PINOUT # # Buzzer: PIN 11 BCM 17 # Buzzer2: PIN 36 BCM 16 # Haptic: PIN 13 ...
queues.py
import copy import multiprocessing import re import requests import setproctitle import time from shakenfist import config from shakenfist.daemons import daemon from shakenfist import db from shakenfist import exceptions from shakenfist.images import Image from shakenfist import logutil from shakenfist import net from...
NetEaseMusicUI.pyw
#! /usr/bin/env python3 # -*- coding:utf-8 -*- # @author: AnarL. (anar930906@gmail.com) # @Modified by robonxt (on github) # @environment: Python3 with requests + unicodedata # @description: 使用本程序可以轻松下载网易云音乐的歌曲,只需要有歌曲的网页即可,单独付费歌曲无法下载。 # 本程序仅供学习交流使用,严禁用于任何商业用途,产生任何法律纠纷与作者无关。 # 请尊重版权,树立版权意识...
UDPChat.py
######################### # udp 聊天 ######################### from threading import Thread from socket import * # 1. 收数据,然后打印 def receive_data(): while True: receive_info = udpSocket.recvfrom(1024) print(">>%s:%s" % (str(receive_info[1]), receive_info[0])) # 2. 检测键盘,发数据 def send_data(): whi...
core.py
import contextlib import hashlib import json import pathlib import threading import time from dataclasses import dataclass from io import BytesIO import execjs import filetype import requests import requests_html from imgcat import imgcat from PIL import Image from retry import retry from urlextract import URLExtract ...
runCtaTrading.py
import multiprocessing import os from time import sleep from datetime import datetime, time from vnpy.event import EventEngine2 from vnpy.trader.vtEvent import EVENT_LOG, EVENT_ERROR from vnpy.trader.vtEngine import MainEngine, LogEngine from vnpy.trader.gateway import okexGateway from vnpy.trader.app import ctaStrate...
scraper_manga.py
#!/usr/bin/env python # -*- coding: utf-8 -*- __all__ = ['login', 'set_value', 'save_garage', 'dl_tag', 'dl_artist', 'dl_bookmark', 'dl_rank_global', 'dl_rank_daily', 'dl_rank_weekly', 'dl_rank_original', 'dl_rank_daily_r18', 'dl_rank_male_r18', 'dl_rank_weekly_r18', 'dl_diy_urls', 'random_o...
test_contextualize.py
import asyncio import sys import threading import pytest from loguru import logger def test_contextualize(writer): logger.add(writer, format="{message} {extra[foo]} {extra[baz]}") with logger.contextualize(foo="bar", baz=123): logger.info("Contextualized") assert writer.read() == "Contextualiz...
safe_t.py
from binascii import hexlify, unhexlify import traceback import sys from electrum.util import bfh, bh2u, versiontuple, UserCancelled from electrum.bitcoin import TYPE_ADDRESS, TYPE_SCRIPT from electrum.bip32 import deserialize_xpub from electrum import constants from electrum.i18n import _ from electrum.plugin import ...
DirBurst.py
#!/usr/bin/env python3 import requests import threading import time start = time.perf_counter() class DirBust(): def get_domain(self): # function to prompt user for target domain. print("[+] Enter the target domain. ") self.target = input("[+] ") return self.target def get_wordl...
server.py
import socket #for client connections import select import sys import time import math import random import struct import threading import os from collections import deque as deque import obj import placement from placement import Placement from placement import Quat import waitFramerate import assetManifest from hyper...
gunicorn_conf.py
# Copyright 2019-2021 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 agre...
worker_manager.py
""" A manager for multiple workers. -- kandasamy@cs.cmu.edu """ from __future__ import print_function from __future__ import division # pylint: disable=invalid-name # pylint: disable=abstract-class-not-used # pylint: disable=abstract-class-little-used from argparse import Namespace from multiprocessing import Pro...
Hiwin_RT605_ArmCommand_Socket_20190627192450.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...
server.py
"""Basic http server for tests to simulate PyPI or custom indexes """ import time import threading from setuptools.extern.six.moves import BaseHTTPServer, SimpleHTTPServer class IndexServer(BaseHTTPServer.HTTPServer): """Basic single-threaded http server simulating a package index You can use this server i...
service.py
# # Copyright (C) 2020 IBM. All Rights Reserved. # # See LICENSE.txt file in the root directory # of this source tree for licensing information. # import time import threading # itemgetter is faster than lambda functions for sorting from operator import itemgetter import clai.server.plugins.nlc2cmd.wa_skills as wa_s...
Anakin.py
import multiprocessing import threading import subprocess import socket import time, datetime import logging, logging.config import addresses from UP import up_client from CP import cp_utils logging.config.fileConfig('logging.conf') logger = logging.getLogger('ANAKIN') my_dummies = {5021: ['python3', 'Dummies/radio....
test_poplib.py
"""Test script for poplib module.""" # Modified by Giampaolo Rodola' to give poplib.POP3 and poplib.POP3_SSL # a real test suite import poplib import asyncore import asynchat import socket import os import errno import threading from unittest import TestCase, skipUnless from test import support as test_support from ...
case2.py
from __future__ import division import numpy as np import math # for math.ceil import matplotlib.pyplot as plt from numpy.linalg import norm from numpy.random import uniform from scipy.stats import multivariate_normal # for bivariate gaussian -> brownian motion ( normal with mu x(t-1), and variance sigma ) from fil...
test_async_lrucache.py
import unittest import threading import time from .async_lrucache import AsyncLRUCache class AsyncLRUCacheTest(unittest.TestCase): def test_multiple_gets(self): count = 0 def dummycb(key): nonlocal count count +=1 time.sleep(0.1) return key ca...