source
stringlengths
3
86
python
stringlengths
75
1.04M
test_util.py
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
EDL.py
import demistomock as demisto from CommonServerPython import * from CommonServerUserPython import * import re from base64 import b64decode from multiprocessing import Process from gevent.pywsgi import WSGIServer from tempfile import NamedTemporaryFile from flask import Flask, Response, request from netaddr import IPAd...
sentiments.py
# -*- coding: utf-8 -*- from snownlp import SnowNLP import codecs import pandas as pd import datetime import os import jieba import jieba.analyse import multiprocessing import time def convertDate(t): td = datetime.datetime.strptime(t,"%m月%d日 %H:%M") return td.strftime("%d"),td.strftime("%m") def convertTime(...
thread.py
import time from threading import Thread import logging log = logging.getLogger(__name__) def start(stats): def _run(): while True: time.sleep(stats.timeout) stats() t = Thread(target=_run) t.daemon = True t.start() return t
progressbar.py
import threading import time from util import const def start(self): self.progressbar.set_visible(True) self.button_process.set_visible(False) self.done = False self.progress = 0 self.task = const.TASK_FRAGMENT def run(): while not self.done: if self.progress <= const.PERCE...
__main__.py
"""Aloe - A shitty weathermapping tool. Think MTR but with the ability to detect/declare incidents and emit logs. Periodically traceroutes the egress network, and then walks pings out the egress network recording times and hosts which failed to respond. Expects a network in excess of 90% packet delivery, but with var...
main.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Some analisys of text files and store results in database. """ # py_ver : [3.5.2] # date : [02.11.2016] # author : [Aleksey Yakovlev] # email : [nothscr@gmail.com] import re import time import multiprocessing from pathlib import Path from nltk.corpus ...
nodes_status.py
#!/home/kjgong/anaconda3/bin/python3 import time import os import sys import threading import paramiko import arrow # from multiprocessing.dummy import Pool import queue from prettytable import PrettyTable ts = os.get_terminal_size() if ts.lines < 31: exit("ERROR:Your terminal size is too small to print this t...
workbench.py
# -*- coding: utf-8 -*- import ast import collections import importlib import logging import os.path import pkgutil import platform import queue import re import socket import sys import tkinter as tk import tkinter.font as tk_font import traceback import webbrowser import gettext from threading import Thread from tki...
tests.py
import threading import time from unittest import mock from multiple_database.routers import TestRouter from django.core.exceptions import FieldError from django.db import ( DatabaseError, NotSupportedError, connection, connections, router, transaction, ) from django.test import ( Transact...
gdal2tilesp.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # ****************************************************************************** # $Id$ # # Project: Google Summer of Code 2007, 2008 (http://code.google.com/soc/) # Support: BRGM (http://www.brgm.fr) # Purpose: Convert a raster into TMS (Tile Map Service) tiles in a dire...
mudpi_server.py
import socket import sys import threading import json import time import redis from logger.Logger import Logger, LOG_LEVEL # A socket server used to allow incoming wiresless connections. # MudPi will listen on the socket server for clients to join and # send a message that should be broadcast on the event system. c...
emitters.py
""" emitters.py Copyright (c) 2013-2021 Snowplow Analytics Ltd. All rights reserved. This program is licensed to you under the Apache License Version 2.0, and you may not use this file except in compliance with the Apache License Version 2.0. You may obtain a copy of the Apache License Version 2.0...
tracking.py
#!/usr/bin/env python import rospy import tf from nav_msgs.msg import Path from geometry_msgs.msg import PoseStamped,Twist from pure_pursuit import * from threading import Lock,Thread import time class Tracking: def __init__(self): self.arrive = 0.1 self.lock = Lock() self.path = Path() ...
tests.py
import threading import time from unittest import mock from multiple_database.routers import TestRouter from django.core.exceptions import FieldError from django.db import ( DatabaseError, NotSupportedError, connection, connections, router, transaction, ) from django.test import ( TransactionTestCase, ove...
server_connection.py
import asyncio import logging import math import threading import time from asyncio.exceptions import CancelledError, TimeoutError from asyncio.streams import StreamReader, StreamWriter from typing import Optional, TypeVar from uuid import UUID import janus import pygame import pygame.event from and_beyond.client impo...
watchdog_plugin.py
#!/usr/bin/env python # # Copyright (C) 2013 Google Inc. # # This file is part of YouCompleteMe. # # YouCompleteMe 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 you...
autoreload.py
import functools import itertools import logging import os import signal import subprocess import sys import threading import time import traceback import weakref from collections import defaultdict from pathlib import Path from types import ModuleType from zipimport import zipimporter import django from django.apps i...
__init__.py
import sys import os from threading import Thread from i3pystatus.core.exceptions import ConfigError from i3pystatus.core.imputil import ClassFinder from i3pystatus.core import io, util from i3pystatus.core.modules import Module class CommandEndpoint: """ Endpoint for i3bar click events: http://i3wm.org/docs...
paxos.py
#!/usr/bin/env python3 """ Paxos application class is part of a thesis work about distributed systems Two main threads are created, one with an UDP socket and one with a TCP socket UDP socket - Command exchange - ADHOC commands sent in the ether TCP socket - Data exchange The membership is controlled by the network ...
tit.py
# -*-coding:utf8 -*- import os, requests, json, threading, datetime, webbrowser import tkinter.messagebox from io import BytesIO from tkinter import * # 使用Tkinter前需要先导入 from tkinter import ttk from PIL import ImageTk, Image from tkinter.ttk import Separator, Combobox # 获取今日时间戳 today_time = datetime.datetime.now().st...
EWSO365.py
import random import string from typing import Dict import dateparser import chardet import demistomock as demisto from CommonServerPython import * from CommonServerUserPython import * import sys import traceback import json import os import hashlib from io import StringIO import logging import warnings import email...
cli.py
# -*- coding: utf-8 -*- """ flask.cli:用于运行flask app的简单命令行程序 """ from __future__ import print_function import ast import inspect import os import re import ssl import sys import traceback from functools import update_wrapper from operator import attrgetter from threading import Lock, Thread import click from werk...
parallel.py
"""This module contains methods and classes for making parallel ETL flows. Note that this module in many cases will give better results with Jython (where it uses threads) than with CPython (where it uses processes). """ # Copyright (c) 2011-2020, Aalborg University (pygrametl@cs.aau.dk) # All rights reserved. ...
CalendarClient.py
from wingchun.constants import Region import os, nnpy, json, threading, time class CalendarClient: def __init__(self): self._req_socket = nnpy.Socket(nnpy.AF_SP, nnpy.REQ) self._req_socket.connect('ipc://' + os.environ["KF_HOME"] + '/calendar/rep.ipc') self._sub_socket = nnpy.Socket(nnpy.A...
keylime_agent.py
#!/usr/bin/python3 """ SPDX-License-Identifier: Apache-2.0 Copyright 2017 Massachusetts Institute of Technology. """ import asyncio import base64 import configparser import datetime import hashlib import http.server import importlib import io import multiprocessing import os import platform import shutil import signa...
multiprocessing_shared_memory_filemsg.py
import multiprocessing import time import math import random import json import os def Json2Dict(fname): with open(fname, "r") as read_content: v_dict = json.load(read_content) os.remove(fname) return v_dict def Var2Json(var_dict, fname): with open(fname, "w") as file: json.dump(var_...
vm_util.py
# Copyright 2014 PerfKitBenchmarker Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
iprpc.py
# -*- coding: utf-8 -*- # FLEDGE_BEGIN # See: http://fledge-iot.readthedocs.io/ # FLEDGE_END """ interprocess rpc """ __author__ = "Douglas Orr" __copyright__ = "Copyright (c) 2020 Dianomic Systems" __license__ = "Apache 2.0" __version__ = "${VERSION}" import os import sys import io import subprocess import threa...
deploy_dag.py
# Copyright © 2019 National Institute of Advanced Industrial Science and Technology (AIST). All rights reserved. from pathlib import Path from injector import singleton import json from datetime import datetime import os import shutil import werkzeug from zipfile import ZipFile import docker from docker.errors import I...
threadlatch.py
""" Java の CountDownLatch 風なクラス (マルチスレッド処理用) REFERENCES:: https://stackoverflow.com/questions/10236947/does-python-have-a-similar-control-mechanism-to-javas-countdownlatch https://qiita.com/shinkiro/items/75f3561d6bc96694ce30 """ import threading as th import typing as ty class CountDownLatch: """\ Java の Co...
rustws.py
import logging from threading import Thread import logging import websocket from typing import Optional from datetime import datetime import time from .rustplus_pb2 import AppMessage, AppRequest from ..structures import RustChatMessage from ...exceptions import ClientNotConnectedError class RustWebsocket(websocket.W...
IRTest.py
#!/user/bin/env python # coding=utf-8 __author__ = 'xzhao' import RPi.GPIO as GPIO import time import threading GPIO.setmode(GPIO.BOARD) GPIO_iR = 7 # 红外传感器GPIO previousIR = 0 # IR前一个状态 iR = 0 def signalCollect(): while True: signaliR() time.sleep(2) def signaliR(): global iR GPIO.se...
__main__.py
import os import sys # import pyaudio from threading import Thread from open_webpage import open_video_stream from stream_audio import transcribe if __name__ == '__main__': os.system('pulseaudio -D') # class textcolors: # if not os.name == 'nt': # blue = '\033[94m' # green = ...
uart2usb_loopback.py
# -*- coding:utf-8 -*- import serial import serial.tools.list_ports import struct import time import sys import random import threading import datetime ############################################################################### #文件设置 ############################################################################### ...
test_table.py
import random import pdb import pytest import logging import itertools import numpy from time import sleep from multiprocessing import Process from milvus import IndexType, MetricType from utils import * dim = 128 delete_table_interval_time = 3 index_file_size = 10 vectors = gen_vectors(100, dim) class TestTable: ...
SentenceTransformer.py
import json import logging import os import shutil from collections import OrderedDict from typing import List, Dict, Tuple, Iterable, Type, Union, Callable from zipfile import ZipFile import requests import numpy as np import transformers import torch from numpy import ndarray from torch import nn, Tensor, device from...
jspagescraper.py
from multiprocessing import Process, Manager, cpu_count import webkit_server import dryscrape from sa.database import Session from sa.logger import LOGGER def get_html(urlQ, callback, xpath_hooks): """ This page takes a url from the URL Queue (urlQ) and calls a callbac that will handle the page source. ...
AtariEnvWrapper.py
import numpy as np # from .atari_wrappers import make_atari, wrap_deepmind, FrameStack from .atari_wrappers import make_atari from .vec_env import VecEnv from .VideoRecord import VideoRecorder from multiprocessing import Process, Pipe # cf https://github.com/openai/baselines def make_atari_env(env_name, rank, seed, ...
natnet_client.py
# Copyright (c) 2020, Fabio Muratore, Honda Research Institute Europe GmbH, and # Technical University of Darmstadt. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source ...
import_thread.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function import threading import traceback import ray from ray import ray_constants from ray import cloudpickle as pickle from ray import profiling from ray import utils class ImportThread(object): """A thread us...
app.py
# coding:utf-8 from __future__ import absolute_import, unicode_literals from optparse import OptionParser import multiprocessing from minion_service.mongo import Mongo from .util import Daemon, get_minion_name, run_spider import time import logging __author__ = "golden" __date__ = '2017/7/20' logger = logging.getLogg...
main.py
from PIL import Image import json import random import threading from itertools import repeat """ Watch out on the syntax and make sure to add a new trait all over the script if you add one. Same goes for removing a trait. """ rarities = { "Backgrounds": [{'Trait': 'Example1', 'Quantity': 4444, 'Rarity':...
environment_proxy.py
# coding=utf-8 # Copyright 2021 RLDSCreator Authors. # # 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...
sensorFusion.py
import serial import numpy as np from threading import Thread, Event from queue import Queue FLOAT_SIZE = 4 MSG_SIZE = FLOAT_SIZE*(3+3+4)+3 QUEUE_SIZE = 128 # 0 for no limit def to_euler_angles(q): if len(q.shape) == 2: q = q.swapaxes(0, 1) x, y, z, w = q t0 = +2.0 * (w * x + y * z) t1 = +1...
worker.py
import Queue import logging import threading class Worker(object): def __init__(self, socket, addr, dispatcher): self.socket = socket self.addr = addr self.channel = Queue.Queue() self.running = True self.lock = threading.Lock() self.dispatcher = dispatcher ...
chart_data.py
from kafka import KafkaProducer import ujson as json import logging import os import requests import traceback from settings import KAFKA_HOSTS, TOPIC_FUNDS_CHART_DATA from multiprocessing import Pool from multiprocessing import Manager, Process from logger import get_logger # TOPIC_FUNDS_CHART_DATA = 'test' class Char...
_cancel_many_calls_test.py
# Copyright 2016 gRPC authors. # # 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...
main_backup.py
#!/usr/bin/env python3 # Copyright 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...
file_writer.py
import threading import os import json from queue import Queue class FileWriter: def __init__(self, file_name=os.path.join(os.getcwd(), 'last_ids.json')): self.queue = Queue() self.file_path = file_name if os.path.isfile(file_name): self.data_dict = json.load(open(file_name, '...
pg_lib.py
import psycopg2 from psycopg2 import sql import multiprocessing as mp import sys import os import time class pg_engine(object): def __init__(self): """ class constructor, set the useful variables """ lib_dir = os.path.dirname(os.path.realpath(__file__)) self.sql_dir = "%s/sql/" % lib_dir self.connections ...
threadmgr.py
import threading import ctypes import traceback import cStringIO from kunai.log import logger # this part is doomed for windows portability, will be fun to manage :) try: libc = ctypes.CDLL('libc.so.6') except Exception: libc = None class ThreadMgr(object): def __init__(self): self.all_threads ...
newslists.py
import queue import time import threading from elasticsearch import Elasticsearch from . import newslists_scrapers from . import article_scrapers newslists = [] articles = queue.Queue() article_parsers = {} def init_newslists_scrapers(): global newslists newslists = newslists_scrapers.scrapers def init_ar...
main.py
#---------------------------------------------------------------------------LIBRARY------------------------------------------------------------------------------ import tensorflow as tf import cv2 as cv import numpy as np import pathlib import threading import time as tm import webbrowser from pygame import time, mi...
plugin_manager.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # king_phisher/client/windows/plugin_manager.py # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright...
teensy_pot.py
from __future__ import print_function import time import serial import threading import numpy as np class TeensyPot(serial.Serial): Baudrate = 115200 ResetSleepDt = 0.5 MaxQueueSize = 1000 Timeout = 10.0 def __init__(self,param): serial_device_param = { 'baudrate' : self....
entry.py
import api import watcher_job import config from bottle import run from threading import Thread cfg = config.get_config() watcher_thread = Thread(target=watcher_job.start_job) watcher_thread.start() listen_host = cfg['listen_host'] listen_port = cfg['listen_port'] run(host = listen_host, port = listen_port, debug = ...
regexArrayBlindInjection.py
import copy; from util.output import verbose; from util.output import success; from util.output import failure; from util.output import question; from util.output import bold; from util.output import info; import threading class RegexArrayBlindInjection: def doc(self): bold("--Description--"); pri...
vthread.py
''' #============================================================== # 更加方便的多线程调用,类装饰器封装,一行代码实现线程池 # github : https://github.com/cilame/vthread # # 注意: # 装饰器会默认对 print 函数进行 monkey patch # 会对python自带的 print 函数加锁使 print 带有原子性便于调试 # 默认打开 log 让 print 能够输出线程名字 # 可以通过 toggle 函数关掉显示线程名功能(不关锁) # 可以通过执行 vthread.unpatch_all() 解除这...
armory.py
# Armory 3D Engine # https://github.com/armory3d/armory bl_info = { "name": "Armory", "category": "Render", "location": "Properties -> Render -> Armory", "description": "3D Game Engine for Blender", "author": "Armory3D.org", "version": (0, 6, 0), "blender": (2, 80, 0), "wiki_url": "http:...
base_thread_class.py
import logging import threading from queue import Queue logger = logging.getLogger('main.{}'.format(__name__)) extra = {'signature': '---SIGNATURE-NOT-SET---'} class BaseThreadClass: @staticmethod def create_thread_queue(func, thread_count=10, **kwargs): enclosure_queue = Queue() logger.debu...
utils.py
# Copyright 2010-2015 Josh Kearney # # 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 agre...
test_core.py
#!/usr/bin/env python # -*- coding: UTF-8 -*- from __future__ import print_function from mock import Mock from mock import patch from mock import ANY import os import sys from threading import Event from threading import Thread import logging from voluptuous import Schema from voluptuous import Required from voluptuou...
server_base.py
""" A base classes and utilities to provide a common set of behaviours for the assemblyline core server nodes. """ from __future__ import annotations import enum import functools import time import threading import logging import signal import sys import io import os from typing import Callable, TYPE_CHECKING import ty...
main.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: github.com/maliozer @license: MIT """ import threading import time def meow(): print('MEOWWWW!!!') time.sleep(2) print('MEOWWWW!!!') def havv(): print("Havv Havvv!!") time.sleep(3) print("Hırrr!!") #%% #calling without th...
installwizard.py
from functools import partial import threading from kivy.app import App from kivy.clock import Clock from kivy.lang import Builder from kivy.properties import ObjectProperty, StringProperty, OptionProperty from kivy.core.window import Window from kivy.uix.button import Button from kivy.utils import platform from kivy...
dynamodump.py
#!/usr/bin/env python """ Simple backup and restore script for Amazon DynamoDB using boto to work similarly to mysqldump. Suitable for DynamoDB usages of smaller data volume which do not warrant the usage of AWS Data Pipeline for backup/restores/empty. dynamodump supports local DynamoDB instances as w...
utxo_fetcher.py
""" UTXO Fetcher: fetches information about unspent transaction outputs from external source (according to config) and feeds it to CoinManager. """ from ngcccbase.services.blockchain import BlockchainInfoInterface, AbeInterface from ngcccbase.services.electrum import ElectrumInterface from ngcccbase.services.hellobl...
test_misc.py
import logging from multiprocessing import Process, Event, Queue import os import platform import shutil import sys import random import unittest from Crypto import Random from Crypto.Hash import MD5 from lbrynet import conf from lbrynet.file_manager.EncryptedFileManager import EncryptedFileManager from lbrynet.core.S...
env.py
# Create by Packetsss # Personal use is allowed # Commercial use is prohibited """ @author: Viet Nguyen <nhviet1009@gmail.com> """ import gym_super_mario_bros from gym.spaces import Box from gym import Wrapper from nes_py.wrappers import JoypadSpace from gym_super_mario_bros.actions import SIMPLE_MOVEMENT, COMPLEX_MO...
data_skin_recorder.py
#!/usr/bin/python # # # Copyright (c) 2013, Georgia Tech Research Corporation # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyrigh...
memory_cache.py
import asyncio import datetime import os import uuid from multiprocessing import Process, Queue from typing import Dict import aiofiles from fastapi import UploadFile from file_cache import settings PROJECT_FILE_DICT: Dict[str, Dict[str, str]] = {} queue = Queue() def remove_file(): while True: file_pa...
Image_Uploader.py
try: from flask import render_template, jsonify, request, Flask, send_from_directory, redirect import json, time, random, requests, os import secrets import discord from discord.ext import commands from discord.ext.commands import bot import asyncio import aiohttp import requests ...
impl.py
# MIT License # # Copyright (c) 2020 Sam McCormack # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify,...
minion.py
# -*- coding: utf-8 -*- ''' Routines to set up a minion ''' # Import python libs from __future__ import absolute_import, print_function import os import re import sys import copy import time import types import signal import fnmatch import logging import threading import traceback import multiprocessing from random imp...
poc.py
#!/usr/bin/env python3 import argparse from colorama import Fore, init import subprocess import threading from pathlib import Path import os from http.server import HTTPServer, SimpleHTTPRequestHandler CUR_FOLDER = Path(__file__).parent.resolve() JAVA_PATH = "/full/path/to/jdk1.8.0_102/bin" def generate_payload(use...
supervisor.py
# Copyright 2016 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...
selfbot.py
# -*- coding: utf-8 -*- ''' Free to use, all credits belong to me, Zero Cool. Do not sell or rent it! © 2018 Hello World ''' from important import * from selfbotv2 import HelpOptions, SelfbotHook # Setup Argparse parser = argparse.ArgumentParser(description='Selfbot Hello World') parser.add_argument('-t', '...
e2e_eval_automation.py
''' The purpose of this file is that it is a lot of work to manually coordinate the processing of all the individual experiment instance data. This function will be able to run the experiments and the analysis component, with a much more concise configuration format. It'll let me handle all the eval work I am going to ...
ban.py
import modules.core.extract as extract import modules.core.database as database import telegram import threading from config import * import time class ban_cls(): def __init__(self,update,context) -> None: self.update = update self.context = context self.msg = None self...
test_common.py
import time import threading import sys import nls URL="wss://nls-gateway.cn-shanghai.aliyuncs.com/ws/v1" AKID="Your AKID" AKKEY="Your AKSECRET" APPKEY="Your APPKEY" class TestSrCommon: def __init__(self, tid, test_file): self.__th = threading.Thread(target=self.__test_run) self.__id = tid ...
tg_trex.py
# Copyright (c) 2016-2017 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.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
udp_server.py
# Copyright 2019 MobiledgeX, Inc. All rights and licenses reserved. # MobiledgeX, Inc. 156 2nd Street #408, San Francisco, CA 94105 # # 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 # # htt...
views.py
# coding: utf-8 from flask import request from flask import redirect from flask import abort from flask import render_template from flask import jsonify from flask import url_for from flask import Response from flask import send_file from flask import g from flask_jwt_extended import jwt_required, create_access_token,...
Main_Controller.py
import serial import numpy as np import threading import time from datetime import datetime import pandas as pd from os import path import json # CSV File Parameters CSV_FILE_PATH = 'Data_Log.csv' MAX_SATELLITE_DEVICES = 10 HEADERS = ['Date'] for i in range(MAX_SATELLITE_DEVICES): HEADERS = HEADERS...
cliente.py
import socket import threading import json class Cliente(): def __init__(self, ip_server): self.s = socket.socket() self.s.connect((ip_server, 8000)) #self.crearsala() thread_rcv= threading.Thread (target=self.receive) thread_rcv.daemon=True th...
test_mock_cs_server.py
# lint-amnesty, pylint: disable=missing-module-docstring import json import threading import unittest import pytest from lms.djangoapps.discussion.django_comment_client.tests.mock_cs_server.mock_cs_server import MockCommentServiceServer class MockCommentServiceServerTest(unittest.TestCase): ''' A mock versi...
WorkerThreadManager.py
#!/usr/bin/env python """ _WorkerThreadManager_ A class used to manage regularly running worker threads. """ from __future__ import print_function import logging import threading import time from WMCore.Agent.HeartbeatAPI import HeartbeatAPI from WMCore.WorkerThreads.BaseWorkerThread import BaseWorkerThread # keep ...
__init__.py
import asyncio import logging import threading from enum import Enum from functools import wraps from time import sleep from typing import Any, Callable, Dict, List, Tuple import click import yaml from aiohttp import web from schemathesis.cli import CSVOption try: from . import handlers except ImportError: #...
mobZpro.py
''' ┏━━━━━━━━━━━━━━━━━ ┣ 𐀀 [x!as 𝗌𝖾𝗅𝖿𝖻𝗈𝗍]. ┗━━━━━━━━━━━━━━━━━ ''' from linepy import * from liff.ttypes import LiffChatContext, LiffContext, LiffSquareChatContext, LiffNoneContext, LiffViewRequest from thrift import transport, protocol, server from akad.ttypes import * from akad.ttypes import Message from akad...
gdal2tiles.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # ****************************************************************************** # $Id: gdal2tiles.py 1f32f6fdbfd2fd352047db41d316d8afbe3c3319 2018-11-30 01:05:06 +0100 Even Rouault $ # # Project: Google Summer of Code 2007, 2008 (http://code.google.com/soc/) # Support: ...
abattery.py
#!/usr/bin/env python ''' Onion Omega LiPo battery asynchronous support. NOTE! This is not the async python lib, just enables asynchronous battery level access. ''' from __future__ import print_function import uuid import threading try: from .battery import Battery except ValueError: from battery import Battery cla...
vep_transcript_etl.py
"""VEP Transcript ETL.""" import logging import multiprocessing import uuid import re from etl import ETL from etl.helpers import ETLHelper from files import TXTFile from transactors import CSVTransactor from transactors import Neo4jTransactor class VEPTranscriptETL(ETL): """VEP Transcript ETL.""" logger =...
test_pwinput.py
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # NOTE: We can't use pytest for these tests because using pyautogui to send # the input results in a "oserror: reading from stdin while output is captured" # error. # These tests don't fail so much as hang the system. If you see the test ha...
two_thread_stackovflow_sample.py
import threading from queue import Queue import time import random run = True def clock(interval): while run: print("The time is %s" % time.ctime()) time.sleep(interval) def process(batch: list): print('Process batch: ', batch) time.sleep(3) def worker(queue: Queue): batch = queue...
__init__.py
import sys import threading import itertools class Spinner(object): spinner_cycle = itertools.cycle(['-', '/', '|', '\\']) def __init__(self, beep=False, disable=False, force=False, stream=sys.stdout): self.disable = disable self.beep = beep self.force = force self.stream = st...
monitoring.py
import glob import json import logging import os import math import networkx as nx import socketserver import threading from CPAC.pipeline import nipype_pipeline_engine as pe # Log initial information from all the nodes def recurse_nodes(workflow, prefix=''): for node in nx.topological_sort(workflow._graph): ...
micfft.py
import pyaudio import numpy as np import wave from time import time from threading import Thread FORMAT = pyaudio.paInt16 CHANNELS = 1 RATE = 44100 CHUNK = 2048 # RATE / number of updates per second lastFft = {'val': 0, 'freq': 0, 'time': 0} def nextFft(stream): data = stream.read(CHUNK, exception_on_overflow=Fals...
leader.py
import logging import time from kazoo.client import KazooState from kazoo.exceptions import ConnectionClosedError from kazoo.recipe.election import Election from paasta_tools.deployd.common import PaastaThread class PaastaLeaderElection(Election): def __init__(self, client, *args, **kwargs): self.clien...
multitester.py
""" Certbot Integration Test Tool - Configures (canned) boulder server - Launches EC2 instances with a given list of AMIs for different distros - Copies certbot repo and puts it on the instances - Runs certbot tests (bash scripts) on all of these - Logs execution and success/fail for debugging Notes: - Some AWS ima...