source
stringlengths
3
86
python
stringlengths
75
1.04M
icyparser.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- ## Author: Gijs Timmers: https://github.com/GijsTimmers ## Licence: CC-BY-SA-4.0 ## http://creativecommons.org/licenses/by-sa/4.0/ ## This work is licensed under the Creative Commons ## Attribution-ShareAlike 4.0 International License. To ...
CEFET Analyze.py
from LibrasVideoSegmentation import LibrasVideoSegmentation from os.path import split from tqdm import tqdm import pandas as pd from pathlib import Path from cupy import fft import cupy as cp # from cusignal import firwin from scipy.signal import lfilter, firwin import numpy as np from json import dump from multiproces...
coverage_test_multicast_ipv6.py
# -*- coding: utf-8 -*- from queue import Queue import random import threading import unittest from coapclient import HelperClient from coapserver import CoAPServer from coapthon import defines from coapthon.messages.option import Option from coapthon.messages.request import Request from coapthon.messages.response im...
4.Thread.Condition.py
# -*- coding: utf-8 -*- """ 主要实现了生产者和消费者线程,双方将会围绕products来产生同步问题,首先是2个生成者生产products ,而接下来的10个消费者将会消耗products, 另外: Condition对象的构造函数可以接受一个Lock/RLock对象作为参数,如果没有指定,则Condition对象会在内部自行创建一个RLock; 除了notify方法外,Condition对象还提供了notifyAll方法,可以通知waiting池中的所有线程尝试acquire内部锁。 由于上述机制,处于waiting状态的线程只能通过notify方法唤醒,所以...
sim_classes.py
#!/usr/bin/python3 from classes.classes import TiltBase, BubblerBase from random import randint import threading import socket class BubblerSim(BubblerBase): def __init__(self, *args, **kwargs): super(BubblerSim, self).__init__(*args, **kwargs) self.server_thread = threading.Thread(target=self.simu...
lte.py
# -*- coding: utf-8 -*- ''' License: © Copyright 2018, Networked Systems group, ESAT-TELEMIC,KU Leuven. 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 code must retain the a...
predict_miss.py
import pymysql import sys import zlib import json from time import sleep from kafka import KafkaConsumer, KafkaProducer, TopicPartition import ast from threading import Thread import threading import wget import subprocess import csv import os import shutil import pandas as pd import time from bson import json_util ...
proxy.py
#!/usr/bin/env python3 import argparse import logging import os import platform import signal import struct import sys import threading from socket import AF_INET, SOCK_STREAM, socket from socketserver import BaseServer, StreamRequestHandler, ThreadingTCPServer # https://github.com/fengyouchao/pysocks __author__ = 'Y...
giltest.py
################################################################################ # # Copyright (c) 2019, the Perspective Authors. # # This file is part of the Perspective library, distributed under the terms of # the Apache License 2.0. The full license can be found in the LICENSE file. # import multiprocessing impor...
server_backup.py
import socket import threading import random import pickle import traceback import select import server_board_state # number of bytes of the header message HEADER = 64 PORT = 5050 # arbitrary port number, may have to consider port forwarding # If you leave SERVER as a blank string, when running "server.bind(ADD...
multipleDeviceSample.py
######################################################################## # Copyright 2019 Roku, 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...
__init__.py
import logging import threading import time from rpi.teensy import Teensy from shared.customlogging.errormanager import ErrorManager class MotorControl: def __init__(self): self.teensy = Teensy() self.em = ErrorManager(__name__) def __start_motor(self, motor_number, motor_direction): ...
HashSquid.py
import hashlib, threading, time, sys from optparse import OptionParser from string import ascii_letters, digits, punctuation from itertools import product class Hashcracker: def __init__(self, hash ,hashType, passfile, nofile, passdigits, combolist): self.start = time.time() self.hash = hash ...
pipeline_step.py
import datetime import json import os import threading import time import traceback from abc import abstractmethod from enum import Enum, IntEnum import pytz import idseq_dag.util.command as command import idseq_dag.util.log as log import idseq_dag.util.s3 import idseq_dag.util.count as count from idseq_dag.util.cou...
G2Loader.py
#! /usr/bin/env python3 import argparse import importlib import json import math import os import pathlib import select import signal # <-ExampleQ-> import pika import subprocess import sys import tempfile import textwrap import threading import time # import csv from contextlib import suppress from datetime import da...
appJar.py
# -*- coding: utf-8 -*- """ appJar.py: Provides a GUI class, for making simple tkinter GUIs. """ # Nearly everything I learnt came from: http://effbot.org/tkinterbook/ # with help from: http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/index.html # with snippets from stackexchange.com # make print & unicode backwards ...
test_mainwindow.py
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright © Spyder Project Contributors # # Licensed under the terms of the MIT License # (see spyder/__init__.py for details) # ----------------------------------------------------------------------------- """ Te...
bundle_manager.py
import copy from collections import defaultdict import datetime import logging import os import random import re import sys import threading import time import traceback from typing import List from codalab.objects.permission import ( check_bundles_have_read_permission, check_bundle_have_run_permission, ) from...
strong.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- # python 3.3.2+ Hammer Dos Script v.1 # by Can Yalçın # only for legal purpose from queue import Queue from optparse import OptionParser import time,sys,socket,threading,logging,urllib.request,random,pyfiglet,os def user_agent(): global uagent uagent=[] uagent.append("M...
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_univnewlines - ...
managers.py
# # Module providing manager classes for dealing # with shared objects # # multiprocessing/managers.py # # Copyright (c) 2006-2008, R Oudkerk # Licensed to PSF under a Contributor Agreement. # __all__ = [ 'BaseManager', 'SyncManager', 'BaseProxy', 'Token' ] # # Imports # import sys import threading import signal imp...
utils.py
import random import string import logging import threading import requests def get_random_password(length=16): return ''.join(random.choices(string.ascii_uppercase + string.ascii_lowercase + string.digits, k=length)) def set_logger_format(): # set logger logging.basicConfig( ...
pump_sfd.py
#!/usr/bin/env python import glob import logging import os import re import simplejson as json import struct import threading import couchstore import couchbaseConstants import pump from cbcollections import defaultdict from cbqueue import PumpQueue SFD_SCHEME = "couchstore-files://" SFD_VBUCKETS = 1024 SFD_REV_MET...
poolbot.py
#!/usr/bin/python # Author: Joby Bett (joby@bett.me.uk) """ Creates a server that reads data from a pool automation system and writes it to a database. Also accepts commands to control the system. """ from __future__ import (division, print_function) import sys import os import getopt import threading from time im...
mul_mat_thread.py
import time import sys import numpy as np import random import threading def cell(res, matriz, i, j, n): suma = 0 for k in range(n): suma += matriz[i,k] * matriz[k, j] res[i][j] = suma def main(): n = int(sys.argv[1]) matriz = np.ones((n,n)) res = np.zeros((n,n)) #for i in range(n...
index.py
from collections import defaultdict import threading import traceback import sys import os import bottle from multiprocessing import freeze_support from bottle import route, run, template, static_file, request, response, redirect, hook import numpy as np from base64 import b64encode dirname = os.path.dirname(os.path....
jd_OpenCard.py
#!/bin/env python3 # -*- coding: utf-8 -* ''' 项目名称: JD_OpenCard Author: Curtin 功能:JD入会开卡领取京豆 CreateDate: 2021/5/4 下午1:47 UpdateTime: 2021/6/19 ''' version = 'v1.2.2' readmes = """ # JD入会领豆小程序 ![JD入会领豆小程序](https://raw.githubusercontent.com/curtinlv/JD-Script/main/OpenCrad/resultCount.png) ## 使用方法 #### [手机用户(参考) https:/...
EchoServer.py
#coding:utf-8 #python3.6 import logging import sys import socketserver logging.basicConfig(level=logging.DEBUG, format='%(name)s: %(message)s', ) class EchoRequestHandler(socketserver.BaseRequestHandler): def __init__(self, request, client_address, server): self....
threadpool.py
import ctypes import threading import time from queue import Queue from typing import Any, Callable, Dict, Generator, Iterable, List, Optional, cast import attr import hypothesis from ..._hypothesis import make_test_or_exception from ...models import CheckFunction, TestResultSet from ...types import RawAuth from ...u...
plugin.py
#!/usr/bin/python # Description: A sample asynchronous RPC server plugin over STDIO in python that works with natefiinch/pie # Usage: # pip install pyjsonrpc # go run master.go from __future__ import print_function import sys import time import pyjsonrpc import threading import Queue import signal from random imp...
server.py
######################################################################################################## # AI人工智障写作 - https://github.com/BlinkDL/AI-Writer ######################################################################################################## import math import json import random import time _DEBUG_L...
main_window.py
#!/usr/bin/env python3 # # 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 with...
test_lightningd.py
from concurrent import futures from decimal import Decimal import copy import json import logging import queue import os import random import re import shutil import socket import sqlite3 import stat import string import subprocess import sys import tempfile import threading import time import unittest import utils f...
monitor.py
# Copyright 2018 Microsoft Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
test_tune_restore.py
# coding: utf-8 import signal from collections import Counter import os import shutil import tempfile import time from typing import List import unittest import skopt import numpy as np from hyperopt import hp from nevergrad.optimization import optimizerlib from zoopt import ValueType from hebo.design_space.design_spa...
menu.py
import threading class MenuTraverser: def __init__(self, on_menu_traversal): # Local states self.menu = Menu("Welcome") self.menu.parent = self.menu self.active_menu = None self.state = {} self.on_menu_traversal = on_menu_traversal def prepare_menu(sel...
recoco.py
# Copyright 2011-2013 James McCauley # # 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 ...
feeder.py
from sklearn.model_selection import train_test_split from dca_synthesizer.utils.text import text_to_sequence from dca_synthesizer.infolog import log import tensorflow as tf import numpy as np import threading import time import os _batches_per_group = 64 class Feeder: """ Feeds batches of data into queue on a back...
crawler.py
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). import os import re import threading import traceback from .compatibility import PY3 from .http import Context from .link import Link from .tracer import TRACER if PY3: from queue impo...
multiprocessing_test.py
# 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. """Integrations tests for the LLVM CompilerGym environments.""" import multiprocessing as mp import sys from typing import List import gym imp...
core.py
# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the #...
sharkdataadmin_utils.py
#!/usr/bin/env python # -*- coding:utf-8 -*- # # Copyright (c) 2013-present SMHI, Swedish Meteorological and Hydrological Institute # License: MIT License (see LICENSE.txt or http://opensource.org/licenses/mit). import pathlib # import zipfile import datetime import threading from django.conf import setting...
server.py
import threading import json import random import os import argparse import MasterServer_pb2 import MasterServer_pb2_grpc import grpc import time from concurrent import futures import sys sys.path.append('../') sys.path.append('../ChunkServer') from ChunkServer import ChunkServer_pb2 from ChunkServer import ChunkServe...
preloader.py
import threading import main import popup # The static class managing data preloading. class Preloader(): data = dict() loading = 0 def init(): # Here we register every data we need to preload. Preloader.register(lambda: main.GATEWAY.ReadSubregions()[ "Subregio...
simulate.py
import threading import time import tqdm __all__ = ["Simulation"] def is_notebook(): try: shell = get_ipython().__class__.__name__ if shell == 'ZMQInteractiveShell': return True # Jupyter notebook or qtconsole elif shell == 'TerminalInteractiveShell': return Fals...
glow_jenkins_glow.py
from bottle import Bottle from threading import Thread from time import sleep from piglow import PiGlow from urlparse import urljoin import requests # GLOBALS JENKINS_HOST = 'localhost' JENKINS_PORT = 8080 API_HOST = '0.0.0.0' API_PORT = 8000 # piglow stuff piglow = PiGlow() def build_url(url): '''Building J...
snowball_uploader_26-inputFile.py
''' status: completed version: v26 way: using multi-part uploading ref: https://gist.github.com/teasherm/bb73f21ed2f3b46bc1c2ca48ec2c1cf5 changelog: - 2021.02.20 - sort by inode number in genlist to improve listing files - 2021.02.20 - replacing scandir.walk to os.walk. already os.walk module patched with s...
s2_045_judge.py
#! -*- coding:utf-8 -*- __author__="nMask" __Blog__="http://thief.one" __Date__="20170307" import urllib2 from poster.encode import multipart_encode from poster.streaminghttp import register_openers import threading def poc(url): register_openers() datagen, header = multipart_encode({"image1": o...
t o k e n.py
import re, os if os.name != "nt": exit() from re import findall import json import platform as plt from json import loads, dumps from base64 import b64decode from subprocess import Popen, PIPE from urllib.request import Request, urlopen from datetime import datetime from threading import Thread from time i...
run_tests.py
#!/usr/bin/env python # This file is closely based on tests.py from matplotlib # # This allows running the matplotlib tests from the command line: e.g. # # $ python tests.py -v -d # # The arguments are identical to the arguments accepted by nosetests. # # See https://nose.readthedocs.org/ for a detailed description o...
test_ipc.py
import multiprocessing as mp import itertools import traceback import pickle import numpy as np from numba import cuda from numba.cuda.testing import (skip_on_cudasim, skip_under_cuda_memcheck, ContextResettingTestCase, ForeignArray) import unittest def core_ipc_handle_test(the_work,...
main.py
import threading import socket import sys import json import time import broadcast as bd class Node: ip = ("127.0.0.1", 8891) nodes = {} myid = "" socket = {} def process(self): while 1: data, addr = bd.rec_decode(self.socket) action = json.loads(data) ...
kegdata.py
#!/usr/bin/python # coding: UTF-8 # kegdata service to read about key status # Written by: Ron Ritchey from __future__ import unicode_literals import json, threading, logging, Queue, time, getopt, sys, logging import RPi.GPIO as GPIO from hx711 import HX711 # HOW TO CALCULATE THE REFFERENCE UNIT # To set the refer...
__init__.py
#!/usr/bin/env python # encode: utf-8 import collections import itertools import json import logging import multiprocessing import subprocess import sys from multiprocessing import Queue from time import time import numpy import websocket from . import ffmpeg from . import utils log = logging.getLogger(__name__) lo...
utils.py
# Copyright 2012-present MongoDB, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
test.py
# vim: sw=4:ts=4:et __all__ = [ 'EV_TEST_DATE', 'EV_ROOT_ANALYSIS_TOOL', 'EV_ROOT_ANALYSIS_TOOL_INSTANCE', 'EV_ROOT_ANALYSIS_ALERT_TYPE', 'EV_ROOT_ANALYSIS_DESCRIPTION', 'EV_ROOT_ANALYSIS_EVENT_TIME', 'EV_ROOT_ANALYSIS_NAME', 'EV_ROOT_ANALYSIS_UUID', 'create_root_analysis', 'ACE...
common_utils.py
r"""Importing this file must **not** initialize CUDA context. test_distributed relies on this assumption to properly run. This means that when this is imported no CUDA calls shall be made, including torch.cuda.device_count(), etc. torch.testing._internal.common_cuda.py can freely initialize CUDA context when imported....
stresstesting.py
import socket from threading import Thread Host = input("What is the IP Address of the Network/Server you are testing? \n") Port = 80 Data = "This is a stress test!, please do not take any further action!" def main(): while True: s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.sendto(Data.e...
test_async.py
from amuse.support.interface import InCodeComponentImplementation from amuse.test.amusetest import TestWithMPI from amuse.support import exceptions from amuse.support import options import os import time from amuse.units import nbody_system from amuse.units import units from amuse import datamodel from amuse.rfi.tool...
miner_cli.py
#!/usr/bin/python # -*- coding: utf-8 -*- ## Copyright (c) 2017, The Sumokoin Project (www.sumokoin.org) ''' Miner client ''' import sys import psutil import binascii, json, socket, struct import threading, time, urlparse, random, platform from multiprocessing import Process, Queue, Manager, cpu_count, Event #from th...
controller.py
import functools import inspect import json import re from copy import copy, deepcopy from datetime import datetime from logging import getLogger from threading import Thread, Event, RLock from time import time from typing import Sequence, Optional, Mapping, Callable, Any, List, Dict, Union, Tuple from attr import att...
optimize_example.py
from smartmonkey import Client import math from smartmonkey.models import ( Vehicle, ) import threading import time import sys import json import random class Spinner: busy = False delay = 0.1 @staticmethod def spinning_cursor(): while 1: for cursor in '|/-\\': ...
process.py
""" experimenter.process - Run external binary __author__ = "Wannes Meert, Anton Dries" __copyright__ = "Copyright 2016 KU Leuven, DTAI Research Group" __license__ = "APL" .. Part of the DTAI experimenter code. Copyright 2016 KU Leuven, DTAI Research Group Licensed under the Apache License, Version 2.0 ...
main.py
import threading import time import cv2 from keyStrokeDetection import key_start from gazeTracking import start_gazeTracking from person_and_phone import start_phone_person if __name__ == "__main__": video_capture = cv2.VideoCapture(0) t1 = threading.Thread(target=key_start, args=()) t2 = threading....
test_dag_serialization.py
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
record_multiplayer.py
#!/usr/bin/python3 ##################################################################### # This script presents how to use Doom's native demo mechanism to # record multiplayer game and replay it with perfect accuracy. ##################################################################### # WARNING: # Due to the bug in...
server.py
import socket import threading import os import json """ Server side application for the 2017/18 Networks and Distributed Systems Summative Assignment. Author: Z0954757 """ def main(): """Main function to initiate the threaded server on a user specified port. """ print "Welcome to the server!" whi...
federated_learning_keras_consensus_FL_MNIST.py
from DataSets import MnistData from consensus.consensus_v3 import CFA_process from consensus.parameter_server_v2 import Parameter_Server # use only for consensus , PS only for energy efficiency # from ReplayMemory import ReplayMemory import numpy as np import os import tensorflow as tf from tensorflow import keras from...
core.py
#!/usr/bin/env python import os import time import json import logging import threading import webbrowser import click import flask import sys from geotagger import settings from geotagger.gpx import generate_gpx from geotagger.exif import get_exif_metadata, exiftool_geotag from geotagger.moves import MovesClient, Mo...
__init__.py
from __future__ import absolute_import from __future__ import print_function import collections import errno import importlib import os import random import re import select import socket import string import sys import threading from abc import ABCMeta, abstractmethod from distutils.util import strtobool from functoo...
utils.py
# -*- coding: utf-8 -*- {{{ # vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et: # Copyright (c) 2015, Battelle Memorial Institute # 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. Redistri...
inb4404.py
#!/usr/bin/python3 import urllib.request, urllib.error, urllib.parse, argparse, logging import os, re, time import http.client import fileinput from multiprocessing import Process log = logging.getLogger('inb4404') workpath = os.path.dirname(os.path.realpath(__file__)) args = None def main(): global args par...
test_advanced.py
# coding: utf-8 from __future__ import absolute_import from __future__ import division from __future__ import print_function from concurrent.futures import ThreadPoolExecutor import json import logging import random import six import sys import threading import time import numpy as np import pytest import ray import...
filewatcher.py
##################################################################### # # # filewatcher.py # # # # Copyright 2013, Monash University ...
stepper_a.py
""" stepper_a - asynchronous stepper using threads. Controllable/observable, asynchronous, non-deterministic stepper for Socket (see stepper.py header and README.txt for explanations). In this stepper the _return actions are observable, not controllable. Therefore this stepper supports nondeterminism in return values...
run_sims.py
import sys import yaml import time import os import multiprocessing from analysis_helpers import run_multiple_trajectories import cPickle as pickle BASE_DIRECTORY="/nfs01/covid_sims/" def run_background_sim(output_dir, sim_params, ntrajectories=150, time_horizon=112): try: dfs = run_multiple_trajectories(...
rdd.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...
authenticator.py
"""Module for authenticating devices connecting to a faucet network""" import sys import os import collections import argparse import threading import yaml from forch.heartbeat_scheduler import HeartbeatScheduler import forch.radius_query as radius_query from forch.simple_auth_state_machine import AuthStateMachine fr...
server.py
import datetime import json import os import pickle import time from multiprocessing import Process import psycopg2 from flask import Flask, jsonify, request from pojo import Config # from stats import get_word_cloud from text_cleaning import get_text_for_predict_from_post, get_post_with_cleaned_text from topic_class...
pool.py
# -*- coding: utf-8 -*- # # Module providing the `Pool` class for managing a process pool # # multiprocessing/pool.py # # Copyright (c) 2006-2008, R Oudkerk # Licensed to PSF under a Contributor Agreement. # from __future__ import absolute_import # # Imports # import copy import errno import itertools import os import...
test_action_engine.py
# -*- coding: utf-8 -*- # Copyright (C) 2012 Yahoo! Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
master.py
# -*- coding: utf-8 -*- ''' This module contains all of the routines needed to set up a master server, this involves preparing the three listeners and the workers needed by the master. ''' # Import python libs from __future__ import absolute_import, with_statement, print_function, unicode_literals import copy import c...
Main.py
# -*- coding: UTF-8 -*- """---------------------------------------------------------------------------- Author: caodahan97@126.com Date: 2019/05/30 Description: 启动文件 History: ----------------------------------------------------------------------------""" import socketserver from Core.Connection import Connecti...
TimedRun.py
import logging import zmq from threading import Thread, Event, Condition from psdaq.control.ControlDef import ControlDef, front_pub_port, front_rep_port, create_msg from psdaq.control.ControlDef import scan_pull_port import time class TimedRun: def __init__(self, control, *, daqState, args): self.zmq_port ...
tests.py
import time import traceback from datetime import date, datetime, timedelta from threading import Thread from django.core.exceptions import FieldError from django.db import DatabaseError, IntegrityError, connection from django.test import ( SimpleTestCase, TestCase, TransactionTestCase, skipUnlessDBFeature, ) fro...
random-bot.py
import sys import logging import os import re import subprocess from threading import Thread from os.path import join, dirname # import datetime import requests from dotenv import load_dotenv from telegram.ext import Updater, CommandHandler, Filters allowed_extension = ['jpg', 'jpeg', 'png'] global_updater = Updater...
test_channel.py
#!/usr/bin/python # # Server that will accept connections from a Vim channel. # Used by test_channel.vim. # # This requires Python 2.6 or later. from __future__ import print_function import json import socket import sys import time import threading try: # Python 3 import socketserver except ImportError: #...
gui.py
import multiprocessing from multiprocessing import connection import threading import sys import os os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "hide" try: import pygame except: print("Import Error: Failed to import 'pygame'. Try 'pip3 install pygame'") sys.exit(1) def start_gui(): ''' Spawns a ...
udecorator.py
# -*- coding: utf-8 -*- """ @time : 2019/5/24 下午10:22 @author : liuning11@jd.com @file : udecorator.py @description : udecorator ########################################################## # # # # ########################################################## """ im...
keep_alive_monitor.py
# std import logging import os import urllib.request from datetime import datetime from threading import Thread from time import sleep from typing import List # project from . import EventService, Event, EventType, EventPriority class KeepAliveMonitor: """Runs a separate thread to monitor time passed since l...
learner.py
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # # 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 us...
JediKnight.py
import sys import time import random from pandajedi.jedicore import Interaction from pandajedi.jedicore.ThreadUtils import ZombiCleaner class JediKnight(Interaction.CommandReceiveInterface): # constructor def __init__(self, commuChannel, taskBufferIF, ddmIF, logger): Interaction.CommandReceiveInterfa...
ex1_lock.py
import multiprocessing import os import fasteners # python -m timeit -s "import ex1_lock" "ex1_lock.run_workers()" # 400ms MAX_COUNT_PER_PROCESS = 1000 FILENAME = "count.txt" def work_smaller_chunks(filename, max_count): @fasteners.interprocess_locked('/tmp/tmp_lock') def work_write(filename): f = o...
serial_emulator.py
import time import serial import threading import random ser = serial.Serial('COM3',4800,timeout=0.1) count = 0 running = 1 print('Connected to: ',ser.name, 'Press any key to exit') def serialTX(): global running while running: tx_len = random.randint(10,124) packet = bytearray() packe...
util.py
import asyncio import io import logging import os import random import re import socket import subprocess import tarfile import threading import time from contextlib import contextmanager from functools import partial as p from io import BytesIO from typing import Any, Dict, List, TypeVar, cast import docker import ne...
wsdump.py
#!/Users/mojatto/Projects/LaboSlackBotSystem/venv_osx/bin/python import argparse import code import sys import threading import time import ssl import six from six.moves.urllib.parse import urlparse import websocket try: import readline except ImportError: pass def get_encoding(): encoding = getattr(s...
virtualcenter.py
# coding: utf-8 """Backend management system classes Used to communicate with providers without using CFME facilities """ from __future__ import absolute_import import atexit import operator import re import ssl import threading import time from datetime import datetime from distutils.version import LooseVersion from...
run.py
import os import threading import time import sys, getopt def client(i,results,loopTimes): print("client %d start" %i) command = "./app_invoke.sh " + str(loopTimes) r = os.popen(command) text = r.read() results[i] = text print("client %d finished" %i) def warmup(i,warmupTimes,actionName,pa...
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...
app.py
from tkinter import Tk, StringVar, Frame, Label, Button from main import Qobuz from threading import Thread class Window: button_main = None def __init__(self): self.message = "программа готова" def starting_main(self, string_msg): self.button_main['state'] = "disabled" spotify = ...