source
stringlengths
3
86
python
stringlengths
75
1.04M
client.py
from cryptography.fernet import Fernet import sys import socket import select import errno import threading class MoleClient: def __init__(self, ip="127.0.0.1", port=1234, header_length=10, physical_key_file="./PHYSICAL_KEY", encoding="utf8"): self.ip = ip self.port = port self.header_leng...
libra.py
import serial import sys import threading import queue import datetime import subprocess import requests import time # Commands CMD_CONT_READ = "SIR\r\n".encode("ascii") CMD_SET_TARE = "T\r\n".encode("ascii") CMD_CALIBRATE_SETTINGS = "C0\r\n".encode("ascii") CMD_CALIBRATE_SET_SETTINGS = "C0 0 1\r\n".encode("ascii") C...
data_util.py
""" This code is based on https://github.com/fchollet/keras/blob/master/keras/utils/data_utils.py """ import time import numpy as np import threading import multiprocessing try: import queue except ImportError: import Queue as queue class GeneratorEnqueuer(object): """ Builds a queue out of a data ge...
assistant.py
# # K9 Conversation by Richard Hopkins using # Kitt-AI Snowboy for hotword recognition # Watson Speech to Text (streaming to sockets) # Watson Conversation # eSpeak Text to Speech # Robot status displayed with Adafruit PWM Servo Driver driving LED brightness # # Original TTS elements (now much revised) derived from # J...
ios_device.py
# Copyright 2019 WebPageTest LLC. # Copyright 2017 Google Inc. # Use of this source code is governed by the Apache 2.0 license that can be # found in the LICENSE file. """Interface for iWptBrowser on iOS devices""" import base64 import logging import multiprocessing import os import platform import select import shutil...
update_from_github.py
import os import sys import time import subprocess import threading import re import zipfile import shutil import stat import glob current_path = os.path.dirname(os.path.abspath(__file__)) root_path = os.path.abspath(os.path.join(current_path, os.pardir)) top_path = os.path.abspath(os.path.join(root_path, os.pardir, o...
__init__.py
import os import sys import subprocess import threading import time import wx import wx.aui from wx import FileConfig import pcbnew from .dialog import Dialog def check_for_bom_button(): # From Miles McCoo's blog # https://kicad.mmccoo.com/2017/03/05/adding-your-own-command-buttons-to-the-pcbnew-gui/ def...
system_profiler.py
# Copyright 2021 MosaicML. All Rights Reserved. """Profiler to record system level metrics.""" from __future__ import annotations import threading import time from typing import TYPE_CHECKING, Dict, cast import psutil from composer.callbacks import memory_monitor from composer.core.callback import Callback if TYP...
day26-7 进程之间不共享全局变量.py
import multiprocessing import time # 定义全局变量列表 g_list = [] # 添加数据任务 def add_data(): for i in range(3): # 列表是可变类型,在原有内存基础上修改数据,内存地址不变,不需要加global关键字 # 加上global的作用:声明要修改全局变量的内存地址 g_list.append(i) print("添加:", i) time.sleep(0.2) print("添加完成:",g_list) # 读取数据任务 def read_data(...
main.py
#!/usr/bin/env python # SOURCE: https://blog.miguelgrinberg.com/post/video-streaming-with-flask import sys from flask import Flask, render_template, Response import os import rospy import threading import html from std_msgs.msg import String from scripts.tracking_markers_class2 import TrackingCamera app = Flask(__na...
video2npy.py
# ============================================================================ # 计算RGB数据并输出保存为.npy文件 # ============================================================================ # -*- coding: utf-8 -*- import cv2 import numpy as np from datetime import datetime import threading from tensorflow.python.platform import ...
test_vacuum.py
from base import pipeline, clean_db from collections import namedtuple import getpass import os import psycopg2 import psycopg2.extensions import random import threading import time def test_concurrent_vacuum_full(pipeline, clean_db): pipeline.create_stream('test_vacuum_stream', x='int') pipeline.create_cv( '...
8c.py
import multiprocessing a = list(enumerate([183677, 186720, 176916, 186554, 113034, 193701, 131768, 142185, 131518, 105202])) b = [0 for i in range(len(a))] def fatorial(n): fat = n for i in range(n-1, 1, -1): fat = fat * i return fat def main(inq, outq, process): while no...
1_disc_golf_range.py
from threading import Semaphore,Lock, Thread from time import sleep import random #initializing semaphores send_cart = Semaphore(0) mutex = Semaphore(1) cart = Semaphore(0) mutex_ballinc = Semaphore(1) rng = random.Random() # used to generate random number #initializing the variables, in case the user does not give...
docker_runner.py
import os import logging import pdb import time import random from multiprocessing import Process import numpy as np from client import MilvusClient import utils import parser from runner import Runner logger = logging.getLogger("milvus_benchmark.docker") class DockerRunner(Runner): """run docker mode""" def...
engine.py
""" """ import logging import sys import smtplib import os from abc import ABC from datetime import datetime from email.message import EmailMessage from queue import Empty, Queue from threading import Thread from typing import Any, Sequence, Type, Dict, List, Optional from howtrader.event import Event, EventEngine fr...
papers.py
import os import ctypes import time import json import tempfile import requests from threading import Thread, Event from screeninfo import get_monitors from flytrap import * # version = 'v0.1.6' # activeParams = { "group": "", "": "username" } # displayed = [] # paper_count = 0 # displays = get_monitors() # primary_...
train.py
#!/usr/bin/env python import os import json import torch import numpy as np import queue import pprint import random import argparse import importlib import threading import traceback from tqdm import tqdm from utils import stdout_to_tqdm from config import system_configs from nnet.py_factory import NetworkFactory fr...
parallel_runner.py
from envs import REGISTRY as env_REGISTRY from functools import partial from components.episode_buffer import EpisodeBatch from multiprocessing import Pipe, Process import numpy as np import torch as th # Based (very) heavily on SubprocVecEnv from OpenAI Baselines # https://github.com/openai/baselines/blob/master/bas...
mock_request_demo.py
# -*- coding: utf-8 -*- import threading import requests url = 'http://127.0.0.1:5000' def req(): response = requests.get(url) return response if __name__ == '__main__': for i in range(20): t = threading.Thread(target=req) t.start() t.join()
uploadWorker.py
import threading from queue import Queue from common_functions import send import socket class Worker(): _run_thread: threading.Thread _uploading_info: Queue _sock: socket.socket _information_info: Queue def __init__(self, s: socket.socket): self._uploading_info = Queue() self._so...
async.py
""" raven.contrib.async ~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from Queue import Queue from raven.base import Client from threading import Thread, Lock import atexit import os SENTRY_WAIT_SECONDS = 10 class...
repair_manager.py
# -*- coding: utf-8 -*- """ Copyright (c) 2017 beyond-blockchain.org. 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 l...
cache.py
import collections import contextlib import datetime import functools import json import logging import os import re import threading import time import sqlalchemy as sa from sqlalchemy.engine.base import Transaction as _sa_Transaction from sgapi import TransportError from sgevents import EventLog from . import fiel...
t.py
from flask import Flask, request app = Flask(__name__) #import threading #import recod @app.route('/') def hello_world(): #x = threading.Thread(target=recod.freeze_support, args=None) #x.start() with open("d.htm") as f: return f.read() #@app.route('/gotcha',methods=['POST']) #def gotcha(): ...
song_line.py
# -*- coding: utf-8 -*- from Scripts.elements import * from Scripts.song_manage import SongManage from Scripts.music_storage import MusicStorage from Scripts.music_interface import MusicInterface class SongLine(SongManage, MusicInterface): def __init__(self): Main.SONG_LINE_CANVAS = Canvas(Main...
crypto.py
import functools import json import os import subprocess import tempfile from mediaman import config from mediaman.core import logtools from mediaman.core import models from mediaman.core import settings from mediaman.middleware import simple logger = logtools.new_logger("mediaman.middleware.crypto") def init(func...
fts.py
""" fts.py ------ Script to transfer file(s) to or from a host that is behind a UNIX gateway. File transfer to a host that is behind a UNIX gateway requires authentication with the gateway prior to accessing the host itself. Arguments can be passed directly when calling the script - supports both the short and long ve...
jstest.py
""" unittest.TestCase for JavaScript tests. """ from __future__ import absolute_import import os import os.path import shutil import sys import threading from . import interface from ... import config from ... import core from ... import utils class JSTestCase(interface.TestCase): """ A jstest to execute. ...
ArUco detection.py
#Procedimentos: #1: Definir a origem e calibrar a posição do objeto na origem escolhida #2: Calibrar a profundidade (z) utilizando regressão linear (medida real x medida obtida) #3: Calibrar a relação entre a variável z e as coordenadas x e y. Relacionar os valores de (x,z) e (y,z). import cv2 as cv from threading imp...
websocket_client_test.py
# encoding: UTF-8 import json import ssl import sys import traceback import socket from datetime import datetime from threading import Lock, Thread from time import sleep import websocket from vnpy.gateway.gateway_test.my_log import MyLog class WebsocketClient(object): """ Websocket API After creating t...
sql_isolation_testcase.py
""" Copyright (c) 2004-Present Pivotal Software, Inc. This program and the accompanying materials are made available under the terms of the 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....
run_unittests.py
#!/usr/bin/env python3 # Copyright 2016-2017 The Meson development team # 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 ...
DPPO.py
import tensorflow as tf import numpy as np import matplotlib.pyplot as plt import gym, threading, queue from tgym.envs import SpreadTrading from test import get_CSV_data EP_MAX = 3455#6910 EP_LEN = 3455 N_WORKER = 4 # parallel workers GAMMA = 0.9 # reward discount factor A_LR = 0.00001 ...
twisted_test.py
# Author: Ovidiu Predescu # Date: July 2011 # # 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 ...
__init__.py
from __future__ import print_function, unicode_literals import zmq import zmq.auth from zmq.auth.thread import ThreadAuthenticator from zmq.utils.monitor import recv_monitor_message import sys import os import json import time import multiprocessing try: import queue except ImportError: import Queue as queue ...
test.py
# -*- coding: utf8 -*- import sys import os IS_PY3 = sys.version_info[0] == 3 IS_PY2 = not IS_PY3 MINOR_VER = sys.version_info[1] # coverage doesn't work in python 3.1, 3.2 due to it just being a shit # python HAS_UNICODE_LITERAL = not (IS_PY3 and MINOR_VER in (1, 2)) cov = None if HAS_UNICODE_LITERAL: run_idx =...
multi_process_runner_test.py
# Copyright 2019 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...
IndexFiles_zhCN.py
# SJTU EE208 INDEX_DIR = "IndexFiles.index" import sys, os, lucene, threading, time from datetime import datetime # from java.io import File from java.nio.file import Paths from org.apache.lucene.analysis.miscellaneous import LimitTokenCountAnalyzer from org.apache.lucene.analysis.standard import StandardAnalyzer fr...
temperature_server_IOC.py
"""Temperature controller server The server communicates with Lightwave( previously known as temperature controller IOC) and Oasis IOC to synchronize the temperature changes. Authors: Valentyn Stadnydskyi, Friedrich Schotte Date created: 2019-05-08 Date last modified: 2019-05-14 """ __version__ = "0.1" # Friedrich Sch...
plotmodel.py
from collections import defaultdict import copy import itertools import threading from ast import literal_eval from PySide2.QtWidgets import QItemDelegate, QColorDialog, QLineEdit from PySide2.QtCore import QAbstractTableModel, QModelIndex, Qt, QSize, QEvent from PySide2.QtGui import QColor import openmc import openmc...
plant.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Date of establishment: November 27, 2018 @author: zhangzd """ import cv2 #导入cv2模块 import requests #导入requests模块 import json #导入json模块 import threading #导入threading模块 import time #导入时间模块 import base64 #导入base64模块 import numpy as np #导入numpy模块 from PIL i...
part1.py
#!/usr/bin/env python3 import sys from program import Program import threading class Robot: def __init__(self, program): self.__program = program self.__pos = (0, 0) self.__dir = (0, 1) self.__painted_zone = set() self.__white_zone = set([(0, 0)]) def execute(self): ...
test_for_multithreading.py
from threading import Thread def test(): import QUANTAXIS as QA global QA QA.QA_util_log_info('指数日线') if __name__ == '__main__': t = Thread(target=test, args=()) t.start() t.join() import QUANTAXIS as QA QA.QA_util_log_info('指数日线')
__init__.py
import math import threading import time import uuid from contextlib import contextmanager import redis from .utils import gen_lock_name, subscribe, get_list_args class Redisz: # ------------------------------------------ sys ------------------------------------------ def __init__(self, url, **kwargs): ...
test_larcv_client.py
import os,sys,time from ublarcvserver import ublarcvserver from multiprocessing import Process from larcv import larcv from ROOT import std """ This script is used to test the Majordomo classes. We implement a dummy setup where the client and worker just say hello to each other. Also servers as an example. We also s...
run_unittests.py
#!/usr/bin/env python3 # Copyright 2016-2017 The Meson development team # 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 ...
VentanaMain.py
# -*- coding: UTF-8 -*- # @author JoseMariaRomeroARK visit my gitHub site at: https://github.com/JoseMariaRomeroARK from tkinter import * import Utilidades import os, shutil, threading from VentanAux import createNew listaFormatos =[".mp3",".aac",".m4a",".mp4",".wma",".wav",".atrac",".m4p",".m3p",".flac",".midi",...
DLHandler.py
import logging from .DLInfos import * from .DLProgress import * from .packer import Packer import time, os from .DLThreadPool import ThreadPool # LOG_FORMAT = "%(asctime)s,%(msecs)03d - %(levelname)s - %(threadName)-12s - (%(progress)s)[%(urlid)s] - %(message)s" # # logging.basicConfig(format=LOG_FORMAT, datefmt="%m...
run_jobs.py
__author__ = 'ones' import os, sys, threading import error_handling working_dir = os.getcwd() directories = [] zombies = [] if len(sys.argv) == 1: os.system('find -mindepth 3 -type d > compounds_directories') elif len(sys.argv) == 2: root = sys.argv[1] depth = root.count('/') os.system('find ./'+ro...
stereopi.py
#!/usr/bin/python3 -u import math import os import threading import time import RPi.GPIO as GPIO import board import neopixel import wakeup switch_pin = 13 led_pin = board.D12 pixels = neopixel.NeoPixel(led_pin, 1) GPIO.setmode(GPIO.BCM) GPIO.setup(switch_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP) print("Starting.....
multiprocessing_queue_1.py
#!/usr/bin/env python3 import multiprocessing import time import random import os from multiprocessing import Queue q_1 = Queue() def hello(q, n): time.sleep(random.randint(1,3)) q.put(os.getpid()) print("[{0}] Hello!".format(n)) processes = [ ] for i in range(10): t = multiprocessing.Process(target...
noticeboard_server.py
#!/usr/bin/env python3.9 import socket import argparse import time import threading import queue import logging from nblib import send_message, recv_message DEFAULT_PORT = 12345 DEFAULT_WORKER_COUNT = 3 DEFAULT_HOST = "127.0.0.1" DEFAULT_TIMEOUT = 13 # use prime as timeout LISTEN_QUEUE_SIZE = 5 # how many...
opencv_gst_camera.py
import traitlets import atexit import cv2 import threading import numpy as np from .camera_base import CameraBase class OpenCvGstCamera(CameraBase): value = traitlets.Any() # config width = traitlets.Integer(default_value=224).tag(config=True) height = traitlets.Integer(default_value=224).tag...
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, ...
mp_spotfinder_server_read_file.py
from __future__ import division from BaseHTTPServer import HTTPServer import cgi, sys from multiprocessing import Process, current_process from urlparse import urlparse #backward compatibility with Python 2.5 try: from urlparse import parse_qs except Exception: from cgi import parse_qs def note(format, *args): sy...
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: #...
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 ...
server_UDP_modified.py
import socket import threading s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.bind(('127.0.0.1',9999)) print('Bind UDP on 9999...') def udplink(data, addr): print('Received from %s:%s.' % addr) s.sendto(b'%s' % data, addr) def thread_func(): global s print("thread started") wh...
Presentiment.py
############ TAGS TO BE USED WITH EXTENSION "BETTER COMMENTS" # $ TÍTULO / DONE # & Subtítulo # ! Warning # * Demo # ? Duda/aclaración # % To do # x Borrado ############ import sys import os import random import ctypes import pandas import numpy import requests import json import tim...
server.py
from config import * import re import os import cv2 import time import json import base64 import shutil import datetime import threading import numpy as np from bottle import route, run, static_file, request, BaseRequest, response from ai import * from tricks import * BaseRequest.MEMFILE_MAX = 10000 * 1000 def g...
plugin.py
#!/usr/bin/env python3 # # Electron Cash - a lightweight Bitcoin Cash client # CashFusion - an advanced coin anonymizer # # Copyright (C) 2020 Mark B. Lundeberg # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to d...
data_utils.py
import threading import traceback from torch.multiprocessing import Process, Queue, Pool import numpy as np import os import torch def get_input(data, render): real_image = data['image'] input_semantics, rotated_mesh, orig_landmarks, rotate_landmarks, \ rendered_images_erode, original_angles, Rd_a, rende...
train.py
""" @author: Viet Nguyen <nhviet1009@gmail.com> """ import os os.environ['OMP_NUM_THREADS'] = '1' import argparse import torch from src.env import MultipleEnvironments from src.model import PPO from src.process import eval import torch.multiprocessing as _mp from torch.distributions import Categorical import torch.nn...
tracker.py
""" Tracker script for DMLC Implements the tracker control protocol - start dmlc jobs - start ps scheduler and rabit tracker - help nodes to establish links with each other Tianqi Chen """ # pylint: disable=invalid-name, missing-docstring, too-many-arguments, too-many-locals # pylint: disable=too-many-branches, too...
sockets.py
from __future__ import absolute_import import socket import sys import threading import numpy as np # FIXME close sockets when simulator is closed, remove SO_REUSEPORT # Currently Nengo does not provide a mechanism for this, thus we allow to # reuse ports currently to avoid problems with addresses already in use (th...
handler.py
# -*- coding: utf-8 -*- import logging import random import threading from copy import copy from datetime import timedelta from random import randint from time import sleep from typing import Dict, List, Optional from urllib.parse import parse_qs, unquote, urlparse import pytz import requests from django.conf import s...
face_train_controller_node.py
#!/usr/bin/env python # Copyright (c) 2018, The Regents of the University of California # 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 cop...
app_cn.py
import os import re import math import sys import shutil import json import traceback import PIL.Image as PilImage import threading import tkinter as tk from tkinter import messagebox from tkinter import ttk from tkinter import filedialog from constants import * from config import ModelConfig, OUTPUT_SHAPE1_MAP, NETWOR...
bluecoat.py
import http.server import json import re import socketserver import sys import threading from urllib.parse import urlparse import time import traceback import requests import os class NewHandler(http.server.SimpleHTTPRequestHandler): def do_GET(self): if self.path == '/': self.path = 'webroot/i...
agent.py
# ------------------------------------------------------------------------------ # Copyright 2021 Mohammad Reza Golsorkhi # # 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.ap...
all.py
from utlis.rank import setrank,isrank,remrank,remsudos,setsudo, GPranks,IDrank from utlis.send import send_msg, BYusers, GetLink,Name,Glang,getAge from utlis.locks import st,getOR from utlis.tg import Bot from config import * from pyrogram.types import ReplyKeyboardMarkup, InlineKeyboardMarkup, InlineKeyboardButton im...
main.py
import cv2 import time import threading import math import sys import numpy import os from ast import Pass from inputs import get_gamepad from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * # USB camera setup src = 'v4l2src device=/dev/video0 ! video/x-raw, width=3840, height=2160, format=NV12 !...
video.py
import threading import requests from config import App_title import youtube_dl from pyrogram.types import InlineKeyboardMarkup,InlineKeyboardButton from modules.control import run_rclone import sys import requests import os import time temp_time= time.time() def progress(current, total,client,message,name): p...
Analysis.py
""" This module contains the ``analysis`` class. It includes common classes for file management and messaging and all calls to AEDT modules like the modeler, mesh, postprocessing, and setup. """ from __future__ import absolute_import import os import shutil import threading import warnings from collections import Ord...
app.py
from aiocqhttp import CQHttp from datetime import datetime from sendmsg import SendMsg from loadData import LoadData import threading import time # windows本机运行本脚本与coolq的配置 # HOST = '127.0.0.1' # PORT = 7788 # 这个url是发送给docker容器里的coolq # 举例来说,假如docker命令有这样的 -p 3542:9000 -p 15700:5700 # 9000 是coolq暴露的页面访问地址(这里映射到了外面的35...
start.py
#!/usr/bin/python3 import os import glob import shutil import multiprocessing import logging as log import sys from podop import run_server from socrate import system, conf log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "WARNING")) def start_podop(): os.setuid(100) url = "http://" + ...
worker.py
import os import sys import time import queue import threading as mt import multiprocessing as mp import radical.utils as ru from .. import Session from .. import utils as rpu from .. import constants as rpc # ------------------------------------------------------------------------------ # cla...
exchange_rate.py
from datetime import datetime import inspect import requests import sys import os import json from threading import Thread import time import csv import decimal from decimal import Decimal from .bitcoin import COIN from .i18n import _ from .util import PrintError, ThreadJob # See https://en.wikipedia.org/wiki/ISO_42...
check_vms.py
import threading import constants_spgw as constants import ConfigParser import ipaddress import time import os import check_vms_constants diagram = """\ +--------------+ Control+----------------> S1MME| MME | Path +-------| ...
local_timer_example.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import logging import multiprocessing as mp import signal import time import unittest imp...
auto_clicker.py
# -*- coding: utf-8 -*- import os, time, pickle, sys, logging, re, random, threading, configparser, requests, json, schedule #画像ダウンロード from urllib import request from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.by import By from selenium.webdri...
base_noninterleaving_notification_ids_tests.py
from abc import ABC, abstractmethod from threading import Event, Thread from unittest import TestCase from uuid import uuid4 from eventsourcing.persistence import ApplicationRecorder, StoredEvent class NonInterleavingNotificationIDsBaseCase(ABC, TestCase): insert_num = 1000 def test(self): recorder ...
joinEx.py
from threading import Thread from random import randint import sys NTHRDS = 6 def theWorks(n): # main function of the "worker thread" r = 0 for i in range(1000000): # do lots of work r += randint(0,50) print('I am {}, the result is: {}'.format(n, r)) sys.exit() threads = [] # creates a list ...
ssh.py
#!/usr/bin/env python3 """ DMLC submission script by ssh One need to make sure all slaves machines are ssh-able. """ from __future__ import absolute_import from multiprocessing import Pool, Process import os, subprocess, logging from threading import Thread from . import tracker def sync_dir(local_dir, slave_node, s...
game.py
import numpy as np import os from utils.config import Config import tkinter as tk import tkinter.messagebox from PIL import Image, ImageTk from cores.color_board import COLOR_BOARD import matplotlib.pyplot as plt from utils.perlin_noise import PerlinNoiseFactory from utils.ca_cave import CA_CaveFactory from utils impor...
produce_consumer.py
#!/usr/bin/env python # _*_coding:utf-8_*_ import time import random import queue import threading q = queue.Queue() def producer(name): count = 0 while count < 10: print("making........") time.sleep(random.randrange(3)) q.put(count) print('Producer %s has produced %s baozi.....
studio.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...
test_ftplib.py
"""Test script for ftplib module.""" # Modified by Giampaolo Rodola' to test FTP class, IPv6 and TLS # environment import ftplib import asyncore import asynchat import socket import io import errno import os import threading import time try: import ssl except ImportError: ssl = None from unittest import Test...
tenmoPg.py
#! /usr/bin/env nix-shell #! nix-shell -i python3 -p "python3.withPackages(ps: [ps.numpy ps.psycopg2 ps.requests ps.websockets])" import sys import threading from tenmoTypes import * from tenmoGraph import universe_print_dot import select import time import datetime import pprint import traceback import io import jso...
monitored_session_test.py
# pylint: disable=g-bad-file-header # 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/LICENS...
server.py
import subprocess import tempfile import sys from beat import playHeartBeat from arduino import myHeartBeat from threading import Thread import datetime import socket import threading #otherBeat = 68 otherDevice = "stormy-fortress-18687" def playBeat(): while True: playHeartBeat(68) HOST = '138.16.1...
gui - Copy.py
# -*- coding: utf-8 -*- import sys from threading import Thread from pathlib import Path import time import matplotlib.pyplot as plt import matplotlib.mlab as mlab from scipy.stats import lognorm, norm from PyQt5.QtGui import * from PyQt5.QtWidgets import * from PyQt5.QtCore import * from PyQt5 import Qt # from ...
test_dispatcher.py
from __future__ import print_function, division, absolute_import import errno import multiprocessing import os import platform import shutil import subprocess import sys import threading import warnings import inspect import pickle import weakref from itertools import chain try: import jinja2 except ImportError: ...
weakaudio.py
# # get at sound cards on both Mac and FreeBSD, # using pyaudio / portaudio. # import sys import numpy import time import threading import multiprocessing import os import weakutil import sdrip import sdriq import eb200 import sdrplay import fmdemod # desc is [ "6", "0" ] for a sound card -- sixth card, channel 0 ...
repository.py
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import absolute_import import functools import logging import os import re import shutil import subprocess from argparse import ArgumentParser, _SubParsersAction from cont...
__init__.py
# coding=utf-8 """ © 2013 LinkedIn Corp. 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 agreed to...
joystick.py
# Copyright (c) 2021 UAVCAN Consortium # This software is distributed under the terms of the MIT License. # Author: Pavel Kirienko <pavel@uavcan.org> from __future__ import annotations from typing import Iterable, Tuple, Callable, Dict, Optional, List import sys import functools import threading import yakut from . im...
processing1.py
#!/usr/bin/env python from processing import Process, Queue import time def f(q): x = q.get() print "Process number %s, sleeps for %s seconds" % (x,x) time.sleep(x) print "Process number %s finished" % x q = Queue() for i in range(10): q.put(i) i = Process(target=f, args=[q]) i.start() pr...
test_channel.py
import io import unittest import pytest class TestHTTPChannel(unittest.TestCase): def _makeOne(self, sock, addr, adj, map=None): from waitress.channel import HTTPChannel server = DummyServer() return HTTPChannel(server, sock, addr, adj=adj, map=map) def _makeOneWithMap(self, adj=Non...