source
stringlengths
3
86
python
stringlengths
75
1.04M
threadpool.py
#!/usr/bin/env python # -- Content-Encoding: UTF-8 -- """ Cached thread pool, inspired from Pelix/iPOPO Thread Pool :author: Thomas Calmant :copyright: Copyright 2015, isandlaTech :license: Apache License 2.0 :version: 0.2.5 .. Copyright 2015 isandlaTech Licensed under the Apache License, Version 2.0 (the "...
main.py
import os import re import logging import time import copy import threading import datetime from shutil import copyfile import requests from flask import Flask, jsonify, redirect, make_response from flask_restful import Resource, Api, reqparse from flask_cors import CORS import influxdb lock = threading.Lock() flush_o...
objectDetectionServer.py
""" @author Eduard Bartolovic Eduard.Bartolovic@posteo.de @version: 25.06.2019 Dieser Python Server bekommt einen ping über das Netzwerk wenn der Client ein Bild fertig auf die Platte schreibt. Dieser Server nutzt die lidarknet.so zum erkennen der Objekte. Die Erkennungen werden dann noch bearbeitet: - Non-maximum...
db.py
import threading import glob import gzip try: from StringIO import StringIO # Python 2.7 except: from io import StringIO # Python 3.3+ import uuid import re import os import sys from collections import defaultdict import pandas as pd import pybars from .column import Column, ColumnSet from .table import Tab...
runner.py
from __future__ import print_function __true_print = print import argparse import datetime import docker import json import multiprocessing import numpy import os import psutil import requests import sys import threading import time import psutil def print(*args, **kwargs): __true_print(*args, **kwargs) sys.s...
subscriber.py
import datetime import threading import time import typing import requests from requests.auth import HTTPBasicAuth import Notipy.constants as constants import Notipy.exceptions as exceptions class Message: def __init__( self, message_id: int, body: str, created: typing.Union[str, datetime.datetime],...
environment.py
# Copyright 2018 Tensorforce Team. 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 la...
eg_threading&concurrent.py
import logging import threading import time import concurrent.futures def thread_function(name): logging.info("Thread %s: starting", name) time.sleep(2) logging.info("Thread %s: finishing", name) if __name__ == "__main__": # format = "%(asctime)s: %(message)s" # logging.basicConfig(format=forma...
main.py
from time import sleep from selenium.webdriver.common.action_chains import ActionChains import threading import time import sys from selenium import webdriver from card_image import * from selenium_login import * import time import os class Main: def __init__(self,user_name,password,id_name): # chrome_o...
convert_data_tf_format.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import csv import itertools import os import queue import threading import numpy as np import scipy as sp import scipy.ndimage import pandas as pd import pydicom import tensorflow as tf from object_detection.utils import dataset_util from object_detection.utils.visuali...
predictor_server.py
#!/usr/bin/env python import numpy as np import keras from keras.models import Model from keras.preprocessing import image from keras.applications.imagenet_utils import decode_predictions, preprocess_input # for the server import socket import sys import traceback from threading import Thread from io import BytesIO #...
queue.py
##################################################################### # # # /queue.py # # # # Copyright 2013, Monash University ...
helper.py
from collections import defaultdict from functools import wraps from threading import Thread from typing import Any, Dict, List def async(func: Any) -> Any: """ Decorator for executing a function in a separate :class:`threading.Thread`. """ @wraps(func) def wrapper(*args: Any, **kwargs: Any) -> An...
startup.py
""" Dependencies """ from multiprocessing import Process """ Module used to run the user test and setup files before starting the detection system """ # Run the detection system in another process and quit the current process used by the 'startup' module def start_full_system(): process = Process(target=) p...
GraphComponentTest.py
########################################################################## # # Copyright (c) 2011-2012, John Haddon. All rights reserved. # Copyright (c) 2011-2013, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted prov...
newnewmultipletickers.py
import ast import os import select import sys import sched import msvcrt import sqlite3 import time from datetime import datetime import numpy as np import pandas as pd from typing import List from polygon import STOCKS_CLUSTER, WebSocketClient, RESTClient # import pandas_ta as ta import threading import openpyxl impor...
async_dataloader.py
import re from queue import Queue from threading import Thread from typing import Any, Optional, Union import torch from torch._six import container_abcs, string_classes from torch.utils.data import DataLoader, Dataset class AsynchronousLoader(object): """ Class for asynchronously loading from CPU memory to ...
taskarchive.py
import threading from urllib.parse import urljoin import logging from typing import Union, List, Dict import requests from astroplan import TimeConstraint, AirmassConstraint, ObservingBlock, FixedTarget, MoonSeparationConstraint from astropy.coordinates import SkyCoord from astropy.time import TimeDelta import astropy....
test_client_http.py
import select import socket import contextlib import threading from tests import unittest from contextlib import contextmanager import botocore.session from botocore.config import Config from botocore.vendored.six.moves import BaseHTTPServer, socketserver from botocore.exceptions import ( ConnectTimeoutError, Read...
csp_subarray_behaviour.py
# Standard python imports import enum import logging import time import threading from ska.base.commands import ResultCode # Tango import from tango import DevState, Except, ErrSeverity MODULE_LOGGER = logging.getLogger(__name__) class OverrideCspSubarray(object): def action_on( self, model, tango_dev=N...
processwriter.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import multiprocessing as mp import logging from clickhouse_mysql.writer.writer import Writer class ProcessWriter(Writer): """Start write procedure as a separated process""" args = None def __init__(self, **kwargs): next_writer_builder = kwargs.pop(...
views.py
""" Routes and views for the flask application. """ import sys import os import json import requests import threading from datetime import datetime from flask import render_template from jarvis_svc import app from flask.json import jsonify from flask import request from flask import Response from jarvis_svc.sensor_re...
data_loader.py
import sys from os import path import random import numpy as np import json import time import threading from collections import deque class DataLoader: def __init__( self, data_path, data_file, batch_size, data_file_num, sleep_time=1, max_queue_size = 2 ...
manager.py
import time import traceback from typing import Type, Dict from avaland.exceptions import AvalandException, SourceNotRegisteredException from avaland.music_base import MusicBase from avaland.search import SearchResult import multiprocessing as mp class SourceManager: _config = dict() _sources = dict() d...
psql.py
import threading import psycopg2 from contextlib import contextmanager from collections import deque class PSQL: def __init__(self, connection_string): self.running = True self.write_semaphore = threading.Semaphore(0) self.write_lock = threading.Lock() self.pending_writes = deque() ...
test_operator_gpu.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
run.py
import sys import os, errno import subprocess import base64 from paramiko import SSHClient from paramiko import AutoAddPolicy import datetime import pwd import json import sys from optparse import OptionParser from time import sleep import threading from os.path import expanduser print_cmd_output = 1 def get_username...
config.py
# Copyright 2015 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. import copy import datetime import functools import logging import os import sys import time import threading # Not all apps enable endpoints. If the import...
rasterizer_gltf.py
import time from utils import perspective_matrix_fov, scale_matrix, translation_matrix, rotation_matrix_y, identity_matrix, GLTF import glfw import compushady.config import compushady.formats import compushady from compushady.shaders import hlsl import platform from utils import vector3 import numpy import threading im...
lesson2.py
import threading import time def sub(): global num # num-=1 print ("ok") lock.acquire() temp=num time.sleep(0.001) num=temp-1 lock.release() num=100 l=[] lock=threading.Lock() for i in range(100): t=threading.Thread(target=sub) t.start() l.append(t) for t in l: t.join(...
utils.py
#---------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. #------------------------------------------------------------------...
base_test.py
# SPDX-FileCopyrightText: 2020-present Open Networking Foundation <info@opennetworking.org> # Copyright 2013-present Barefoot Networks, Inc. # # SPDX-License-Identifier: LicenseRef-ONF-Member-1.0 # SPDX-License-Identifier: Apache-2.0 # # Antonin Bas (antonin@barefootnetworks.com) # Carmelo Cascone (carmelo@opennetworki...
main.py
from googleapiclient.discovery import build import threading import time import random version = "1.0" title = "Views" description = "Places a block for each view on a youtube video." author = "drakeerv" youtube = build("youtube", "v3", developerKey=input("Google API Key for 'Youtube Data API v3': ")) ch_request = yo...
duce.py
import json import os import random import re import threading import time import traceback from decimal import Decimal from urllib.parse import parse_qs, unquote, urlsplit import cloudscraper import requests from bs4 import BeautifulSoup as bs from tqdm import tqdm from colors import * # DUCE-CLI # Scraper def dis...
semaphore.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from multiprocessing import Process, BoundedSemaphore, current_process import time def run(s): s.acquire() print(f'{current_process().name} is running at {time.ctime()}.') time.sleep(1) s.release() if __name__ == '__main__': semaphore = BoundedSemap...
utils.py
from colorama import init, Fore, Back, Style from datetime import datetime from selenium.webdriver import Chrome, ChromeOptions from selenium.webdriver.common.desired_capabilities import DesiredCapabilities from webhook import DiscordWebhook, DiscordEmbed from chromedriver_py import binary_path as driver_path import js...
ircclient.py
import sys from functools import wraps import socket import ssl import threading import logging import time if sys.hexversion < 0x03000000: #Python 2 import Queue as queue BlockingIOError = socket.error else: import queue class IRCClient(object): """Provides real-time multithreaded IRC Client comm...
amqpdriver.py
# Copyright 2013 Red Hat, 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 agr...
test_wordcounter_multithreads.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function, division, unicode_literals import sys, re, time, os import operator from collections import Counter from functools import reduce from multiprocessing import cpu_count from threading import Thread from Queue import Queue from datetime i...
test_worker.py
from confluent_kafka import Consumer from kafka.errors import KafkaTimeoutError from worker.kafka_worker import KafkaWorker import numpy as np import argparse import threading import time import json import os class TestKafkaWorker(KafkaWorker): POLL_TIMEOUT_DEFAULT = 25 SEND_TIMEOUT_DEFAULT = 5 TEST_ITERA...
wsgiserver.py
#!/usr/bin/env python # http://www.bortzmeyer.org/wsgi.html import os import sys import getopt import socket import traceback import importlib import wsgiref.simple_server as server # See lib_client.py with similar code which cannot be imported here. # This expects bytes (Py3) or str (Py2). def create_string_stream(...
helpers.py
# This file is copied from https://github.com/qtile/qtile """ This file contains various helpers and basic variables for the test suite. Defining them here rather than in conftest.py avoids issues with circular imports between test/conftest.py and test/backend/<backend>/conftest.py files. """ import functools import...
model_to_db.py
# %% # -*- coding: utf-8 -*- # Loading libraries import os import sys import time from networkx.algorithms.centrality import group import pandas as pd import re import csv from swmmtoolbox import swmmtoolbox as swmm from datetime import datetime from os import listdir from concurrent import futures from sqlalchemy impo...
aruco_flight.py
from pioneer_sdk import Pioneer import os import sys import math import cv2 import cv2.aruco as aruco import numpy as np import yaml import multiprocessing as mp from multiprocessing.managers import BaseManager def image_proc(buff, drone, camera_mtx, camera_dist): size_of_marker = 0.12 # side length in meters ...
mwlogger.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Author: deng_lingfei Email: deng_lingfei@mycompany.cn Create time: 2016-01-04 10:28 Last modified: 2016-01-04 10:28 Filename: mwlogger.py Description: ''' import os from os.path import abspath, join, dirname import sys import logging from logging.handlers import S...
TestPooledDB.py
"""Test the PooledDB module. Note: We don't test performance here, so the test does not predicate whether PooledDB actually will help in improving performance or not. We also assume that the underlying SteadyDB connections are tested. Copyright and credit info: * This test was contributed by Christoph Zwerschke """...
halo.py
# -*- coding: utf-8 -*- # pylint: disable=unsubscriptable-object """Beautiful terminal spinners in Python. """ from __future__ import unicode_literals, absolute_import, print_function import sys import threading import cursor import time import logging from spinners.spinners import Spinners from log_symbols.symbols i...
downloadclient.py
# -*- coding: utf-8 -*- # Copyright 2018-2022 CERN # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
webServer.py
#!/usr/bin/env/python # File name : server.py # Production : GWR # Website : www.adeept.com # Author : William # Date : 2020/03/17 import time import threading import move import Adafruit_PCA9685 import os import info import RPIservo import functions import robotLight import switch...
archiver.py
import argparse import dateutil.tz import errno import io import json import logging import os import pstats import random import re import shutil import socket import stat import subprocess import sys import tempfile import time import unittest from binascii import unhexlify, b2a_base64, a2b_base64 from configparser i...
automator.py
# 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/. # This function will run the pulse build watcher, # then on detecting a build, it will run the tests # using that build....
test_io.py
"""Unit tests for the io module.""" # Tests of io are scattered over the test suite: # * test_bufio - tests file buffering # * test_memoryio - tests BytesIO and StringIO # * test_fileio - tests FileIO # * test_file - tests the file interface # * test_io - tests everything else in the io module # * test_univnewlines - ...
runner.py
# -*- coding: utf-8 -*- from __future__ import annotations import os import platform import subprocess from abc import abstractmethod from queue import Queue from typing import Any, Dict, Iterator, IO, Optional from pathlib import Path from threading import Thread from dataclasses import dataclass from .types import...
ExdDebugger.py
from kivy.uix.gridlayout import GridLayout from kivy.lang import Builder from kivy.uix.scrollview import ScrollView from kivy.properties import BooleanProperty, StringProperty from kivy.uix.textinput import TextInput from kivy.clock import Clock from functools import partial import thread...
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 =...
app.py
#### MAKE SURE YOU HAVE GONE THROUGH README.MD global skipped # IMPORTS --------------------- from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import We...
voltage_source.py
from functools import partial from pubsub import pub from threading import Thread from time import sleep import wx from wx.lib.agw.floatspin import FloatSpin from spacq.gui.tool.box import load_csv, save_csv, Dialog, MessageDialog from spacq.interface.units import Quantity """ Configuration for a VoltageSource. """ ...
NBVTest.py
#!/usr/bin/env python ''' Copyright (c) 2016, Allgeyer Tobias, Aumann Florian, Borella Jocelyn, Hutmacher Robin, Karrenbauer Oliver, Marek Felix, Meissner Pascal, Trautmann Jeremias, Wittenbeck Valerij All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted...
thread.py
from queue import Queue, Empty import threading from time import sleep from scopus_crawler import process_paper conferences = [] global_lock = threading.Lock() paper_queue = Queue() file_contents = [] crawled_paper_filename = "docs/crawled_papers.txt" no_result_filename = "docs/no_result_papers.txt" num_thread_auth...
helpers.py
""" Helper functions file for OCS QE """ import base64 import random import datetime import hashlib import json import logging import os import re import statistics import tempfile import threading import time import inspect from concurrent.futures import ThreadPoolExecutor from itertools import cycle from subprocess i...
spinsolve.py
""" Spinsolve module """ import asyncio import pprint as pp import queue import threading import warnings from pathlib import Path from typing import Optional, Union from loguru import logger from lxml import etree from packaging import version from unsync import unsync from flowchem.components.devices.Magritek.msg_m...
preparer.py
# -*- coding: utf-8 -*- # Copyright 2020-2022 CERN # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
muty.py
import time import threading from threading import Lock mylock = Lock() def threadfn(data): mylock.acquire() print("Inside lock",data) if data == 3: time.sleep(2) print("Just coming out of lock",data) mylock.release() i=0 while True: t = threading.Thread(target=threadfn,args=(i,)) ...
messagehandler.py
from socket import socket, SOCK_DGRAM, SOL_SOCKET, SO_REUSEADDR from time import sleep from threading import Thread, Lock from ..utils.logger import getLogger from ..utils.network import Decode_Response, Encode_Request, Udp_Message from ..utils.leader_election import Leader_Election class MessageHandler: def __in...
big_countdown_threading.py
import threading def big_countdown(n): while n: n -= 1 if __name__ == '__main__': thread1 = threading.Thread(target=big_countdown, args=(100_000_000,)) thread2 = threading.Thread(target=big_countdown, args=(100_000_000,)) thread1.start() thread2.start() thread1.join() thread2.j...
deletionwatcher.py
# coding=utf-8 import json import os.path import pickle import requests import time import threading # noinspection PyPackageRequirements import websocket # noinspection PyPackageRequirements from bs4 import BeautifulSoup from urllib.parse import urlparse import chatcommunicate import metasmoke from globalvars import G...
HiwinRA605_socket_ros_test_20190625185755.py
#!/usr/bin/env python3 # license removed for brevity #接收策略端命令 用Socket傳輸至控制端電腦 import socket ##多執行序 import threading import time ## import sys import os import numpy as np import rospy import matplotlib as plot from std_msgs.msg import String from ROS_Socket.srv import * from ROS_Socket.msg import * import HiwinRA605_s...
bt_scanner.py
import threading import time from typing import List # noinspection PyUnresolvedReferences from gi.repository import GLib import dbus import dbus.mainloop.glib import bluezutils from bt_device import BtDevFromProperties, BtDevice class BtScanner: bt_dev_list: List[BtDevice] def __init__(self): sel...
email.py
# -*- coding: utf-8 -*- # Author: G.J.J. van den Burg <gvandenburg@turing.ac.uk> # License: See LICENSE file # Copyright: 2020 (c) The Alan Turing Institute from threading import Thread from flask import current_app from flask_mail import Message from app import mail def send_async_email(app, msg): with app.a...
downloader.py
""" Downloader submodule Part of GeoRef, Python Offline Georeferencer by Karim Bahgat, 2014 Downloads, structures, and formats necessary online reference/gazetteer data for offline georeferencing use. Unfinished alpha version """ import sys,os,shutil,time,csv,threading,urllib,zipfile from helpers import messages,pyp...
test_zeromq.py
# -*- coding: utf-8 -*- ''' :codeauthor: Thomas Jackson <jacksontj.89@gmail.com> ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import os import time import threading import multiprocessing import ctypes from concurrent.futures.thread import ThreadPoolExecutor # ...
mp_video.py
# Multiprocessing video with queue import multiprocessing as mp import os import cv2 import time import ctypes import threading from detect_ap2 import det_preprocess, det_postprocess from xfdnn.rt import xdnn import numpy as np ################################################## # CONSTANTS #################...
common_helpers.py
import datetime import logging import re import pydash import json import threading from pydoc import locate from dateutil.relativedelta import relativedelta from dateutil import parser from django.contrib.auth.models import Group, Permission from django.urls import resolve from django.http import QueryDict from dja...
mdnsListener.py
#!/usr/bin/env python # Copyright 2017 British Broadcasting Corporation # # 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...
plot_mode_base.py
from __future__ import print_function, division from pyglet.gl import * from plot_mode import PlotMode from threading import Thread, Event, RLock from color_scheme import ColorScheme from sympy.core import S from sympy.core.compatibility import is_sequence from time import sleep import warnings class PlotModeBase(Pl...
Doctor.py
from vidstream import * import tkinter as tk import socket import threading local_ip_address = socket.gethostbyname(socket.gethostname()) server = StreamingServer(local_ip_address, 9999) receiver = AudioReceiver(local_ip_address, 8888) def start_listening(): t1 = threading.Thread(target=server.start_server) t2 = t...
_user.py
import stockings import pickle from multiprocessing import Process class Data: def __init__(self, message = ""): self.message = message def printData(data): print(pickle.loads(data).message) def main(): c = stockings.SocketClient('localhost', 8080, 4096) c.connect() p = Process(target=c.s...
main.py
import socket import threading from someClasses import * import json # server config HEADER = 20 IP_ADDRESS = socket.gethostbyname(socket.gethostname()) PORT = 50551 ADDRESS = (IP_ADDRESS, PORT) DISCONNECT_MESSAGE = "!DISCONNECT" FORMAT = "utf-8" groups = [] def send_messages_to_client(client_handler): print(...
pipeline_helper.py
#!/usr/bin/env python # #===- pipeline_helper.py - Remote Index pipeline Helper *- python -------*--===# # # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. # See https://llvm.org/LICENSE.txt for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # #===---------...
sm.py
# -*- coding: utf-8 -*- from pprint import pprint from time import sleep, time import json from requests import Session from threading import Thread from tkinter import * from itertools import combinations time_step = 2 n_step = 10 class Http(): http = Session() class Root(): root = None def run(self):...
logger_hanlder.py
import logging from .logclient import LogClient from .logitem import LogItem from .putlogsrequest import PutLogsRequest from threading import Thread import atexit from time import time, sleep from enum import Enum from .version import LOGGING_HANDLER_USER_AGENT from collections import Callable import six if six.PY2: ...
NetSav4.py
# Authors: Shir, Hodaya and Alexey # Version: 4.0 # Date: 07/2019 # Sources: # https://stackoverflow.com/questions/19311673/fetch-source-address-and-port-number-of-packet-scapy-script # https://github.com/ickerwx/arpspoof # libraries import argparse import os import subprocess import re import sys import uuid import s...
read_to_influxdb.py
import sys sys.path.append('../src/ptprobe') import logging import threading import time import argparse import board from sinks import InfluxDBSampleSink import json if __name__ == "__main__": format = "%(asctime)s: %(message)s" logging.basicConfig(format=format, level=logging.INFO, datefmt="%H:%M:%S") ...
csclient.py
""" NCOS communication module for SDK applications. Copyright (c) 2018 Cradlepoint, Inc. <www.cradlepoint.com>. All rights reserved. This file contains confidential information of CradlePoint, Inc. and your use of this file is subject to the CradlePoint Software License Agreement distributed with this file. Unauthor...
ipcontrollerapp.py
#!/usr/bin/env python # encoding: utf-8 """ The IPython controller application. Authors: * Brian Granger * MinRK """ #----------------------------------------------------------------------------- # Copyright (C) 2008-2011 The IPython Development Team # # Distributed under the terms of the BSD License. The full ...
main.py
import json from enum import Enum from threading import Thread import pandas import webview from flask import Blueprint, Flask, render_template from flask_cors import CORS from flask_sockets import Sockets from gevent import pywsgi from geventwebsocket.handler import WebSocketHandler import pymongo from pymongo impor...
tcp_serial_redirect.py
#!/usr/bin/env python # (C) 2002-2009 Chris Liechti <cliechti@gmx.net> # redirect data from a TCP/IP connection to a serial port and vice versa # requires Python 2.2 'cause socket.sendall is used # (C) 2010 Ben Kempke <bpkempke@umich.edu> # modified to dump all serial activity to file, accept multiple connections, an...
ee2_load_test.py
# -*- coding: utf-8 -*- import copy import logging import os import queue import threading import time import unittest from configparser import ConfigParser from unittest.mock import patch from lib.execution_engine2.authorization.workspaceauth import WorkspaceAuth from lib.execution_engine2.db.MongoUtil import MongoUt...
control.py
import threading import time import math from Queue import Queue, Empty class ControlThread(object): def __init__(self, delay=0): self.delay = delay self.queue = Queue() self.sleep = threading.Condition() def start(self, sense, rules, robot): self.sense = sense self.ru...
decision_client_tests.py
#!/usr/bin/env python3 # # Copyright (c) 2014-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals fro...
test.py
import json import os.path as p import random import subprocess import threading import time from random import randrange import pika import pytest from google.protobuf.internal.encoder import _VarintBytes from helpers.client import QueryRuntimeException from helpers.cluster import ClickHouseCluster from helpers.test_...
main.py
from pygame import mixer from pynput.keyboard import Key, Listener, Controller import threading from tkinter import * class Detector: def __init__(self): mixer.init() self.sound_fire = mixer.Sound("sounds/winchester.mp3") self.sound_reload_1 = mixer.Sound("sounds/winchester_reload_part1.mp...
wsdump.py
#!c:\users\vinicio\documents\python\proyecto1\venv\scripts\python.exe import argparse import code import sys import threading import time import ssl import six from six.moves.urllib.parse import urlparse import websocket try: import readline except ImportError: pass def get_encoding(): encoding = geta...
test_process_utils.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...
baikeandimg.py
''' 输入关键词 爬取百度百科第一段的简介 爬取百度图片前三十张图片 ''' import threading import urllib.request from urllib.parse import quote import urllib.parse import re import os from lxml import etree class BaikeAndImg: global headers # 定义全局变量headers # 字典headers 浏览器标识 headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0...
process.py
# -*- coding: utf-8 -*- ''' Functions for daemonizing and otherwise modifying running processes ''' # Import python libs from __future__ import absolute_import, with_statement, print_function, unicode_literals import copy import os import sys import time import errno import types import signal import logging import th...
_debugger_case_multiprocessing.py
import multiprocessing import sys def run(name): print("argument: ", name) # break 1 here if __name__ == '__main__': if sys.version_info[0] >= 3 and sys.platform != 'win32': multiprocessing.set_start_method('fork') multiprocessing.Process(target=run, args=("argument to run method",)).start() ...
manual.py
import tkinter as tk import threading WINDOW_SIZE_X = 500 WINDOW_SIZE_Y = 200 class Manual(tk.Tk): def __init__(self, client): super().__init__(className=' Manual Mode') self.client = client self.geometry(str(WINDOW_SIZE_X) + "x" + str(WINDOW_SIZE_Y)) self.joint_frame = tk.Frame(se...
video.py
import os import sys import dill from vipy.globals import print from vipy.util import remkdir, tempMP4, isurl, \ isvideourl, templike, tempjpg, filetail, tempdir, isyoutubeurl, try_import, isnumpy, temppng, \ istuple, islist, isnumber, tolist, filefull, fileext, isS3url, totempdir, flatlist, tocache, premkdir, ...
database.py
# Copyright 2013-2018 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) """ These tests check the database is functioning properly, both in memory and in its file """ import datetime import func...