source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
test_local_task_job.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... |
fixtures.py | #!/usr/bin/env python
import functools
import logging
import multiprocessing
import os
import signal
import socket
import time
import warnings
import pytest
from flask import _request_ctx_stack
def deprecated(reason):
"""Decorator which can be used to mark function or method as deprecated.
It will result a w... |
mote.py | import vim
import threading
import subprocess
import json
import os.path
import select
# This doesn't work in vim 7.3. Window doesn't have a "valid" attribute,
# among other things
# Need to kill processes properly. If I open two motes then they don't
# get killed correctly
log = open(os.path.join(os.path.expandu... |
shexterd.py | #!/usr/bin/env python3
from threading import Thread
from time import sleep
import logging
import shexter.requester
import shexter.platform as platform
import shexter.config
"""
This file is for the shexter daemon, which runs persistantly. Every 5 seconds, it polls the phone to see if there are
unread messages. If t... |
test_urllib.py | """Regresssion tests for urllib"""
import urllib.parse
import urllib.request
import urllib.error
import http.client
import email.message
import io
import unittest
from unittest.mock import patch
from test import support
import os
import ssl
import sys
import tempfile
from nturl2path import url2pathname, pathname2url
... |
get_rates.py | """ get rates """
from concurrent.futures import ThreadPoolExecutor
from datetime import date, timedelta
import requests
import threading
from rates_demo.business_days import business_days
def get_rates() -> None:
""" get rates """
start_date = date(2021, 1, 1)
end_date = start_date + timedelta(days=20)... |
gpsegwalrep.py | #! /usr/bin/env python
"""
Initialize, start, stop, or destroy WAL replication mirror segments.
============================= DISCLAIMER =============================
This is a developer tool to assist with development of WAL replication
for mirror segments. This tool is not meant to be used in production.
It is sug... |
multiprocess.py | #!/usr/bin/env python
"""Helper functions to multiprocess functions easily"""
########################################################################
# File: multiprocess.py
# executable: multiprocess.py
#
# Author: Andrew Bailey, Most work was originally done by Trevor Pesout
# History: 03/05/18 Created
############... |
test_sync_inbox.py | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import py... |
dummy.py | import argparse
from io import BytesIO
import logging
import threading
# pylint: disable=import-error
import numpy as np
from xain_sdk import ParticipantABC, configure_logging, run_participant
LOG = logging.getLogger(__name__)
class Participant(ParticipantABC):
def __init__(self, model: bytes) -> None:
... |
process_replay.py | #!/usr/bin/env python3
import importlib
import os
import sys
import threading
import time
from collections import namedtuple
import capnp
from tqdm import tqdm
import cereal.messaging as messaging
from cereal import car, log
from cereal.services import service_list
from common.params import Params
from selfdrive.car.... |
networking.py | from socket import *
import threading
import socket
import SocketServer
from content import Mock
import sys
import re
import socket
import subprocess
import time
class RemoteClient():
"""
The RemoteClient sends commands to a remote DeviceRequestListener via TCP.
"""
def __init__(self, host, port, callb... |
benchmark.py | #!/usr/bin/env python3
import time
import sys
import random
import threading
from psrt import Client
from argparse import ArgumentParser
ap = ArgumentParser()
ap.add_argument('PAYLOAD_SIZE')
ap.add_argument('-H',
help='host:port',
default='localhost:2873',
metavar='HOS... |
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... |
multiProcTest.py | # -*- coding: utf-8 -*-
"""
待处理数据队列 长度N,M个在运行调度器处理
"""
from queue import Queue, Empty
from threading import Lock, Thread, BoundedSemaphore, current_thread, activeCount
import logging
import time
class AppLogger:
def __init__(self, moduleName, logfile):
self._logger = logging.getLogger(moduleName)
... |
test_multiprocess.py | import sys
import platform
import multiprocessing
import pytest
import keyring
def subprocess_get():
keyring.get_password('test_app', 'test_user')
pytestmark = [
pytest.mark.xfail(
platform.system() == 'Linux',
reason="#410: keyring discovery fails intermittently",
),
pytest.mark.x... |
server_windows.py | from argparse import ArgumentParser
import socket
from os import system
from os.path import exists, isfile, isdir
from time import sleep
from threading import Thread
try:
from requests import get as r_get
except ImportError:
pass
class Server:
def __init__(self, ip=None, port=6000):
# server ip, ... |
extensions.py | """
All logic regarding extensions management
"""
import collections
import importlib
import logging
import threading
import time
from collections import defaultdict
import scapy.arch.linux as linux
import scapy.layers.dot11 as dot11
import wifiphisher.common.constants as constants
import wifiphisher.common.globals a... |
partial.py | # flake8: noqa
import multiprocessing
from functools import partial
def a_flows_to_sink(a, b):
__test_sink(a)
def partial_application_with_tainted():
x = __test_source()
partial(a_flows_to_sink, x)
def partial_application_with_benign():
x = 1
partial(a_flows_to_sink, x)
def partial_applicat... |
V1.1B.py | '''
November 2020 - FangCore - Jacob Scrapchansky
FangCore is a python library built for creating highly customizable Operating systems.
'''
VERSION = "v1.1B"
import socket
import threading
class FangCore:
def __init__(self, *enabled_builtins):
self.command_bindings = []
self.load_defines = {}
self.extension... |
pydPiper.py | #!/usr/bin/python.pydPiper
# coding: UTF-8
# pydPiper service to display music data to LCD and OLED character displays
# Written by: Ron Ritchey
from __future__ import unicode_literals
import json, threading, logging, Queue, time, sys, getopt, moment, signal, commands, os, copy, imp, urllib2
import pages
import displ... |
sync_utils.py | import json
import threading
import time
import traceback
from concurrent.futures._base import Error
from weakref import WeakValueDictionary
import websocket
from torequests import NewFuture, tPool
from torequests.utils import quote_plus
from .base import ChromeDaemon
from .logs import logger
"""
[Archived]: will not... |
test_signal.py | import enum
import errno
import inspect
import os
import random
import signal
import socket
import statistics
import subprocess
import sys
import threading
import time
import unittest
from test import support
from test.support import os_helper
from test.support.script_helper import assert_python_ok, spawn_python
try:
... |
mdns_example_test.py | import re
import os
import socket
import time
import struct
import dpkt
import dpkt.dns
from threading import Thread, Event
from tiny_test_fw import DUT
import ttfw_idf
# g_run_server = True
# g_done = False
stop_mdns_server = Event()
esp_answered = Event()
def get_dns_query_for_esp(esp_host):
dns = dpkt.dns.DN... |
run.py |
# Copyright (c) 2020 Institution of Parallel and Distributed System, Shanghai Jiao Tong University
# ServerlessBench is licensed under the Mulan PSL v1.
# You can use this software according to the terms and conditions of the Mulan PSL v1.
# You may obtain a copy of Mulan PSL v1 at:
# http://license.coscl.org.cn/M... |
server.py | from http.server import BaseHTTPRequestHandler, HTTPServer
from operator import attrgetter
from threading import Thread
import json
import gamestate
import payloadparser
class GSIServer(HTTPServer):
def __init__(self, server_address, auth_token):
super(GSIServer, self).__init__(server_address, RequestHand... |
dataframe.py | from index import Index
import itertools
import operator
import numpy as np
import scipy.sparse as sp
from transform import Transform
from collections import OrderedDict
import networkx as nx
from os.path import commonprefix
from time import time
from threading import Lock, Thread
import json
from rwlock import ReadWr... |
app_mt.py | '''
Copyright 2020 Xilinx 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, software
distr... |
mpv.py | # -*- coding: utf-8 -*-
#
# Python MPV library module
# Copyright (C) 2017 Sebastian Götte <code@jaseg.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the Licen... |
tcp_echo_client.py | # Copyright 2015 ARM Limited, 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 a... |
exporter.py | #!/usr/bin/env python3
import xmlrpc.client
import argparse
import logging
import threading
import time
import json
import re
import sys
from socketserver import ThreadingMixIn
from http.server import HTTPServer
from pprint import pformat
import requests
from prometheus_client import Gauge, Counter, Enum, MetricsHand... |
example_profiled_application.py | from __future__ import absolute_import, print_function
import profilomatic
import profilomatic.monkey_patch
import profilomatic.monitor
import eliot
import datetime
import json
from profilomatic.fast_monotonic import monotonic
from eliot import startAction, Action, FileDestination
from threading import Thread
from prom... |
schat.py | import socket
import sys
import threading
import datetime
seperator = ","
print("Welcome to SChat!")
online_users = {}
schat_username = input("Choose a username: ")
print("SCHAT_USERNAME", schat_username)
def get_host_ip_address():
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8"... |
main.py | from ros.processor.inventory_events_consumer import InventoryEventsConsumer
from ros.processor.insights_engine_result_consumer import InsightsEngineResultConsumer
from ros.processor.garbage_collector import GarbageCollector
import threading
def process_engine_results():
processor = InsightsEngineResultConsumer()
... |
chapter9_8.py | # This example referenced Miguel Grinberg's code on Github:
# https://github.com/miguelgrinberg/oreilly-flask-apis-video/blob/master/camera/camera.py
#
from flask import Flask, url_for, jsonify, request,\
make_response, copy_current_request_context
from flask.ext.sqlalchemy import SQLAlchemy
from chapter9_pexpect_... |
lims_image_profiling_gen.py | __author__ = 'coriannaj'
#to run lims IVSCC swcs on general workstation logged into Zhi's account - otherwise V3D path needs to be changed
#needs to be a v3d version that accepts .tifs
#will run image profiling from IVSCC swcs by finding the corresponding image in the lims database, convert to tif,
#and run profilin... |
thread.py | import cv2, threading, queue
class ThreadingClass:
def __init__(self, name):
self.cap = cv2.VideoCapture(name)
self.q = queue.Queue()
t = threading.Thread(target=self._reader)
t.daemon = True
t.start()
def _reader(self):
while True:
(ret, frame) = self.cap.read()
if not ret:
... |
logger.py | # Copyright 2013-2014 James P Goodwin bkp@jlgoodwin.com
import sys
import os
import traceback
import queue
import threading
class Logger:
def __init__( self ):
self.logger_thread = None
self.logger_stop = False
self.logger_queue = queue.Queue()
def perform_log( self ):
""" read... |
views.py | #
# SPDX-License-Identifier: Apache-2.0
#
import logging
import base64
import shutil
import os
from rest_framework import viewsets, status
from rest_framework.decorators import action
from rest_framework.response import Response
from drf_yasg.utils import swagger_auto_schema
from django.core.paginator import Paginator... |
__init__.py | """
Create ssh executor system
"""
import base64
import binascii
import copy
import datetime
import getpass
import hashlib
import logging
import multiprocessing
import os
import queue
import re
import shlex
import subprocess
import sys
import tarfile
import tempfile
import time
import uuid
import salt.client.ssh.shel... |
access_to_resources.py | import logging
import random
import threading
import time
logging.basicConfig(level=logging.DEBUG,
format='(%(threadName)-10s) %(message)s',
)
class Counter(object):
def __init__(self, start=0):
self.lock = threading.Lock()
self.value = s... |
minion.py | # -*- coding: utf-8 -*-
'''
Routines to set up a minion
'''
# Import python libs
from __future__ import absolute_import, print_function, with_statement
import os
import re
import sys
import copy
import time
import types
import signal
import fnmatch
import logging
import threading
import traceback
import contextlib
impo... |
test_generator.py | import functools
import os
import threading
import unittest
import numpy
import pytest
import cupy
from cupy import cuda
from cupy.cuda import runtime
from cupy.random import _generator
from cupy import testing
from cupy.testing import attr
from cupy.testing import condition
from cupy.testing import hypothesis
def ... |
startingThread.py | import threading
import time
import random
def executeThread(i):
print("Thread {} started".format(i))
sleepTime = random.randint(1,10)
time.sleep(sleepTime)
print("Thread {} finished executing".format(i))
for i in range(10):
thread = threading.Thread(target=executeThread, args=(i,))
thread.start()
prin... |
xla_client_test.py | # Lint as: python3
# 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 ... |
grid_tools.py | import numpy as np
from numpy.fft import fft, ifft, fftfreq, rfftfreq
from astropy.io import ascii,fits
from scipy.interpolate import InterpolatedUnivariateSpline, interp1d
from scipy.integrate import trapz
from scipy.special import j1
import multiprocessing as mp
import sys
import gc
import os
import bz2
import h5py
... |
test_interactive.py | from threading import Thread
import sys
sys.path.append('../src/')
from transaction import Transaction
from block import Block
from client import Client
from validator import Validator
PORTS = [6644, 6666, 6688]
def val_thread(port, leader):
val = Validator(port=port)
val.create_connections()
while True:... |
lidar.py | import socket
import time
import threading
from flask import Flask
running = False
udp_port = 5044
app = Flask(__name__)
@app.route('/mode/set/<mode>')
def mode_set(mode):
global running
if mode.lower() == 'run':
running = True
reply_string = '{"status": "%s"}' % "Running" if running else "I... |
test_events.py | """Tests for events.py."""
import functools
import gc
import io
import os
import signal
import socket
try:
import ssl
except ImportError:
ssl = None
import subprocess
import sys
import threading
import time
import errno
import unittest
import unittest.mock
from test.support import find_unused_port, IPV6_ENABLE... |
monitor.py | # encoding: utf-8
from GUI import Ui_MainWindow
from PyQt5 import QtCore, QtGui, uic, QtWidgets
from PyQt5.QtWidgets import QWidget, QPushButton, QApplication, QMainWindow, QGridLayout, QFileDialog
from PyQt5.QtCore import *
from PyQt5.QtGui import *
import sys, cv2, threading
from yolo import YOLO
from PIL import Imag... |
soccer_datagen.py | from __future__ import division
import random
import math
import time
import numpy as np
import threading
import os, sys
import airsimdroneracingvae
import airsimdroneracingvae.types
import airsimdroneracingvae.utils
# import utils
curr_dir = os.path.dirname(os.path.abspath(__file__))
import_path = os.path.join(curr_d... |
m_to_r.py |
"""Defines blocking function mqtttoredis:
Receives XML data from MQTT and stores in redis.
Reads data published via redis, and outputs to MQTT.
"""
import os, sys, threading, pathlib
from time import sleep
import xml.etree.ElementTree as ET
REDIS_AVAILABLE = True
try:
import redis
except:
... |
nng.py | """
Provides a Pythonic interface to cffi nng bindings
"""
import logging
from ._nng import ffi, lib
from .exceptions import check_err, ConnectionRefused
from . import options
from . import _aio
logger = logging.getLogger(__name__)
__all__ = '''
ffi
Bus0
Pair0
Pair1
Pull0 Push0
Pub0 Sub0
Req0 Rep0
Socket
Surveyo... |
task.py | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright(c) 2018 Senscape Corporation.
# License: Apache 2.0
import numpy
import cv2
import threading
import queue
import time
class SingleTask:
"""
本类管理了两个子线程来执行单一的神经网络任务
"""
def __init__(self, net, **kwargs):
"""
实例化方法
... |
stream.py | import threading
import time
import typing as ty
from logging import getLogger
from uuid import uuid4
logger = getLogger(__name__)
E = ty.TypeVar("E")
StreamEventFunnel = ty.Callable[[E], ty.Any]
Shard = ty.TypeVar("Shard")
ShardIterator = ty.TypeVar("ShardIterator")
class ShardedStreamFunnelController(ty.NamedTup... |
test_base.py | import asyncio
import aiounittest
import threading
import time
from rtcbot.base import (
SubscriptionConsumer,
SubscriptionProducer,
ThreadedSubscriptionConsumer,
ThreadedSubscriptionProducer,
)
class TestBaseClasses(aiounittest.AsyncTestCase):
async def test_SubscriptionConsumer(self):
c ... |
zmqpub.py | from threading import Thread
from six.moves.queue import Empty
import json
try:
import gevent
import zmq.green as zmq
except ImportError:
import zmq
timeout = 0.1
class Publisher(object):
def __init__(self, zmqaddr, queue):
self.zmqaddr = zmqaddr
self.queue = queue
self.kill =... |
test_run.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 os
import subprocess
import tempfile
import threading
from unittest import mock
from antlir.artifacts_dir impor... |
14_edf_wait_die_Speak.py | # Author Emeka Ugwuanyi Emmanuel
from functools import reduce
from sys import *
import numpy as np
import random as r
import ping_code as pc
import socket
import struct
import subprocess as sp
from threading import Thread
import paramiko
import ast
import time
import os
import datetime as dt
import getpass as gp
impor... |
coqtop.py | # -*- coding: utf8 -*-
# Author: Wolf Honore
"""Coqtop interface with functions to send commands and parse responses."""
import concurrent.futures as futures
import datetime
import logging
import signal
import subprocess
import threading
import time
from queue import Empty, Queue
from tempfile import NamedTemporaryFil... |
test_multiprocessing.py | import pytest
import multiprocessing
import contextlib
import redis
from redis.connection import Connection, ConnectionPool
from redis.exceptions import ConnectionError
from .conftest import _get_client
@contextlib.contextmanager
def exit_callback(callback, *args):
try:
yield
finally:
callba... |
SDK基类.py | # coding:utf-8
from hashlib import md5,sha1
from hmac import HMAC
from urllib.parse import urlsplit,urljoin,quote,unquote,parse_qsl
from collections import OrderedDict
import json
import logging
import re
from pathlib import Path
import os
from time import time
from random import choice
import json
import functools
i... |
ws28xx.py | # Copyright 2013 Matthew Wall
# See the file LICENSE.txt for your full rights.
#
# Thanks to Eddie De Pieri for the first Python implementation for WS-28xx.
# Eddie did the difficult work of decompiling HeavyWeather then converting
# and reverse engineering into a functional Python implementation. Eddie's
# work was b... |
test_c10d.py | import copy
import math
import multiprocessing
import socket
import sys
import tempfile
import unittest
from functools import wraps
from collections import namedtuple
import torch
from torch import nn
import torch.nn.functional as F
from torch.distributed import c10d
from torch.nn.parallel import distributed_c10d
fr... |
materialized_views_test.py | import collections
import re
import sys
import time
import traceback
import pytest
import threading
import logging
from flaky import flaky
from enum import Enum
from queue import Empty
from functools import partial
from multiprocessing import Process, Queue
from cassandra import ConsistencyLevel, InvalidRequest, Writ... |
manifest_worker.py | import threading
from queue import Queue
import concurrent.futures
import logging
import os
from pathlib import Path
from typing import Optional, List
import gevent
from app.globals import OPEN_VR_DLL, EXE_NAME
from app.mod import get_available_mods
from app.events import progress_update
def run_update_steam_apps(s... |
tpu_estimator.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... |
check_interval.py | import threading
n = 0
# def foo():
# global n
# n += 1
###############
# LOCK version
###############
lock = threading.Lock()
def foo():
global n
with lock:
n += 1
threads = []
for i in range(100):
t = threading.Thread(target=foo)
threads.append(t)
for t in threads:
... |
tello.py | """License.
Copyright 2018 Todd Mueller <firstnamelastname@gmail.com>
This program 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) any later version.
This pr... |
main_v4.py | import random
from remi import App, start
import os
import remi.gui as tk
from creators import C
import datetime
import matplotlib.pyplot as plt
import seaborn as sns
from getbankdata import GetBankData
import glob
import pandas as pd
from user import User
from threading import Thread
from run_saved_model ... |
osc_input.py | import logging, threading
from py2030.base_component import BaseComponent
try:
from OSC import OSCServer, NoCallbackError
except ImportError:
logging.getLogger(__name__).warning("importing embedded version of pyOSC library")
from py2030.dependencies.OSC import OSCServer, NoCallbackError
DEFAULT_PORT = 203... |
socketserverservice.py | # -*- coding: utf-8 -*-
"""
A windows service wrapper for the py.execnet socketserver.
To use, run:
python socketserverservice.py register
net start ExecNetSocketServer
"""
import socketserver
import sys
import threading
import servicemanager
import win32event
import win32evtlogutil
import win32service
import win32... |
test_socket.py | #!/usr/bin/env python3
import unittest
from test import support
from unittest.case import _ExpectedFailure
import errno
import io
import socket
import select
import tempfile
import _testcapi
import time
import traceback
import queue
import sys
import os
import array
import platform
import contextlib
from weakref impo... |
processor.py | from queue import Queue, Empty
from threading import Thread
import logging
log = logging.getLogger(__name__)
class Processor:
POISON_PILL = 'POISON_PILL'
def __init__(self, threads=1):
self.threads = []
self.tasks = Queue()
self.running = True
for i in range(threads):
... |
Window.py | #!/usr/bin/env python3
from tkinter import *
from tkinter import ttk
from tkinter import filedialog
from tkinter import messagebox
from PIL import Image
from PIL import ImageTk
from tkinter.filedialog import askdirectory
import _tkinter
from Modules.Sprite import Sprite
import sys, os, time, math
from threading import ... |
build_environment.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
"""
This module contains all routines related to setting up the package
build environment. All of this is set up by packa... |
__init__.py | """Interact with the Linux bluetooth resources."""
import subprocess
import threading
import traceback
from pathlib import Path
from typing import List, Mapping, MutableMapping, Optional, Sequence
import albert as v0
from gi.repository import GdkPixbuf, Notify
__title__ = "bluetooth"
__version__ = "0.4.0"
__triggers... |
lisp-rtr.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... |
booter.py | #!/usr/bin/python
import time
import sys
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import threading
from pyvirtualdisplay import Display
env = 1;
def instabooter():
title = "BotNET[1]"
print "%s initializing...\r" %title
#Fix XMLRPC select
if(sys.argv[2] == 'XMLRPC'... |
CommonObservePackages.py | '''
Because we can run MouseObserver and KeyboardObserver with same code
regardless on Windows or Mac, we implemented common classes here.
But we can implement in per classes when we have to implement following OS.
'''
import math
import time
from datetime import datetime
from collections import deque
# import... |
sort_img_thr.py | from PIL import Image as Im
import numpy as np
import threading as Th
import math
img1 = Im.open("barbara.tif").convert("L")
im1 = np.array(img1, dtype=np.int)
im2 = np.array(img1, dtype=np.int)
ini=int(0)
fin=int(0)
def thsort(Im1,Im2,ini,fin):
for i in range(ini,fin):
Im2[i]=np.sort(Im1[i])
threads = []
##cuan... |
Notify.py | import os
import time
import json
import requests
import threading
host_ip = os.environ.get("TEST_AGENT_IP", "172.23.0.1")
manager_port = int(os.environ.get("WTMANAGER_PORT", "8080"))
device_serial = os.environ.get("ADB_SERIAL")
mobile_agent_port = None
shouldStop = False
last_touch = (1080, 1920, 0, 0) #(with, heigh... |
vumeter_widget.py | import sys
import subprocess
import threading
from gi import require_version as gi_require_version
# from ..backends import Pulse
gi_require_version('Gtk', '3.0')
from gi.repository import Gtk, GLib
class Vumeter(Gtk.ProgressBar):
def __init__(self, device_type, device_id, config, vertical=True):
super... |
filevideostream.py | # import the necessary packages
from threading import Thread
import sys
import cv2
import time
# import the Queue class from Python 3
if sys.version_info >= (3, 0):
from queue import Queue
# otherwise, import the Queue class for Python 2.7
else:
from Queue import Queue
class FileVideoStream:
def ... |
lisp-etr.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_executors.py | import os
import multiprocessing
import sys
import threading
import time
import pytest
import prefect
from prefect.utilities.executors import (
run_with_thread_timeout,
run_with_multiprocess_timeout,
tail_recursive,
RecursiveCall,
)
# We will test the low-level timeout handlers here and `run_task_wi... |
ws_proxy.py | import argparse
import ssl
import sys
import threading
import asyncio
import websockets
import logging
__TOKEN_DB = []
def add_token(token, user, vmi_name):
matches = [x for x in __TOKEN_DB if x["user"] == user and x["vmi"] == vmi_name]
if len(matches) >= 1:
return False
__TOKEN_DB.append({"user... |
__init__.py | # -*- coding: utf-8 -*-
"""
Python library for controlling the Teufel Raumfeld system
@author: Patrick Maier
@contact: mail@maierp.de
Based on python-raumfeld by Thomas Feldmann:
https://github.com/tfeldmann/python-raumfeld
Further information see README.md
"""
import logging
import socket
import threading
import t... |
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... |
WebFuzzer.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# "Testing Web Applications" - a chapter of "The Fuzzing Book"
# Web site: https://www.fuzzingbook.org/html/WebFuzzer.html
# Last change: 2022-01-11 10:25:37+01:00
#
# Copyright (c) 2021 CISPA Helmholtz Center for Information Security
# Copyright (c) 2018-2020 Saarland Un... |
smart_camera.py | """A smart webcam,
get video feed from camera,
feedforward captuerd frame on NCS pretrained graph,
compute FPS,
return the captured frame, with detected object, inframe_self.logger.infoed FPS, and header: "smart camera".
"""
# USAGE
# python ncs_realtime_objectdetection.py --graph graphs/mobilenetgraph --display... |
messaging_service.py | from __future__ import with_statement
import socket
import threading
import time
class MessagingService:
def __init__(self, local_address):
# self.playerDict = {} # Maps player names to addresses.
self.message_queue = [] # contains tuples of the form (message, address)
self.r... |
test_hash_table.py | # -*- coding: utf-8 -*-
"""
"""
import os
import sys
import runpy
from threading import Thread
import pytest
import numpy as np
from cslug import ptr
from hirola import HashTable, exceptions
from hirola._hash_table import slug
from tests import random_ids, ignore_almost_full_warnings, warnings_as_errors
DATA = np.... |
utils.py | from __future__ import print_function
import colorsys
import inspect
import json
import math
import os
import pickle
import platform
import signal
import numpy as np
import pybullet as p
import random
import sys
import time
import datetime
import shutil
code_dir = os.path.dirname(os.path.realpath(__file__))
sys.path.a... |
webpagetest.py | # Copyright 2019 WebPageTest LLC.
# Copyright 2017 Google Inc.
# Use of this source code is governed by the Apache 2.0 license that can be
# found in the LICENSE file.
"""Main entry point for interfacing with WebPageTest server"""
from datetime import datetime
import gzip
import logging
import multiprocessing
import os... |
generate_schedule.py | # coding: utf-8
import os
import os.path
import csv
import threading
from functools import partial
from deap import base, creator, tools, algorithms
import numpy
from deap.tools import Statistics
from scoop import futures
from .deep import *
import logging
log = logging.getLogger(__name__)
DATEFORMAT = "%a %H:%M"... |
dokku-installer.py | #!/usr/bin/env python3
import cgi
import json
import os
import re
import shutil
try:
import SimpleHTTPServer
import SocketServer
except ImportError:
import http.server as SimpleHTTPServer
import socketserver as SocketServer
import subprocess
import sys
import threading
VERSION = 'v0.23.5'
def bytes_t... |
__init__.py | # -*- coding: utf-8 -*-
# moldynplot.__init__.py
#
# Copyright (C) 2015-2017 Karl T Debiec
# All rights reserved.
#
# This software may be modified and distributed under the terms of the
# BSD license. See the LICENSE file for details.
"""
General functions.
"""
################################### MODULES ###... |
prefetch.py | #!/usr/bin/python
# Copyright (c) 2010 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.
# this functional test spawns a web server, and runs chrome to point
# at that web server. The content served contains prefetch reques... |
tasks.py |
import json
import logging
import threading
from datetime import datetime, date
from internos.taskapp.celery import app
from .client import ActivityInfoClient
from .utils import r_script_command_line, generate_indicator_tag, calculate_indicators_all_tags
logger = logging.getLogger(__name__)
def get_reporting_year(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.