source
stringlengths
3
86
python
stringlengths
75
1.04M
conftest.py
from mockingServer.MockServer import MockServer from mockingServer.modules.RequestHandler import RequestHandler from modules.Vcenter import Vcenter from exporter import run_prometheus_server from threading import Thread import pytest import json import yaml import time def pytest_addoption(parser): """Pytest Para...
STRique.py
# \MODULE\------------------------------------------------------------------------- # # CONTENTS : STRique # # DESCRIPTION : Raw nanopore signal repeat detection pipeline # # RESTRICTIONS : none # # REQUIRES : none # # --------------------------------------------------------------------------------- # ...
samplercpy.py
import numpy from queue import Queue from threading import Thread, Condition class Sampler(object): """ Sampler used to play, stop and mix multiple sounds. .. warning:: A single sampler instance should be used at a time. """ def __init__(self, sr=22050, backend='sounddevice'): """ ...
multiprocessing_test3.py
import multiprocessing import time import math def to_signed(n): return n - ((0x80 & n) << 1) def sender(conn): mouse = open("/dev/input/mice", "rb") total_x = 0 total_y = 0 time_start = time.time() last_event_time = time_start while True: status, dx, dy = tuple(c for c in mouse.re...
trainer_utils.py
# coding=utf-8 # Copyright 2020-present the HuggingFace Inc. team. # # 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 ap...
__init__.py
from zmq.backend.cython.constants import NOBLOCK import signal import threading import traceback from datetime import datetime, timedelta from functools import lru_cache from typing import Any, Callable import zmq def _(x): return x # Achieve Ctrl-c interrupt recv signal.signal(signal.SIGINT, signal.SIG_DFL) KEE...
test__socket.py
from __future__ import print_function from __future__ import absolute_import from gevent import monkey # This line can be commented out so that most tests run with the # system socket for comparison. monkey.patch_all() import sys import array import socket import time import unittest from functools import wraps impo...
mtime_file_watcher.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_unix.py
#!/usr/bin/python # -- Content-Encoding: UTF-8 -- """ Tests the server & client in Unix socket mode (when available) :license: Apache License 2.0 """ # Standard library import os import random import socket import threading import unittest # JSON-RPC library from jsonrpclib import ServerProxy from jsonrpclib.SimpleJ...
system_test.py
''' Copyright (c) 2019-2021, Arm Limited and Contributors SPDX-License-Identifier: Apache-2.0 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...
nx.py
#!/usr/bin/python2 #! coding : utf-8 """ Usage : # encrypt a python file sudo ./nxcrypt.py --file=file_to_encrypt.py sudo ./nxcrypt.py --file=file_to_encrypt.py --output=output_file.py # inject a malicious python file into a normal python file sudo ./nxcrypt --file=normal_file.py --backdoor-file=msf_listener.py --outp...
testLogs.py
import logging import threading import time def worker(arg): while not arg['stop']: logging.debug('Hi from myfunc') time.sleep(0.5) def main(): logging.basicConfig(level=logging.DEBUG, format='%(relativeCreated)6d %(threadName)s %(message)s') logging.basicConfig(level=logging.DEBUG, format...
test_scheduler.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file tests the scheduler by stubbing the worker an echo server and verifying that the json request coming in the same json request coming out """ import asyncio from multiprocessing import Process, Queue import pytest import requests import sys import time import...
proxy.py
import sys import socket from threading import Thread def hexdump(src, length=16): result = [] for i in range(0, len(src), length): s = src[i:i+length] hexa = ' '.join("{:02X}".format(x) for x in s) text = ''.join([chr(x) if 0x20 <= x < 0x7F else '.' for x in s]) # Only decode ASCII ...
example_parallel.py
# -*- encoding: utf-8 -*- import multiprocessing import shutil import sklearn.model_selection import sklearn.datasets import sklearn.metrics from autosklearn.metrics import accuracy from autosklearn.classification import AutoSklearnClassifier from autosklearn.constants import * tmp_folder = '/tmp/autosklearn_paralle...
core.py
#coding=utf-8 import os import re import time import threading import subprocess from optparse import OptionParser import log from case import TestCase from case import TestSuite from connect import ADB, AdbException def hook(c): def deco(f): setattr(c, f.__name__, f) return f return deco LO...
decode_wavernn_dualgru_compact_lpc_mband_cf.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2021 Patrick Lumban Tobing (Nagoya University) # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) from __future__ import division from distutils.util import strtobool import argparse import logging import math import os import sys import time import...
TestServer.py
# coding=utf-8 from PIL import Image import numpy as np from werkzeug.utils import secure_filename from flask import Flask, request, jsonify from flask_cors import CORS from Queue import Queue import threading import traceback import paddle.v2 as paddle from cnn import convolutional_neural_network app = Flask(__name__...
test_python_server_image_builder.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...
integration.py
import os from threading import Thread from mindsdb.utilities.config import STOP_THREADS_EVENT from mindsdb.utilities.log import log import mindsdb.interfaces.storage.db as db class Integration: def __init__(self, config, name): self.config = config self.name = name self.mindsdb_database ...
decorators.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from threading import Thread from functools import wraps def thread(func): @wraps(func) def wrap(*args, **kwargs): return Thread(target=lambda: func(*args, **kwargs)).start() return wrap
AsynchExec.py
""" Framework for setting up an experiment. """ import numpy as np import gym import gym_minigrid,gym_cap import tensorflow as tf import argparse from urllib.parse import unquote import os from networks.network import Network from utils.utils import InitializeVariables, CreatePath, interval_flag, GetFunction from uti...
Work.py
import os import re import shutil import subprocess import time import uuid import xml.etree.ElementTree as ET from multiprocessing import Queue , Process import matplotlib.pyplot as plt import pandas as pd import seaborn as sns from PIL import Image import Tools sns.set_style('darkgrid') class Work: status_co...
wikiwindows.py
# ****************************************************************************** # Copyright 2017-2018 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apa...
watcher.py
# Copyright (c) 2022 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 ap...
test_process_utils.py
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
status.py
import sys import time import os import threading bytestoremote = 0 bytesfromremote = 0 _relayport = 0 _remoteaddress = "" _remoteport = 0 def reportbandwidth(): global bytestoremote global bytesfromremote step = 0 while True: time.sleep(1) if (sys.platform == "win32"): os.system('cls') else: os.syst...
test_cancellation.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...
client.py
""" CTQA Client Module Contains logic for implementing the CTQA Client with the ctqa_client class. """ import tkinter as tk from tkinter import ttk from tkinter import Toplevel from tkinter import messagebox from PIL import Image, ImageTk from collections import deque from .. import servicemanager from .. import repo...
plutus.py
# Plutus Bitcoin Brute Forcer # Made by Isaac Delly # https://github.com/Isaacdelly/Plutus import os import pickle import hashlib import binascii import multiprocessing from ellipticcurve.privateKey import PrivateKey DATABASE = r'database/MAR_15_2021/' def generate_private_key(): """ Generate a random 32-by...
__init__.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 app...
asynchronous_read_write.py
#!/usr/bin/env python3 ### IMPORT MODULES ### import time import threading from typing import Union from TerminalUI import TerminalUI ### USER DEFINED FUNCTIONS ### def command_entered_testing(terminal_ui : TerminalUI, command : str): """An example function that could be passed into the TerminalUI command_entere...
interface_http.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import time import os import logging import json import threading from functools import partial try: from http.server import BaseHTTPRequestHandler, HTTPServer #py3 import urllib.parse as urlparse except ImportError: from BaseHTTPServer import BaseHTTPRequestHa...
wxRavenWalletLogic.py
''' Created on 13 déc. 2021 @author: slinux ''' from .wxRavenWalletDesign import * import threading import time class walletMainPanel(wxRavenWalletMain): view_base_name = "Simple Wallet" view_name = "Simple Wallet" parent_frame = None default_position = "main" icon = 'wallet'#wx.Bitma...
test_dag_serialization.py
# -*- coding: utf-8 -*- # # 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 #...
messaging.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See LICENSE in the project root # for license information. from __future__ import print_function, with_statement, absolute_import import collections import itertools import json import sys import threading class JsonIOStre...
feeder.py
import queue import time import threading import j1939 class AcceptAllCA(j1939.ControllerApplication): """CA to accept all messages""" def __init__(self, name, device_address_preferred=None): # old fashion calling convention for compatibility with Python2 j1939.ControllerApplication.__init__...
socks5.py
#!/usr/bin/env python3 import argparse import logging import os import platform import signal import struct import sys import threading from socket import AF_INET, SOCK_STREAM, socket from socketserver import BaseServer, StreamRequestHandler, ThreadingTCPServer __author__ = 'Youchao Feng' support_os = ('Darwin', 'Lin...
main.py
from tkinter import * from tkinter import ttk from link import * import socket from _thread import * import threading, pyaudio import queue nickname_global = "" # Hardcoded, should be the first thing a user sets up when opening the app connected_users = [] recorded_frames = [] received_frames = {} play_threads = [] HA...
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...
tello3.py
# # Tello Python3 Control Demo # # http://www.ryzerobotics.com/ # # 1/1/2018 # # usage: # # $ python tello3.py # command # takeoff # land # quit # % import threading import socket # Create a UDP socket sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.bind(('', 9000)) tello_addr...
ip_main_and_multipro_try.py
import numpy as np from cv2 import cv2 from time import perf_counter from os import getcwd import multiprocessing from ip_functions import detect_class_in_img from sys import path # database management functions path.append( getcwd() + '/Database Management') from db_functions import getAllData img_dir = getcwd()...
characterization_gui.py
__author__ = 'Chronis' from definitions import SLM import numpy as np import pygame from QtGUI.core.pco_definitions import PixelFly from astropy.io import fits import os, sys, time from PyQt4 import QtCore, QtGui import pyqtgraph as pg from threading import Thread class SLMInspector(QtGui.QWidget): "...
PipelineManager.py
from IProcess import IProcess, EDataType import multiprocessing as mp from queue import Empty, Full from math import floor, ceil from shutil import get_terminal_size class PipelineManager(IProcess): def __init__(self): IProcess.__init__(self) self.isManager = True self.mpQueue = None def toId(self): retu...
game_coordinator.py
import time import threading import yaml from auto_player import common from auto_player import player class GameCoordinator(): def __init__(self, server_url, test_data=None, verbose=False): self.players = [] self.n_rounds = 3 self.expected_game_winner = None self.expected_round_w...
test_csv.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...
clang_format.py
#! /usr/bin/env python """ A script that provides: 1. Ability to grab binaries where possible from LLVM. 2. Ability to download binaries from MongoDB cache for clang-format. 3. Validates clang-format is the right version. 4. Has support for checking which files are to be checked. 5. Supports validating and updating a s...
_testing.py
import bz2 from collections import Counter from contextlib import contextmanager from datetime import datetime from functools import wraps import gzip import operator import os import re from shutil import rmtree import string import tempfile from typing import Any, Callable, ContextManager, List, Optional, Type, Union...
main_core.py
#!/usr/bin/env python import random import select import sys import threading import time from threading import Thread, Event, RLock from Buffer import * from Custom_Class import * from DataManagerRx import rxd_platform from User import User from mcast4 import rxd_multicast, txd_multicast from message_gen import messa...
percent_data_maker.py
import cv2 import numpy as np import os NUM_OF_DATAPOINTS = 30 def get_percent_diff(var1: float, var2: float): return 1.0-(min([var1, var2])/max([var1, var2])) def get_all_combos(elem_list: list): elem_diff_list = [] for item1_index in range(len(elem_list)): for item2_index in range(item1_inde...
test_threading_local.py
import unittest from doctest import DocTestSuite from test import test_support import threading import weakref import gc class Weak(object): pass def target(local, weaklist): weak = Weak() local.weak = weak weaklist.append(weakref.ref(weak)) class ThreadingLocalTest(unittest.TestCase):...
communication.py
import socket import threading import state import strings HOST = '' PORT = 9975 tcp = None conn = None client = None friend_username = "" def server_loop(): global conn global friend_username try: while True: # A abertura do servidor foi movida para a função init() # ...
reservation.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 contains client/server methods to manage node reservations during TFCluster startup.""" from __future__ import absolute_import from __future__ import division from _...
image_subscriber.py
import cv2 import threading import numpy as np import rospy from cv_bridge import CvBridge, CvBridgeError from sensor_msgs.msg import CompressedImage class ImageSubscriber: cv_image = np.zeros((480, 640, 3), np.uint8) last_msg_seq = -1 def __init__(self): self.bridge = CvBridge() self.th...
test_bio_membuf.py
#!/usr/bin/env python """Unit tests for M2Crypto.BIO.MemoryBuffer. Copyright (c) 2000 Ng Pheng Siong. All rights reserved.""" import os import multiprocessing from M2Crypto.BIO import MemoryBuffer from tests import unittest class TimeLimitExpired(Exception): pass def time_limit(timeout, func, exc_msg, *args...
Client.py
__author__ = 'Hector' from Tkinter import * import tkMessageBox from PIL import Image, ImageTk import socket, threading, sys, traceback, os from RtpPacket import RtpPacket CACHE_FILE_NAME = "cache-" CACHE_FILE_EXT = ".jpg" class Client: INIT = 0 READY = 1 PLAYING = 2 state = INIT SETUP = 0 PLAY = 1 PAUSE = 2...
test_dag_serialization.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...
lisp-itr.py
# ----------------------------------------------------------------------------- # # Copyright 2013-2019 lispers.net - Dino Farinacci <farinacci@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 obtain...
test_context.py
import logging import mock import threading import pytest from ddtrace.span import Span from ddtrace.context import Context from ddtrace.constants import HOSTNAME_KEY from ddtrace.ext.priority import USER_REJECT, AUTO_REJECT, AUTO_KEEP, USER_KEEP from .test_tracer import get_dummy_tracer from tests import BaseTestCa...
23_multithread_insecure.py
from threading import Thread num = 0 def do_sth(): global num for i in range(1000000): # 相当于 num = num + 1 # 首先计算num + 1,存入临时变量中;然后将临时变量的值赋给 # cpu调度不正确,因此结果不正确 num += 1 t1 = Thread(target=do_sth) t2 = Thread(target=do_sth) t1.start() t2.start() t1.join() t2.join() print(n...
netgear.py
""" =============================================== vidgear library source-code is deployed under the Apache 2.0 License: Copyright (c) 2019-2020 Abhishek Thakur(@abhiTronix) <abhi.una12@gmail.com> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the ...
application.py
# -*- coding:utf-8 -*- import sys import subprocess import threading import time import datetime import os import re # import commands import subprocess import json from server.gene_temp import Generater, generate_execute, generate_complete from server.service_log import ServiceLog dataUrl = "../" _da...
thread_semaphore.py
# encoding=utf-8 # 信号量通常用于保护数量有限的资源,例如数据库服务器。 # 在资源数量固定的任何情况下,都应该使用有界信号量。 # 在生成任何工作线程前,应该在主线程中初始化信号量。 # https://docs.python.org/zh-cn/3/library/threading.html#threading.Semaphore # from threading import BoundedSemaphore # maxconnections = 5 # # ... # pool_sema = BoundedSemaphore(value=maxconnections) # with pool_sema:...
ScraperService.py
# ScraperService.py from User import User from Reminder import Reminder from Conv import Conv # from app import Service # from ctparse import ctparemidrse # from datetime import datetime from bs4 import BeautifulSoup import requests import lxml, urllib import traceback from dateparser.search import search_dates from t...
ascii_gui.pyw
import os import tkinter import ascii import threading help_file = """The file or URL to ASCII. If you only put a name, it must be in the same folder as this program. Otherwise, include a file path. """ help_resolution = """The characterpixel resolution. Each ASCII character will represent x•y pixels of the original...
base_consumer.py
# -*- coding: utf-8 -*- # @Author : ydf # @Time : 2019/8/8 0008 13:11 """ 所有中间件类型消费者的抽象基类。使实现不同中间件的消费者尽可能代码少。 真个流程最难的都在这里面。 """ import abc import copy # from multiprocessing import Process import datetime import json import sys import socket import os import uuid import time import traceback from collections impor...
__init__.py
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) an...
test_recv_save_op.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...
multi_node_criteo_2node_4gpu.py
from hugectr import Session, solver_parser_helper, get_learning_rate_scheduler from mpi4py import MPI import threading import sys def session_impl_test(json_file): solver_config = solver_parser_helper(seed = 0, batchsize = 16384, batchsize_eva...
_pdp.py
from multiprocessing.pool import ThreadPool from threading import Event, Semaphore, Thread from typing import Callable from pdp import Pipeline from pdp.interface import ComponentDescription, Source, One2One from pdp.base import SourceExhausted, StopEvent from loky import ProcessPoolExecutor, Future def start_iter(q...
novedades.py
# -*- coding: utf-8 -*- # StreamOnDemand Community Edition - Kodi Addon # ------------------------------------------------------------ # streamondemand 5 # Copyright 2015 tvalacarta@gmail.com # http://www.mimediacenter.info/foro/viewforum.php?f=36 # # Distributed under the terms of GNU General Public License v3 (GPLv3...
dumping_callback_test.py
# Copyright 2019 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...
05 therading.local-线程不安全.py
# encoding = utf-8 __author__ = "mcabana.com" import threading class A: def __init__(self): self.x = 100 a = A() y = 10 print(a.x) def worker(): global y for c in range(1000000): a.x += 1 print('in the', threading.current_thread().name, a.x) # a.x += 1 # print(a.x) # 在线...
omsagent_ff.py
#!/usr/bin/env python # # OmsAgentForLinux Extension # # Copyright 2015 Microsoft Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2....
VisualizingTheInvisible.py
#!/usr/bin/env python import datetime import math import os import threading import timeit import cv2 import numpy import wx __author__ = 'Joseph Howse' __copyright__ = 'Copyright (c) 2018, Nummist Media Corporation Limited' __credits__ = ['Joseph Howse'] __license__ = 'BSD 3-Clause' __version__ = '0.0.1' __maintai...
test_receiver_threading.py
import imzmqx, cv2, time, queue, pylaxz from threading import Thread cap = imzmqx.ImageHub() class QueueFPS(queue.Queue): def __init__(self): queue.Queue.__init__(self) self.startTime = 0 self.counter = 0 def put(self, v): queue.Queue.put(self, v) self.counter += 1 ...
robot_gui.py
#!/usr/bin/env python import numpy as np import rospy import threading import time from newtonian_chain_numpy_simulated_dynamics import NewtonianArmDynamics from simulated_robot import SimulatedRobot from friction import Friction from simulated_chain_robot_gui import SimulatedChainRobotGUI from robot_sim.msg import ...
config.py
import os from pymongo import MongoClient import time import threading mongo_client = MongoClient(os.environ['database']) spyclient = MongoClient(os.environ['spydatabase']) pasyuk_id = 441399484 senderman_id = 94197300 admins = (pasyuk_id, senderman_id) db = spyclient.about_users about_user = db.users def createabo...
server.py
import socket from threading import Thread import time SERVER = None PORT = None IP_ADDRESS = None CLIENTS = {} playerNames = [] def handleClient(player_socket,player_name): global CLIENTS global playerNames # Sending Initial message playerType =CLIENTS[player_name]["player_type"] if(playerType...
test_capi.py
# Run the _testcapi module tests (tests for the Python/C API): by defn, # these are all functions _testcapi exports whose name begins with 'test_'. from __future__ import with_statement import sys import time import random import unittest from test import test_support as support try: import thread ...
rootprocess.py
import signal import threading import time import os import logging from luks.multiluks import MultiLuks logger = logging.getLogger("FileCrypto.root") def runcommand(cmd,pipe,pipelock,lks): out = "OK" #The output of a successful command is "OK" try: if (cmd["cmd"] == "create"): logger.i...
orphan_process_monitor.py
# # Copyright 2021 Splunk 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 writing, so...
simple_day_rythm_pump.py
#! /usr/bin/env python import threading import rospy import actionlib from nextfood_tasks.msg import * from datetime import datetime def str_to_sec(time_str): h, m, s = time_str.split(':') return int(h) * 3600 + int(m) * 60 + int(s) def pretty_print_sec(seconds): m, s = divmod(seconds, 60) h, m = divmod...
stt_node.py
#!/usr/bin/python3 import sys import time import getopt from google.cloud import speech from google.cloud.speech import enums from google.cloud.speech import types from google.api_core.exceptions import Unknown as Unknown_except from success_ros_msgs.msg import ( Speech as Speech_msg ) import rospy import threa...
quantum_nn.py
import numpy as np from qiskit import QuantumCircuit, transpile from typing import List, Union from collections import OrderedDict import itertools from qiskit.quantum_info import Statevector import multiprocessing as mp from . import Model # This class creates a quantum model that comprises of a feature map and vari...
test_concat_runner.py
# Copyright 2021 Zilliz. 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 agree...
MarketAnalysis.py
import csv import threading import time import datetime from cStringIO import StringIO try: import numpy use_numpy = True except ImportError as ex: ex.message = ex.message if ex.message else str(ex) print("WARN: Module Numpy not found, using manual percentile method instead. " "It is recommend...
process_wiki_dump.py
""" Pre-process a Wiki extractor files and segment sentences with CoreNLP. """ import os import sys import glob import gzip import json import warnings from multiprocessing import Process from bs4 import BeautifulSoup from url_conversion_helper import sanitize_url from corenlp import CoreNlPClient from helper import en...
gazeml_predictor.py
import functools import json import subprocess import threading import time import numpy as np import typing from PIL import Image from .basic_predictor import BasicPredictor class GazeMLPredictor(BasicPredictor): """GazeML based predictor Actually, it is just an interface for gazeML subprocess as i was to...
test03.py
# encoding: utf-8 import serial import Queue import threading import struct import time ser = None def do_imu(data): temp = struct.unpack('h', bytearray(data[4:6]))[0] print(data[4],data[5]) # acc ax = struct.unpack('h', bytearray(data[6:8]))[0] ay = struct.unpack('h', bytearray(data[8:10]))[0]...
application.py
# Copyright 2017 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...
backend.py
# -*- coding: utf-8 -*- import ast import builtins import copy import functools import importlib import inspect import io import logging import os.path import pkgutil import pydoc import re import signal import site import subprocess import sys import tokenize import traceback import types import warnings from collect...
submitty_autograding_shipper.py
#!/usr/bin/env python3 import os import time import signal import json import shutil import contextlib import datetime import multiprocessing from pathlib import Path from submitty_utils import dateutils import operator import paramiko import tempfile import socket import traceback import subprocess from autograder ...
download_ffhq.py
# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. # # This work is licensed under the Creative Commons # Attribution-NonCommercial-ShareAlike 4.0 International License. # To view a copy of this license, visit # http://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to # Creative Commons, PO Box...
hpds-02-A-00.py
# -*- coding: utf-8 -*- """ Created on Mon Dec 7 08:59:27 2020 Contoh Threading sederhana di Python 3 @author: Taufik Sutanto """ import time from threading import Thread def sleeper(i): nSleep = 3 print("thread {} sleeps for {} seconds".format(i, nSleep)) time.sleep(nSleep) print("thread %d woke up" ...
test_attenuator.py
import logging import threading import time from unittest.mock import Mock import pytest from ophyd.sim import make_fake_device from ophyd.status import wait as status_wait from ..attenuator import (AT1K4, AT2L0, MAX_FILTERS, AttBase, Attenuator, _att_classes) logger = logging.getLogger(__n...
feature_shutdown.py
#!/usr/bin/env python3 # Copyright (c) 2018 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test bytzd shutdown.""" from test_framework.test_framework import BitcoinTestFramework from test_framework....
scheduler_job.py
# pylint: disable=no-name-in-module # # 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, Versio...
test_webhook.py
from threading import Thread from time import sleep from webhook import Event import requests import hmac import hashlib import base64 class TestTwitivity: webhook: dict = None @staticmethod def create_signature(key, msg, digest=hashlib.sha256): hash_digest = hmac.digest(key, msg, digest) ...
DEM_run_all_benchmarks_grid.py
from __future__ import print_function import os import subprocess import sys import multiprocessing as mp if sys.version_info >= (3, 0): import queue else: import Queue as queue from threading import Thread import threading from glob import glob import shutil import KratosMultiphysics.kratos_utilities as kratos...