source
stringlengths
3
86
python
stringlengths
75
1.04M
testhadoop.py
#!/usr/bin/python # coding=utf-8 ########################################################################## from test import CollectorTestCase from test import get_collector_config from test import unittest from mock import patch from diamond.collector import Collector from hadoop import HadoopMetrics2Collector from...
test_locks.py
import errno import os import tempfile import time from multiprocessing import Process from mock import Mock from pytest import raises from locks import Mutex try: BlockingIOError except NameError: BlockingIOError = (IOError, OSError) class TestMutex(object): def test___init__(self): mutex = M...
CHAS.py
#!/usr/bin/env python3 from olctools.accessoryFunctions.accessoryFunctions import dotter, GenObject, make_path, run_subprocess, \ write_to_logfile from threading import Thread from queue import Queue from glob import glob import threading import os __author__ = 'adamkoziol' class CHAS(object): def chas(self)...
main_window.py
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2012 thomasv@gitorious # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including witho...
flaskwebgui.py
import os, time, psutil import sys, subprocess as sps from threading import Thread class FlaskUI: """ This class opens in 3 threads the browser, the flask server, and a thread which closes the server if GUI is not opened Described Parameters: app, ...
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 u...
log_handler.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...
abunai.py
#! /usr/bin/env python # Abunai v2.2 # IRC translator bot # call with python abunai.py server nick channel USER USERLANGUAGE CHANNELLANGUAGE # do not include the # sign in the channel arg # as is, this script won't play nicely with servers that need nickserv or sasl # quit by entering q at the terminal import ...
restservice.py
from fedn.clients.reducer.interfaces import CombinerInterface from fedn.clients.reducer.state import ReducerState, ReducerStateToString from flask_wtf.csrf import CSRFProtect from werkzeug.utils import secure_filename from flask import Flask, jsonify, render_template, request from flask import redirect, url_for, flash...
bot_manager.py
#!/usr/bin/env python3 # coding: utf-8 # @Author: arthur # @Email: arthur.bernard.92@gmail.com # @Date: 2020-01-27 09:58:03 # @Last modified by: ArthurBernard # @Last modified time: 2020-05-10 18:31:21 """ Set a server and run each bot. """ # Built-in packages import logging from multiprocessing import Process from t...
trezor.py
import traceback import sys from typing import NamedTuple, Any from electrum.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException from electrum.bitcoin import TYPE_ADDRESS, TYPE_SCRIPT from electrum.bip32 import BIP32Node, convert_bip32_path_to_list_of_uint32 as parse_path from electrum import const...
flameMenuSG.py
''' flameMenuSG Flame 2020 and higher written by Andrii Toloshnyy andriy.toloshnyy@gmail.com ''' import os import sys import time import threading import atexit import inspect import re from pprint import pprint from pprint import pformat __version__ = 'v0.1.5' # from sgtk.platform.qt import QtGui menu_group_name =...
JobBrowserBFF_JSONRPCServer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import datetime import json import sys import traceback from getopt import getopt, GetoptError from multiprocessing import Process from wsgiref.simple_server import make_server from JobBrowserBFF.jsonrpcbase import ( JSONRPCService, InvalidParamsError, KeywordEr...
dut.py
#!/usr/bin/python '''The MIT License (MIT) Copyright (c) 2017 Yu Xiong Wei(try.dash.now@gmail.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation...
greengrassHelloWorld.py
# # Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # greengrassHelloWorld.py # Demonstrates a simple publish to a topic using Greengrass core sdk # This lambda function will retrieve underlying platform information and send # a hello world message along with the platform information to ...
collection.py
# Copyright 2009-2014 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 writin...
mainwindow.py
import json import os import sys from threading import Thread from typing import Dict, Optional, Tuple, Union sys.path.append(os.getcwd()) # must be ran in sbumips directory (this is bc PYTHONPATH is weird in terminal) from constants import * from interpreter.interpreter import Interpreter from sbumips import assembl...
gist_80.py
import functools import json import os import shutil import tempfile import threading import traceback import webbrowser try: import sublime import sublime_plugin except ImportError: from test.stubs import sublime from test.stubs import sublime_plugin from gist_20_exceptions import MissingCredentialsE...
federated_learning_keras_PS_MNIST_gradients.py
from DataSets import MnistData from DataSets_task import MnistData_task from consensus.consensus_v2 import CFA_process from consensus.parameter_server import Parameter_Server # best use with PS active # from ReplayMemory import ReplayMemory import numpy as np import os import tensorflow as tf from tensorflow import ke...
core_test.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...
Server.py
# # Server.py # # Created by Thomas Johannesmeyer on 02/02/2016. # Copyright (c) 2016 Thomas Johannesmeyer. All rights reserved. # #!/usr/bin/python import socket import os import sys import inspect from threading import Thread from Logger import * from time import sleep from signal import pause ## # Importin...
test_sslkeylog.py
import sys import os import time import re import threading import socket import ssl from contextlib import closing import pytest from mock import Mock from six.moves import socketserver import sslkeylog SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) CERTFILE = os.path.join(SCRIPT_DIR, 'keycert.pem') ADDRE...
minion.py
# -*- coding: utf-8 -*- ''' Routines to set up a minion ''' # Import python libs import logging import getpass import multiprocessing import fnmatch import os import hashlib import re import threading import time import traceback import sys import signal # Import third party libs import zmq HAS_RANGE = False try: ...
_kit2fiff_gui.py
"""Mayavi/traits GUI for converting data from KIT systems""" # Authors: Christian Brodbeck <christianbrodbeck@nyu.edu> # # License: BSD (3-clause) import os from ..externals.six.moves import queue from threading import Thread import numpy as np from scipy.linalg import inv # allow import without traits try: fro...
Chapter15_ProcessThread10_ThreadLocal.py
# -*- coding: utf-8 -*- import threading local_school = threading.local() # 创建全局ThreadLocal对象,其每个属性都是线程的局部变量,可以任意读写而互不干扰 def process_student(): std = local_school.student # 获取当前线程关联的student age = local_school.age print(std, age, threading.current_thread().name) def process_thread(name, ag...
touch.py
#!/usr/bin/python import evdev import threading import urwid import os import sys ######################################################### # Display stuff ######################################################### quit = False class Button(object): def __init__(self, params): self.name = params['name']...
main.py
def main(): from argparse import ArgumentParser from os import environ parser = ArgumentParser( prog='CyberPuffer', description='CyberPuffer - Just yet another telegram bot') parser.add_argument('--secret', '-s', dest='api_secret') parser.add_argument('--config', '-c', dest='config_id'...
test_attach_context_to_thread.py
from threading import Thread from unittest import TestCase, main from expects import expect, be, raise_error from twin_sister import dependency, dependency_context class TwoStageThread(Thread): """ Thread that runs in two stages: 1. Launch the thread but do nothing else 2. Run the target function ...
TwitterListener.py
import asyncio import threading import tweepy import urllib3 from utils.config import GLOBAL as cfg from queue import Queue from threading import Thread NUM_THREADS = 5 class TwitterListener(tweepy.StreamListener): def __init__(self, cog, q = Queue()): super().__init__() self.twitter_cog = cog ...
HiwinRA605_socket_ros_20190614132314.py
#!/usr/bin/env python3 # license removed for brevity #接收策略端命令 用Socket傳輸至控制端電腦 import socket ##多執行序 import threading import time ## import sys import os import numpy as np import rospy import matplotlib as plot from std_msgs.msg import String from ROS_Socket.srv import * from ROS_Socket.msg import * import HiwinRA605_s...
system_tests_http1_adaptor.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...
yapt.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Photo Tools """ import argparse import datetime import os import pathlib import re import shutil import sys import threading import time import typing import humanize import piexif from PIL import Image from yaptUtils import decode, decodeExifDateTime __author__ = ...
test_errcodes.py
#!/usr/bin/env python # test_errcodes.py - unit test for psycopg2.errcodes module # # Copyright (C) 2015 Daniele Varrazzo <daniele.varrazzo@gmail.com> # # psycopg2 is free software: you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published # by the Free Software ...
Lidar.py
# -*- coding: utf-8 -*- ''' 雷达类 基于官方ROS驱动,本脚本只提供订阅"/livox/lidar"topic的后续处理 ''' # 为了某些情况ros驱动没有正常加载,但也可以用主程序类测试 try: import rospy from sensor_msgs.msg import PointCloud2 from sensor_msgs import point_cloud2 except: print("[ERROR] ROS environment hasn't been successfully loaded.You can only use DepthQueue...
algo_five.py
from functools import reduce import numpy as np import random as r import socket import struct import subprocess as sp import threading from threading import Thread import ast import time import datetime as dt import os import psutil from netifaces import interfaces, ifaddresses, AF_INET import paho.mqtt.client as mqtt...
bruter.py
# Date: 12/28/2018 # Author: Mohamed # Description: Bruter import queue import time import threading import typing from lib.browser import Browser from lib.display import Display from lib.proxy_manager import ProxyManager from lib.password_manager import PasswordManager from lib.const import max_time_to_wait, max_bots...
simplepty.py
import tty, termios, signal, fcntl, struct, os, threading, sys, time def run_in_raw_mode(func): def inner(*args, **kwargs): fd = 0 old = termios.tcgetattr(fd) try: tty.setraw(fd) func(*args, **kwargs) finally: termios.tcsetattr(fd, termios.TCSADRA...
distributed_train.py
from rainbow_ddpg.ddpg import DDPG import baselines.common.tf_util as tfutil import itertools from baselines import logger import numpy as np import tensorflow as tf import cv2 import gym from baselines.common.schedules import LinearSchedule import sys import os from threading import Thread tmp = os.path.dirname(sys.m...
stream_interface.py
"""Stream Interface base class """ import logging import threading import time import traceback import serial from .mesh_interface import MeshInterface from .util import stripnl START1 = 0x94 START2 = 0xc3 HEADER_LEN = 4 MAX_TO_FROM_RADIO_SIZE = 512 class StreamInterface(MeshInterface): """Interface class for...
zmq_server.py
#!/bin/python from multiprocessing import Pool import multiprocessing as mp import multiprocessing import socket import sys import os import argparse import json import pickle import ast import importlib import contextlib def execute(connection, address): import logging logging.basicConfig(level=logging.DEBUG)...
util.py
...
main_window.py
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2012 thomasv@gitorious # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including witho...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
optimization.py
import hashlib import json import six from copy import copy, deepcopy from datetime import datetime from itertools import product from logging import getLogger from threading import Thread, Event from time import time from typing import List, Set, Union, Any, Sequence, Optional, Mapping, Callable from .job import Clea...
__init__.py
import sys import io import time import json import threading import traceback import collections import bisect try: import Queue as queue except ImportError: import queue # Patch urllib3 for sending unicode filename from . import hack from . import exception __version_info__ = (12, 2) __version__ = '.'.jo...
eval_mini_srcgame.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function USED_DEVICES = "-1" import os os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" os.environ["CUDA_VISIBLE_DEVICES"] = USED_DEVICES import sys import threading import time import tensorflow as tf from absl import ...
views.py
import os import shutil from datetime import datetime from os import path, listdir, makedirs from threading import Thread import requests from django.conf import settings from django.contrib import messages from django.contrib.auth.mixins import UserPassesTestMixin from django.http import HttpResponse from django.shor...
stresscpu.py
#!/usr/bin/env python3 # Programm : stresscpu.py # Version : 1.03 # SW-Stand : 17.02.2022 # Autor : Kanopus1958 # Beschreibung : Anzeige von System Informationen import psutil import subprocess import threading from multiprocessing import Process, active_children, cpu_count, Pipe from time import ...
fastbuild.py
#!/usr/bin/python3 # Copyright 2017-2018 Motylenok Mikhail # # 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...
test_monkey_mp.py
from __future__ import print_function from multiprocessing.process import current_process from gevent import monkey if not getattr(current_process(), "_inheriting", False): monkey.patch_all() from unittest import TestCase, main, skip import trace from time import sleep from gevent import spawn try: from u...
audiowrite.py
import io import numpy as np import threading from pathlib import Path import soundfile from scipy.io.wavfile import write as wav_write from pb_chime5.mapping import Dispatcher from pb_chime5.io.audioread import normalize_path int16_max = np.iinfo(np.int16).max int16_min = np.iinfo(np.int16).min def dump_audio( ...
concurrent_consumers.py
''' An example of concurrent consumers of the Natural Numbers Stream The producer and consumers are implemented as subprocesses to simplify the example's execution ''' from multiprocessing import Process from util.connection import get_connection KEY = 'numbers' def setup(): ''' Initializes the Stream ''' r...
basic.py
"""Find and show 10 working HTTP(S) proxies.""" import asyncio import json import traceback from datetime import datetime from queue import Queue from threading import Thread, Lock import requests import proxybroker import logging log = logging.getLogger(__name__) stream_handler = logging.StreamHandler() file_handl...
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...
misc.py
import os from time import sleep import multiprocessing __copyright__ = "Copyright 2016-2018, Netflix, Inc." __license__ = "Apache, Version 2.0" def empty_object(): return type('', (), {})() def get_unique_sorted_list(l): """ >>> get_unique_sorted_list([3, 4, 4, 1]) [1, 3, 4] >>> get_unique_sor...
app.py
"""Slack app to perform safety checks and monitoring for people working alone.""" import os import time import logging from flask import Flask from slack import WebClient from slack import errors from slackeventsapi import SlackEventAdapter import ssl as ssl_lib import certifi import database as db import datetime imp...
genetic_search.py
#!/usr/bin/env python import os, sys, subprocess import argparse import subprocess import threading import timeit from multiprocessing import Queue, Lock from configobj import ConfigObj from numpy import loadtxt from numpy.linalg import inv import matplotlib.pyplot as plt import moving from cvguipy import trajstorage,...
gui_tcp_server.py
import sys from time import sleep import threading from bottle import Bottle, ServerAdapter, request, response, run, error, hook import requests from openport.services.logger_service import get_logger from openport.common.config import OpenportAppConfig logger = get_logger('server') class CherryPyServer(ServerAdapt...
test_celery.py
import threading import pytest pytest.importorskip("celery") from sentry_sdk import Hub, configure_scope, start_transaction from sentry_sdk.integrations.celery import CeleryIntegration from sentry_sdk._compat import text_type from celery import Celery, VERSION from celery.bin import worker @pytest.fixture def con...
api_music.py
import aiohttp, json, re, os, uuid, math, urllib, threading, re import http.cookiejar as HC from .shaonianzhentan import fetch_info, fetch_json from homeassistant.helpers.network import get_url # 全局请求头 HEADERS = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55....
hello.py
# Copyright 2019 Open Source Robotics Foundation, 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...
backend_overview.py
# -*- coding: utf-8 -*- # Copyright 2018, IBM. # # This source code is licensed under the Apache License, Version 2.0 found in # the LICENSE.txt file in the root directory of this source tree. """A module for monitoring backends.""" import time import threading import types from IPython.display import display ...
alert_vm_disk_write_iops.py
''' Test about monitor trigger on vm disk writing iops in one minute @author: Songtao,Haochen ''' import os import test_stub import random import time import threading import zstacklib.utils.ssh as ssh import zstackwoodpecker.test_util as test_util import zstackwoodpecker.operations.resource_operatio...
wifi_shield_emulator.py
import threading import time import json import http.client import socket import subprocess import sys import logging from random import randint from http.server import HTTPServer, BaseHTTPRequestHandler from brainflow_emulator.emulate_common import log_multilines, TestFailureError class ShieldWriter(threading.Threa...
simple_socket_thread.py
#!/usr/bin/python3 import socket import threading #Let's first create a TCP type Server for handling clients class Server(object): """A simple TCP Server.""" def __init__(self, hostname, port): """Server initializer Keyword arguments: hostname -- The hostname to use for the server ...
SolarVIZ.py
# SolarVIZ Server # v0.0 (19.07.2019) # v0.1 (23.07.2019) # v0.2 (01.08.2019) # v0.3 (06.08.2019) # v0.4 (08.08.2019) # v0.5 (11.08.2019) # v0.9 (29.08.2019) # v0.91 (03.01.2020) # v0.93 (04.01.2020) # v0.93.3 (05.01.2020) # (c) Rami Saarivuori 2020 VIZversion = "0.93" polku = '//home//pi//SolarV...
test_capture.py
import contextlib import io import os import subprocess import sys import textwrap from io import UnsupportedOperation from typing import BinaryIO from typing import cast from typing import Generator from typing import TextIO import pytest from _pytest import capture from _pytest.capture import _get_multicapture from ...
buttontotalk.py
# Copyright (C) 2017 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 or agreed to in writi...
test_multiprocessing.py
from multiprocessing import Pool, Process import time if 1: #using 6 processes p = Pool(6) def occupy_cpu(): for _ in range(60000000): 1 + 1 def func_time(callable): init = time.time() callable() end = time.time() print(end - init) #0.94 sec if 1: def occupy_cpu(num): for __ in range(30): ...
stdout_supress.py
# Code Author Github user minrk # Originally from https://github.com/minrk/wurlitzer/blob/master/wurlitzer.py from __future__ import print_function from contextlib import contextmanager import ctypes import errno from fcntl import fcntl, F_GETFL, F_SETFL import io import os try: from queue import Queue except I...
BuildReport.py
## @file # Routines for generating build report. # # This module contains the functionality to generate build report after # build all target completes successfully. # # Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR> # This program and the accompanying materials # are licensed and made a...
test_variable_pubsub.py
import unittest as ut from localpubsub import VariablePub import threading as th class TestVariablePubsub( ut.TestCase ): def __producer(self, iterations, pub, wait=False): for i in range(iterations): pub.publish(i) def __consumer_iter(self, iterations, sub): for i in range(iterat...
run.py
# -*- coding:utf-8 -*- import hashlib import random from random import randint from time import sleep, time import requests from urllib import parse import json import threading import tkinter as tk from tkinter import ttk from tkinter import EXTENDED from tkinter import END columns1 = ("TITTLE", "ID") headers = { ...
VideoPlayer.py
import sys import threading import time import tkinter as tk import PIL from PIL import Image, ImageTk import cv2 import PySimpleGUI as sg class App: """ TODO: change slider resolution based on vid length TODO: make top menu actually do something :P """ def __init__(self): # ------ App sta...
test_numpy.py
import queue import threading import multiprocessing import numpy as np import pytest from numpy.random import random from numpy.testing import ( assert_array_almost_equal, assert_array_equal, assert_allclose ) from pytest import raises as assert_raises import scipy.fft as fft def fft1(x): L = len(...
dockerTest.py
# Copyright (C) 2015-2018 Regents of the University of California # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
scheduler.py
#!/usr/bin/python """ Author: Fabio Hellmann <info@fabio-hellmann.de> """ import logging import time import threading from datetime import datetime from attr import s, ib from attr.validators import instance_of _LOGGER = logging.getLogger(__name__) @s(frozen=True) class SchedulerTask(object): name = ib(va...
test_io.py
"""Unit tests for the io module.""" # Tests of io are scattered over the test suite: # * test_bufio - tests file buffering # * test_memoryio - tests BytesIO and StringIO # * test_fileio - tests FileIO # * test_file - tests the file interface # * test_io - tests everything else in the io module # * test_univnew...
__init__.py
# We import importlib *ASAP* in order to test #15386 import importlib import importlib.util from importlib._bootstrap_external import _get_sourcefile import builtins import marshal import os import platform import py_compile import random import stat import sys import threading import time import unittest import unitte...
main.py
#! python3 import numpy as np import sounddevice as sd import time import argparse import queue import sys import os from scipy.io.wavfile import read, write import tensorflow as tf import uuid import random import threading import simpleaudio as sa # Uncomment to disable GPU support os.environ["CUDA_DEVICE_ORDER"] =...
run_engine.py
""" 启动任务 """ import os os.chdir(os.path.split(os.path.realpath(__file__))[0]) from multiprocessing import Process, Pool from ControlNode.control_manager import ControlManager from SpiderNode.spider_schedule import SpiderSchedule import sys import time if __name__ == '__main__': # 参数 try: taskname = eva...
index.py
import logging import multiprocessing import os import time from .proxies import db_session, current_repo, current_app from .models import ErrorLog, Post, IndexMetadata from .utils.emails import send_subscription_emails from .utils.time import time_since logging.basicConfig(level=logging.INFO) logger = logging.getLog...
test_credentials.py
# Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompa...
test_generator_mt19937.py
import sys import pytest import numpy as np from numpy.linalg import LinAlgError from numpy.testing import ( assert_, assert_raises, assert_equal, assert_allclose, assert_warns, assert_no_warnings, assert_array_equal, assert_array_almost_equal, suppress_warnings) from numpy.random import Generator, MT199...
httproxy.py
#!/usr/bin/env python3 import sys import ssl import socket import select import threading def connect(addr): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0) s.connect((addr, 443)) s = ssl.wrap_socket(s) return s def pconnect(addr): addr = addr.split(":") s = socket.sock...
BLERemote.py
import threading, queue, struct import time import bluepy.btle as bt from hub import BaseDevice, DeviceException serviceUUID = bt.UUID('1234') buttonUUID = bt.UUID('0001') ledsUUID = bt.UUID('0002') chargingUUID = bt.UUID('0003') resetUUID = bt.UUID('0099') numLEDs = 5 class Device(BaseDevice): def configure(...
Client_for_R.py
from __future__ import print_function import grpc from google.protobuf import json_format import file_pb2 import file_pb2_grpc from threading import Thread import json from collections import Iterator import itertools from json.encoder import JSONEncoder import ast from multiprocessing import Queue try: import queu...
CityscapesDataset.py
# ---------------------------------------- # Written by Yude Wang # ---------------------------------------- from __future__ import print_function, division import os, glob import torch import pandas as pd import cv2 import multiprocessing from skimage import io from PIL import Image import numpy as np from torch.util...
image_reader.py
import os from Queue import Queue import sys from threading import Thread import time # third party lib import numpy from PIL import Image from PIL import ImageFile ImageFile.LOAD_TRUNCATED_IMAGES = True from label_util import listdir, filename_to_label, dense_to_one_hot class ImageReader(object): """ImageReader - ...
torbenRavenServer.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...
ipug.py
#!/usr/bin/env python # # -*- coding: utf-8 -*- # pylint: disable=invalid-name, line-too-long, too-many-nested-blocks, too-many-branches, too-many-locals # """ PUG: 'Pug, the Uefi Guidedog', or 'the Programmer's Uefi Guide'. A front-end to build the Uefi driver(s) with a .PY as the configuration file. (c) 2019-2021 T...
add_code_to_python_process.py
r''' Copyright: Brainwy Software Ltda. License: EPL. ============= Works for Windows by using an executable that'll inject a dll to a process and call a function. Note: https://github.com/fabioz/winappdbg is used just to determine if the target process is 32 or 64 bits. Works for Linux relying on gdb. Limitations:...
portscanner_subinterpreters.py
import time import _xxsubinterpreters as subinterpreters from threading import Thread import textwrap as tw from queue import Queue timeout = 1 # in seconds.. def run(host: str, port: int, results: Queue): # Create a communication channel channel_id = subinterpreters.channel_create() interpid = subinter...
test_pv_scale_and_respin_ceph_pods.py
""" PV Create with ceph pod respin & Memory Leak Test: Test the PVC limit with 3 worker nodes create PVCs and check for memory leak TO DO: This Test needs to be executed in Scaled setup, Adding node scale is yet to be supported. """ import logging import pytest import threading import time from tests import helpers, d...
parallelcluster-release-check.py
#!/usr/bin/python # # Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy # of the License is located at # # http://aws.amazon.com/apache2.0/ # # or in t...
flask_test.py
#-*- coding: utf-8 -*- #flask test #todo: It should be tested as django_test.py. import os, sys, subprocess, shutil import multiprocessing, time, signal import urllib2 sys.path.append(os.path.dirname(__file__) + "/../lib") from test_helper import create_virtenv, run_test ENV_NAME = "flask_test_env_" + os.path.basenam...
DAT Texture Wizard.py
#!/usr/bin/python # This file's encoding: UTF-8, so that non-ASCII characters can be used in strings. # ------------------------------------------------------------------- # # ~ ~ Written by DRGN of SmashBoards (Daniel R. Cappel) ~ ~ # # - - - - [ Feb., 2015 ] - ...
wheel_detection.py
import time import board import busio import adafruit_mpr121 import os import sys import RPi.GPIO as GPIO from threading import Thread i2c = busio.I2C(board.SCL, board.SDA) mpr121 = adafruit_mpr121.MPR121(i2c) alarm = False interval = 5 counter = 0 CODERUN = True #setting the GPIO mode GPIO.setmode(GPIO.BCM) GPIO...
example_sync.py
#!/usr/bin/env python3 """ This is an example of how the pytradfri-library can be used. To run the script, do the following: $ pip3 install pytradfri $ Download this file (example_sync.py) $ python3 example_sync.py <IP> Where <IP> is the address to your IKEA gateway. The first time running you will be asked to input ...
app.py
import networkwhisper, sync, sys, threading, time # TODO: Consider moving sync state outside of log # XXX: Assume {a,b}sync.log exists # TODO: UX feedback, when recv it should show # XXX: Ugly constants, should be elsewhere SETTINGS = { 'a': { 'host': "http://localhost:8500", 'keypair': "0x570833...