source
stringlengths
3
86
python
stringlengths
75
1.04M
util.py
import hashlib import http.server import json import logging import os import re import shutil import socketserver import subprocess from contextlib import contextmanager, ExitStack from itertools import chain from multiprocessing import Process from shutil import rmtree, which from subprocess import check_call from ty...
dow.py
from classes.Config import DowConfig from classes.Database import DowDatabase from classes.Sankaku2 import DowSankaku from classes.Pixiv import DowPixiv from classes.Worker import DowWorker from classes.MimeType import DowMimeType import pathlib from multiprocessing import Process config = DowConfig(pathlib.Path(".")....
dataset.py
# Global dependencies from config import IMG_DIR_PATH, CLINICAL_CONTROL_COLUMNS, IMG_CODES_FILENAME, NON_IMG_DATA_FILENAME, \ N_DATALOADER_WORKERS, CACHE_LIMIT import os import pdb import copy import random import pickle import cv2 import numpy as np import pandas as pd from torch.utils.data import Dataset, Data...
show.py
import discord import logging import asyncio import os import json import time from discord.ext import commands from threading import Thread import s3 import podcast_utils import recording_utils recording_thread = None recording_buffer = recording_utils.BufSink() class ShowCog(commands.Cog): def __init__(...
executor.py
#!/usr/bin/env python # hook for virtualenv # switch to the virtualenv where the executor belongs, # replace all the path for modules import sys, os.path P = 'site-packages' apath = os.path.abspath(__file__) if P in apath: virltualenv = apath[:apath.index(P)] sysp = [p[:-len(P)] for p in sys.path if p.endswith...
TimeoutSendService.py
from __future__ import annotations from threading import Thread from typing import Callable, Optional from .interfaces import ITimeoutSendService from ..clock import IClock from ..service import IService, IServiceManager from ..send import ISendService from ..util.Atomic import Atomic from ..util.InterruptableSleep imp...
test_pdb.py
# A test suite for pdb; not very comprehensive at the moment. import doctest import os import pdb import sys import types import unittest import subprocess import textwrap from test import support # This little helper class is essential for testing pdb under doctest. from test.test_doctest import _FakeInput class P...
streamwaveform.py
import uhd from uhd import libpyuhd as lib import threading from Tools.WaveformMonitor import WaveformMonitor import time import os from watchdog.observers import Observer from watchdog.events import FileSystemEventHandler class EventHandler(FileSystemEventHandler): def __init__(self, streamingThread, waveMan): ...
main.py
#!/usr/bin/env python3 """ When studying distributed systems, it is usefull to play with concepts and create prototype applications. This main runner aims in helping with the prototyping, so that an application can be created as a class in ./classes/apps. This code contains the main runner that will run in each node....
test_xmlrpc.py
# expected: fail import base64 import datetime import sys import time import unittest import xmlrpclib import SimpleXMLRPCServer import mimetools import httplib import socket import StringIO import os import re from test import test_support try: import threading except ImportError: threading = None try: i...
arc2owl.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # author: houzhiwei # time: 2019/1/7 22:25 from owlready2 import * import json import re from JSON2OWL.OwlConvert.OwlUtils import OWLUtils from JSON2OWL.OwlConvert.Preprocessor import Preprocessor import datetime # import math module_uri = 'http://www.egc.org/ont/process...
thread_utils.py
# # This file is part of khmer, https://github.com/dib-lab/khmer/, and is # Copyright (C) Michigan State University, 2009-2015. It is licensed under # the three-clause BSD license; see LICENSE. # Contact: khmer-project@idyll.org # """Utilities for dealing with multithreaded processing of short reads.""" from __future...
server.py
import abc import socket from threading import Lock, Thread import six.moves.cPickle as pickle from flask import Flask, request from multiprocessing import Process from ..utils.sockets import determine_master from ..utils.sockets import receive, send from ..utils.serialization import dict_to_model # from multiprocessi...
xadmin_action.py
import os import threading import abupy import numpy as np from abupy import AbuFactorBuyBreak, AbuBenchmark, AbuCapital, ABuPickTimeExecute, AbuMetricsBase, AbuFactorAtrNStop, \ AbuFactorCloseAtrNStop, \ AbuFactorPreAtrNStop, AbuFactorSellBreak, ABuGridHelper, GridSearch, ABuFileUtil, WrsmScorer, EMarketSourc...
slack.py
import json import logging import random import re import requests import sys import time import traceback import websocket from markdownify import MarkdownConverter from will import settings from .base import IOBackend from will.utils import Bunch, UNSURE_REPLIES, clean_for_pickling from will.mixins import SleepMixi...
__init__.py
#coding:utf-8 import os import select import signal import sys import threading from wsgiref.simple_server import make_server from caty.core.system import System from caty.front.console import CatyShell from caty.front.web.console import HTTPConsoleThread from caty.util import init_writer from caty.util.syslog import i...
misc.py
import shutil import sys import os import tables import warnings from threading import Thread from queue import Queue, Empty from tierpsy import AUX_FILES_DIR # get the correct path for ffmpeg. First we look in the aux # directory, otherwise we look in the system path. def get_local_or_sys_path(file_name): file_...
progress_queue1.py
import time from multiprocessing import Process from multiprocessing import Queue # 共享全局变量通信 # 共享全局变量不使用于多进程编程,使用与多线程 def product(a): a[1] = 2 def consume(a): time.sleep(2) print(a) if __name__ == "__main__": a = {} p = Process(target=product, args=(a,)) c = Process(target=consume, args=(...
equilibrator-apiServer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from wsgiref.simple_server import make_server import sys import json import traceback import datetime from multiprocessing import Process from getopt import getopt, GetoptError from jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError,\ JSONRPCError, Inva...
client3.py
import socket from threading import Thread utf = "utf-8" sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect(('127.0.0.1', 19400)) print("Welcome to the chat, enter 'Bye' to exit") def send_message(): while True: sock.send(input().encode(utf)) def receive_message(): while True: ...
parallel_manager.py
import os import time import logbook import threading from tempfile import mkdtemp from six.moves import xmlrpc_client from .. import log from ..exceptions import INTERRUPTION_EXCEPTIONS, ParallelServerIsDown, ParallelTimeout from ..conf import config from .server import Server, ServerStates, KeepaliveServer from .wor...
flash_lights.py
import pyaudio from threading import Thread import time import numpy as np # import servo board from board import SCL, SDA import busio from adafruit_pca9685 import PCA9685 # Vales to control whether dome lights are on or off VOL_MIN = 400 VOL_MAX = 8000 RATE = 44100 # recording rate in Hz MAX = 400 # minimum volum...
test_threading_local.py
import unittest from doctest import DocTestSuite from test import support import weakref import gc # Modules under test _thread = support.import_module('_thread') threading = support.import_module('threading') import _threading_local class Weak(object): pass def target(local, weaklist): weak = Weak() lo...
goldenrod.py
# twisted imports from twisted.words.protocols import irc from twisted.internet import reactor, protocol from twisted.python import log import logging # system imports import datetime, time, sys, threading, os.path import commandparser import messagequeue import contestmanager import config import random...
raw.py
# Run to collect raw data or graph live data from data import * from graphics import start_loop import threading import argparse # Argparse for optional options parser = argparse.ArgumentParser() parser.add_argument('-s', '--save', action='store_true', help='saves to data.out') parser.add_argument('-g', '--graphics', ...
driver.py
from multiprocessing import Value from multiprocessing import Process class Driver(object): LINEAR = 'linear' ANGULAR = 'angular' #STEP LINEAR_STEP_SPEED = 0.05 ANGULAR_STEP_SPEED = 0.2 #MAX MAX_LINEAR_SPEED = 0.5 MAX_ANGULAR_SPEED = 1 def __init__(self): self.linear = V...
unit_tests.py
#! /bin/python import time import multiprocessing import unittest import unittest.mock import os import signal import logging import psutil import pynisher try: import sklearn # noqa is_sklearn_available = True except ImportError: print("Scikit Learn was not found!") is_sklearn_available = False al...
model.py
import json from threading import Thread import time from typing import Any, Dict, List, FrozenSet, Set, Union, Optional import urwid from zulipterminal.helper import ( asynch, classify_unread_counts, index_messages, set_count ) from zulipterminal.ui_tools.utils import create_msg_box_list class Mode...
simplesubscribe.py
# coding=utf-8 import zmq import threading import uuid from google.protobuf.message import DecodeError from fysom import Fysom import machinetalk.protobuf.types_pb2 as pb from machinetalk.protobuf.message_pb2 import Container class SimpleSubscribe(object): def __init__(self, debuglevel=0, debugname='Simple Subsc...
server_env.py
import gym from gym import spaces import numpy as np import asyncio import websockets from multiprocessing import Pipe, Process from threading import Thread import json import subprocess class ServerEnv(gym.Env): def __init__(self, serverIP='127.0.0.1', serverPort='8000', exeCmd=None, action_sp...
test_smtplib.py
import asyncore import base64 import email.mime.text from email.message import EmailMessage from email.base64mime import body_encode as encode_base64 import email.utils import hmac import socket import smtpd import smtplib import io import re import sys import time import select import errno import textwrap import thre...
java_gateway_test.py
# -*- coding: UTF-8 -*- """ Created on Dec 10, 2009 @author: barthelemy """ from __future__ import unicode_literals, absolute_import from collections import deque from decimal import Decimal import gc import math from multiprocessing import Process import os from socket import AF_INET, SOCK_STREAM, socket import subp...
dispatcher_node.py
# Copyright 2021 Open Source Robotics Foundation, 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...
_speech_synthesizer.py
# -*- coding: utf-8 -*- """ * Copyright 2015 Alibaba Group Holding Limited * * 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 * * Unl...
gruv_socks.py
from time import sleep from select import select from threading import Thread from traceback import print_exc from struct import pack, unpack, error as struct_error from socket import socket, SHUT_RDWR, SOL_SOCKET, SO_REUSEADDR, error as socket_error SOCK_ERROR = b'\x01' SOCK_TIMEOUT = b'\x00' class Soc...
test_s3.py
import boto3 import botocore.session from botocore.exceptions import ClientError from botocore.exceptions import ParamValidationError from nose.tools import eq_ as eq from nose.plugins.attrib import attr from nose.plugins.skip import SkipTest import isodate import email.utils import datetime import threading import re ...
window.py
# -*- coding=UTF-8 -*- # pyright: strict """umamusume pertty derby automation. """ import contextlib import logging import sys import threading import time from ctypes import windll from typing import Callable, Optional, Set, Text, Tuple import mouse import PIL.Image import PIL.ImageGrab import win32con import win32...
multipro3.py
#!/usr/bin/env python # -*- coding:utf-8 -*- ''' 进程间的通讯 当我们使用进程和线程的时候,我们会发现使用线程的时候列表是可传递数值的,是空享内存的 但是我们使用进程的时候会发现进程数据是不共享的列表每次都是一个元素输出 ''' from multiprocessing import Process from threading import Thread def run(info_list,n): info_list.append(n) print info_list ''' if __name__ =='__main__': i...
function_http.py
import socket import os import threading from picamera import PiCamera class OutputStream: def __init__(self, to, cam): self.to = to self.cam = cam def start_header(self, response_code=200, msg="OK"): self.to.send(f"HTTP/1.0 {str(response_code)} {str(msg)}\r\n".encode()) def add...
master.py
# -*- coding: utf-8 -*- ''' This module contains all of the routines needed to set up a master server, this involves preparing the three listeners and the workers needed by the master. ''' # Import python libs import os import re import time import errno import fnmatch import signal import shutil import stat import lo...
train.py
# Author: Bichen Wu (bichen@berkeley.edu) 08/25/2016 """Train""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from datetime import datetime import os.path import sys import time import math import numpy as np from six.moves import xrange import tensorf...
Client.py
#!/usr/bin/env python ########################################################################### import os import shutil def EnsureDir(path): if not os.path.exists(path): os.makedirs(path) def RemoveDir(path): if os.path.exists(path): shutil.rmtree(path) def split_list(a, n): k, m = di...
python_ls.py
# Copyright 2017 Palantir Technologies, Inc. from functools import partial import logging import os import sys import socketserver import threading from pyls_jsonrpc.dispatchers import MethodDispatcher from pyls_jsonrpc.endpoint import Endpoint from pyls_jsonrpc.streams import JsonRpcStreamReader, JsonRpcStreamWriter ...
client.py
#!/usr/bin/python2 import socket import json import os import sys import time import threading # Constants DEFAULTPORT = 60000 if os.path.isfile("port"): with open("port", 'r') as f: DEFAULTPORT = int(f.read().strip()) # Utility functions def dprint(s): if hasattr(dprint, 'number'): sys.stde...
test__transaction.py
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (c) 2001, 2002, 2005 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should acc...
app.py
import os import sys import logging import multiprocessing import time from flask import Flask, request, jsonify from flask_cors import CORS import io from io import BytesIO from PIL import Image import cv2 import numpy as np from worker import get_model_api # define the app app = Flask(__name__) CORS(app) # neede...
test.py
import threading import time from flask import Flask app = Flask(__name__) def run_job(): while True: print("Run recurring task") #time.sleep(3) @app.before_first_request def activate_job(): print("b4") @app.route("/") def hello(): return "Hello World!" if __name__ == "...
BBCLIPS.py
# -*- coding: utf-8 -*- ''' @author: arcra ''' import time, threading, os import Tkinter as tk import argparse import clipsFunctions from clipsFunctions import clips, _clipsLock import pyrobotics.BB as BB from pyrobotics.messages import Command, Response import GUI from BBFunctions import assertQueue, ResponseReceiv...
main.py
from __future__ import absolute_import, print_function import argparse import os import sys import threading import time from os import listdir from os.path import isfile, join from sys import platform as _platform from threading import Thread import cv2 import pyfakewebcam from PIL import Image, ImageTk if sys.vers...
elements.py
from __future__ import division from __future__ import print_function from __future__ import absolute_import from future import standard_library standard_library.install_aliases() from builtins import str import tkinter as tk import tkinter.filedialog as tkfile import sys, os, re import threading from . import objects...
stepper_motor.py
#!/usr/bin/env python import time import sys import Queue import threading import RPi.GPIO as GPIO import config import led import gpio_lock steps_queue = Queue.Queue() change_notify = None def set_motor_input(i1, i2, i3, i4): GPIO.output(config.STEP_MOTOR_IN1, i1) GPIO.output(config.STEP_MOTOR_IN2, i2) ...
8.flask_multiple_session_impliment.py
import subprocess from selenium.webdriver import Chrome import pywebio import template import time import util from pywebio.input import * from pywebio.output import * from pywebio.utils import to_coroutine, run_as_function def target(): template.basic_output() template.background_output() run_as_funct...
display_ssd1306.py
#!/usr/bin/env python3 ''' ***************************************** PiFire Display Interface Library ***************************************** Description: This library supports using the SSD1306 display with 64Hx128W resolution. This module utilizes Luma.LCD to interface this display. *******************...
douyin01.py
# -*- coding:utf-8 -*- import random import time from appium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.ui import WebDriverWait from config import * import multiprocessing class DouYin(objec...
VideoStream.py
#To make python 2 and python 3 compatible code from __future__ import absolute_import from threading import Thread import sys if sys.version_info[0] < 3:#e.g python version <3 import cv2 else: import cv2 from cv2 import cv2 # import the Queue class from Python 3 if sys.version_info >= (3, 0): from queue ...
storage.py
import base64 import datetime import json import requests import sys import threading import time import utils global _bc,_fs,_fs_d,_fs_s,_fs_u ORG_NAME="tmp-5y34hjweu" REPO_NAME="_app_data2" with open("server/token.dt","r") as f: GITHUB_TOKEN=f.read().strip() GITHUB_HEADERS="application/vnd.github.v3+json,applicat...
utils.py
import ast, json, threading, platform, os from http.server import SimpleHTTPRequestHandler from enum import Enum try: from SimpleWebSocketServer import SimpleWebSocketServer, WebSocket except ImportError: SimpleWebSocketServer = object WebSocket = object class Watchable(Enum): Source = "Source" F...
gpu.py
import io import os import time import pandas as pd import subprocess import threading import psutil class GPUMonitor(object): def __init__(self, interval=5): """ Constructor :type interval: int :param interval: Check interval, in seconds """ self.interval = interv...
timeout.py
"""An implementation of the decorator design pattern for enforcing timeout. Typical usage example: @timeout(10) def function_that_will_return_none_after_ten_seconds(): ... """ from functools import wraps from time import sleep from kthread import KThread def timeout(seconds): """A decorator ...
lib.py
# -*- coding: utf-8 -*- """Utility functions used for Avalon - Harmony integration.""" import subprocess import threading import os import random import zipfile import sys import importlib import shutil import logging import contextlib import json import signal import time from uuid import uuid4 from Qt import QtWidget...
bios_console.py
#!/usr/bin/env python import os import pty import threading import argparse import subprocess import shutil from litex.tools.litex_term import LiteXTerm from rowhammer_tester.scripts.utils import RemoteClient, litex_server def pty2crossover(m, stop): while not stop.is_set(): r = os.read(m, 1) w...
Decorators.py
# -*- coding: utf-8 -*- import codecs import sys import functools import threading import re import ast import collections def Singleton(class_): instances = {} def getinstance(*args, **kwargs): if class_ not in instances: instances[class_] = class_(*args, **kwargs) return instanc...
bench.py
#!/usr/bin/env python3 import os import sys import time import subprocess import gc import statistics import json import threading import re import csv # Need to avoid as much extra CPU usage as possible gc.disable() # sysfs power supply nodes for power sampling POWER_SUPPLY = None POWER_SUPPLY_NODES = [ # Qualc...
pubsub.py
from __future__ import absolute_import import redis import logging import random from django.conf import settings from threading import Thread from six.moves.queue import Queue, Full class QueuedPublisher(object): """ A publisher that queues items locally and publishes them to a remote pubsub service on...
helpers.py
"""Supporting functions for polydata and grid objects.""" import collections.abc import enum import logging import signal import sys from threading import Thread import threading import traceback import numpy as np from pyvista import _vtk import pyvista from .fileio import from_meshio from . import transformations ...
imagefolder.py
# Copyright (c) Facebook, Inc. and its affiliates. import http.server import os import re import threading import torch import torch.utils.data.backward_compatibility import torchvision.datasets as datasets import torchvision.datasets.folder import torchvision.transforms as transforms from PIL import Image from torch....
test_venv.py
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import absolute_import import errno import multiprocessing import os import shutil import subprocess import sys import tempfile from subprocess import CalledProcessError f...
executorwebdriver.py
import json import os import socket import threading import time import traceback import urlparse import uuid from .base import (CallbackHandler, RefTestExecutor, RefTestImplementation, TestharnessExecutor, extra_timeout, st...
env_stock_papertrading.py
import datetime import threading from finrl.finrl_meta.data_processors.processor_alpaca import AlpacaProcessor import alpaca_trade_api as tradeapi import time import pandas as pd import numpy as np import torch import gym class AlpacaPaperTrading(): def __init__(self,ticker_list, time_interval, drl_lib, agent, cw...
core.py
# Copyright 2018 John Reese # Licensed under the MIT license import asyncio import sys import time from unittest import TestCase from unittest.mock import patch import aiomultiprocess as amp from .base import ( async_test, do_nothing, get_dummy_constant, initializer, raise_fn, sleepy, two,...
kafka_broker_integration_test.py
#!/usr/bin/python import random import os import shutil import socket import subprocess import tempfile from threading import Thread, Semaphore import time import unittest from kafka import KafkaAdminClient, KafkaConsumer, KafkaProducer, TopicPartition from kafka.admin import ConfigResource, ConfigResourceType, NewPa...
framework.py
#!/usr/bin/env python from __future__ import print_function import gc import sys import os import select import unittest import tempfile import time import faulthandler import random import copy import psutil from collections import deque from threading import Thread, Event from inspect import getdoc, isclass from tra...
tests (copy).py
#!/usr/bin/env python import unittest import contextlib import json import constants as cst import calendar import time import rospy from std_msgs.msg import String from threading import Thread PKG = 'social_robotics' import sys def load_json(path): with contextlib.closing(open(path)) as json_data: ...
contextlog.py
"""This file and its contents are licensed under the Apache License 2.0. Please see the included NOTICE for copyright information and LICENSE for a copy of the license. """ import logging import os import sys import io import requests import calendar import threading import json import platform from datetime import da...
cli.py
from __future__ import absolute_import import sys import logging from flask_assistant.utils import get_assistant from .schema_handlers import IntentGenerator, EntityGenerator, TemplateCreator from .api import ApiAi from . import logger from multiprocessing import Process logger.setLevel(logging.INFO) api = ApiAi() ...
function.py
# # public function used by CUIT web site # from threading import Thread from flask.ext.mail import Message import config def user_rank_color(score): if score in xrange(0,1000): return "#24e5bf" elif score in xrange(1000,1500): return "#f2cf2e" else : return "#fd8321" def submit_...
__init__.py
import json import re import threading import time from urllib.request import Request, urlopen from i3pystatus import SettingsBase, IntervalModule, formatp from i3pystatus.core.util import user_open, internet, require class WeatherBackend(SettingsBase): settings = () @require(internet) def http_request(...
client.py
""" This module contains the HiSockClient, used to power the client of HiSock, but also contains a `connect` function, to pass in things automatically. It is strongly advised to use `connect` over `HiSockClient`, as `connect` passes in some key arguments that `HiSockClient` does not provide ===========================...
articlecrawler.py
#!/usr/bin/env python # -*- coding: utf-8, euc-kr -*- #사용 모듈 from time import sleep from bs4 import BeautifulSoup from multiprocessing import Process from korea_news_crawler.exceptions import * from korea_news_crawler.articleparser import ArticleParser from korea_news_crawler.writer import Writer import os import pla...
test_kex_gss.py
# Copyright (C) 2003-2007 Robey Pointer <robeypointer@gmail.com> # Copyright (C) 2013-2014 science + computing ag # Author: Sebastian Deiss <sebastian.deiss@t-online.de> # # # 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 Gene...
test_autograd.py
import contextlib import gc import sys import io import math import random import tempfile import time import threading import unittest import warnings from copy import deepcopy from collections import OrderedDict from itertools import product, permutations from operator import mul from functools import reduce, partial...
test_cases.py
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2018-2019 Fetch.AI Limited # # 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 ...
server.py
import socket from threading import Thread socketList = [] def waitConnect(s): """ cmd format --> # -H $IP -p $PORT -c <start|stop> """ while True: sock, addr = s.accept() if sock not in socketList: socketList.append(sock) def sendCmd(cmd): print("Send command......"...
http2_connection.py
import Queue import threading import socket import errno import struct from http_common import * from hyper.common.bufsocket import BufferedSocket from hyper.packages.hyperframe.frame import ( FRAMES, DataFrame, HeadersFrame, PushPromiseFrame, RstStreamFrame, SettingsFrame, Frame, WindowUpdateFrame, GoAway...
mikemanager.py
#!/usr/bin/python -u # coding=utf-8 """ Manage microphone with pyaudio """ import logging import os import sys import threading import time import traceback import wave from collections import deque from pathlib import Path from subprocess import Popen, PIPE import argparse import glob import yaml import pandas as pd f...
main_window.py
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2012 thomasv@gitorious # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including witho...
tello.py
import socket import threading import time import numpy as np import libh264decoder class Tello: """Wrapper class to interact with the Tello drone.""" def __init__(self, local_ip, local_port, imperial=False, command_timeout=.3, tello_ip='192.168.10.1', tello_port=8889): """ Bi...
test_mp.py
import torch import torch.multiprocessing as mp import time class warpper(): def __init__(self, t): self.t = t def fn(t): #it is not safe ''' PS F:\Dota2BotStepByStep> python .\d2bot\test\test_mp.py tensor([ 3.5505e+05]) tensor([ 3.8177e+05]) tensor([ 4.7613e+05]) ...
multithread_http_server.py
#!/usr/bin/env python """ MIT License Copyright (c) 2018 Ortis (cao.ortis.org@gmail.com) 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 righ...
test_dist_graph_store.py
import os os.environ['OMP_NUM_THREADS'] = '1' import dgl import sys import numpy as np import time import socket from scipy import sparse as spsp from numpy.testing import assert_array_equal from multiprocessing import Process, Manager, Condition, Value import multiprocessing as mp from dgl.graph_index import create_gr...
server.py
######### # Copyright (c) 2014 GigaSpaces Technologies Ltd. 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...
multiprocessing_logging_1.py
import logging import logging.handlers import multiprocessing from random import choice, random import time import utils def listener_configurer(): root = logging.getLogger() log_file_path = f"{utils.get_logs_directory()}/multiprocessing_logging_1.log" h = logging.handlers.RotatingFileHandler(log_file_pa...
api.py
import hashlib import os import random import sqlite3 import string import sys import threading import time from typing import List, Dict, Tuple import cv2 import numpy as np # import pd2image_patched from pd2image_patched import convert_from_path from pytesseract import pytesseract, Output import api_interface cla...
scdlbot.py
# -*- coding: utf-8 -*- """Main module.""" import gc import pathlib import random import shelve import shutil from datetime import datetime from multiprocessing import Process, Queue from queue import Empty from subprocess import PIPE, TimeoutExpired # skipcq: BAN-B404 from urllib.parse import urljoin from uuid impo...
state_machine.py
#!/usr/bin/env python from pysm import StateMachine, State, Event import drill_machine import melt_machine import threading import rospy from std_msgs.msg import Int32 from std_msgs.msg import Bool from std_msgs.msg import Empty from std_msgs.msg import String from nuice_msgs.srv import FloatCommand, FloatCommandRespo...
email.py
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.app_context(): mail.send(msg) def send_email(subject, sender, recipients, text_body, html_body, attachments=None, sync=False): msg = Message(subject...
app.py
import flask from functools import partial import logging import queue import threading import time from .service import Agent, Channel from .service.slack import load_config, validate_token, get_service from .dispatch import QueuingDispatch, MuxDispatch from .game import GeneralWerewolf, SpecificWerewolf from .persis...
ecr.py
""" Date 04.2021 @author: Chair of Functional Materials - Saarland University - Saarbrücken, Bruno Alderete @version 1.2 """ __author__ = 'Bruno Alderete' ####################################################################################################################### # # The MIT License (MIT) # # Cop...
GameSpaceBot.py
from threading import Thread from source.console.Preview import Preview from source.main.Main import Main from source.vkapi.CallBackAPI import m_thread from source.vkapi.VkAPP.GSB import app # Preview Preview.preview() # Messages Handling messages = Thread(target=Main.routine) messages.start() # VkApp vk_app = Thre...
filelockscheduler.py
import multiprocessing import threading import atexit import time from multiprocessing import shared_memory from filelock import Timeout, FileLock CPUS = multiprocessing.cpu_count() global cpu_list ''' The CPU bits (0 for unused, 1 for occupied) in the shared list are designed to pre-empt load off the lockfiles and ...