source
stringlengths
3
86
python
stringlengths
75
1.04M
input_dataset.py
from .dataset import DataSet, DataSetMode, RawDataSet from calamari_ocr.ocr.data_processing import DataPreprocessor from calamari_ocr.ocr.text_processing import TextProcessor from calamari_ocr.ocr.augmentation import DataAugmenter from typing import Generator, Tuple, List, Any import numpy as np import multiprocessing ...
cloud.py
""" Object Store plugin for Cloud storage. """ import logging import multiprocessing import os import os.path import shutil import subprocess import threading import time from datetime import datetime from galaxy.exceptions import ObjectInvalid, ObjectNotFound from galaxy.util import ( directory_hash_id, safe...
test_serializable_count_can_fail.py
############## # Setup Django import django django.setup() ############# # Test proper import threading import time import pytest from django.db import DatabaseError, connection, transaction from django.db.models import F, Subquery from app.models import Sock @pytest.mark.django_db def test_serializable_count_can...
OBS_OSC.py
#!/usr/bin/python # # OBS_OSC.py # # by Claude Heintz # copyright 2014-2020 by Claude Heintz Design # # see license included with this distribution or # https://www.claudeheintzdesign.com/lx/opensource.html # import socket import threading import time from select import select import math import struct import ...
two_thread.py
## в два потока import time from threading import Thread def countup(N): n = 0 while n < N: n += 1 if __name__ == '__main__': max_for_thread = 30000000//2 first_thread = Thread(target=countup, args=(max_for_thread,)) second_thread = Thread(target=countup, args=(max_for_thread,)) st_t...
test_socketserver.py
""" Test suite for socketserver. """ import contextlib import io import os import select import signal import socket import tempfile import threading import unittest import socketserver import test.support from test.support import reap_children, reap_threads, verbose test.support.requires("network") TEST_STR = b"h...
main.py
# -*- coding: utf-8 -*- import socket import serial import serial.tools.list_ports import sys from subprocess import PIPE, Popen from threading import Thread import os import re import signal try: from queue import Queue, Empty except ImportError: from Queue import Queue, Empty # python 2.x from PyQt5.QtWid...
signpeaker.py
from urllib.parse import urlencode import threading import traceback import responder import requests import livejson import datetime import base64 import pytz import time SETTINGS = livejson.File("settings.json") if "host" not in SETTINGS: SETTINGS["host"] = "0.0.0.0" if "port" not in SETTINGS: SETTINGS["port"] = 5...
mark_for_deployment.py
#!/usr/bin/env python # Copyright 2015-2016 Yelp 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 ...
test_fetchplugin_dialog_model.py
"""test_fetchplugin_dialog_model.py - tests the fetchplugin_dialog_model module Chris R. Coughlin (TRI/Austin, Inc.) """ __author__ = 'Chris R. Coughlin' from models import fetchplugin_dialog_model from models import zipper from controllers import pathfinder import cStringIO import os import SimpleHTTPSe...
tests.py
from time import sleep from django.conf import settings from typing import List, Tuple # import os # testing libraries from django.test import TestCase from unittest_dataprovider import data_provider # django_adtools from django_adtools.ad_tools import ad_clear_username from django_adtools.discover_dc import DCList,...
ServerWorkSync3.py
''' Version 3.0 - Now \w Journals and Threading ''' from watchdog.events import PatternMatchingEventHandler from colorama import Fore, Style from lib.rfilecmp import cmp import stat,csv,time import pandas as pd import threading import paramiko import os,errno '''(Hint: Check threading -> Attempt to connect (required ...
sensord.py
#!/usr/bin/python3 # # Copyright (c) 2017-2021 Ilker Temir # # MIT License # # 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 ...
client_credentials_grant.py
import os import signal import sys from wsgiref.simple_server import WSGIRequestHandler, make_server sys.path.insert(0, os.path.abspath(os.path.realpath(__file__) + '/../../../')) from oauth2 import Provider from oauth2.grant import ClientCredentialsGrant from oauth2.store.memory import ClientStore, TokenStore from o...
adapters.py
import can import socket import struct import serial from queue import Queue import threading class SocketCANConnection: # See <linux/can.h> for format CAN_FRAME_FMT = "=IB3x8s" CAN_FRAME_SIZE = struct.calcsize(CAN_FRAME_FMT) def __init__(self, interface): """ Initiates a CAN connecti...
acceptor.py
# -*- coding: utf-8 -*- """ proxy.py ~~~~~~~~ ⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on Network monitoring, controls & Application development, testing, debugging. :copyright: (c) 2013-present by Abhinav Singh and contributors. :license: BSD, see LICENSE...
_logger.py
""" .. References and links rendered by Sphinx are kept here as "module documentation" so that they can be used in the ``Logger`` docstrings but do not pollute ``help(logger)`` output. .. |Logger| replace:: :class:`~Logger` .. |add| replace:: :meth:`~Logger.add()` .. |remove| replace:: :meth:`~Logger.remove()` .. |...
app.py
#!/bin/python3 import threading import msg_handler import http_interface msgThread = threading.Thread(target=lambda: msg_handler.mainLoop()) msgThread.daemon = True msgThread.start() http_interface.app.run(host='localhost', port=8080)
train_abstractive.py
#!/usr/bin/env python """ Main training workflow """ from __future__ import division import argparse import glob import os import random import signal import time import torch from pytorch_transformers import BertTokenizer import distributed from models import data_loader, model_builder from models.data_loader i...
test_wrapper.py
from __future__ import division, absolute_import, print_function __copyright__ = "Copyright (C) 2009 Andreas Kloeckner" __license__ = """ 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 r...
__init__.py
# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the f...
lcddaemon.py
#!/usr/bin/env python3 #-*- coding: utf-8 -*- """ This script is the launcher of the daemon. """ import sys import threading from core.daemonargs import parse_arguments from core.message import Message from core.message import set_default_repeat from core.message import set_default_ttl from core.message import set_de...
do_backup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' A script doing periodical backup. ''' from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import argparse from datetime import datetime, timedelta import dateutil.relativ...
docker_image_manager.py
from collections import namedtuple import threading import time import traceback import logging import docker from codalabworker.fsm import DependencyStage from codalabworker.state_committer import JsonStateCommitter from codalabworker.worker_thread import ThreadDict logger = logging.getLogger(__name__) # Stores th...
local_job_service.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
keep_alive.py
from flask import Flask from threading import Thread app = Flask('') @app.route('/') def main(): return "papicito is sexy" def run(): app.run(host="0.0.0.0", port=8080) def keep_alive(): server = Thread(target=run) server.start()
workers.py
# /* # * Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. # * # * Licensed under the Apache License, Version 2.0 (the "License"). # * You may not use this file except in compliance with the License. # * A copy of the License is located at # * # * http://aws.amazon.com/apache2.0 # * # * or i...
pijuice.py
#!/usr/bin/env python3 __version__ = "1.8" import ctypes import sys import threading import time from smbus import SMBus pijuice_hard_functions = ['HARD_FUNC_POWER_ON', 'HARD_FUNC_POWER_OFF', 'HARD_FUNC_RESET'] pijuice_sys_functions = ['SYS_FUNC_HALT', 'SYS_FUNC_HALT_POW_OFF', 'SYS_FUNC_SYS_OFF_HALT', 'SYS_FUNC_REBO...
test_socket.py
import unittest from test import support import errno import io import itertools import socket import select import tempfile import time import traceback import queue import sys import os import array import contextlib from weakref import proxy import signal import math import pickle import struct import random import...
thread_function.py
# coding=utf-8 # Copyright 2021 DeepMind Technologies 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 # # Unless required by applic...
3_philosophers.py
from threading import Semaphore, Thread from time import sleep from timeit import Timer import random rand = random.Random() rand.seed(100) #num of philosopher num_p = 20 # num of meal/philosopher r =100 #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ #Tanenbaum left philosopher function def t_left(i): return (i+num_p-1)%nu...
main.py
import glob import os import shutil import sys import threading import time import configparser import eventlet from tkinter import messagebox, Tk, filedialog, colorchooser import cv2 import numpy as np from PIL import Image from PyQt6 import QtWidgets, QtCore, QtGui from translate import translate, change_translate_...
SentenceTransformer.py
import json import logging import os import shutil from collections import OrderedDict from typing import List, Dict, Tuple, Iterable, Type, Union, Callable from zipfile import ZipFile import requests import numpy as np import transformers import torch from numpy import ndarray from torch import nn, Tensor, device from...
gmail.py
""" File: gmail.py -------------- Home to the main Gmail service object. Currently supports sending mail (with attachments) and retrieving mail with the full suite of Gmail search options. """ import base64 from email.mime.audio import MIMEAudio from email.mime.application import MIMEApplication from email.mime.base ...
Hub.py
from udi_interface import Node,LOGGER import sys,logging,yaml,re from traceback import format_exception from threading import Thread,Event from nodes import Device,Activity from harmony_hub_funcs import ip2long,long2ip,get_valid_node_name,get_file from pyharmony import client as harmony_client from sleekxmpp.exception...
index.py
from concurrent.futures import process from scripts.query import run as query from scripts.execute import run as execute from utils.mongo import Mongo from threading import Thread query() threads = 24 documents = Mongo().get_all_documents() def loop(start, stop): for i in range(start, stop): if documents...
check_azure_accounts.py
from datetime import datetime, timezone from django.core.management.base import BaseCommand import logging from multiprocessing import Process, Queue from organisation.models import DepartmentUser, CostCentre, Location from organisation.utils import ms_graph_users def get_users(queue): # Worker function to call ...
main.py
import socket import ssl import threading import select import re import os import sys import subprocess import time from binascii import hexlify, unhexlify from base64 import b64encode from seth.args import args from seth.parsing import * import seth.consts as consts class RDPProxy(threading.Thread): """Represe...
tests.py
import unittest import time import random import threading from subprocess import CalledProcessError from os.path import abspath, join, dirname, exists from os import mkdir import shutil from maryjane import Project, Observer, MaryjaneSyntaxError WAIT = 1 class ProjectTestCase(unittest.TestCase): def setUp(sel...
oandav20store.py
from __future__ import (absolute_import, division, print_function, unicode_literals) import collections import threading import copy import json import time as _time from datetime import datetime, timezone import v20 import backtrader as bt from backtrader.metabase import MetaParams from back...
midiate.py
# -*- coding: utf-8 -*- ################################################################## ## pymidiate ## ## Copyright (C) 2018-2019 PGkids Laboratory <lab@pgkids.co.jp> ## ################################################################## import sys import subproc...
server.py
# encoding=utf-8 import sys sys.path.append("../../..") from simplerpc.rpcserver import RpcServer from simplerpc.simplerpc import dispatcher, AsyncResponse import time @dispatcher.add_method def foobar(**kwargs): return kwargs["foo"] + kwargs["bar"] @dispatcher.add_method def make_error(*args): raise @dis...
threads.py
__author__ = "Altertech Group, http://www.altertech.com/" __copyright__ = "Copyright (C) 2018-2019 Altertech Group" __license__ = "Apache License 2.0" __version__ = "0.2.7" import threading from functools import wraps from pyaltt import task_supervisor from pyaltt import TASK_NORMAL class LocalProxy(threading.loc...
OB_tkwindowv4.py
from OB_classesv3 import On_Box_Window import time from Decoder import * from threading import Thread import serial.tools.list_ports #import glances_sub from glances_sub import system_specs import watchdog import os import datetime as dt ser = serial.Serial("/dev/ttyACM0",9600) ser.flush() parser = bi...
simple_pusher.py
"""A really dump pusher 'clone', for use in testing and running locally.""" import argparse import collections import json import logging import SimpleHTTPServer import SocketServer import sys import threading import time import SimpleWebSocketServer HTTP_PORT = 8101 WEBSOCKET_PORT = 8102 LOGFMT = '%(asctime)s %(leve...
kb_virsorter2Server.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import datetime import json import os import random as _random import sys import traceback from getopt import getopt, GetoptError from multiprocessing import Process from os import environ from wsgiref.simple_server import make_server import requests as _requests from json...
__main__.py
#!/usr/bin/env python3 # # MIT License # # (C) Copyright 2019-2022 Hewlett Packard Enterprise Development LP # # 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 w...
clusterScalerTest.py
# Copyright (C) 2015-2018 Regents of the University of California # # 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 app...
fdsnwstest.py
#!/usr/bin/env python ############################################################################### # Copyright (C) 2013-2014 by gempa GmbH # # Author: Stephan Herrnkind # Email: herrnkind@gempa.de ############################################################################### from __future__ import absolute_imp...
reviews.py
""" Fall 2017 CSc 690 File: flickr_thread.py Author: Steve Pedersen & Andrew Lesondak System: OS X Date: 12/13/2017 Usage: python3 spotify_infosuite.py Dependencies: pyqt5, thread, pitchfork, metacritic Description: Requester class. A thread used to search Metacritic and Pitchfork asynchronously. """ from reviews.pi...
dataloader.py
import os import sys # set environment #module_name ='PaGraph' #modpath = os.path.abspath('.') #if module_name in modpath: # idx = modpath.find(module_name) # modpath = modpath[:idx] #sys.path.append(modpath) import dgl import torch import numpy as np import multiprocessing as mp import socket barrier_interval = 20...
app.py
"""ThreatConnect Playbook App""" # standard library import json import time import traceback from threading import Lock, Thread from urllib.parse import urlparse # third-party import dns.exception import dns.message import dns.query import dns.resolver # first-party from argcheck import tc_argcheck from json_util im...
bot.py
from trade_client import TradeClient from trading import TradeORB from log_wrapper import LogWrapper import threading #practice account so no security threat accountID = '101-001-19034598-001' token = '06e811dacdba86915a05a7031c744136-94a79c4cfede80f7362248aa069e8214' # creating oanda client object trade_client = Tra...
server_rpc.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # king_phisher/server/server_rpc.py # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice...
test_asyncore.py
import asyncore import unittest import select import os import socket import threading import sys import time from test import test_support from test.test_support import TESTFN, run_unittest, unlink from StringIO import StringIO HOST = test_support.HOST class dummysocket: def __init__(self): self.closed ...
gpu.py
import os import re import sys import time import trio import uuid import string import random import shutil import curses import zipfile import clip_filter import pandas as pd import infrastructure from glob import glob from tqdm import tqdm from pathlib import Path from colorama import Fore from gevent import joinall...
26_sound_recorder.py
import tkinter as tk import threading import pyaudio import wave class App(): chunk = 1024 sample_format = pyaudio.paInt16 channels = 2 fs = 44100 frames = [] def __init__(self, master): self.isrecording = False self.button1 = tk.Button(main, text='rec',...
data_preprocessor.py
#!/usr/bin/env python import wx import wx.lib.buttons import wx.lib.agw.customtreectrl as CT import gettext import os import re import sys import fcntl import threading import Queue import time import socket import struct import shlex import signal import subprocess import psutil import pty import yaml import datetime...
face_reco.py
import face_recognition import cv2 import kinect import img_file_parser import voice2text import threading import mc_face import os import tts import db_wrapper # Get a reference to webcam #0 (the default one) class face_reco(): def __init__(self): self.video_capture = cv2.VideoCapture(0) self.db =...
create_tfrecords.py
""" Create the tfrecord files for a dataset. This script is taken from the Visipedia repo: https://github.com/visipedia/tfrecords A lot of this code comes from the tensorflow inception example, so here is their license: # Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version ...
exposition.py
import base64 from contextlib import closing from http.server import BaseHTTPRequestHandler import os import socket from socketserver import ThreadingMixIn import sys import threading from urllib.error import HTTPError from urllib.parse import parse_qs, quote_plus, urlparse from urllib.request import ( build_opener...
test_backends.py
from functools import partial from tempfile import NamedTemporaryFile from threading import Thread import time from mock import Mock from mock import call from mock import patch import pytest from yoyo import backends from yoyo import read_migrations from yoyo import exceptions from yoyo.connections import get_backen...
test_socket.py
import unittest from test import support import errno import io import itertools import socket import select import tempfile import time import traceback import queue import sys import os import array import platform import contextlib from weakref import proxy import signal import math import pickle import struct impo...
bus_controller.py
from __init__ import * class BusController(object): def __init__(self): self._logger = logging.getLogger('{}.{}'.format(cfg.LOGGER_BASE_NAME, self.__class__.__name__)) self._root = tk.Tk() self._bus_view = BusView(master=self._root, controller=self) self._bus_data = HomeBusAlerter(...
conftest.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- # Copyright (c) "Neo4j" # Neo4j Sweden AB [http://neo4j.com] # # This file is part of Neo4j. # # 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 #...
test_utils.py
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
inference.py
"""Helper functions to run inference on trained models""" import argparse import os import sys import numpy as np import tensorflow as tf import multiprocessing as mp import json import zipfile from cddd.input_pipeline import InputPipelineInferEncode, InputPipelineInferDecode from cddd.hyperparameters import ...
test_capture.py
from __future__ import absolute_import, division, print_function # note: py.io capture tests where copied from # pylib 1.4.20.dev2 (rev 13d9af95547e) from __future__ import with_statement import pickle import os import sys from io import UnsupportedOperation import _pytest._code import py import pytest import contextl...
_coreg_gui.py
# -*- coding: utf-8 -*- u"""Traits-based GUI for head-MRI coregistration. Hierarchy --------- This is the hierarchy of classes for control. Brackets like [1] denote properties that are set to be equivalent. :: CoregFrame: GUI for head-MRI coregistration. |-- CoregModel (model): Traits object for estimating the h...
mpdatagen_nearest.py
import numpy as np import glob import os import uproot as ur import time from multiprocessing import Process, Queue, set_start_method import compress_pickle as pickle from scipy.stats import circmean from sklearn.neighbors import NearestNeighbors import random def geo_coords_to_xyz(geo_data): geo_xyz = np.zeros((g...
server.py
import logging import os import socketserver import threading import argparse from functools import partial from typing import Callable, Optional from mrols.mro_lang_server import MROLanguageServer log = logging.getLogger(__name__) class _StreamHandlerWrapper(socketserver.StreamRequestHandler, object): """A wra...
mc-monitor.py
#!/usr/bin/env python3 # -*- coding: utf8 -*- # VERSION: 1.2.2 """ Copyright 2016 Fingercomp 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/LICE...
_handfree_control.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import os import queue import threading import subprocess import datetime import time import codecs import requests as web import bs4 import urllib.parse def v_output(txt): playFile='temp/temp_playSJIS.txt' while os.path.exists(playFile): ti...
upgrade_test.py
#!/usr/bin/env python3 from argparse import ArgumentParser, RawDescriptionHelpFormatter import glob import os from pathlib import Path import platform import random import shutil import stat import subprocess import sys from threading import Thread, Event import traceback import time from urllib import request import ...
penv.py
import gym from gym_minigrid.minigrid import OBJECT_TO_IDX, COLOR_TO_IDX from multiprocessing import Process, Pipe def get_global(env, obs): # get global view grid = env.grid # position agent x, y = env.agent_pos # rotate to match agent's orientation for i in range(env.agent_dir + 1):...
dispatcher.py
import argparse import subprocess import os import multiprocessing import pickle import csv from twilio.rest import Client import json import sys from os.path import dirname, realpath sys.path.append(dirname(dirname(realpath(__file__)))) import rationale_net.utils.parsing as parsing EXPERIMENT_CRASH_MSG = "ALERT! jo...
stream.py
slait_server = "http://192.168.220.128:5994/" # slait_server = "http://127.0.0.1:5994/" def subscriber_test(): from os import sys, path sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) import pyslait sc = pyslait.StreamClient(slait_server) @sc.onCtrl("lobs","BTC") def on_ct...
random.py
import os import cv2 import sys import threading thread_started = False def thread(): global thread_started print(thread_started) # Making a new window and setting its properties cv2.namedWindow('Image', cv2.WND_PROP_FULLSCREEN) cv2.setWindowProperty("Image", cv2.WND_PROP_FULLSCREEN, cv2.WINDO...
run_test.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import multiprocessing as mp import os import runpy import shutil import subprocess import...
main.py
from threading import Thread from critical_watcher import criticalWatcher from audio import updatePos from connections import * from user_functions import * import console import server import variables import sys import traceback console.initLogger() # not that magic consts server_port = int(sys.argv[1]) controller_...
LenaUI.py
""" The MIT License (MIT) Copyright (c) 2017 Paul Yoder, Joshua Wade, Kenneth Bailey, Mena Sargios, Joseph Hull, Loraina Lampley 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...
camgear.py
# import the necessary packages from threading import Thread from pkg_resources import parse_version import re #Note: Remember, Not all parameters are supported by all cameras which is #one of the most troublesome part of the OpenCV library. Each camera type, #from android cameras to USB cameras to professional #one...
test_runtime_rpc.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...
ws_core.py
import threading, time, datetime, json, uuid from concurrent.futures.thread import ThreadPoolExecutor import traceback import tornado.ioloop import tornado.web import tornado.websocket import tornado.template import tornado.httpserver from tornado import gen import ssl,os import OmniDB_app.include.Spartacus as Sparta...
WhoIsHome.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = "MPZinke" ########################################################################################## # # created by: MPZinke # on 2020.03.31 # # DESCRIPTION: # BUGS: # FUTURE: # ################################################################################...
food_ordering_system.py
import threading import time from collections import deque class Queue: def __init__(self): self.buffer = deque() def enqueue(self, val): self.buffer.appendleft(val) def dequeue(self): if len(self.buffer)==0: print("Queue is empty") return return ...
onnxruntime_test_python.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -*- coding: UTF-8 -*- import unittest import os import numpy as np import onnxruntime as onnxrt import threading import sys from helper import get_name from onnxruntime.capi.onnxruntime_pybind11_state import Fail class Te...
mailcat.py
#!/usr/bin/python3 import argparse import base64 import datetime import json import random import smtplib import string as s import sys import threading from time import sleep from typing import Dict, List import dns.resolver import requests from requests_html import HTMLSession # type: ignore def randstr(num): ...
test_c10d_common.py
import copy import os import sys import tempfile import threading import time import unittest from datetime import timedelta from itertools import product from sys import platform import torch import torch.distributed as c10d if not c10d.is_available(): print("c10d not available, skipping tests", file=sys.stderr)...
Chat.py
import socket import sys from threading import Thread from tkinter import * from tkinter import messagebox # create socket s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) ip = "0.0.0.0" port = 81 s.bind((ip, port)) num = 1 users = {"192.168.56.102": ["JOHN", "dark green"], "192.168.56.103": ["TOM", "Dar...
client.py
from base64 import b64encode from engineio.json import JSONDecodeError import logging import queue import signal import ssl import threading import time import urllib try: import requests except ImportError: # pragma: no cover requests = None try: import websocket except ImportError: # pragma: no cover ...
base.py
import multiprocessing as mp import ctypes import time from rlpyt.samplers.base import BaseSampler from rlpyt.samplers.buffer import build_samples_buffer from rlpyt.samplers.parallel.worker import sampling_process from rlpyt.utils.logging import logger from rlpyt.utils.collections import AttrDict from rlpyt.utils.syn...
posca_factor_ping.py
#!/usr/bin/env python ############################################################################## # Copyright (c) 2017 Huawei Technologies Co.,Ltd and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompani...
test_nameregistry.py
import logging import random import threading import time from unittest import TestCase from dogpile.util import NameRegistry log = logging.getLogger(__name__) class NameRegistryTest(TestCase): def test_name_registry(self): success = [True] num_operations = [0] def create(identifier): ...
simulateAndVisualizeLive.py
""" Created on 2/11/20 Marquette Robotics Club Danny Hudetz Purpose: change the variables of the megarm live and visualize what it will look like """ import numpy as math import pygame import matplotlib import matplotlib.pyplot as plt import threading # Define some colors BLACK = (0, 0, 0) WHITE = (255, 255,...
test2.py
#!/usr/bin/env python3 # -*- coding:utf-8 -*- #http://cuiqingcai.com/3335.html import multiprocessing import time def process(num): time.sleep(num) print ('Process:', num) if __name__ == '__main__': for i in range(5): p = multiprocessing.Process(target=process, args=(i,)) p.start() pr...
multiplexer_standalone.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 ...
DrawableMesh.py
import pythreejs as three import numpy as np from time import time, sleep from .Colors import colors from ..utils import Observer, ColorMap import threading import copy import math import re class DrawableMesh (Observer): def __init__(self, geometry, mesh_color = None, reactive = False): super(DrawableM...
surface.py
import tkinter as tk from tkinter.filedialog import * from tkinter import ttk import predict import cv2 from PIL import Image, ImageTk import threading import time class Surface(ttk.Frame): pic_path = "" viewhigh = 600 viewwide = 600 update_time = 0 thread = None thread_run = False camera = ...
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 hashlib import hmac import socket import smtpd import smtplib import io import re import sys import time import select import errno import textw...