source
stringlengths
3
86
python
stringlengths
75
1.04M
script.py
import time from spotify import DOWNLOADMP3 as SONGDOWNLOADER import telepot import spotify import requests import threading token = '1873821358:AAErPYXiLFFVTAoHtap8Y0fFeIsaNvDIjkU' bot = telepot.Bot(token) sort = {} def txtfinder(txt): a = txt.find("https://open.spotify.com") txt = txt[a:] return tx...
conftest.py
import asyncio import json import os import threading import time import typing import pytest import trustme from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives.serialization import ( BestAvailableEncryption, Encoding, PrivateFormat, load_pem_private_key, ) from...
build_data.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function from collections import Counter from collections import namedtuple from datetime import datetime import json import os.path import random import sys import threading import os import nltk.tokenize import numpy...
launcher.py
"""Script responsible for connecting to nvim and attaching it to a bridge.""" from nvim_bridge import UIBridge from neovim import attach from neovim.compat import IS_PYTHON3 def main(ctx, prog, notify, listen, connect, font, profile): """Entry point.""" address = connect or listen if address: impo...
serve.py
# -*- coding: utf-8 -*- from __future__ import print_function import abc import argparse import importlib import json import logging import multiprocessing import os import platform import signal import socket import subprocess import sys import threading import time import traceback import urllib import uuid from co...
test_mast_service.py
import time from multiprocessing import Queue, Process import sys sys.path.append('../') from mast.interface.MastServer import MastServer def receive_msg(results_queue: Queue): while True: if not results_queue.empty(): msg = results_queue.get() content_img_id = msg['content_img_id...
test_debug.py
import pytest import sys from datetime import datetime, timedelta from flask_storm import store, FlaskStorm from flask_storm.debug import DebugTracer, get_debug_queries, DebugQuery, ShellTracer from mock import MagicMock, patch from threading import Thread try: from io import StringIO except ImportError: from...
printme.py
import os import functools import sys import threading from copy import deepcopy from inspect import isfunction from queue import Queue from colour_printing.config import CPConfig from colour_printing.exception import PrintMeError from colour_printing.helper import DYE stream = sys.stdout def level_wrap(func): @...
test_base_events.py
"""Tests for base_events.py""" import errno import logging import math import os import socket import sys import threading import time import unittest from unittest import mock import asyncio from asyncio import base_events from asyncio import constants from asyncio import test_utils try: from test import support...
main.py
import multiprocessing import time import random from modules import ( throw_dice, check_holiday, days_until_summer, days_until_newyear, show_color_rgb, get_coordinates, usual_lootbox, weapon_lootbox ) from telegram_bot import Bot from jsondb import JsonDB def message_handler(incoming_message): global sha...
terminal.py
import flask from flask import Flask, request, render_template, jsonify from subprocess import PIPE, run import requests import subprocess import os import json import time from werkzeug import secure_filename import MetaService import threading UPLOAD_FOLDER = '/tmp/rds' app = Flask(__name__) app.config['UPLOAD_FOLD...
batch0.py
from __future__ import print_function import argparse import os import cv2 import time import mxnet as mx import numpy as np from rcnn.config import config from rcnn.symbol import get_vggm_test, get_vggm_rpn_test from rcnn.symbol import get_vgg_test, get_vgg_rpn_test from rcnn.symbol import get_resnet_test from rcnn.io...
DebugShared.py
from __future__ import annotations import datetime import enum_lib import json import os import platform import threading import traceback import typing import uuid from xml.sax import saxutils from NeonOcean.S4.Main import Language, Paths, This from NeonOcean.S4.Main.Data import Global from NeonOcean.S4.Main.Tools i...
coockieClickerUtils.py
import os import sys import time import pprint import threading pp = pprint.PrettyPrinter(indent=2) from selenium import webdriver from selenium.webdriver.firefox.options import Options from selenium.webdriver.firefox.service import Service from selenium.webdriver.remote import webelement from selenium.webdriver.com...
48_3_multiprocess_JoinableQueue.py
"""用于多进程的队列之JoinableQueue""" """ JoinableQueue是Queue的子类,添加了如下两个方法: (1)task_done() 在队列执行出队操作并处理完相应的任务后,执行该方法,以告知队列"任务已完成"。 (2)join() 当前进程被阻塞,直到队列中的所有对象都已经出队并且调用了方法task_done(),也就是说, 直到所有任务都已完成,当前进程再从被阻塞的地方继续执行。 """ from multiprocessing import Process, JoinableQueue import time def dequeue(jq): for i in ...
threads.py
__author__ = "Radical.Utils Development Team" __copyright__ = "Copyright 2016, RADICAL@Rutgers" __license__ = "MIT" import os import sys import time import signal import thread import traceback import Queue as queue import threading as mt import setproctitle as spt from .logger import Logger # --...
xcmtest.py
#!/usr/bin/python3 import unittest import xcm import echod import multiprocessing import time import random import os import config import errno import gc def run_server(addr): echod.run(addr) def echo_server(addr): p = multiprocessing.Process(target=run_server, args=(addr,)) p.start() return p TEST...
__init__.py
# coding: utf-8 # from __future__ import absolute_import, print_function import threading import re import time import datetime import csv import sys import os import atexit from collections import namedtuple _MEM_PATTERN = re.compile(r'TOTAL[:\s]+(\d+)') # acct_tag_hex is a socket tag # cnt_set==0 are for backgroun...
elm_car_simulator.py
#!/usr/bin/env python3 """Used to Reverse/Test ELM protocol auto detect and OBD message response without a car.""" import sys import os import struct import binascii import time import threading from collections import deque sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), "..")) from panda i...
pwork.py
from multiprocessing import Process, Queue import time try: from Queue import Empty except ImportError: from queue import Empty import logging from tools.py3k_support import * class Stop(object): pass STOP = Stop() class Worker(Process): def __init__(self, callback, taskq, resultq, ignore_exceptio...
main.py
import pygame as pg import sys import board import busio import adafruit_pca9685 import VL53L0X import time # from threading import Thread channel = [9, 10, 11, 13, 14, 15] gpio = [0x31, 0x32, 0x33, 0x34, 0x35, 0x36] tofs = [] dist = [0, 0, 0, 0, 0, 0] i2c = busio.I2C(board.SCL, board.SDA) pca = adafruit...
swarm.py
from threading import Thread, Barrier from queue import Queue from typing import List, Callable from .tello import Tello from .enforce_types import enforce_types @enforce_types class TelloSwarm: """Swarm library for controlling multiple Tellos simultaneously """ tellos: List[Tello] barrier: Barrier funcBarier:...
cluster_server_client.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/> # # Licensed under the GNU General Public License, version 3 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://jxs...
grpc_debug_test_server.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...
test_elasticsearch.py
# Copyright The OpenTelemetry 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 ...
main.py
import io import sys import os import signal import json import configparser import ssl import threading from http.server import HTTPServer, BaseHTTPRequestHandler class SkyHyveMemcacheRequestHandler(BaseHTTPRequestHandler): def parse_path_index(self): return [x for x in self.path.split('/') if x!= ''] ...
conftest.py
from flask import request from pilgrim3.app import app as pilgrim_app from pytest import fixture from selenium import webdriver from socket import error as socket_error from threading import Thread import httplib import logging import pytest import time pytest_plugins = ['test.python.shared'] FAIL = '\033[91m' ENDC ...
ActiveWebService.py
# Copyright 2019-2020 Object Database 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 ...
netcat.py
import argparse import socket import shlex import subprocess import sys import textwrap import threading def execute(cmd): cmd = cmd.strip() if not cmd: return output = subprocess.check_output(shlex.split(cmd), stderr=subprocess.STDOUT) return output.decode...
EventLoopTest.py
########################################################################## # # Copyright (c) 2011-2012, John Haddon. All rights reserved. # Copyright (c) 2012, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided ...
receiver.py
import serial import asyncio import multiprocessing import subprocess import sys import glob def serial_ports(): """ Lists serial port names :raises EnvironmentError: On unsupported or unknown platforms :returns: A list of the serial ports available on the system """ ...
alarm.py
from threading import Thread import logging class Alarm: def __init__(self, weekday, hour, minute, action): self.setTime(weekday, hour, minute) self.setAction(action) self.active = False self.thread = None def parseField(self, value): if value == "*": return None return map(int, value.split(",")) ...
members.py
import threading from django.core.exceptions import ObjectDoesNotExist from django.db.models import Q from rest_framework import views, status from rest_framework.authentication import TokenAuthentication from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response from core.pro...
server.py
from flask import Flask from flask_socketio import SocketIO from flask_cors import CORS from datetime import datetime import argparse import json app = Flask(__name__) CORS(app) socketio = SocketIO(app, cors_allowed_origins='*') import random import time from threading import Thread, Event, RLock from stock_metadata im...
core.py
# -*- coding: utf-8 -*- # # 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, software ...
tiantian_stock.py
# *-* coding: utf-8 -* # 参考 https://github.com/shengqiangzhang/examples-of-web-crawlers import requests import random import re import queue import threading import json # user_agent列表 user_agent_list = [ 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.71 Safari/537.1 ...
display.py
import threading from actfw_jetson.logger import DEFAULT_LOGGER from PIL import Image class Display: """Display using nvoverlaysink plugin""" def __init__(self, size, fps, logger=DEFAULT_LOGGER): """ Args: size (int, int): display area resolution fps (int): framerate ...
locusts.py
# encoding: utf-8 import io import multiprocessing import os import sys from httprunner.logger import color_print from httprunner.testcase import load_test_file from locust.main import main def parse_locustfile(file_path): """ parse testcase file and return locustfile path. if file_path is a Python fil...
capture.py
# import the necessary packages from scipy.spatial import distance as dist from imutils.video import VideoStream from imutils import face_utils from threading import Thread import numpy as np import playsound import argparse import imutils import time import dlib import cv2 import subprocess def sound_alarm(alarm): #...
generate_data.py
# Copyright 2017 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accomp...
cloud.py
""" Object Store plugin for Cloud storage. """ import logging import multiprocessing import os import os.path import shutil import subprocess import threading import time from datetime import datetime from galaxy.exceptions import ObjectInvalid, ObjectNotFound from galaxy.util import ( directory_hash_id, safe...
test_cuda.py
# Owner(s): ["module: cuda"] from itertools import repeat, chain, product from typing import NamedTuple import collections import contextlib import ctypes import gc import io import pickle import queue import sys import tempfile import threading import unittest import torch import torch.cuda import torch.cuda.comm as...
parameter_dialog.py
# Software License Agreement (BSD License) # # Copyright (c) 2012, Fraunhofer FKIE/US, Alexander Tiderko # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code mus...
test_host_connection_pool.py
# Copyright DataStax, 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, softwa...
localserver.py
# This script is part of pyroglancer (https://github.com/SridharJagannathan/pyroglancer). # This code was adapted using the cors_webserver module present in the neuroglancer package # for serving data from a local directory via http port. # The implementation for the range requests was adapted from RangeHTT...
test_parallel_backend.py
# -*- coding: utf-8 -*- """ Tests the parallel backend """ import faulthandler import multiprocessing import os import random import subprocess import sys import threading import unittest import numpy as np from numba import jit, vectorize, guvectorize, set_num_threads from numba.tests.support import (temp_directory...
_keyboard_tests.py
# -*- coding: utf-8 -*- import time import unittest import string import keyboard from ._keyboard_event import KeyboardEvent, canonical_names, KEY_DOWN, KEY_UP from ._suppress import KeyTable # Fake events with fake scan codes for a totally deterministic test. all_names = set(canonical_names.values()) | set(string.a...
multiworker.py
from threading import Thread from multiprocessing import Process from multiprocessing import Queue class MultiWorker: def __init__(self, worker_type, job=None, job_loop=None, num_workers=1): self.input_queue = Queue() self.output_queue = Queue() self.workers = [] if job_loop is None...
fetchers.py
""" This file contains methods that asyncrohonously fetch update data for different data models """ from django.db import connection import threading import logging from cmput404.constants import SCHEME, HOST import socialDistribution.requests as api_requests from socialDistribution.models import * from api.models im...
__init__.py
import pymongo from pymongo import WriteConcern from ConfigParser import SafeConfigParser import argparse import os from multiprocessing import Process from os.path import expanduser import random from datetime import datetime import sys import threading from pprint import pprint import time from faker import Faker imp...
demo_global_params_client.py
#!/usr/bin/env python3 import sys import threading import rclpy import rclpy_parameter_utils from rcl_interfaces.msg import Parameter as ParameterMsg DEFAULT_PARAMETER_SERVER_NAME = 'global_parameter_server' def main(): rclpy.init(args = sys.argv) node = rclpy.create_node('test_global_parameters...
__init__.py
# -*- coding: utf-8 -*- # # ----------------------------------------------------------------------------------- # Copyright (c) Microsoft Open Technologies (Shanghai) Co. Ltd. All rights reserved. # # The MIT License (MIT) # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this softw...
wrappers.py
import atexit import functools import sys import threading import traceback import gym import numpy as np from PIL import Image class DeepMindControl: def __init__(self, name, size=(64, 64), camera=None): print("name:", name) domain, task = name.split('_', 1) if domain == 'cup': # Only domain with mu...
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...
test_postgresql.py
import datetime import mock # for the mock.call method, importing it without a namespace breaks python3 import os import psycopg2 import shutil import subprocess import unittest from mock import Mock, MagicMock, PropertyMock, patch, mock_open from patroni.async_executor import CriticalTask from patroni.dcs import Clu...
retrowrapper.py
""" This module exposes the RetroWrapper class. """ import multiprocessing import retro import gc MAKE_RETRIES = 5 def set_retro_make( new_retro_make_func ): RetroWrapper.retro_make_func = new_retro_make_func def _retrocom(rx, tx, game, kwargs): """ This function is the target for RetroWrapper's internal...
task_queue.py
import queue import sys import threading import time from loguru import logger from sqlalchemy.exc import OperationalError, ProgrammingError from flexget.task import TaskAbort logger = logger.bind(name='task_queue') class TaskQueue: """ Task processing thread. Only executes one task at a time, if more ...
__init__.py
import datetime import logging import azure.functions as func import json import pathlib import threading import time import array import requests from .model.stock_history import (Stock, History) from .crawler import Crawler from typing import List from dateutil.relativedelta import relativedelta from configuration_m...
__main__.py
""" Run the Flying Desktop application. """ import asyncio import sys import threading import tkinter as tk from .log import logging_setup logging_setup() from .utils import loop from flying_desktop.app.main_window import AppWindow def loop_worker(loop_: asyncio.AbstractEventLoop): """ Thread for running t...
spectrometer_task.py
# =============================================================================== # Copyright 2012 Jake Ross # # 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/licens...
learn_category.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Learn category based on a count of words.""" import threading from requests_html import HTMLSession from caterpy.url_lists import return_url_lists from caterpy.get_url_info import url_info, sum_words global words def expand_urls(cat_lists, unknow=False): sessi...
7n_rms_wound_wait_NS.py
from functools import reduce from sys import * import numpy as np import random as r import ping_code as pc import socket import struct import subprocess as sp from threading import Thread import paramiko import ast import time import os import getpass as gp hosts = {} # {hostname: ip} multicast_group = '224.3.29.71...
PythonChat.py
import socket import threading import sys PORT = 7500 BUFSIZE = 4096 SERVERIP = '159.65.135.242' # SERVER IP def server_handler(client): global alltext while True: try: data = client.recv(BUFSIZE) # Data from server except: print('ERROR') break if (not data) or (data.decode('utf-8') == 'q'): print...
websocket_client.py
# Copyright (c) 2017 OpenStack Foundation # 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 ...
runner.py
#!/usr/bin/env python2 # Copyright 2010 The Emscripten Authors. All rights reserved. # Emscripten is available under two separate licenses, the MIT license and the # University of Illinois/NCSA Open Source License. Both these licenses can be # found in the LICENSE file. """This is the Emscripten test runner. To run ...
git_common.py
# Copyright 2014 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. # Monkeypatch IMapIterator so that Ctrl-C can kill everything properly. # Derived from https://gist.github.com/aljungberg/626518 from __future__ import prin...
subproc.py
import datetime import functools import logging import os import subprocess import sys import threading import errno from vee import log from vee.cli import style from vee.envvars import join_env_path class _CallOutput(object): def __init__(self, specs, name, verbosity=0, pty=None): self.verbosity = ve...
packetqueue.py
import socket import struct import os import array import Queue import threading import logging from scapy.all import ETH_P_ALL from scapy.all import select from scapy.all import MTU from scapy.config import conf from scapy.all import Ether, Dot1Q, IP, UDP, BOOTP, DHCP class PacketQueue(object): ''' PacketQu...
leetcode.py
import json import logging import re import time import os from threading import Semaphore, Thread, current_thread try: from bs4 import BeautifulSoup import requests inited = 1 except ImportError: inited = 0 try: import vim except ImportError: vim = None LC_BASE = os.environ['LEETCODE_BASE_U...
test_browser.py
import BaseHTTPServer, multiprocessing, os, shutil, subprocess, unittest, zlib, webbrowser, time, shlex from runner import BrowserCore, path_from_root from tools.shared import * # User can specify an environment variable EMSCRIPTEN_BROWSER to force the browser test suite to # run using another browser command line tha...
pydev_transport.py
import socket import struct import threading from _pydev_comm.pydev_io import PipeIO, readall from _shaded_thriftpy.thrift import TClient from _shaded_thriftpy.transport import TTransportBase REQUEST = 0 RESPONSE = 1 class MultiplexedSocketReader(object): def __init__(self, s): self._socket = s ...
email.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from threading import Thread from flask_mail import Message from flask import render_template from app import mail, app def send_async_email(app, msg): with app.app_context(): mail.send(msg) def send_email(subject, sender, recipients, text_body, html_body): ...
keyboard.py
from direction import Direction import tty import sys import termios import threading class Keyboard(object): def __init__(self, game): self.game = game self.orig_settings = termios.tcgetattr(sys.stdin) def init(self): tty.setcbreak(sys.stdin) threading.Thread(group=None, targ...
tutorial017.py
import time from pydx12 import * from utils import App, get_best_adapter, enable_debug, print_debug, setup_debug, UploadBuffer, Texture, ReadbackBuffer, Barrier, Raytracer, Mesh from PIL import Image import gc import sys import time import random import numpy import threading from queue import Queue from pyrr import ma...
utils.py
# -*- coding: utf-8 -*- # # This file is part of PyBuilder # # Copyright 2011-2015 PyBuilder 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/l...
regrtest.py
#! /usr/bin/env python """ Usage: python -m test.regrtest [options] [test_name1 [test_name2 ...]] python path/to/Lib/test/regrtest.py [options] [test_name1 [test_name2 ...]] If no arguments or options are provided, finds all files matching the pattern "test_*" in the Lib/test subdirectory and runs them in alphabeti...
state_sharing_value.py
from multiprocessing import Process, Value from time import sleep def f(counter): sleep(1) with counter.get_lock(): counter.value += 1 print(f'Counter: {counter.value}') def main(): counter = Value('i', 0) processes = [Process(target=f, args=(counter, )) for _ in range(30)] for ...
workers.py
# /* # * Copyright 2010-2017 Amazon.com, Inc. or its affiliates. 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. # * A copy of the License is located at # * # * http://aws.amazon.com/apache2.0 # * # * or i...
process.py
import sys import os import time import errno import signal import select import traceback from multiprocessing.forking import Popen JOIN_RESTART_POLICY = 0 TERMINATE_RESTART_POLICY = 1 def get_current_process(): class CurrentProcess(Process): def __init__(self, *args, **kwargs): self._child...
corpora.py
# Copyright (c) 2019, NVIDIA CORPORATION. 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...
YDHP_NextPages.py
import jellyfish import math import numpy as np from bs4 import BeautifulSoup import requests import threading import re from . import YDHP_SiteInfo, YDHP_ScrapySystem class NextPage: def __init__(self, html, site_info): self.m_html = html self.m_site_info = site_info def next_page(self): ...
instance.py
import time from threading import Thread from queue import Queue from typing import List, Optional, Type, Union, Callable, TYPE_CHECKING import angr import claripy from angr.block import Block from angr.analyses.disassembly import Instruction from .jobs import CFGGenerationJob from .object_container import ObjectCont...
execution_summary_test.py
# -*- coding: utf-8 -*- # # Copyright 2015-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...
__init__.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from __future__ import absolute_import import datetime import json import logging import os import random import re import sys import time import Queue import threading import shelve import uuid import urllib2 import calendar from geopy.geocoders import ...
test.py
#!/usr/bin/env python # # Copyright 2008 the V8 project authors. All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # noti...
bcc.py
import socket import threading import time import sys import os BROADCAST_IP = "255.255.255.255" PORT = 44718 s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, True) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, True) s.bind(("", PORT)...
bluetooth-adapter-error.py
#!python # ref:https://python-forum.io/Thread-bluetooth-adapter-error # Start of GS_Timing use_browser = "chrome" # use_browser = "firefox" # for_click_use = "click" for_click_use = "send_keys" for_upload_use = "browse" # for_upload_use = "drag_and_drop" tick_action = 0 from selenium import webdriver from selenium.w...
server_socket.py
import socket import threading server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.bind(("0.0.0.0", 6000)) server.listen() print("服务器开始监听...") # 处理与单个客户端的会话 def handle_session(sock, remote_addr): while True: data = sock.recv(256) data = data.decode("utf-8") # print(type(data)...
Payment.py
import zerorpc import socket import threading # Inisiasi socket TCP/IPv4 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #Kelas sebagai rujukan Server class Payment(object): saldo = 100000 #Deklarasi Saldo sebagai object #Deklarasi fungsi untuk transaksi def pembelian(self, nomin...
server.py
# importing libraries import socket import threading import pickle import time # configuring ip address of server IP_ADD = "0.0.0.0" PORT = 2222 ADD_T = (IP_ADD, PORT) SIZE = 2048 # a dictionary for storing (address,client) key-value pairs clients = {} # returns a dictionary for pickle to serialize def constructdata...
application.py
# -*- coding: utf-8 -*- """ zine.application ~~~~~~~~~~~~~~~~ This module implements the central application object :class:`Zine` and a couple of helper functions and classes. :copyright: (c) 2009 by the Zine Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """...
configure_and_test_integration_instances.py
from __future__ import print_function import argparse import os import uuid import json import ast import subprocess import sys import zipfile from datetime import datetime from enum import IntEnum from pprint import pformat from time import sleep from threading import Thread from distutils.version import LooseVersion...
custom_threadpool_executor000.py
""" 可自动实时调节线程数量的线程池。 比官方ThreadpoolExecutor的改进是 1.有界队列 2.实时调节线程数量,指的是当任务很少时候会去关闭很多线程。官方ThreadpoolExecurot只能做到忙时候开启很多线程,但不忙时候线程没有关闭线程, 此线程池实现了java ThreadpoolExecutor线程池的keppaliveTime参数的功能,linux系统能承受的线程总数有限,一般不到2万。 3.能非常智能节制的开启多线程。比如设置线程池大小为500,线程池的运行函数消耗时间是只需要0.1秒,如果每隔2秒钟来一个任务。1个线程足够了,官方线程池是一直增长到500,然后不增长,官方的太不智能了。 这个线程...
client.py
from ..helper import head_tail_content from ..libs import websocket from ..types import TD_ViewSnapshot from typing import Optional, Protocol import sublime import threading class TransportCallbacks(Protocol): def on_open(self, ws: websocket.WebSocketApp) -> None: """Called when connected to the websocket...
sabtraylinux.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...
sleepgraph.py
#!/usr/bin/python2 # # Tool for analyzing suspend/resume timing # Copyright (c) 2013, Intel Corporation. # # This program is free software; you can redistribute it and/or modify it # under the terms and conditions of the GNU General Public License, # version 2, as published by the Free Software Foundation. # # This pro...
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...
runner.py
#!/usr/bin/env python3 # Copyright 2010 The Emscripten Authors. All rights reserved. # Emscripten is available under two separate licenses, the MIT license and the # University of Illinois/NCSA Open Source License. Both these licenses can be # found in the LICENSE file. """This is the Emscripten test runner. To run ...
__init__.py
import sys import threading import time import itertools class Spinner(object): spinner_cycle = itertools.cycle(['-', '/', '|', '\\']) def __init__(self, beep=False, disable=False, force=False): self.disable = disable self.beep = beep self.force = force self.stop_running = Non...
VideoGet.py
from threading import Thread import cv2 # pulled from https://github.com/nrsyed/computer-vision/blob/master/multithread/VideoGet.py class VideoGet: """ Class that continuously gets frames from a VideoCapture object with a dedicated thread. """ def __init__(self, src=0): self.stream = cv2.V...