source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
bus.py | """ A simple event bus """
from functools import wraps
from threading import Thread
from collections import defaultdict, Counter
from typing import Iterable, Callable, List, Dict, Any, Set, Union
from event_bus.exceptions import EventDoesntExist
class EventBus:
""" A simple event bus class. """
# ---------... |
test_sender.py | from __future__ import print_function
import os
import pytest
import six
from six.moves import queue
import threading
import time
import shutil
import sys
import wandb
from wandb.util import mkdir_exists_ok
from .utils import first_filestream
def test_send_status_request_stopped(mock_server, backend_interface):
... |
connectors.py | """
Sock
====
.. Copyright:
Copyright 2019 Wirepas Ltd under Apache License, Version 2.0.
See file LICENSE for full license details.
"""
import logging
import ssl
import threading
import websocket
class WNTSocket(object):
"""
WNTSocket
This class handles websocket connection... |
decorators.py | from queue import Queue, Empty as QueueEmpty
import threading
try:
import thread
except ImportError:
import _thread as thread
from spardaqus.core.exceptions import SpardaqusTimeout
from spardaqus.core.utils import info
def _call(timer, q, fn, args, kwargs):
timer.start()
results = fn(*args, **kwargs)... |
adversarial_objects.py | import copy
import json
import threading
import numpy as np
import torch
from robustness import airsim
from .sim_object import SimObject
class AdversarialObjects(SimObject):
def __init__(self, name='3DAdversary', car=None, **kwargs):
super().__init__(name)
assert 'resolution_coord_descent' in kw... |
display_Run_Old.py | import cv2
import _thread
import time
import multiprocessing as mp
from luma.core.interface.serial import i2c
from luma.core.render import canvas
from luma.oled.device import ssd1306, ssd1325, ssd1331, sh1106
from time import sleep
from PIL import Image
cap= cv2.VideoCapture('/home/pi/Downloads/videoplayback.mp4')
n_r... |
planar_hand_worker_second_order.py | import multiprocessing
import time
from quasistatic_simulator.core.quasistatic_simulator import (
QuasistaticSimParameters)
from quasistatic_simulator.core.quasistatic_system import (
cpp_params_from_py_params)
try:
from irs_lqr.quasistatic_dynamics import *
from irs_lqr.mbp_dynamics import *
from... |
duco_api.py | ##########################################
# Duino-Coin API Module
# https://github.com/revoxhere/duino-coin
# Distributed under MIT license
# © Duino-Coin Community 2021
##########################################
import ast
from requests import get
import requests
import socket
import json
import hashlib
import urllib... |
test_random.py | import warnings
import numpy as np
from numpy.testing import (
assert_, assert_raises, assert_equal, assert_warns,
assert_no_warnings, assert_array_equal, assert_array_almost_equal,
suppress_warnings
)
from numpy import random
import sys
class TestSeed:
def test_scalar(self):
... |
socket_.py | # Author: Jimmy Huang (1902161621@qq.com)
# License: WTFPL
from base64 import b64encode
from socket import * # noqa
import hmac
import hashlib
import queue
import json
import threading
import logging
global g_logger
g_logger = logging.getLogger('ECY_client')
class Socket_(object):
def __init__(self, PORT, HMAC... |
__init__.py | try:
import time
FirstTime = time.time()
import os
import io
import sys
import time
import glob
import socket
import locale
import hashlib
import tempfile
import datetime
import subprocess
from ctypes import windll
from urllib.request import urlopen
imp... |
SatadishaModule_final_trie.py |
# coding: utf-8
# In[298]:
import sys
import re
import string
import csv
import random
import time
#import binascii
#import shlex
import numpy as np
import pandas as pd
from itertools import groupby
from operator import itemgetter
from collections import Iterable, OrderedDict
from nltk.tokenize import sent_tokenize... |
dppo.py | #!/usr/bin/python
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import gym
import threading,queue
EP_MAX = 500
EP_LEN = 200
GAMMA = 0.9
A_LR = 0.0001
C_LR = 0.0002
MIN_BATCH_SIZE = 32
UPDATE_STEPS = 10
EPSION = 0.2
GAME = 'Pendulum-v0'
S_DIM,A_DIM = 3,1
N_WORKER = 2
class PPO(object):... |
dsr_service_tool_simple.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# ##
# @brief [py example simple] motion basic test for doosan robot
# @author Kab Kyoum Kim (kabkyoum.kim@doosan.com)
import rospy
import os
import threading, time
import sys
sys.dont_write_bytecode = True
sys.path.append( os.path.abspath(os.path.join(os.path.dirn... |
test_threading.py | """
Tests for the threading module.
"""
import test.support
from test.support import threading_helper
from test.support import verbose, cpython_only, os_helper
from test.support.import_helper import import_module
from test.support.script_helper import assert_python_ok, assert_python_failure
import random
import sys
i... |
named_pipe.py | """
RPC client/server implementation based on named pipe transport.
"""
import json
import logging
import os
import socket
import struct
from threading import Thread
from .client import RpcsyncwerkClient
from .server import rpcsyncwerk_server
from .transport import RpcsyncwerkTransport
from .utils import make_socket_... |
server.py | #! python3
from socket import socket as _socket
from threading import Thread
from time import time
from secure import Secure
from Crypto.Cipher import PKCS1_OAEP
HOST = "localhost"
PORT = 9999
class Server():
def __init__(self):
self.s = _socket()
self.s.bind((HOST, PORT))
self.s.listen(5... |
networm.py | """
Python 3 Networm
Author: Richard Poschinger (poschinger.net)
"""
import string
import subprocess
import threading
import traceback
from random import shuffle
import netifaces
import nmap
from netaddr import *
import paramiko
from netaddr.fbsocket import AF_INET
from paramiko.ssh_exception import BadHostKeyExcepti... |
MocaWriteFileController.py | # -- Imports --------------------------------------------------------------------------
from typing import (
Union, Optional
)
from pathlib import Path
from threading import Thread
from queue import Queue
from ..moca_core import ENCODING
from ..moca_encrypt import MocaAES
# ---------------------------------------... |
cblock.py | import cv2
import tkinter
from threading import Thread
def open_camera():
cap = cv2.VideoCapture(0)
cap.set(cv2.CAP_PROP_FPS, 2)
while (cap.isOpened()):
ret, frame = cap.read()
cap.release()
def main():
thread = Thread(target=open_camera)
thread.setDaemon(True)
thread.start();
... |
test_webpack.py | import json
import os
import time
from subprocess import call
from threading import Thread
import django
from django.conf import settings
from django.test import RequestFactory, TestCase
from django.views.generic.base import TemplateView
from django_jinja.builtins import DEFAULT_EXTENSIONS
from unittest2 import skipIf... |
app.py | # -*- coding: utf-8 -*-
"""
:author: Tyou
"""
import os
from threading import Thread
import sendgrid
from sendgrid.helpers.mail import Email as SGEmail, Content, Mail as SGMail
from flask_mail import Mail, Message
from flask_wtf import FlaskForm
from wtforms import StringField, TextAreaField, SubmitField
from wtfo... |
custom.py | # pylint: disable=too-many-lines
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------... |
hsw.py | from ..utils import is_main_process
import os
import random
import socketio
import subprocess
import threading
import time
if is_main_process():
from flask import Flask
from flask_socketio import SocketIO
app = Flask(__name__)
sio_server = SocketIO(app)
@sio_server.on("request")
def reque... |
docker-network.py | #!/usr/bin/env python
from docker import Client
import BaseHTTPServer
import SocketServer
import datetime
import errno
import json
import os
import signal
import socket
import threading
import time
import urllib2
PLUGIN_ID="docker-network"
PLUGIN_UNIX_SOCK="/var/run/scope/plugins/" + PLUGIN_ID + ".sock"
DOCKER_SOCK="... |
data_utils.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
htmlwidgets.py | import sys
import platform
from bindings import TkinterWeb
from utilities import (AutoScrollbar, StoppableThread, cachedownload, download,
notifier, currentpath, threadname)
from imageutils import newimage
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlp... |
helpers.py | import sys
import re
from multiprocessing import Process
import threading
import time
from typing import List
from concurrent.futures import ProcessPoolExecutor
from nb_log import LoggerMixin
import nb_log
from fabric2 import Connection
from funboost.utils.paramiko_util import ParamikoFolderUploader
logger = nb_lo... |
dppo.py | """
A simple version of OpenAI's Proximal Policy Optimization (PPO). [https://arxiv.org/abs/1707.06347]
Distributing workers in parallel to collect data, then stop worker's roll-out and train PPO on collected data.
Restart workers once PPO is updated.
The global PPO updating rule is adopted from DeepMind's paper (DPPO)... |
scraper-parallel.py | from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.by import By
from queue import Queue
from random import shuffle, choices
from os.path import exists
from os import mkdir
import threading
# share... |
window.py | import os
import sys
import sqlite3
import logging
from PyQt5 import QtCore
from worker import Worker
from PyQt5 import QtWidgets
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QPalette
from updater_tick import UpdaterTick
from multiprocessing import Process, Queue
sys.path.append(os.path.dirname(os.path.abspath(o... |
archiver.py | import argparse
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
from configparser import ConfigParser
from datetim... |
BLM_EPICS.py | #!/usr/bin/env python
# created from Anna Stampfli PSI. July 2021
# for Beam Loss Project
from pcaspy import Driver, SimpleServer
import threading # to run subprocesses, like image processing
#import queue #to make a queue of tasks
import logging #to mkae a log file
import traceback # for what??
import csv #for saving... |
vision.py | """
Image Data Processing
Copyright 2018(c), Andrew Ferlitsch
"""
version = '0.9.3'
import os
import io
import threading
import time
import copy
import random
import requests
import imutils
import gc
# Import numpy for the high performance in-memory matrix/array storage and operations.
import numpy as np
# Import h... |
sbutil.py | import time
import objc_util
from functools import wraps
from threading import Thread
_app = objc_util.ObjCClass('UIApplication').sharedApplication()
_status_bar = _app.statusBar()
_color = objc_util.ObjCClass('UIColor')
def _run_in_background(func):
"""Run func in a new thread. The thread is expected to exit o... |
test_failure_2.py | import logging
import os
import signal
import sys
import threading
import time
import numpy as np
import pytest
import ray
from ray.experimental.internal_kv import _internal_kv_get
from ray.autoscaler._private.util import DEBUG_AUTOSCALING_ERROR
import ray._private.utils
from ray.util.placement_group import placement... |
viewer.py | import wx
import pynder as t
from urllib.request import urlopen
import io
from geopy.geocoders import Nominatim
import threading
import auth
import os
import time
from login import LoginDialog
from messages import Messages
class PinderApp(wx.App):
def __init__(self, redirect=False):
'''
Takes a loc... |
driver.py | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright (c) 2010 Citrix Systems, Inc.
# Copyright (c) 2011 Piston Cloud Computing, Inc
# Copyright (c) 2012 University Of Minho
# (c) Copyright 2013 Hewlett-Pa... |
context.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... |
__init__.py | import re
import argparse
from ..gateware.clockgen import *
__all__ = ["GlasgowAppletError", "GlasgowApplet", "GlasgowAppletTool"]
class GlasgowAppletError(Exception):
"""An exception raised when an applet encounters an error."""
class _GlasgowAppletMeta(type):
def __new__(metacls, clsname, bases, namesp... |
test_c10d_common.py | import copy
import os
import random
import sys
import tempfile
import threading
import time
import traceback
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, sk... |
TaskPool.py | #!/usr/bin/env python
# The MIT License (MIT)
#
# Copyright (c) 2015 Caian Benedicto <caian@ggaunicamp.com>
# Copyright (c) 2016 Edson Borin <edson@ic.unicamp.br>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to... |
test_ftplib.py | """Test script for ftplib module."""
# Modified by Giampaolo Rodola' to test FTP class, IPv6 and TLS
# environment
import ftplib
import asyncore
import asynchat
import socket
import StringIO
import errno
import os
try:
import ssl
except ImportError:
ssl = None
from unittest import TestCase
from test import t... |
test_closing.py | from fixtures import * # noqa: F401,F403
from flaky import flaky
from lightning import RpcError
from utils import only_one, sync_blockheight, wait_for, DEVELOPER, TIMEOUT, VALGRIND, SLOW_MACHINE
import os
import queue
import pytest
import re
import threading
import unittest
@unittest.skipIf(not DEVELOPER, "Too slow... |
test_external_step.py | import os
import time
import uuid
from threading import Thread
import pytest
from dagster import (
Field,
ModeDefinition,
RetryRequested,
String,
execute_pipeline,
execute_pipeline_iterator,
pipeline,
reconstructable,
resource,
seven,
solid,
)
from dagster.core.definitions.n... |
desktoppet.py | '''
Function:
桌面宠物
Author:
Car
微信公众号:
Car的皮皮
'''
import os
import sys
import time
import random
import requests
import threading
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5 import QtWidgets, QtGui
'''配置信息'''
class Config:
ROOT_DIR = os.path.join(os.p... |
test_mq_handler.py | # NEON AI (TM) SOFTWARE, Software Development Kit & Application Development System
# All trademark and other rights reserved by their respective owners
# Copyright 2008-2021 Neongecko.com Inc.
# BSD-3
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the fo... |
data_plane.py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
bot.py | import socket, random, string
from threading import Thread
global bot
global botid
class connection:
def __init__(self, sock=None):
pass
def connect(self, host, port):
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.host = host
self.port = port
... |
automated_driving_with_fusion2_1.py | """Defines SimpleSensorFusionControl class
----------------------------------------------------------------------------------------------------------
This file is part of Sim-ATAV project and licensed under MIT license.
Copyright (c) 2018 Cumhur Erkan Tuncali, Georgios Fainekos, Danil Prokhorov, Hisahiro Ito, James Kap... |
log_collector.py | #!/usr/bin/env python
# encoding: utf-8
import yaml
import threading
from zstacklib import *
from utils import linux
from utils import shell
from utils.sql_query import MySqlCommandLineQuery
from termcolor import colored
from datetime import datetime, timedelta
def info_verbose(*msg):
if len(msg) == 1:
o... |
start_host.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, ... |
executor.py | from concurrent.futures import Future
import typeguard
import logging
import threading
import queue
import pickle
from multiprocessing import Process, Queue
from typing import Dict # noqa F401 (used in type annotation)
from typing import List, Optional, Tuple, Union, Any
import math
from parsl.serialize import pack_a... |
log_util_test.py | # Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
thonny-webdriver.py | from selenium import webdriver
from thonny import get_workbench
from selenium.common import exceptions
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from tkinter.simpledialog import askstring
from threading import Thread
import time
class Singleton:
"""This Singleton class is need... |
log.py | from vyper import types
from flask import Flask, render_template
from flask_socketio import SocketIO, emit, send
import threading
import requests
import json
app = Flask(__name__)
web_app = ""
def setup(bot):
global web_app
web_app = bot.web_app
print(web_app)
if web_app:
t = threading.Thread(target=app.run)
t... |
writeIQ.py | #!usr/bin/env python2
# Authors: Kareem Attiah/ Ammar Alhosainy
# Date: Nov 15th, 2017/ March 3rd, 2018
from gnuradio import gr
from gnuradio import uhd
from gnuradio import blocks
import sys
import threading
import time
import os
from fcntl import ioctl
USBDEVFS_RESET = ord("U") << (4*2) | 20
class WriteIQ(gr.top_... |
custom.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
server.py | '''
simple RPC over HTTP
'''
import threading
import json
import socket
try:
from BaseHTTPServer import BaseHTTPRequestHandler
from SocketServer import TCPServer
except:
from http.server import BaseHTTPRequestHandler
from socketserver import TCPServer
class Client:
def __init__(... |
gap.py | import numpy as np
import sys
from threading import Thread, BoundedSemaphore, Lock
from sklearn.cluster import KMeans
semaphore = None
# Counter for number of reference data processing completed
b_completed = 0
lock = Lock()
def gap_statistics(data, kmax=10, kmin=1, B=10, cluster_algorithm=KMeans, max_threads=10, *... |
test_insert.py | import time
import pdb
import threading
import logging
import threading
from multiprocessing import Pool, Process
import pytest
from milvus import IndexType, MetricType
from utils import *
dim = 128
index_file_size = 10
collection_id = "test_add"
ADD_TIMEOUT = 60
tag = "1970-01-01"
add_interval_time = 1.5
nb = 6000
... |
test_webserver.py | import subprocess
import time
import sys
import os
import re
import threading
import queue
import pytest
import requests
from pytest_test_filters import skip_on_windows
pytestmark = skip_on_windows(
reason="Subprocess based approach is problematic on windows."
)
from testplan.common.utils.process import kill_pr... |
logging.py | ################################################################################
# Copyright (C) 2019 drinfernoo #
# #
# This Program is free software; you can redistribute it and/or modify ... |
test_messaging.py | import multiprocessing
import pytest
import time
from datetime import datetime
from panoptes.utils.messaging import PanMessaging
@pytest.fixture(scope='module')
def mp_manager():
return multiprocessing.Manager()
@pytest.fixture(scope='function')
def forwarder(mp_manager):
ready = mp_manager.Event()
don... |
discord_pub.py | import asyncio
import datetime
import discord
from discord.ext import commands, tasks
from ee250_final.user import User
import io
import json
import logging
import os
import paho.mqtt.client as mqtt
from PIL import Image
import schedule
import threading
import time
logging.basicConfig(level=logging.INFO)
class Comma... |
xvfb.py | #!/usr/bin/env vpython
# Copyright (c) 2012 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.
"""Runs tests with Xvfb and Openbox or Weston on Linux and normally on other
platforms."""
from __future__ import print_functi... |
opt_asynchronous_evaluations.py | #!/usr/bin/env python
import sys
sys.path.append('../../phoenics')
import uuid, time
import pickle
import numpy as np
from threading import Thread
from phoenics import Phoenics
from branin import branin as loss
#========================================================================
class OptimizationManager... |
price_poller.py |
import threading, time
from cryptocompy import price
from requests.exceptions import ConnectionError
class PricePoller:
def __init__(self, config):
self._thread_shutdown = False
self._config = config
self._prices = None
self._thread = None
def eth_price_poller(self):
... |
state.py | """Related to CSGO Gamestate"""
import json
from threading import Lock, Thread
from http.server import BaseHTTPRequestHandler, HTTPServer
import config
class PlayerState:
def __init__(self, json, sounds):
self.valid = False
self.sounds = sounds
provider = json.get("provider", {})
... |
tsleepd.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Trusted Sleep Monitor Bot
This bot monitors group members' sleep time using online status.
Threads:
* tg-cli
* Event: set online state
* Telegram API polling
* /status - List sleeping status
* /average - List statistics about sleep time
* /help - About the b... |
test_logging.py | # Copyright 2001-2013 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permissio... |
TyBotMultiNega.py |
import random
import time
import multiprocessing
from multiprocessing import Array
from config import WHITE, BLACK, EMPTY
from copy import deepcopy
class BotPlayer:
""" Your custom player code goes here, but should implement
all of these functions. You are welcome to implement
additional helper functio... |
test_interrupt.py | import os
import time
from threading import Thread
import pytest
from dagster import (
DagsterEventType,
DagsterSubprocessError,
ExecutionTargetHandle,
Field,
String,
execute_pipeline_iterator,
pipeline,
seven,
solid,
)
from dagster.core.instance import DagsterInstance
from dagster... |
test_subprocess.py | import unittest
from unittest import mock
from test import support
import subprocess
import sys
import platform
import signal
import io
import itertools
import os
import errno
import tempfile
import time
import selectors
import sysconfig
import select
import shutil
import threading
import gc
import textwrap
from test.s... |
transfer.py | #!/usr/bin/env python
"""
Downloads files to temp locations. This script is invoked by the Transfer
Manager (galaxy.jobs.transfer_manager) and should not normally be invoked by
hand.
This is deprecated - it only works with older ini configurations of Galaxy.
"""
import json
import logging
import optparse
import os
im... |
agent_code_block.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 ... |
test_ssl.py | """Tests for TLS support."""
# -*- coding: utf-8 -*-
# vim: set fileencoding=utf-8 :
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import functools
import json
import os
import ssl
import subprocess
import sys
import threading
import time
import traceback
import OpenSSL.SSL
im... |
SimPMAC.py | import sys
import threading
from time import sleep
import time
import logging
import SocketServer
import npyscreen
current_milli_time = lambda: int(round(time.time() * 1000))
# Trajectory scanning M variable definitions
M_TRAJ_STATUS = 4034
M_TRAJ_VERSION = 4049
M_TRAJ_BUFSIZE = 4037
M_TRAJ_A_ADR = 4041
M_TRAJ_B_ADR ... |
exposition.py | from __future__ import unicode_literals
import base64
from contextlib import closing
import os
import socket
import sys
import threading
from wsgiref.simple_server import make_server, WSGIRequestHandler
from .openmetrics import exposition as openmetrics
from .registry import REGISTRY
from .utils import floatToGoStrin... |
model_inference_server.py | """
model_inference_server.py
Server side logic to handle model inference from client web_server.py
Delivers frame by frame of model's playthrough to the web_server.py through TCP/IP connection.
author: @justjoshtings
created: 3/16/2022
"""
import socket
import threading
from mysqlx import ProgrammingError
import nu... |
FD_BS_m_circles_minimum_overlap.py | import cv2
from tkinter import Tk
from tkinter.filedialog import askopenfilename
import numpy as np
import imutils
import math
import threading
def main():
cap = cv2.VideoCapture(vid_path)
status1, previous_frame = cap.read()
total_frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
... |
email.py |
from threading import Thread
from flask import current_app
from flask_mail import Message
from ... 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 =... |
test_logging.py | # Copyright 2001-2019 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permissio... |
ipsec_perf_tool.py | #!/usr/bin/env python3
"""
**********************************************************************
Copyright(c) 2021-2022, Intel Corporation All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* ... |
connection_service.py | from send_message_exception import SendMessageException
from not_connected_exception import NotConnectedException
import socket
import time
import multiprocessing
import struct
class ConnectionService():
MAX_QUEUE_SIZE = 1
def __init__(self, host, port):
self.host = host
self.port = port
... |
test_socket.py | import unittest
from test import support
from test.support import os_helper
from test.support import socket_helper
from test.support import threading_helper
import errno
import io
import itertools
import socket
import select
import tempfile
import time
import traceback
import queue
import sys
import os
import platform... |
example3.py | # ch6/example3.py
from multiprocessing import Process, current_process
import time
import os
def print_info(title):
print(title)
if hasattr(os, 'getppid'):
print('Parent process ID: %s.' % str(os.getppid()))
print('Current Process ID: %s.\n' % str(os.getpid()))
def f():
print_info('Functio... |
run_dqn.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import random
import threading as th
import time
from datetime import datetime
from six.moves import range # pylint: disable=redefined-builtin
import numpy as np
import tensorflow as tf
import scipy... |
test_concurrent_futures.py | import test.support
# Skip tests if _multiprocessing wasn't built.
test.support.import_module('_multiprocessing')
# Skip tests if sem_open implementation is broken.
test.support.import_module('multiprocessing.synchronize')
# import threading after _multiprocessing to raise a more revelant error
# message: "No module n... |
FumeBotSockComm.py | """
FUMEBOT SOCKET SERVER
This is the Fumebot socket server and is used to handle both image as well
as byte string data sent over TCP/IP sockets. One class is used to handle both
type of data. In the image type mode, sending image data to the remote robot is
not necessary and therefore is not implemented.
Written by... |
startDask.py | import os
import argparse
import time
from dask.distributed import Client
from azureml.core import Run
import sys, uuid
import threading
import subprocess
import socket
from notebook.notebookapp import list_running_servers
def flush(proc, proc_log):
while True:
proc_out = proc.stdout.readline()
if... |
app.py | """Main app module.
"""
import os
import random
import colorsys
import json
import logging
import tkinter as tk
from PIL import Image, ImageDraw, ImageTk
from navigation import ImageList
import threading
import time
logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s')
class App(tk.Tk):
... |
agent.py | #!/usr/bin/env python3
#
# Copyright (c) 2020 Fondazione Bruno Kessler
# Author(s): Giovanni Baggio (g.baggio@fbk.eu)
#
# 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.... |
test_asyncore.py | import asyncore
import unittest
import select
import os
import socket
import sys
import time
import errno
import struct
import threading
from test import support
from test.support import os_helper
from test.support import socket_helper
from test.support import threading_helper
from test.support import warnings_helper
... |
server.py | from flask import Flask,render_template,request,redirect
import addrgen
import find_coins_amount
import hashlib
import datetime
from threading import Thread
from time import sleep
import supply
app = Flask(__name__)
@app.route('/', methods = ['POST', 'GET'])
def data():
if request.method == 'GET':
... |
processes.py | import time
import atexit
import heapq
from threading import Thread
from plumbum.lib import IS_WIN32, six
try:
from queue import Queue, Empty as QueueEmpty
except ImportError:
from Queue import Queue, Empty as QueueEmpty # type: ignore
try:
from io import StringIO
except ImportError:
from cStringIO i... |
main.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import html # unescape
import itertools
import os
import sys # sys.stdin.read, argv
from collections import deque
from datetime import datetime
from enum import Enum
from threading import Lock, Thread, current_thread
from time import sleep
import click # edit
from vk... |
scan_laser_ceramic_slit.py | """
One-dimensional scans
Friedrich Schotte, APS, Mar 12, 2008 - Jul 23, 2015
Valentyn Stadnytskyi, APS, Feb 28, 2018 - July 4, 2018
Run simuation:
from sim_scan import *
data=rscan(sim_taby,-0.2,0.2,20,sim_flux)
COM(data)
app=wx.App(False)
Plot(data)
Run electronic test:
tmode.value = 1
trigger="pulses.value=1;slee... |
ModbusTCP.py | #!/usr/bin/env python3
# Copyright (c) 2017 Dennis Mellican
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, mod... |
cluster_2_test.py | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.