source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
core.py | # Core model
import threading
import time
from abc import ABCMeta, abstractmethod
import boto3
import messenger
from CostModel import CostModel
lambda_client = boto3.client('lambda', 'us-west-2')
lambda_name = "testfunc1"
# Code shared by all Cirrus experiments
# Contains all data for a single experiment
class Bas... |
test_fftpack.py | from __future__ import division, absolute_import, print_function
import numpy as np
from numpy.testing import TestCase, run_module_suite, assert_array_almost_equal
from numpy.testing import assert_array_equal
import threading
import sys
if sys.version_info[0] >= 3:
import queue
else:
import Queue as queue
de... |
test_search_20.py | import pytest
from time import sleep
from base.client_base import TestcaseBase
from utils.util_log import test_log as log
from common import common_func as cf
from common import common_type as ct
from common.common_type import CaseLabel, CheckTasks
from utils.utils import *
from common.constants import *
prefix = "se... |
RecordIR_v18.3.py | #!/usr/bin/env python3
# Author: Karl Parks, 2018
from PyQt5 import QtCore, QtGui, uic
print('Successful import of uic') #often reinstallation of PyQt5 is required
from PyQt5.QtCore import (QCoreApplication, QThread, QThreadPool, pyqtSignal, pyqtSlot, Qt, QTimer, QDateTime)
from PyQt5.QtGui import (QImage, QPixmap, Q... |
data_plane.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... |
test_threading_2.py | # testing gevent's Event, Lock, RLock, Semaphore, BoundedSemaphore with standard test_threading
from __future__ import print_function
from _six import xrange
import greentest
setup_ = '''from gevent import monkey; monkey.patch_all()
from gevent.event import Event
from gevent.lock import RLock, Semaphore, BoundedSemaph... |
sim-treestructured-parallel.py | #!/usr/bin/env python
# Copyright (c) 2013. Mark E. Madsen <mark@madsenlab.org>
#
# This work is licensed under the terms of the Apache Software License, Version 2.0. See the file LICENSE for details.
"""
Description here
"""
import logging as log
import ming
import argparse
import time
import itertools
import co... |
test_func.py | # coding: utf-8
"""
Test suite for testing isolated HTTP WEB Server in a standalone process
"""
from app01.app01_imp import app
from multiprocessing import Process
from time import sleep
import socket
import unittest
from urllib3 import HTTPConnectionPool
import os
import logging
import json
app.config["TESTING"] = Tr... |
testScriptAkandaMain.py | from Transfer import WriteToFile
from MultipleNetworksSimulation import SalibPreprocessGetParamsForSobol, Simulate
import multiprocess.context as ctx
from sys import platform
import time
import sys
from multiprocessing import Pool
sys.setrecursionlimit(100000000)
from Networks import RandomSocialGraphAdvanced
#
# folde... |
main.py | import snap
from PySide2 import QtWidgets
import sys
from threading import Thread
import OpenGL
from OpenGL.GL import *
from OpenGL.GLU import *
from snap import gl
import numpy as np
import snap.viewer
from snap.math import *
class Viewer(snap.viewer.Viewer):
def draw_cross(self):
glColor(0.7... |
server.py | """
Utilities for creating bokeh Server instances.
"""
from __future__ import absolute_import, division, unicode_literals
import datetime as dt
import os
import signal
import sys
import threading
import uuid
from collections import OrderedDict
from contextlib import contextmanager
from functools import partial
from t... |
inference.py | #!/usr/bin/python3.7
import numpy as np
import multiprocessing as mp
import queue
from utils.dataset import Dataset
from utils.network import Forwarder
from utils.grammar import PathGrammar
from utils.length_model import PoissonModel
from utils.viterbi import Viterbi
### helper function for parallelized Viterbi deco... |
streaming_beam_test.py | # Copyright 2020 Google LLC
#
# 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 wr... |
test_memusage.py | import decimal
import gc
import itertools
import multiprocessing
import weakref
import sqlalchemy as sa
from sqlalchemy import ForeignKey
from sqlalchemy import inspect
from sqlalchemy import Integer
from sqlalchemy import MetaData
from sqlalchemy import select
from sqlalchemy import String
from sqlalchemy import test... |
test_callbackserverServer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import json
import os
import random as _random
import sys
import traceback
from getopt import getopt, GetoptError
from multiprocessing import Process
from os import environ
from wsgiref.simple_server import make_server
import requests as _requests
from json... |
sync.py | """Main application logic: class :class:`~gitobox.sync.Synchronizer`.
"""
from __future__ import unicode_literals
import logging
from threading import Semaphore, Thread
from gitobox.git import GitRepository
from gitobox.server import Server
from gitobox.utils import unicode_, make_unique_bytestring
from gitobox.watc... |
test_runner_mp.py | '''
Created on Sep 12, 2021
@author: mballance
'''
import asyncio
import ctypes
import socket
from TblinkTestCase import TblinkTestCase
import multiprocessing as mp
import tblink
from tblink_rpc.impl.iftype_rgy import IftypeRgy
from tblink_rpc.component import Component
from tblink_rpc.runtime.runner import Runner
f... |
stats_manager.py | # std
import logging
from datetime import datetime, timedelta
from typing import List
from threading import Thread
from time import sleep
# project
from . import HarvesterActivityConsumer, FinishedSignageConsumer
from .stat_accumulators.eligible_plots_stats import EligiblePlotsStats
from .stat_accumulators.search_time... |
run_alerter.py | import logging
import multiprocessing
import signal
import sys
import time
from types import FrameType
from typing import Tuple
import pika.exceptions
from src.alert_router.alert_router import AlertRouter
from src.alerter.managers.chainlink import ChainlinkAlertersManager
from src.alerter.managers.evm import EVMNodeA... |
lib.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
"""General purpose functions, not directly linked to click-project"""
from __future__ import print_function, absolute_import
import difflib
import functools
import datetime
import hashlib
import heapq
import itertools
import time
import json
import getpass
import os
impor... |
fibonacci_sum_recursion.py | from multiprocessing import Process, Pool, cpu_count
import timeit
import os
def fib(n):
if n == 0:
return 0
if n == 1:
return 1
else:
return fib(n - 1) + fib(n - 2)
def caller_func(n):
print(fib(n))
def multiprocessing_func(n):
jobs = []
for i in range(10):
... |
test_automap.py | import random
import threading
import time
from unittest.mock import Mock
from unittest.mock import patch
from sqlalchemy import create_engine
from sqlalchemy import ForeignKey
from sqlalchemy import Integer
from sqlalchemy import MetaData
from sqlalchemy import select
from sqlalchemy import String
from sqlalchemy imp... |
network.py | #!/usr/bin/python
from socket import *
import threading
import sys
from time import sleep
import cPickle as pickle
import time
from enum import IntEnum
class TYPE(IntEnum):
WAITREPLY = 0
NOWAITREPLY = 1
ACKWAITREPLY = 2
class Network:
def __init__(self, id=-1, broadcast_addr = "127.255.255.... |
get_401_string.py | #!/usr/bin/env/ python
# coding=utf-8
__author__ = 'Achelics'
__Date__ = '2017/04/24'
import os as _os
import json as _json
import multiprocessing
import sys as _sys
reload(_sys)
_sys.setdefaultencoding("utf-8")
def split_http_web(raw_file_path="", raw_file_name="", result_path=""):
"""
根据http协议的状态码得到分割结果... |
routingTable.py | import json
import os
import sys
import time
import threading
import copy
import network
from constants import *
# TODO:- Manage log(N) entries
logger = logging.getLogger('routingTable')
logger.setLevel(logging.INFO)
fh = logging.FileHandler(os.path.join(LOG_PATH, LOG_FILE))
formatter = logging.Formatter(
'%(as... |
scraper.py | #!/usr/bin/env python3
from bs4 import BeautifulSoup
import os
import subprocess
import sys
import json
import multiprocessing as mp
import datetime as dt
import time
import traceback
import signal
# Debug switch
DISABLE_PERSISTENCE = False
FORCE_RESCRAPE = False
VERBOSE_LOGNAMES = False
downloadmetacmd = "./yt-dlp/... |
keep_alive.py | from flask import Flask
from threading import Thread
app = Flask('')
@app.route('/')
def home():
return "Hello. I am alive!"
def run():
app.run(host='0.0.0.0', port=8081)
def keep_alive():
t = Thread(target=run)
t.start()
|
upnp.py | import logging
import threading
from queue import Queue
from typing import Optional
try:
import miniupnpc
except ImportError:
pass
log = logging.getLogger(__name__)
class UPnP:
thread: Optional[threading.Thread] = None
queue: Queue = Queue()
def __init__(self):
def run():
t... |
main.py | '''
Basic Picture Viewer
====================
This simple image browser demonstrates the scatter widget. You should
see three framed photographs on a background. You can click and drag
the photos around, or multi-touch to drop a red dot to scale and rotate the
photos.
The photos are loaded from the local images direc... |
Imitator_test.py | """
Copyright (c) College of Mechatronics and Control Engineering, Shenzhen University.
All rights reserved.
Description :
train a imitaor using the carla standard control data.
Author:Team Li
"""
import tensorflow as tf
import numpy as np
from carla_utils.logging import logger
from carla_utils.world_ops import *
fr... |
XChat-DeaDBeeF.py | # -*- coding: utf-8 -*-
#
# XChat-DeaDBeeF - XChat/HexChat script for DeaDBeeF integration
# Python 3 version
#
# Unless indicated otherwise, files from the XChat-DeaDBeeF project
# are licensed under the WTFPL version 2. Full license information
# for the WTFPL version 2 can be found in the LICENSE.txt file.
#
... |
video.py | # -*- coding: utf-8 -*-
"""Video readers for Stone Soup.
This is a collection of video readers for Stone Soup, allowing quick reading
of video data/streams.
"""
from abc import abstractmethod
import datetime
import numpy as np
try:
import ffmpeg
import moviepy.editor as mpy
except ImportError as error:
ra... |
broker.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 ag... |
audio.py | # Copyright 2004-2019 Tom Rothamel <pytom@bishoujo.us>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, m... |
test_dynamic_routing.py | import threading
import time
import pytest
from google.protobuf import json_format
from jina import __default_host__
from jina.logging.logger import JinaLogger
from jina.helper import random_identity
from jina.parsers import set_pea_parser
from jina.peapods.zmq import Zmqlet, AsyncZmqlet, ZmqStreamlet
from jina.proto... |
wallet_multiwallet.py | #!/usr/bin/env python3
# Copyright (c) 2017-2020 The worldwideweb Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test multiwallet.
Verify that a worldwidewebd node can load multiple wallet files
"""
from decima... |
system_test.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... |
osa_online_extend.py | #!/usr/bin/python
"""
(C) Copyright 2020-2021 Intel Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
"""
import time
import threading
from itertools import product
from test_utils_pool import TestPool
from write_host_file import write_host_file
from daos_racer_utils import DaosRacerCommand
from osa_utils... |
threadpool.py | import asyncio
import threading
class ExecutionThreadPool:
__slots__ = ('_loop', 'max_threads', 'worker_queue', 'threads')
def __init__(self, max_threads: int):
self._loop = asyncio.get_event_loop()
self.max_threads = max_threads
self.worker_queue = []
self.threads ... |
ex1_nolock4.py | import multiprocessing
import os
# python -m timeit -s "import ex1_nolock" "ex1_nolock.run_workers()"
# 71ms
MAX_COUNT_PER_PROCESS = 1000
FILENAME = "count.txt"
def work(filename, max_count):
for n in range(max_count):
f = open(filename, "r")
try:
nbr = int(f.read())
except Va... |
assistant_info.py | from matrix import *
import LED_display as LMD
import threading
import sys
import time
import random
def assistant_info():
def LED_init():
thread = threading.Thread(target = LMD.main, args=())
thread.setDaemon(True)
thread.start()
return
def draw_matrix(m):
arr... |
proxies.py | import random
import datetime
import threading
import time
from urllib.request import Request, urlopen
from fake_useragent import UserAgent
from bs4 import BeautifulSoup
from typing import List
from dataclasses import dataclass
@dataclass
class Proxy:
ip: str
port: str
created: datetime.datetime
uses... |
test_asyncore.py | import asyncore
import unittest
import select
import os
import socket
import sys
import time
import errno
import struct
import threading
from test import support
from io import BytesIO
if support.PGO:
raise unittest.SkipTest("test is not helpful for PGO")
TIMEOUT = 3
HAS_UNIX_SOCKETS = hasattr(socket, 'AF_UNIX'... |
demodulators.py | from mirage.libs.common.sdr.sources import SDRSource
from mirage.libs.common.sdr.decoders import SDRDecoder
from mirage.libs import utils,io
import queue,threading,math
'''
This component implements multiple Software Defined Radio demodulators allowing to demodulate an IQ stream to recover packet's data.
'''
class SD... |
test_creator.py | from __future__ import absolute_import, unicode_literals
import difflib
import gc
import json
import logging
import os
import shutil
import stat
import subprocess
import sys
import zipfile
from collections import OrderedDict
from itertools import product
from stat import S_IREAD, S_IRGRP, S_IROTH
from textwrap import ... |
kinect2grasp.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Author : Hongzhuo Liang
# E-mail : liang@informatik.uni-hamburg.de
# Description:
# Date : 05/08/2018 6:04 PM
# File Name : kinect2grasp.py
import rospy
from sensor_msgs.msg import PointCloud2
from visualization_msgs.msg import MarkerArray
from visualizati... |
global_windowed_motion.py | import numpy as np
from numpy.linalg import norm
import cma
import logging
from parameterized_motion import ParameterizedMotion
from pydart import SkelVector
import threading
def optimizer_worker(motion):
motion.solve()
class Sample(object):
def __init__(self, motion, t0, dt, prev, params=None):
sel... |
__init__.py | # Module
import sys
import time
from threading import Thread
from . import updater
from .modules import audio_module, time_module, dropbox_module, wlan_module, internet_module,\
battery_module, load_module
def run():
sys.stdout.write('{"version":1}\n')
sys.stdout.write('[\n')
sys.stdout.write('[]\n')
... |
main_multiThread.py | '''Server入口'''
from socket import *
from users import authenticate
from FrozenToolKit import FrozenFile
import settings
import threading
import protocol
import json
import os
class User:
'''用于管理接入用户的数据'''
def __init__(self,_session,_clientAddr,_MAX_RECV):
#socket parameter
self.session = _sessi... |
client.py | import sys
import logging
import select
import threading
import socket
from collections import deque
import re
import struct
from simple_socket import SimpleSocket
from lamport import LamportClock
import time
CONFIG_FILE = 'config.cfg'
SERVER_PORT = 5535
class Client:
def __init__(self, port):
# setup soc... |
dag_processing.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... |
daniel.py | from argparse import ArgumentParser
import airsimneurips as asim
import cv2
import threading
import time
import utils
import numpy as np
import math
import control
import planning
from termcolor import colored
# Ideas:
# Remove the odometry call restrictions or increase the frequency.
# Remove acceleration constraints... |
datasets.py | 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.general import xyxy2xywh, xywh2xyxy, torch_di... |
config_monitor.py | import typing
import logging
import hashlib
import time
from threading import Thread
from dataclasses import dataclass
from db import DBHandler
log = logging.getLogger(__file__)
@dataclass
class PodMonitorConfig:
pod_names: typing.Set[str]
monitor_file: str
service_name: str
class ConfigMonitor:
... |
serve.py | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
# @@: This should be moved to paste.deploy
# For discussion of daemonizing:
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/278731
# Code t... |
ShowDisplay2.py | from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout
import cv2
import threading
import sys
from PyQt5 import QtWidgets
from PyQt5 import QtGui
from PIL import ImageGrab
import numpy as np
class MyApp(QWidget):
def __init__(self):
super().__init__()
self.initUI()
self.running =... |
engine.py | import copy
import json
import os
import sys
import queue
import shlex
import subprocess
import threading
import time
import traceback
from typing import Callable, Dict, List, Optional
from kivy.utils import platform
from katrain.core.constants import OUTPUT_DEBUG, OUTPUT_ERROR, OUTPUT_EXTRA_DEBUG, OUTPUT_KATAGO_STDE... |
ppo_v2.py | import numpy as np
import pydart2 as pydart
from FootDeep.sh_v2.vp_env_v2 import HpVpEnv
from collections import namedtuple
from collections import deque
from itertools import count
import random
import time
import os
from multiprocessing import Process, Pipe
import torch
from torch import nn, optim
import torch.nn... |
__init__.py | #!/usr/bin/env python
import serial
import time
import threading
class J1708Interface(object):
'''
This is the J1708 object. The following methods can be used to
interact with the J1708 bus. Run the command j.methodName? for more
information about any particular method (e.g, j.tx_from_file?)
j.p... |
test__multiprocessing.py | import os
import multiprocessing
import time
from pathlib import Path
import pytest
# noinspection PyProtectedMember
from quicken._internal._multiprocessing import run_in_process
# noinspection PyProtectedMember
from quicken._internal._multiprocessing_reduction import (
dumps,
loads,
set_fd_sharing_base... |
other-sites.py | '''
NERYS
a universal product monitor
Current Module: Other Sites
Usage:
NERYS will monitor specified sites for keywords and sends a Discord alert
when a page has a specified keyword. This can be used to monitor any site
on a product release date to automatically detect when a product has been
uploaded. Use... |
nethunter.py | #!/usr/bin/python3
import os
import sys
import re
import shutil
import time
import threading
import subprocess
from subprocess import Popen
from printer import dialog
CURRENT_PATH = os.getcwd()
LOGS_PATH = os.path.join( CURRENT_PATH, 'airodump-logs' )
ARCHIVES_NAMES = (
'airodump-logs-output.txt',
'airodump... |
FileIOTest.py | #! /usr/bin/python
import os
import threading
import time
import sys as s
class OutputGrabber(object):
"""
Class used to grab standard output or another stream.
"""
escape_char = "\b"
def __init__(self, stream=None, threaded=False):
self.origstream = stream
self.threaded = threade... |
Service.py | import asyncore
from queue import Queue
from threading import Thread
from Communication.Actions import Action
from App.Logger import Logger
from json import loads
from Utils.Exceptions import AntlrExcption
from Env.EnvSingleton import Environment
TASK_QUEUE = Queue()
BUFFER_SIZE = 8192
IS_FINISH = False
def _handle_... |
tagger.py | import pymongo
import logging
import argparse
from multiprocessing import Process, Queue, Pool, Manager
from datetime import datetime
from chess import Move, Board
from chess.pgn import Game, GameNode
from chess.engine import SimpleEngine, Mate, Cp
from typing import List, Tuple, Dict, Any
from model import Puzzle, Tag... |
run_dispatcher.py | # Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved.
import os
import logging
from multiprocessing import Process
from django.conf import settings
from django.core.cache import cache as django_cache
from django.core.management.base import BaseCommand
from django.db import connection as django_connection, connecti... |
workflows_scaling.py | #!/usr/bin/env python
"""A small script to drive workflow performance testing.
% ./test/manual/launch_and_run.sh workflows_scaling --collection_size 500 --workflow_depth 4
$ .venv/bin/python scripts/summarize_timings.py --file /tmp/<work_dir>/handler1.log --pattern 'Workflow step'
$ .venv/bin/python scripts/summarize_... |
nervion_mp.py | import threading
import socket
import sys
import signal
class NervionMultiplexer:
def __init__(self, multi, ip):
self.routes = {}
self.spgw_ip = ip
self.multi = multi
def processMessage(self, payload, address):
teid = (ord(payload[4]) << 24) | (ord(payload[5]) << 16) | (ord(payload[6]) << 8) | ord(payloa... |
playAll.py | # NeoPixel multithreaded display
# This script plays all lyr_* modules in the directory, calling hte NeoFX() function from the module
# Author: Karl Grindley (karl@linuxninja.net)
#
# derived from NeoPixel library strandtest example
# NeoPixel strandtest Author: Tony DiCola (tony@tonydicola.com)
import time
import mul... |
utilities.py | import itertools
import sys
import threading
import time
from numbers import Number
class Namespace(object):
"""
helps referencing object in a dictionary as dict.key instead of dict['key']
"""
def __init__(self, adict):
self.__dict__.update(adict)
class Spinner:
busy = False
delay = ... |
dRepServer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import json
import os
import random as _random
import sys
import traceback
from getopt import getopt, GetoptError
from multiprocessing import Process
from os import environ
from wsgiref.simple_server import make_server
import requests as _requests
from json... |
download_1024_captcha.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import zlib
import urllib.request
import urllib.parse
import time
import random
from fake_useragent import UserAgent
import ssl
import asyncio
from threading import Thread
from tqdm import tqdm
# 全局取消证书验证,避免访问https网页报错
ssl._create_default_https_context = ssl._cre... |
_logger.py | """
.. References and links rendered by Sphinx are kept here as "module documentation" so that they can
be used in the ``Logger`` docstrings but do not pollute ``help(logger)`` output.
.. |Logger| replace:: :class:`~Logger`
.. |add| replace:: :meth:`~Logger.add()`
.. |remove| replace:: :meth:`~Logger.remove()`
.. |... |
radia.py | # TODO urrlib do usuniecia , przejscie na requets
import urllib2
import json
import threading
import constants
import xml.etree.ElementTree
import ConfigParser
import os
import xml.dom.minidom as minidom
import logging
import time
import requests
from THutils import skonstruuj_odpowiedzV2OK
#TODO usunac ... |
9.12_async_demo.py | from tkinter import Tk, Button
import asyncio
import threading
import random
def asyncio_thread(event_loop):
print('The tasks of fetching multiple URLs begins')
event_loop.run_until_complete(simulate_fetch_all_urls())
def execute_tasks_in_a_new_thread(event_loop):
""" Button-Event-Handler starting the asyncio... |
part1.py | # Much of this code follows verbatim after
# http://sebastianraschka.com/Articles/2014_multiprocessing_intro.html
# Please refer to Sebastian's terms of license; the MIT license might not apply to this code
import multiprocessing as mp
import random
import string
# Define an output queue
output = mp.Queue()
# define... |
idcard_generate_service.py | # coding:utf-8
import os
from multiprocessing import Process
import PIL.Image as PImage
import cv2
import numpy as np
from PIL import ImageFont, ImageDraw
from app.main.app.entity.idcard import IdCard
from app.main.app.service import config_util
from app.main.app.utils import image_util, config, text_util, vo_utils
f... |
python.py | import socket
import threading
lport = 6666
sock = socket.socket()
sock.bind(('0.0.0.0',lport))
sock.listen(1024)
socklist = []
numm = None
def con(): #主要保存主动上钩的连接
num = 0
print('等待主机加入')
while True:
(sk, addrport) = sock.accept() #接收连接并返回一个套接字sk,addrport是地址跟... |
adventure.py | import asyncio
import configparser
import logging
import os
import pty
import subprocess
import termios
import threading
import tty
import yaboli
from yaboli.utils import *
logger = logging.getLogger("adventure")
class AdventureWrapper:
ARGS = ["/usr/bin/adventure"]
def __init__(self):
self.masterfd, self.slav... |
Client.py | from tkinter import *
import tkinter
import socket
from threading import Thread
import sys
def receive():
while True:
try:
msg = s.recv(1024).decode("utf8")
msg_list.insert(tkinter.END, msg)
except:
print("There is an error while receiving a message")
... |
threading.py | """A threading based handler.
The :class:`SequentialThreadingHandler` is intended for regular Python
environments that use threads.
.. warning::
Do not use :class:`SequentialThreadingHandler` with applications
using asynchronous event loops (like gevent). Use the
:class:`~kazoo.handlers.gevent.Sequential... |
__init__.py | import os
import threading
from time import sleep
from flask import Flask
delay_time = 180 # 3 minutes
def create_app(test_config=None):
# create and configure the app
app = Flask(__name__, instance_relative_config=True)
def aws_ami():
while True:
from .libs.aws import get_all_aws_ami... |
client.py | from __future__ import print_function
import sys
import time
import threading
import Pyro4
if sys.version_info < (3, 0):
current_thread = threading.currentThread
else:
current_thread = threading.current_thread
serv = Pyro4.core.Proxy("PYRONAME:example.servertypes")
print("-----------------------------------... |
fun_util.py | import cv2, pickle
import numpy as np
import tensorflow as tf
#from cnn_tf import cnn_model_fn
import os
import sqlite3, pyttsx3
from keras.models import load_model
from threading import Thread
engine = pyttsx3.init()
engine.setProperty('rate', 150)
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
#model = load_model('cnn_mod... |
droidbot_app.py | import logging
import socket
import subprocess
import time
import json
import struct
from adapter import Adapter
DROIDBOT_APP_REMOTE_ADDR = "tcp:7336"
DROIDBOT_APP_PACKAGE = "io.github.ylimit.droidbotapp"
DROIDBOT_APP_PACKET_HEAD_LEN = 6
ACCESSIBILITY_SERVICE = DROIDBOT_APP_PACKAGE + "/io.github.privacystreams.accessi... |
script.py | from __future__ import absolute_import
import os
import traceback
import threading
import shlex
import sys
class ScriptError(Exception):
pass
class ScriptContext:
def __init__(self, master):
self._master = master
def log(self, message, level="info"):
"""
Logs an event.
... |
prediction_controller.py | import connexion
import six
import json
import multiprocessing
from linkprediction.openapi_server.models.evaluation_results import EvaluationResults # noqa: E501
from linkprediction.openapi_server.models.prediction_setup import PredictionSetup # noqa: E501
from linkprediction.openapi_server.models.prediction_state i... |
cache.py | #!encoding=utf-8
import time
import threading
"""
Cache().setex(k, v, timeout)
Cache().get(k)
"""
HB = 10 # 检查频率 秒
class Cache(object):
m = {}
def __new__(cls, *args, **kw):
if not hasattr(cls, '_instance'):
orig = super(Cache, cls)
cls._instance = orig.__new__(cl... |
utils.py | import os, signal, subprocess, sys, threading
def isint(s):
'''
Check if a string represents an int.
Note: Numbers in scientific notation (e.g., 1e3) are floats in Python,
and `isint('1e3')` will return False.
Source: https://stackoverflow.com/a/1265696
'''
if len(s) < 1:
retu... |
curses_menu.py | import curses
import os
import platform
import threading
class CursesMenu(object):
"""
A class that displays a menu and allows the user to select an option
:cvar CursesMenu cls.currently_active_menu: Class variable that holds the currently active menu or None if no menu\
is currently active (E.G. when switching ... |
rpcproxy.py | # Copyright (C) 2021 The Xaya developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
Simple proxy server for JSON-RPC, which just forwards requests to
another host/port. It has the ability to disconnect and reconnect
on d... |
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 ... |
irc.py | from __future__ import unicode_literals, division, absolute_import, with_statement
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
from past.builtins import basestring
from future.moves.urllib.parse import quote
import os
import re
import threading
import logging
from xml.etree.ElementT... |
manager.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2015 clowwindy
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... |
pi_videostream.py | #!/usr/bin/python
# import the necessary packages
from picamera.array import PiRGBArray
from picamera import PiCamera
from threading import Thread
class PiVideoStream:
def __init__(self, resolution=(320, 240), framerate=32):
# initialize the camera and stream
self.camera = PiCamera()
self.... |
multithread6.py | '''
多个线程共享数据 - 有锁的情况
'''
import time
import threading
class Account(object):
def __init__(self):
self._balance = 0
self._lock = threading.Lock()
def deposit(self, money):
# 获得锁之后代码才能继续执行
self._lock.acquire()
try:
new_balance = self._balance + money
... |
TS3Connection.py | """Main TS3Api File"""
import telnetlib
import socket
import logging
import threading
import time
import sys
import traceback
from .Events import TS3Event
from . import Events
import blinker
from . import utilities
from .utilities import TS3Exception, TS3ConnectionClosedException
from .TS3QueryExceptionT... |
main_game.py | """
游戏界面
"""
import pygame
from source import setup
from .. import tools
from .. import constants as C
from ..components import info, maze
from ..runtime import runtime
import time
from config import option
import socket
import threading
import json
import ctypes
import inspect
import random
class MainGame:
def __... |
defs.py | """Strong typed schema definition."""
import http.server
import json
import random
import re
import socket
import socketserver
import string
from base64 import b64encode
from enum import Enum
from pathlib import Path
from threading import Thread
from time import time
from typing import Any, Dict, List, Optional, Set, U... |
speechSpyGlobalPlugin.py | # A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2018 NV Access Limited
# This file may be used under the terms of the GNU General Public License, version 2 or later.
# For more details see: https://www.gnu.org/licenses/gpl-2.0.html
"""This module provides an NVDA global plugin which creates a and robo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.