source
stringlengths
3
86
python
stringlengths
75
1.04M
controllers.py
# Module for server from flask import request, abort # Module for Line SDK from linebot.exceptions import ( InvalidSignatureError ) from linebot.models import ( MessageEvent, JoinEvent, MemberJoinedEvent, MemberLeftEvent, UnfollowEvent, FollowEvent,PostbackEvent ) # Module for event handler from eve...
params.py
#!/usr/bin/env python3 """ROS has a parameter server, we have files. The parameter store is a persistent key value store, implemented as a directory with a writer lock. On Android, we store params under params_dir = /data/params. The writer lock is a file "<params_dir>/.lock" taken using flock(), and data is stored in...
local_service_handler.py
# Copyright (c) 2020 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 appli...
workflow.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2020-2021 Barcelona Supercomputing Center (BSC), Spain # # 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...
test_frozen_attribs.py
from typing import Dict, Any from torch import nn from core.base_abstractions.experiment_config import ExperimentConfig from core.base_abstractions.task import TaskSampler from utils.experiment_utils import TrainingPipeline import torch.multiprocessing as mp # noinspection PyAbstractClass,PyTypeChecker class MyConfi...
split-all-clipbounds.py
#!/usr/bin/python import sys, os, tempfile from datetime import datetime import Queue, threading import random, time # just simulate the splitting by sleeping for a randome number of seconds, # used to test mutoprocess handling simulate = True # the directory to scan for clipbounds-files clipDir = "clipbounds" # the...
snake.py
""" Juego de la serpiente """ from turtle import update, ontimer, setup, hideturtle, tracer, listen, onkey, \ done, clear from random import randrange, choice from freegames import square, vector from playsound import playsound from threading import Thread food = vector(0, 0) snake = [vector(10, 0)] aim = vector(0...
local_game_status.py
import time import logging as log import re from file_read_backwards import FileReadBackwards from threading import Thread import psutil as psutil from definitions import UbisoftGame, GameType, GameStatus, ProcessType, WatchedProcess, SYSTEM, System from steam import get_steam_game_status from local_helper import ge...
jsonrpc.py
import json import logging try: import Queue except ImportError: import queue as Queue import threading from collections import deque log = logging.getLogger(__name__) class JSONRPC2ProtocolError(Exception): pass class ReadWriter: def __init__(self, reader, writer): self.reader = reader ...
awning.py
import logging import sys import time from datetime import datetime from abc import ABC, abstractmethod from threading import Thread, Lock class Motor(ABC): @abstractmethod def stop(self): pass @abstractmethod def backward(self): pass @abstractmethod def forward(self): ...
dense_update_ops_no_tsan_test.py
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
Hiwin_RT605_ArmCommand_Socket_20190627160417.py
#!/usr/bin/env python3 # license removed for brevity import rospy import os import numpy as np from std_msgs.msg import String from ROS_Socket.srv import * from ROS_Socket.msg import * import math import enum pos_feedback_times = 0 mode_feedback_times = 0 msg_feedback = 1 #接收策略端命令 用Socket傳輸至控制端電腦 import socket ##多執行序 i...
config.py
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: # # Copyright 2021 The NiPreps Developers <nipreps@gmail.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may...
rl_scheduler.py
import os import json import time import pickle import logging import threading import multiprocessing as mp from collections import OrderedDict import mxnet as mx from .resource import DistributedResource from ..utils import (save, load, mkdir, try_import_mxboard, tqdm) from ..core import Task from ..core.decorator ...
writer.py
import os import time from threading import Thread from queue import Queue import cv2 import numpy as np import torch import torch.multiprocessing as mp from alphapose.utils.transforms import get_func_heatmap_to_coord from alphapose.utils.pPose_nms import pose_nms, write_json DEFAULT_VIDEO_SAVE_OPT = { 'savepath...
clidirector.py
import json import libtmux import random import subprocess import threading import time import typing class InstructionSpec(typing.NamedTuple): instruction: str time_from: float time_to: float class CliDirector: def __init__(self): self.record_start = None self.pause_between_keys = 0...
02_env_isolation_agent.py
#!/usr/bin/env python3 import re import os import sys import copy import pprint import multiprocessing as mp import radical.utils as ru # # fuck python # from .00_env_isolation_utils import env_read, env_diff # from .03_env_isolation_exec import executor eiu = __import__('00_env_isolation_utils') eie = __import_...
EXPERIMENT.py
import concurrent.futures import threading import time def sendMail(st): time.sleep(2) print("printing ...{}".format(st)) return "Done {}".format(st) student = ['student1', 'student2', 'student3', 'student4'] st = ['stud1', 'stud2', 'stud3', 'stud4'] def test1(): message = "Email failed!" with c...
safe_bank_fine_grained.py
import datetime import random import time from threading import Thread, RLock from typing import List class Account: def __init__(self, balance=0): self.balance = balance self.lock = RLock() def main(): accounts = create_accounts() total = sum(a.balance for a in accounts) validate_b...
push_server.py
#!/usr/bin/python3 def main(config_fname=None): import asyncio import socket import time import dill import tornado.httpserver import tornado.web from pysyncobj import SyncObj, SyncObjConsumer from pysyncobj import SyncObjConf from pushpy.batteries import ReplLockDataManager f...
multiprocessing_test.py
import multiprocessing # from https://docs.python.org/2/library/multiprocessing.html def f(x): return x*x if __name__ == '__main__': p = multiprocessing.Pool(5) print(p.map(f, [1, 2, 3])) def f(name): print 'hello', name if __name__ == '__main__': p = multiprocessing.Process(target=f, args=('b...
app.py
# Press the green button in the gutter to run the script. import os import sys import threading import time import logging from arm_prosthesis.external_communication.core.communication import Communication from arm_prosthesis.external_communication.services.telemetry_service import TelemetryService from arm_p...
main.py
#!/usr/bin/env python3 import sys import click import os import time import math import traceback import threading import json import socket from datetime import datetime from datetime import timedelta from marie47esp32.webserver.webserver import WebServer from marie47esp32.util.log import log from marie47esp32.util....
check_hit_new.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' check hash conflict ''' import tempfile from multiprocessing import Process import os import traceback import sys from utils import run_command_noret MAP_SIZE_INDEX = 16 TRACE_EDGES = set() class DynamicAnalyzer(object): def __init__(self): """ init """...
okcoinGateway.py
# encoding: UTF-8 ''' vn.okcoin的gateway接入 注意: 1. 前仅支持USD和CNY的现货交易,USD的期货合约交易暂不支持 ''' import os import json import logging from datetime import datetime from time import sleep from copy import copy, deepcopy from threading import Condition from Queue import Queue from threading import Thread from time import sleep f...
discovery.py
""" Discovery Module for LSL stream discovery and data retrieval """ import logging from threading import current_thread, Thread from pylsl import resolve_bypred, LostError, TimeoutError, resolve_streams from .stream import Stream class Discovery: """ Class representing the available LSL stream information and inc...
configure_and_test_integration_instances.py
from __future__ import print_function import argparse import ast import json import logging import os import subprocess import sys import uuid import zipfile from datetime import datetime from distutils.version import LooseVersion from enum import IntEnum from pprint import pformat from threading import Thread from ti...
loop.py
import sys import time import json import threading import traceback import collections try: import Queue as queue except ImportError: import queue from . import exception from . import _find_first_key, flavor_router class RunForeverAsThread(object): def run_as_thread(self, *args, **kwargs): t =...
views.py
import json import logging import multiprocessing import os import sys import threading import time from json import JSONDecodeError from signal import SIGTERM, SIGINT from django.shortcuts import render from django.http import HttpResponse from django.views.decorators.csrf import csrf_exempt sys.path.append('.') f...
fb_executor.py
""" fb_executor module This is built for interfacing with the ForceBalance command line interface. """ import os import shutil import subprocess import time import copy import threading import numpy as np from forcebalance.nifty import lp_load from forcebalance.parser import gen_opts_types, tgt_opts_types from force...
cli.py
""" Command line entry """ #import asyncio import threading from os import getpid import psutil from .web import Webserver from ..models import WebserverArgs from ..framework.communicator import CommunicatorFactory class CommandLine: '''Command line entry class ''' def __init__(self, **kwargs): s...
extraction_line_manager.py
# =============================================================================== # Copyright 2011 Jake Ross # # 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...
PseudoDialogOptionsGrid.py
from tkinter import ttk import tkinter as tk import tkinter.filedialog as fd import pandas as pd import threading import hashlib import os import pandas.io.formats.excel import logging from logging.handlers import RotatingFileHandler import pem import gc import sys pandas.io.formats.excel.header_style = None class A...
deploy.py
# Copyright (c) OpenMMLab. All rights reserved. import argparse import logging import os.path as osp from functools import partial import mmcv import torch.multiprocessing as mp from torch.multiprocessing import Process, set_start_method from mmdeploy.apis import (create_calib_table, extract_model, ...
DualTaskSpaceControl.py
#!/usr/bin/python # -*- coding: utf-8 -*- # Dual Task Space Control import numpy as np import argparse from numpy.linalg import norm from numpy.linalg import inv from scipy.io import savemat import matplotlib.pyplot as plot import struct import UR5Class import socket import time import sys import csv #import json impor...
dynamic_subscription_example.py
""" In this example code we will show a pattern that allows a user to change the websocket subscriptions as they please. """ import logging import threading import asyncio import time from alpaca_trade_api import StreamConn from alpaca_trade_api.common import URL ALPACA_API_KEY = "<YOUR-API-KEY>" ALPACA_SECRET_KEY = "...
client.py
import socket import threading def receive(): while True: try: message = client.recv(1024).decode("ascii") if message == 'NICK': nickname = input("Choose a nickname: ") client.send(nickname.encode("ascii")) print(client.recv(1024).deco...
client.py
# -*- coding: utf-8 -*- ''' 测试客户端: - 维护TUN - 监听数据 - 修改数据包 ''' import logging import time import os import socket import uuid as UUID_GENERATOR from threading import Thread from select import select from core.dns_handler import Decapsulator, Encapsulator from core.sys_manage import TunManager logging.basicC...
app.py
############################################################################# # Copyright (c) 2018, Voilà Contributors # # Copyright (c) 2018, QuantStack # # # # Distri...
test_gpio.py
# # Microchip Peripheral I/O # # Joshua Henderson <joshua.henderson@microchip.com> # Copyright (C) 2017 Microchip Technology 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 Li...
timed_subprocess.py
# -*- coding: utf-8 -*- ''' For running command line executables with a timeout ''' import shlex import subprocess import threading import hubblestack.exceptions import hubblestack.utils.data import hubblestack.utils.stringutils class TimedProc(object): ''' Create a TimedProc object, calls subprocess.Popen wi...
multiprocess.py
from __future__ import absolute_import import logging import time from multiprocessing import Process, Queue as MPQueue, Event, Value try: from Queue import Empty except ImportError: # python 2 from queue import Empty from .base import ( AUTO_COMMIT_MSG_COUNT, AUTO_COMMIT_INTERVAL, NO_MESSAGES_WAIT_...
skill_slider.py
import time from threading import Thread import wx class SlidersInputFrame(wx.Frame): def __init__(self, dim=3): super().__init__(parent=None, title="Sliders", size=(400, dim*100 - 20)) panel = wx.Panel(self) sizer = wx.BoxSizer(wx.VERTICAL) title = wx.StaticText(panel, style=wx.A...
qconfig.py
from PyQt5.QtCore import Qt, pyqtSignal, pyqtBoundSignal from PyQt5.QtGui import QFont, QIcon from .qinputtracklist import QInputFiles from .qfilterlist import QFilterList from .qavailablefilters import QAvailableFilters from .qoutputfiles import QOutputFiles from .qoutputconfig import QOutputConfig from PyQt5.QtWidge...
test_p2p_grpform.py
# P2P group formation test cases # Copyright (c) 2013-2014, Jouni Malinen <j@w1.fi> # # This software may be distributed under the terms of the BSD license. # See README for more details. import logging logger = logging.getLogger() import time import threading import Queue import os import hostapd import hwsim_utils ...
app.py
from queue import Empty, Queue import threading, time, uuid, os from flask import ( Flask, send_file, request, Response, render_template, ) import torch from data import colorize_image as CI from skimage import color as skiColor import numpy as np from io import BytesIO from PIL import Image, ImageColor colorMode...
2.Multiprocessing.Queue.py
# -*- coding: utf-8 -*- import multiprocessing def writer_proc(q): try: # q.put(1, block = False) q.put(1) except: pass def reader_proc(q): try: # x = q.get(block = False) x = q.get() print x except: pass if __name__ == "__ma...
manager.py
#!/usr/bin/env python3 import datetime import os import signal import subprocess import sys import traceback from multiprocessing import Process from typing import List, Tuple, Union import cereal.messaging as messaging import selfdrive.sentry as sentry from common.basedir import BASEDIR from common.params import Para...
threading_test.py
try: from queue import Empty, Full, Queue except ImportError: from Queue import Empty, Full, Queue import sys import threading import time import unittest import stomp from stomp.backward import monotonic from stomp.test.testutils import * class MQ(object): def __init__(self): self.connection = s...
tabletmanager.py
#!/usr/bin/python import warnings # Dropping a table inexplicably produces a warning despite # the "IF EXISTS" clause. Squelch these warnings. warnings.simplefilter("ignore") import logging import os import signal from subprocess import PIPE import threading import time import unittest import urllib import environme...
yandexwebdav.py
#!/usr/bin/python # coding=utf-8 import os import sys import threading import logging import base64 import xml.dom.minidom from six.moves import queue from six.moves import http_client from six import u, b, PY3 if PY3: from urllib.parse import unquote, quote else: from urllib import unquote, quote logger = ...
Validator.py
from IPProxyPool import config from gevent import monkey monkey.patch_all() import time, requests, json, chardet, os, sys, gevent, psutil from multiprocessing import Process, Queue from IPProxyPool.util.exception import Test_URL_Fail from IPProxyPool.db.DataStore import sqlhelper def detect_from_db(myip, proxy, proxie...
simple_action_state.py
import roslib; roslib.load_manifest('smach_ros') import rospy import threading import traceback import copy from actionlib.simple_action_client import SimpleActionClient, GoalStatus import smach from smach.state import * __all__ = ['SimpleActionState'] class SimpleActionState(State): """Simple action client s...
TFCluster.py
# Copyright 2017 Yahoo Inc. # Licensed under the terms of the Apache 2.0 license. # Please see LICENSE file in the project root for terms. """ This module provides a high-level API to manage the TensorFlowOnSpark cluster. There are three main phases of operation: 1. **Reservation/Startup** - reserves a port for the T...
test_pdb.py
# A test suite for pdb; not very comprehensive at the moment. import doctest 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 PdbTestInpu...
heart_beat.py
import sys sys.path.append('C:/Python37/Lib/site-packages') from pyqtgraph.Qt import QtGui, QtCore import pyqtgraph as pg import random from pyOpenBCI import OpenBCICyton import threading import time import numpy as np from scipy import signal import random import numpy as np from PIL import Image im...
__init__.py
from email import message_from_string import json import logging import random from StringIO import StringIO from threading import Thread import time import urlparse from flask import Flask, request, Response, g from httpbin.helpers import get_dict, status_code from twisted.internet import protocol, reactor from twist...
gui.py
# -*- coding: utf-8 -*- import wx import wx.xrc import json import requests import time from datetime import datetime import urllib.parse as urlparse from urllib.parse import parse_qs from threading import Thread from selenium import webdriver from chromedriver_py import binary_path as driver_path from lxml import htm...
kb_MetricsServer.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...
tcpserver.py
#!/usr/bin/env python3 from __future__ import print_function import socket import threading try: import queue import socketserver except ImportError: import Queue as queue import SocketServer as socketserver import time import os import signal import sys import struct import select import multiprocessin...
simple_telnet_load.py
#!/usr/bin/python # Telnet loader | have fun Yo! This Loads Mostly BuZy BoXeS regulr format/Mirai. # You Can Find Fresh TELNET List To Load @ http://godz56.tk/telnet-list/ # Simple Telnet Loader Ya d1g? import sys, re, os, socket, time from multiprocessing import Process if len(sys.argv) < 2: sys.exit("\033...
miniterm.py
#!/home/aakanksha/Blockchain-ERP-interoperability/odoo-13.0/venv/bin/python # # Very simple serial terminal # # This file is part of pySerial. https://github.com/pyserial/pyserial # (C)2002-2015 Chris Liechti <cliechti@gmx.net> # # SPDX-License-Identifier: BSD-3-Clause import codecs import os import sys import thre...
mcts.py
import torch, math, os import numpy as np import pickle, collections, time from utils import load_net from tqdm import tqdm from animal_chess_pymodule import * from alpha_zero_net import ChessNet import torch.multiprocessing as mp class Node(): MAX_ACTION = 252 def __init__(self, game, move, parent = None): ...
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...
server.py
#!/usr/bin/env python # # Copyright 2007 Google 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 o...
test_threading.py
""" Tests for the threading module. """ import test.support from test.support import (verbose, import_module, cpython_only, requires_type_collecting) from test.support.script_helper import assert_python_ok, assert_python_failure import random import sys import _thread import threading import...
metric.py
from __future__ import division import threading import numpy as np __all__ = ['SegmentationMetric', 'batch_pix_accuracy', 'batch_intersection_union', 'pixelAccuracy', 'intersectionAndUnion', 'hist_info', 'compute_score'] """Evaluation Metrics for Semantic Segmentation""" class SegmentationMetric(object...
base.py
# -*- coding: utf-8 eval: (yapf-mode 1) -*- # # February 19 2015, Christian Hopps <chopps@gmail.com> # # Copyright (c) 2015, Deutsche Telekom AG # # 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 a...
crash_utils.py
# Copyright (c) 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import atexit import cgi import ConfigParser import json import os import Queue import threading import time from common import utils from result import...
write_db.py
import json import threading import loguru import mysql.connector import websocket from binance.client import Client import LineNotify as Notify websocket.enableTrace(True) ### SETTING file_name = "config.json" with open(file_name, "r") as f: data = json.load(f) host = data["host"] port = data["port"] ...
network.py
import asyncio import datetime import json import logging import multiprocessing import threading import time import re from base64 import b32encode from binascii import unhexlify from http import HTTPStatus from typing import Optional, Union, List, Callable, Dict from urllib.parse import urlparse from requests.excepti...
library.py
import os import re import json import datetime import logging import csv import threading from core import searchresults, plugins import core from core.movieinfo import TheMovieDatabase, Poster from core.helpers import Url from hachoir.parser import createParser from hachoir.metadata import extractMetadata import PTN ...
test_motor_change_stream.py
# Copyright 2017-present MongoDB, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
xxe.py
import socket import sys import argparse import requests import threading import time import hashlib import os import sendrequest as req import utils.logger as logger import utils.logs as logs from utils.db import Database_update dbupdate = Database_update() # Dummy response data = b'''\ HTTP/1.1 200 OK\r\n\ Connect...
multi_launcher.py
""" This module contains methods for launching several Rockets in a parallel environment """ import os import threading import time from multiprocessing import Manager, Process from fireworks.core.rocket_launcher import rapidfire from fireworks.fw_config import ( DS_PASSWORD, PING_TIME_SECS, RAPIDFIRE_SLE...
init.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import os app_dir = os.path.normpath(os.path.join(os.getcwd(), os.path.dirname(__file__))) sys.path.append(os.path.dirname(app_dir)) sys.path.append(os.path.dirname(app_dir) + '/../') from core.config import settings fro...
test_clients_streaming.py
import os import time, asyncio from typing import List from datetime import datetime from functools import partial from multiprocessing import Process, current_process import pytest from jina import Flow, Document, DocumentArray, Executor, requests, Client INPUT_LEN = 4 INPUT_GEN_SLEEP_TIME = 1 SLOW_EXECUTOR_SLEEP_TI...
helper.py
import os import platform import shlex import subprocess import time from collections import defaultdict from functools import wraps from itertools import chain, combinations from re import ASCII, match from threading import Thread from typing import ( Any, Callable, DefaultDict, Dict, FrozenSet, Iterable, List, Op...
visualizer.py
import math import numpy as np import threading import open3d as o3d from open3d.visualization import gui from open3d.visualization import rendering from collections import deque from .boundingbox import * from .colormap import * from .labellut import * import time class Model: """The class that helps build visu...
fedavg_test.py
#!/usr/bin/env python3 import json import multiprocessing import os import sys # add the FedML root directory to the python path import threading import time sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "./../../../../"))) sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "./../../../"))) s...
main.py
from CommunicationLayer import NATSCommunication from CommunicationLayer import ServiceRegistry import asyncio import argparse import os import APIGateway import cherrypy import threading from Sensors import CSVSensor class Logic: lastFrame = None coordinateN = 0 coordinateE = 0 Name = "" frameRat...
carbon_black.py
import time, os, sys import logging import threading import datetime import pprint import copy from configparser import ConfigParser from threading import Lock, Thread from lib.constants import FA_HOME from lib.modules import base_module import lib.cbapi_3 as cbapi_3 log = logging.getLogger() class CarbonBlack(base...
power_monitoring.py
import random import threading import time from statistics import mean from cereal import log from common.params import Params, put_nonblocking from common.realtime import sec_since_boot from selfdrive.hardware import HARDWARE from selfdrive.swaglog import cloudlog from common.op_params import opParams CAR_VOLTAGE_LO...
sender.py
import datetime import json import os import socket import threading import time import tkinter as tk import wave from tkinter import filedialog, messagebox, ttk from tkinter.ttk import Combobox, Entry, Progressbar import tkinter.font as tkFont import pyaudio import scipy.io.wavfile as wav from PIL import Image, Image...
example_binance_futures.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # File: example_binance_futures.py # # Part of ‘UNICORN Binance WebSocket API’ # Project website: https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api # Documentation: https://oliver-zehentleitner.github.io/unicorn-binance-websocket-api # PyPI: https://p...
ex1.py
import threading NUM_THREAD = 10 mutex = threading.Lock() printed = False def print_text(): global printed mutex.acquire () if not printed: printed = True print ("printed once") mutex.release() threads = [] for i in range (NUM_THREAD): t = threading.Thread (target=print_text) ...
__init__.py
import os import shutil import subprocess import sys from packaging.version import Version, parse def _get_run_args(print_args: bool = True): from jina.helper import get_rich_console from jina.parsers import get_main_parser console = get_rich_console() silent_print = {'help', 'hub'} parser = g...
server.py
# -*- coding: utf-8 -*- # Python module: ModbusServer class (ModBus/TCP Server) from . import constants as const from .utils import test_bit, set_bit import socket import struct from threading import Lock, Thread # for python2 compatibility try: from socketserver import BaseRequestHandler, ThreadingTCPServer exc...
i2cgui.py
#!/usr/bin/env python import time import struct import sys import os import re import csv import threading from functools import partial import serial.tools.list_ports as slp import serial try: import wx import wx.lib.newevent as NE except ImportError: print("i2cgui.py needs wxPython, but it wasn't found...
client.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import json import websocket import threading from parlai.core.params import ParlaiParser from parlai.scripts.interactiv...
mesh_startup.py
import os import time from micropsi_server.mesh_ipy import IPythonConnection ipython_client = IPythonConnection() console_termination_requested = False def no_exit(code): pass def start_runtime_and_console(port=7543): import micropsi_server import micropsi_server.micropsi_app import sys sys.ex...
widget.py
import base64 import json import logging import threading import time import uuid import ipywidgets as widgets import ipywidgets.embed import numpy as np from IPython.display import display from ipywidgets import (Image, Box, DOMWidget, HBox, VBox, IntSlider, Output, Play, Widget, jslink) from ...
simple_train.py
import utils.atari_wrapper as atari_wrapper from utils.multi import create_buffers, get_batch, act import torch.multiprocessing as mp # from utils import argparse from model.atari_impala import AtariCasaNet import logging import torch import time import timeit import os import utils.some_trace as some_trace import util...
mock.py
import socket import json import threading import time from typing import Dict, Union, Any from localite.flow.payload import Queue from localite.flow.loc import localiteClient def append(outqueue: Queue, is_running: threading.Event, imi: float = 1): from queue import Full def Messages(): continual = ...
run_iperf.py
#Copyright 2012-2013 SAP Ltd # # 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...
battery_printer.py
import json import random import string import threading import time from typing import Callable, Dict, Union import websocket from pymitter import EventEmitter ee = EventEmitter() event_name = "battery_loader_" + "".join( random.SystemRandom().choice(string.ascii_letters + string.digits) for _ in range(6) ) DEF...
mitm.py
#!/usr/bin/env python3 import socket import argparse import threading import signal import json import requests import sys import time import traceback from queue import Queue from contextlib import contextmanager CLIENT2SERVER = 1 SERVER2CLIENT = 2 running = True """ "fast" TLS brute-force @author: Hung Nguyen """ ...
server.py
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
runserver.py
#!/usr/bin/python # -*- coding: utf-8 -*- import webbrowser import os import logging import subprocess from threading import Thread from pogom import config from pogom.app import Pogom from pogom.utils import load_credentials from pogom.search import search_loop from pogom.models import create_tables, Pokemon, Pokesto...
devices.py
""" This module holds Devices related components. A 'Device' is any computer running the clientapp or the serverapp """ import logging from ConfigParser import SafeConfigParser import config as config import time from player import LocalPlayer, RemotePlayer from socket import * import select import os import threadin...