source
stringlengths
3
86
python
stringlengths
75
1.04M
bme680.py
#! /usr/bin/env python3 import subprocess import threading import re import os import time BME_PATH = os.path.dirname(__file__)+'/../../bme680/bsec_bme680_linux/bsec_bme680' class Bme680 (object): def __init__(self): self._data_lock = threading.Lock() self._ready = False self._iaq = 0 ...
test_subprocess.py
import unittest from test import script_helper from test import support import subprocess import sys import signal import io import locale import os import errno import tempfile import time import re import selectors import sysconfig import warnings import select import shutil import gc import textwrap try: import...
example_test.py
import http.server import os import random import re import socket import ssl import struct import subprocess from threading import Thread import ttfw_idf from tiny_test_fw import DUT server_cert = '-----BEGIN CERTIFICATE-----\n' \ 'MIIDXTCCAkWgAwIBAgIJAP4LF7E72HakMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\n'\ ...
simulator.py
# SIM-CITY webservice # # Copyright 2015 Joris Borgdorff <j.borgdorff@esciencecenter.nl> # # 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 # #...
subproc_vec_env.py
import numpy as np from multiprocessing import Process, Pipe from . import VecEnv, CloudpickleWrapper from baselines.common.tile_images import tile_images import time import sys sys.path.append("/home/jupyter/Notebooks/Chang/HardRLWithYoutube") USE_IMMITATION_ENV = True if USE_IMMITATION_ENV: print(sys.path) f...
server.py
# Date: 09/28/2017 # Author: Ethical-H4CK3R # Description: CnC Server import time import socket import threading class Server(object): ''' Command & Control ''' def __init__(self): self.server = None self.server_status = False def kill(self, session): try: session.shutdown(socket.SHUT_RDWR) sessi...
loop.py
import sys import time import json import threading import traceback import collections try: import Queue as queue except ImportError: import queue from . import exception from . import _find_first_key, flavor_router class RunForeverAsThread(object): def run_as_thread(self, *args, **kwargs): t =...
condition_objects_03.py
import threading from random import randint from time import sleep from queue import Queue queue_resource = Queue() condition = threading.Condition(lock=threading.Lock()) def producer() -> None: for i in range(2): sleep(3) condition.acquire() resource: str = f'resource_{randint(0, 10)}' queue_resour...
test_ccallback.py
from numpy.testing import assert_equal, assert_ from pytest import raises as assert_raises import time import pytest import ctypes import threading from scipy._lib import _ccallback_c as _test_ccallback_cython from scipy._lib import _test_ccallback from scipy._lib._ccallback import LowLevelCallable try: import cf...
test_sink_integration.py
import threading from typing import Callable, Dict, List, Tuple from unittest import mock import pytest from pyconnect.config import SinkConfig from pyconnect.core import Status from .utils import PyConnectTestSink, TestException, compare_lists_unordered ConnectSinkFactory = Callable[..., PyConnectTestSink] @pyte...
hot.py
import json import time from . import api from flask import jsonify from threading import Thread def cache_hot(api, spider_fuc, key): """ 缓存热榜信息 :param api: :return: """ try: result = spider_fuc() output = { 'code': 0, 'msg': '成功', 'data': re...
pricewars_merchant.py
from abc import ABCMeta, abstractmethod import time import threading import hashlib import base64 from typing import Optional, List from api import Marketplace, Producer from server import MerchantServer from models import SoldOffer, Offer class PricewarsMerchant(metaclass=ABCMeta): def __init__(self, port: int...
multiprocess_iterator.py
from __future__ import division import datetime import multiprocessing from multiprocessing import sharedctypes # type: ignore import signal import sys import threading import warnings import numpy import six from pytorch_trainer.dataset import iterator from pytorch_trainer.iterators import _statemachine from pytorc...
p2p.py
#Code definitely doesn't work. Will deliver free Canes on Monday for extra credit try: raw_input except NameError: raw_input = input import argparse import os from threading import Thread # dependency, not in stdlib from netifaces import interfaces, ifaddresses, AF_INET import zmq def liste...
photobooth.py
import cv2 import cv import numpy as np import serial #cargamos la libreria serial import threading import time #Iniciamos la camara captura=cv2.VideoCapture(0) #Iniciamos la comunicacion serial #ser = serial.Serial('/dev/ttyACM0', 9600) def showVideo(cap): key=0 print "hola" while(key!=27): print "hol...
client.py
#------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. #-------------------------------------------------------------------------- # pylint: d...
concurrency_tests.py
import engine.db_structure as db_py import threading import os filename = "concurrency.vdb" if os.path.isfile(filename): os.remove(filename) db = db_py.Database(False, filename) db.create_table("vadik_table", {"zhenya1": "int", "zhenya2": "str"}) def test_multithreading_insert(): def insert_func(): f...
bag.py
# Software License Agreement (BSD License) # # Copyright (c) 2012, 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 code must retain the above...
kafka_consumer.py
""" Copyright 2020 Expedia, 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 https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
test_sys.py
# -*- coding: iso-8859-1 -*- import unittest, test.test_support from test.script_helper import assert_python_ok, assert_python_failure import cStringIO import gc import operator import os import struct import sys class SysModuleTest(unittest.TestCase): def tearDown(self): test.test_support.reap_children()...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
serverTest.py
''' Created on Jul 25, 2014 @author: gigemjt ''' import unittest import BaseHTTPServer import time import threading import urllib2 from src.connection.server import RequestHandler from src.projectManagment import ProjectManagment from src.projectManagment import Project HOST_NAME = 'localhost' # !!!REMEMBER TO CHANGE...
manager.py
#!/usr/bin/env python3 import os import time import sys import fcntl import errno import signal import shutil import subprocess import datetime import textwrap from typing import Dict, List from selfdrive.swaglog import cloudlog, add_logentries_handler from common.basedir import BASEDIR from common.hardware import HA...
app.py
# -*- coding: utf-8 -*- """ :author: Grey Li (李辉) :url: http://greyli.com :copyright: © 2018 Grey Li :license: MIT, see LICENSE for more details. """ import os from threading import Thread from settings import config import sendgrid from sendgrid.helpers.mail import Email as SGEmail, Content, Mail as S...
agent.py
# Copyright 2017 MDSLAB - University of Messina # 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 # # U...
test_cp.py
# -*- coding: utf-8 -*- # Copyright 2013 Google 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.0 # # Unless require...
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...
robot_host.py
#!/usr/bin/python3 import math import rospy import rostopic import rosnode import copy import threading from geometry_msgs.msg import PoseStamped from nics_robot_host.srv import * from rospy.core import rospyinfo class RobotHost(object): def __init__(self, args, env): # get agent number from env se...
test_exchange.py
import unittest from multiprocessing import Process import requests import json import time from ..exchange import Exchange from ..config import DefaultConfig from ..auth import Auth from ..error import TimeoutError,ResponseError from grabbag.list import first_not_none from grabbag.dict import merge TEST_METHODS = ...
timeToSaturation.py
from simulationClasses import DCChargingStations, Taxi, Bus, BatterySwappingStation import numpy as np import pandas as pd from scipy import stats, integrate import matplotlib.pyplot as plt from matplotlib.ticker import FuncFormatter from matplotlib.dates import DateFormatter, HourLocator, MinuteLocator, AutoDateLocato...
testLocal.py
# -*- coding:utf-8 -*- import unittest import time from threading import Thread from tindo import Local class TestLocal(unittest.TestCase): def testSingle(self): local = Local() local.name = 'gaofeng' local.age = 12 self.assertEqual(local.name, 'gaofeng') self.assertEqual(l...
test-ble-adapter.py
# !usr/bin/python # coding:utf-8 # Need pygatt tool for BLE communication: # https://github.com/peplin/pygatt import time import pygatt import threading from pygatt import BLEDevice class BLEAdapter: def __init__(self): self.remote_devices_type = pygatt.BLEAddressType.random self.adapter = p...
5.thread_with_logger.py
import logging import threading import time logging.basicConfig(level=logging.DEBUG, format='[%(levelname)s] (%(threadName)-10s) %(message)s', ) def worker(): logging.debug('Starting') time.sleep(2) logging.debug('Exiting') def my_service(): logging.debug('St...
test_connection_pool.py
from concurrent.futures import ThreadPoolExecutor, TimeoutError from itertools import count from threading import Event, Lock, Thread from time import sleep, time from typing import Any, List, Optional, Union from unittest import TestCase from eventsourcing.persistence import ( Connection, ConnectionNotFromPoo...
io.py
# Copyright (c) 2018 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...
crypto_counter.py
import argparse import logging import sys import threading import time from datetime import datetime, timedelta from enum import Enum from functools import wraps from queue import Queue from typing import Callable, List, Literal, TypeVar, Union, cast, overload import praw from lib import * from lib import analyze_comm...
fake_server.py
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright (c) 2016, Anaconda, Inc. All rights reserved. # # Licensed under the terms of the BSD 3-Clause License. # The full license is in the file LICENSE.txt, distributed with this software. # -------------------...
startTask.py
# -*- coding=utf-8 -*- import datetime, time, random, threading import config from main.loadDriver import auto_activity # 上班时间 START_TIME = config.START_CLOCK_TIME - random.randint(1, config.FL_CLOCK_TIME) # 下班时间 OUT_TIME = config.OUT_CLOCK_TIME + random.randint(1, config.FL_CLOCK_TIME) def count_time(): now = d...
test_fft.py
import functools import unittest import pytest import numpy as np import cupy from cupy import testing from cupy.fft import config from cupy.fft.fft import _default_fft_func, _fft, _fftn def nd_planning_states(states=[True, False], name='enable_nd'): """Decorator for parameterized tests with and wihout nd plann...
tests.py
# Copyright 2021 Google LLC # # 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, ...
WinCoreManagement.py
import sys, os, time import socket, struct, json import win32clipboard # 剪贴板操作,需要安装pywin32才可以 import win32con import win32api import cv2 from ctypes import windll from ctypes import CFUNCTYPE from ctypes import POINTER from ctypes import c_int, c_void_p from ctypes import byref from ctypes.wintypes import MSG from t...
bettermap.py
#!/usr/bin/python3 import io import sys from concurrent.futures import ThreadPoolExecutor import collections import itertools import multiprocessing as mp import multiprocessing.connection from multiprocessing.context import ForkProcess from typing import Iterable, List, Optional, Any, Dict import dill from queue im...
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'...
nanny.py
from __future__ import print_function, division, absolute_import from datetime import timedelta import logging from multiprocessing.queues import Empty import os import psutil import shutil import threading import uuid import dask from tornado import gen from tornado.ioloop import IOLoop, TimeoutError from tornado.lo...
videocaptureasync.py
import threading import cv2 from time import sleep import copy class VideoCaptureAsync: def __init__(self, width=2688, height=1520, thermal=True): self.src = 0 self.cap = cv2.VideoCapture(self.src) self.cap.set(cv2.CAP_PROP_FRAME_WIDTH, width) self.cap.set(cv2.CAP_PROP_FRAME_HEIGHT,...
example_test.py
import re import os import socket import BaseHTTPServer import SimpleHTTPServer from threading import Thread import ssl from tiny_test_fw import DUT import ttfw_idf server_cert = "-----BEGIN CERTIFICATE-----\n" \ "MIIDXTCCAkWgAwIBAgIJAP4LF7E72HakMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\n"\ "BAYTAk...
player.py
""" The MIT License (MIT) Copyright (c) 2015-present Rapptz 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, merg...
fluffchat-client.py
import socket #lets me use TCP sockets in import tkinter #handles GUI import base64 import blowfish #handles encryption from threading import Thread # allows multi threading from datetime import datetime # lets me get current time cipher = blowfish.Cipher(b"thisIsATest") # server's IP address print("some...
NmakeSubdirs.py
# @file NmakeSubdirs.py # This script support parallel build for nmake in windows environment. # It supports Python2.x and Python3.x both. # # Copyright (c) 2018, Intel Corporation. All rights reserved.<BR> # # SPDX-License-Identifier: BSD-2-Clause-Patent # # # Import Modules # from __future__ import p...
pinging.py
import threading import subprocess def get_ping(host): return subprocess.Popen(["ping", "-c", "1", "-n", host]).communicate() if __name__ == "__main__": hosts = [ "google.com", "yandex.ru", "vk.com", "habr.com", "python.org", "mipt.ru", ] threads = [t...
app.py
# encoding: utf-8 ''' A REST API for Salt =================== .. versionadded:: 2014.7.0 .. py:currentmodule:: salt.netapi.rest_cherrypy.app :depends: - CherryPy Python module. Version 3.2.3 is currently recommended when SSL is enabled, since this version worked the best with SSL in internal testing....
icmp_active_shell.py
''' Sniffs packages ICMP ECHO REQUEST to activate shell on server. OS: Linux Tiago Martins (tiago.tsmweb@gmail.com) ''' import socket import sys import os import pty import threading from struct import * PORT = 42444 ICMP_ECHO_REQUEST = 8 def open_shell(): try: # Create socket sock ...
server.py
import socket import sys import os, stat import threading import time import json from Queue import * import time directory = "Upload" cookie_key = "id" banned_ips = set() cookie_count = 0 client_ip_addr_map = {} cookie_last_number_visit_map = {} lock = threading.Lock() def get_file_type(file_name): if file_nam...
util.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 "L...
test_application.py
# # This file is part of Python-REST. Python-REST is free software that is # made available under the MIT license. Consult the file "LICENSE" that is # distributed together with this file for the exact licensing terms. # # Python-REST is copyright (c) 2010 by the Python-REST authors. See the file # "AUTHORS" for a comp...
spacemouse.py
"""Driver class for SpaceMouse controller. This class provides a driver support to SpaceMouse on Mac OS X. In particular, we assume you are using a SpaceMouse Wireless by default. To set up a new SpaceMouse controller: 1. Download and install driver from https://www.3dconnexion.com/service/drivers.html 2. Ins...
client.py
"""This module implements the SlowLoris client.""" import threading import time from .connection import LorisConnection from .user_agent import get_random_user_agent class LorisClient: """SlowLoris attack client.""" def __init__(self,client_ips=[]): self.targets = [] self.client_ips = [] ...
detect_drowsiness.py
import cv2 import numpy as np from keras.models import load_model from keras.preprocessing.image import img_to_array from playsound import playsound from threading import Thread def start_alarm(sound): """Play the alarm sound""" playsound('data/alarm.mp3') classes = ['Closed', 'Open'] face_c...
CorrelationNetworkServer.py
import os, random, binascii, json, subprocess, configparser import datetime as dt from queue import Queue import threading from threading import Thread import pony.orm as pny import rpyc from rpyc.utils.server import ThreadedServer import Datasets # Parse config config = configparser.ConfigParser() #config.read('....
__init__.py
#!/usr/bin/python3 # @todo logging # @todo extra options for url like , verify=False etc. # @todo enable https://urllib3.readthedocs.io/en/latest/user-guide.html#ssl as option? # @todo option for interval day/6 hour/etc # @todo on change detected, config for calling some API # @todo fetch title into json # https://di...
index.py
import time from ui.main_ui import Ui_MainWindow import sys from PyQt5.QtWidgets import QApplication, QMainWindow, QHeaderView, QTableWidgetItem, QWidget from core.moviedl import moviedl from PyQt5.QtCore import QObject, pyqtSignal from threading import Thread from ui.about import Ui_Dialog # 修改ui文件后重新复发布py文件 : pyuic...
testZEO.py
############################################################################## # # Copyright (c) 2001, 2002 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # TH...
test_fusion.py
import mock import numpy import six import threading import unittest import cupy from cupy import testing def fusion_default_array_equal(): def deco(func): def wrapper(self_x, name, xp, **dtypes): @cupy.fuse() def f(*args): return getattr(xp, name)(*args) ...
computersinger.py
''' Function: 让电脑主板上的蜂鸣器哼歌 Author: Car 微信公众号: Car的皮皮 ''' import os import sys import time import threading from PyQt5.QtGui import * from PyQt5.QtCore import * from PyQt5.QtWidgets import * '''让电脑主板上的蜂鸣器哼歌''' class ComputerSinger(QWidget): tool_name = '让电脑主板上的蜂鸣器哼歌' def __init__(self, parent=No...
main.py
from tkinter import Tk,Button,Label,Frame,filedialog,ttk,DoubleVar,PhotoImage,RIGHT,LEFT from keyboard import on_release,wait from pygame import mixer from threading import Thread mixer.init() tune = mixer.Sound("sound1.mp3") vol = 1.0 w = Tk() w.title("Mechvibe v-1.1.2") track = 0 vibe_vol_value = DoubleV...
automator.py
#!/usr/bin/python # # automator.py # Licence : https://github.com/wolfviking0/webcl-translator/blob/master/LICENSE # # Created by Anthony Liot. # Copyright (c) 2013 Anthony Liot. All rights reserved. # import commands import subprocess import os import sys import multiprocessing import time from optparse import Op...
taskqueue_stub.py
#!/usr/bin/env python # # Copyright 2007 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 o...
queue_0408.py
# -*- coding: utf-8 -*- # @version : Python3.6 # @Time : 2017/4/8 16:55 # @Author : Jianyang-Hu # @contact : jianyang1993@163.com # @File : queue_0408.py # @Software: PyCharm """ queue 队列: 适用于多线程编程的先进先出数据结构,可以用来安全的传递多线程信息。 queue 方法: 先进先出 q = Queue.Queue(maxsize) 后进先出 a = Queue.LifoQueue(maxs...
OverlayCamera.py
import time import threading try: from greenlet import getcurrent as get_ident except ImportError: try: from thread import get_ident except ImportError: from _thread import get_ident import cv2 import textwrap from .settings import STREAM_URL from .settings import TEXT_DATA_REFRES...
database_throughput_test.py
#!/usr/bin/env python3 # Coyright 2017-2019 Nativepython 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 req...
SHM.py
# -*- coding: utf-8 -*- """ Created on Mon Mar 15 09:38:01 2021 @author: zjl-seu """ import cv2 import time import numpy as np import tkinter as tk from VRmodel import VR from threading import Thread from PIL import Image, ImageTk from tkinter import scrolledtext from PIL import Image, ImageDraw, ImageFo...
YouTube Downloader.py
import os import requests import tkinter as tk from tkinter import * import threading from pytube import YouTube import pyperclip as pc import validators as vd from PIL import ImageTk, Image from io import BytesIO root = tk.Tk() root.title("Youtube Video Downloader") img = ImageTk.PhotoImage(Image.open("Assets...
pubsub2bq.py
#!/usr/bin/env python import argparse import json from datetime import datetime import threading, queue import os def pubsub2bq( project_id, subscription_id, dataset_id, table_id, timeout=None ): """Receives messages from a pull subscription with flow control.""" # [START pubsub_subscriber_flow_settings] ...
powp2pcoin_three.py
""" POW Syndacoin Usage: pow_syndacoin.py.py serve pow_syndacoin.py.py ping [--node <node>] pow_syndacoin.py.py tx <from> <to> <amount> [--node <node>] pow_syndacoin.py.py balance <name> [--node <node>] Options: -h --help Show this screen. --node=<node> Hostname of node [default: node0] """ import ...
build_knn_map_index.py
# Copyright (c) 2022, 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...
gamepad_reader.py
from absl import app from absl import flags from inputs import get_gamepad import threading import time FLAGS = flags.FLAGS MAX_ABS_RX = 32768 MAX_ABS_RY = 32768 def _interpolate(raw_reading, max_raw_reading, new_scale): return raw_reading / max_raw_reading * new_scale class Gamepad: """Interface for reading c...
test_poplib.py
"""Test script for poplib module.""" # Modified by Giampaolo Rodola' to give poplib.POP3 and poplib.POP3_SSL # a real test suite import poplib import asyncore import asynchat import socket import os import time import errno from unittest import TestCase from test import support as test_support threading = test_suppo...
test_XpathBrowser.py
# -*- coding: utf-8 -*- ''' xpathwebdriver Copyright (c) 2015 Juju. Inc Code Licensed under MIT License. See LICENSE file. ''' import unittest import threading from contextlib import contextmanager import bottle from selenium.webdriver.remote.webdriver import WebDriver from xpathwebdriver.browser import Browser from...
agent.py
import threading import settings as s from collections import namedtuple, deque from api.actions import Actions from analytics_frame import Analytics from api.agent_analytics_frame import AgentAnalyticsFrameAPI import random import math import copy from sklearn.preprocessing import MinMaxScaler import numpy as np imp...
sdk_worker.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...
server.py
''' A HTTP server that is packaged using class(the same as "static_web_server.py") This http server can retrieve html file in the './static' and run & print the result of xx.py in the './wsgipython' 1. create a socket 2. bind & reuse addr 3. listen 4. while True: 4.1 accept 4.2 n...
simple_queue.py
from lithops.multiprocessing import Process, SimpleQueue, Queue def f(q): q.put([42, None, 'hello World']) if __name__ == '__main__': q = SimpleQueue() # q = Queue() p = Process(target=f, args=(q,)) p.start() print(q.get()) # prints "[42, None, 'hello']" p.join()
signals.py
from django.dispatch import receiver from django.db.models.signals import post_save from django.contrib.auth import get_user_model from sw.models import Message from sw.task import send_verification_email from threading import Thread User = get_user_model() @receiver(post_save, sender=Message, dispatch_uid='send_mail_...
xla_client_test.py
# Lint as: python3 # Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
GUI.py
""" This is module is a GUI created for the Liber module included in this package. It is intended to be used with the Liber module only. Copyright (C) Ryan Drew 2015 This module is free software and can be distributed, used and modified under the restrictions of the MIT license, which should be included in this packa...
test.py
# Copyright 2013 dotCloud 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 w...
repliers.py
import zmq from .sockets import ServerConnection from .constants import * import threading def replier(address,callback,message_type): """ Creates a replier binding to the given address send replies. The callback is invoked for every request received. Args: - address: the address to bi...
microphone.py
import signal from binascii import hexlify, unhexlify from os import close, path, remove, rename, stat from struct import pack from sys import exit from tempfile import mkstemp from threading import Thread from time import sleep import serial from pitop.common.logger import PTLogger from pitop.pulse import configurat...
test_waffle.py
import logging import random import threading import unittest from django.contrib.auth import get_user_model from django.conf import settings from django.contrib.auth.models import AnonymousUser, Group from django.db import connection, transaction from django.test import RequestFactory, TransactionTestCase from djang...
stress_test.py
from multiprocessing import Process, active_children, Pipe import os import signal import sys import time import psutil DEFAULT_TIME = 60 TOTAL_CPU = psutil.cpu_count(logical=True) DEFAULT_MEMORY = (psutil.virtual_memory().total >> 20)*1000 PERCENT = 100 GIGA = 2 ** 30 MEGA = 2 ** 20 def loop(conn, affinity, check): ...
train_and_eval_low_level_runner.py
# Copyright 2018 Google. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
run_experiments.py
#!/usr/bin/python import subprocess import threading import multiprocessing import os ''' backup of an old config conf_str_incast32 = init_cwnd: 12 max_cwnd: 15 retx_timeout: 450 queue_size: 524288 propagation_delay: 0.0000002 bandwidth: 100000000000.0 queue_type: 6 flow_type: 6 num_flow: {0} num_hosts: 33 flow_trac...
Hiwin_RT605_ArmCommand_Socket_20190627195102.py
#!/usr/bin/env python3 # license removed for brevity import rospy import os import socket ##多執行序 import threading import time import sys import matplotlib as plot import HiwinRA605_socket_TCPcmd as TCP import HiwinRA605_socket_Taskcmd as Taskcmd import numpy as np from std_msgs.msg import String from ROS_Socket.srv imp...
module.py
#!/usr/bin/env python # # Copyright 2007 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 o...
cbStatsHashTest.py
from xdcrbasetests import XDCRReplicationBaseTest from threading import Thread from time import sleep from remote.remote_util import RemoteMachineShellConnection """Testing timeouts to upsert due to cbstats hash traversal""" class CbstatsHashTest(XDCRReplicationBaseTest): def setUp(self): super(CbstatsHa...
zuul_swift_upload.py
#!/usr/bin/env python3 # # Copyright 2014 Rackspace Australia # Copyright 2018 Red Hat, 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 # # ...
feeder.py
from sklearn.model_selection import train_test_split from synthesizer.utils.text import text_to_sequence from 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 background t...
compute_guesses_numpy.py
# Compute the security loss of edit 1 correction for q guesses. # Required: A typo model, or a way to generate the neighborhood of a password # 1. Create the neighborhood graph of the real password, and then # 2. Create the ball structure (somehow) # 3. After having a data structure for balls, and neighbors, computing ...
decorators.py
from threading import Thread def async(f): def wrapper(*args, **kwargs): thr = Thread(target=f, args=args, kwargs=kwargs) thr.start() return wrapper
main.py
# -*- coding: UTF-8 -*- import commands import sys from flask import Flask, request import methods from threading import Thread import multiprocessing import operator import time from argparse import ArgumentParser from multiprocessing import Event from multiprocessing import Pipe from terminaltables import AsciiTable...