source
stringlengths
3
86
python
stringlengths
75
1.04M
run.py
import itchat import os import threading curr_idx = 0 # 歌单 playlist = [ '/home/pi/speechsdk-1.2.0/samples/bin/mix_tts_6.wav', '/home/pi/speechsdk-1.2.0/samples/bin/mix_tts_3.wav', '/home/pi/speechsdk-1.2.0/samples/bin/mix_tts_0.wav', '/home/pi/NewsDictation01.mp3', '/home/pi/empty.wav', ] # 播放列表中...
can.py
# -*- coding: utf-8 -*- ''' Tool for running a session with the can interface. Example: .. code-block:: python import pykarbon.can as pkc from time import sleep with pkc.Session() as dev: dev.write(0x123, 0x11223344) # Send a message sleep(5) # Your code here! ...
pl6_ex22.py
from multiprocessing import Process, Array, Semaphore import random, time MAX_SIZE = 5 buffer = Array("i",MAX_SIZE) empty = Semaphore(MAX_SIZE) #Inicialmente, MAX_SIZE posicoes livres full = Semaphore(0) #Inicialmente, 0 posicoes ocupadas def produtor(): inPosition = 0 while True: nextProduced = rand...
base.py
import os import re import logging import threading import ujson as json from abc import ABC, abstractmethod from datetime import datetime, timedelta from shutil import copy2 from flask_wtf import FlaskForm from wtforms import StringField, BooleanField from wtforms.validators import InputRequired, Optional, Validatio...
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 ...
test_boot_daemon.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # The MIT License (MIT) # Copyright (c) 2020 SBofGaySchoolBuPaAnything # # 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, in...
complicated.py
#!/usr/bin/env python3 '''A lengthy example that shows some more complex uses of finplot: - control panel in PyQt - varying indicators, intervals and layout - toggle dark mode - price line - real-time updates via websocket This example includes dipping in to the internals of finplot and the u...
index.py
# !/usr/bin/env python # -*- coding: utf-8 -*- """----Definición de las librerías requeridas para la ejecución de la aplicación---""" from flask import Flask, request, render_template #Interfaz gráfica WEB ##from flask_socketio import SocketIO from werkzeug.utils import secure_filename #Encriptar ...
runner.py
#!/usr/bin/env python3 # Copyright 2010 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. """This is the Emscripten test runner. To run ...
webui.py
import asyncio import json import logging import websockets import threading import numpy as np import queue import re import http.server from http.server import HTTPServer import time import os import encodings.idna logging.basicConfig() scheduledMessages = queue.Queue() isQuitRequested = False def sendCoords(nam...
pb_utils.py
from __future__ import print_function import colorsys from pyquaternion import Quaternion import json import math import os import pickle import platform import numpy as np import pybullet as p import random import sys import time import datetime from collections import defaultdict, deque, namedtuple from itertools im...
events.py
from pythontools.core import logger from threading import Thread import traceback class Event: def __init__(self, name, function, scope="global", threaded=False): self.name = name self.function = function self.scope = scope self.threaded = threaded def call(self, *args, **kwa...
manager.py
#!/usr/bin/env python3 import datetime import os import signal import subprocess import sys import traceback from multiprocessing import Process from typing import List, Tuple, Union import cereal.messaging as messaging import selfdrive.sentry as sentry from common.basedir import BASEDIR from common.params import Para...
server.py
import math import os import queue import sys import threading import time import uuid from collections import namedtuple from concurrent.futures import ThreadPoolExecutor from threading import Event as ThreadingEventType from time import sleep import grpc from dagster import check, seven from dagster.core.code_pointe...
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. from __future__ import print_function import argparse ...
check_mysql_bigtable.py
#!/usr/bin/env python #coding:utf-8 import os import sys import string import time import datetime import MySQLdb path='./include' sys.path.insert(0,path) import functions as func from multiprocessing import Process; def check_mysql_bigtable(host,port,username,password,server_id,tags,bigtable_size): try: c...
function.py
# -*- coding: utf-8 -*- """ Created on Fri Jan 11 20:24:50 2013 @author: Wang Hao """ import pdb import time import numpy as np from multiprocessing import Process, Array, Lock from scipy.stats import gaussian_kde, chi from scipy.integrate import quad, simps from numpy.random import rand, randn from num...
AnnotationTool.py
## Tkinter modules import Tkinter as tk import tkMessageBox as tkmsg ## Default python modules import os, sys, glob, time from os.path import join, basename, dirname, splitext from copy import copy, deepcopy from threading import Thread import argparse ## External libraries import cv2 import numpy as np ''' Requirem...
test_describe_collection.py
import pytest import logging import time from utils.utils import * from common.constants import * uid = "describe_collection" class TestDescribeCollection: @pytest.fixture( scope="function", params=gen_single_filter_fields() ) def get_filter_field(self, request): yield request.pa...
communicator.py
from twisted.internet.protocol import ClientFactory from twisted.internet.task import deferLater, cooperate from zope.interface import implementer __author__ = 'matthewgalligan' import time,Queue from twisted.internet import reactor, protocol, endpoints from twisted.protocols import basic from doodle import Doodle fro...
worker.py
from contextlib import contextmanager import atexit import faulthandler import hashlib import inspect import io import json import logging import os import redis import sys import threading import time import traceback from typing import Any, Dict, List, Iterator # Ray modules from ray.autoscaler._private.constants im...
ISP.py
import zerorpc import socket import threading # Inisiasi socket TCP/IPv4 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #Kelas sebagai rujukan Serve class InternetServiceProvider(object): myPulsa = 5500 #Deklarasi myPulsa sebagai object quotaPulse = 1000000 #Deklarasi penyedia ...
__init__.py
from radio.extensions.extension import Extension from radio.extensions.tagesschau import Tagesschau100s import radio.player from typing import List from threading import Thread from time import sleep import radio.scheduler as rs def add_extensions(player: 'radio.player.Player', exts: List[str]) -> None: for ext_i...
video.py
''' Synopsis: Script to obtain videos from webcam. Author: Nikhil Venkatesh Contact: mailto:nikv96@gmail.com ''' #Opencv Imports import cv2 import numpy as np #Python Imports import multiprocessing cores_available = multiprocessing.cpu_count() def image_capture_background(imgcap_connection): global c...
test_http_functions.py
import sys from urllib.error import HTTPError from tests.utils import testutils from threading import Thread import unittest import os import urllib.request import time PYTHONPATH = ['invoker', '%s/tests/functions' % os.getcwd(), '%s/invoker' % os.getcwd()] for p in PYTHONPATH: sys.path.append(p) from invoker im...
kws.py
# -*- coding: utf-8 -*- """ Keyword spotting using pocketsphinx """ import os import threading try: import Queue as queue except ImportError: import queue from voice_engine.element import Element from pocketsphinx.pocketsphinx import Decoder class KWS(Element): def __init__(self): super(KWS, se...
combiner.py
import os import queue import threading import uuid from datetime import datetime, timedelta from fedn.common.net.connect import ConnectorCombiner, Status from fedn.common.net.grpc.server import Server import fedn.common.net.grpc.fedn_pb2 as fedn import fedn.common.net.grpc.fedn_pb2_grpc as rpc from fedn.clients.comb...
process.py
import multiprocessing from oslo_concurrency import processutils import psutil import time # To avoid circular imports, util modules should only import a limited # set of shakenfist modules, mainly exceptions, logutils, and specific # other util modules. from shakenfist import db from shakenfist import logutil LOG, ...
runner.py
# Copyright 2018 Datawire. 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 agr...
test_asyncore.py
import asyncore import unittest import select import os import socket import sys import time import errno import struct import threading from test import support from io import BytesIO if support.PGO: raise unittest.SkipTest("test is not helpful for PGO") HAS_UNIX_SOCKETS = hasattr(socket, 'AF_UNIX') class dum...
utils.py
import http.client import logging import os import queue as Queue import ssl import threading from http.server import BaseHTTPRequestHandler, HTTPServer from urllib.parse import parse_qs, urlparse def enable_requests_logging(): http.client.HTTPConnection.debuglevel = 4 logging.basicConfig() logging.getLo...
getImg.py
import time,re from base64 import b64encode from io import BytesIO import urllib import math import threading import requests from wordcloud import WordCloud import numpy as np from PIL import Image, ImageDraw, ImageFont, ImageFilter from .getDB import GetInfo,GetCharacter,GetSpiralAbyssInfo,GetMysInfo,errorDB,cache...
main.py
#!py -3 import math import os import sqlite3 import sys import time from configparser import ConfigParser try: from tk import filedialog except: from tkinter import filedialog import hashlib from dateutil import parser from datetime import datetime import json import threading import http.server import sockets...
data_helper.py
import copy import crc32 import hashlib import json import random import socket # from multiprocessing.process import Process # from multiprocessing.queues import Queue import threading import time import uuid import zlib from random import Random from TestInput import TestInputServer from TestInput import TestInputSin...
api.py
""" API ====== """ import zipfile try: import queue except ImportError: import Queue as queue import threading import datetime import math import requests import mimetypes import os import pathlib import uuid try: from urllib.parse import urlunparse, urlencode, urlparse, parse_qs except ImportError: fr...
cf_gyms.py
import os from threading import Thread from prettytable import PrettyTable from .cf_utils import read_data_from_file, write_data_to_file, Obj, obj_to_dict from .codeforces import CodeforcesAPI codeforces = CodeforcesAPI() cache_loc = os.path.join(os.environ['HOME'], '.cache', 'cf_submit') gyms_loc = os.path.join(cac...
test_host_connection_pool.py
# Copyright 2013-2015 DataStax, 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 writi...
stress.py
# import the necessary packages from threading import Thread import requests import time # initialize the Keras REST API endpoint URL along with the input # image path KERAS_REST_API_URL = " http://0.0.0.0:5000/predict" IMAGE_PATH = "kitten.jpg" # initialize the number of requests for the stress test along with # the s...
launch_monitor_server.py
import roslaunch import rospy import psutil from multiprocessing import Pool import roslaunch_monitor.msg from functools import partial import actionlib from roslaunch_monitor.srv import NodeAction, NodeActionResponse, NodeActionRequest from collections import Counter import sys #import threading def get_pid_stats(pid...
train_taobao.py
#coding:utf-8 import numpy from data_iterator import DataIterator import tensorflow as tf from model import * import time import random import sys from utils import * import multiprocessing import argparse import cPickle as pkl parser = argparse.ArgumentParser() parser.add_argument('-p', type=str, default='train', hel...
process.py
# -*- coding: utf-8 -*- """ Functions for daemonizing and otherwise modifying running processes """ # Import python libs from __future__ import absolute_import, print_function, unicode_literals, with_statement import contextlib import copy import errno import functools import io import logging import multiprocessing ...
threaded_server.py
import json import os import threading from http.server import BaseHTTPRequestHandler, HTTPServer try: HOST = os.environ["GOLLY_PELICAN_TEST_MOCKAPI_HOST"] PORT = int(os.environ["GOLLY_PELICAN_TEST_MOCKAPI_PORT"]) except KeyError: raise Exception( "Error: you must define GOLLY_PELICAN_TEST_MOCKAPI...
simple_http_server.py
# *-* coding: utf8 *-* import re import socket import multiprocessing def handle_client(new_socket): """为客户端服务""" # 1.接收客户端请求 request = new_socket.recv(1024).decode("utf-8") # print(recv_data) request_lines = request.splitlines() # 当客户端主动关闭, 会收到空字符串并解阻塞; 这里会生成空列表 if not request_lines: ...
Musicplayer.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 lis...
_read_some_but_not_all_responses_test.py
# Copyright 2016, Google 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 copyright # notice, this list of conditions and the f...
test_urllib.py
"""Regresssion tests for urllib""" import urllib.parse import urllib.request import urllib.error import http.client import email.message import io import unittest from unittest.mock import patch from test import support import os import sys import tempfile from nturl2path import url2pathname, pathname2url from base64...
concurrencia.py
''' En el siguiente ejemplo visto en clase, se utilizan los semáforos como una herramienta de comunicación entre hilos. Los palillos se pueden representar como un arreglo de semáforos asegurando la exclusión mutua, esto quiere decir que, un solo filósofo puede sostener un palillo al mismo tiempo. Se presentó la si...
main.py
import threading import socket import json import time import Seq2Seq as rnn import requests import os states = [1, 1] reply_dict = [None, None] input_str = ['', ''] work_dir = rnn.works_dir coolq_config_path = os.path.join(work_dir, 'coolq_config.txt') # 读取配置文件 with open(coolq_config_path, 'r', encoding='UTF-8') as...
31.py
#!/usr/bin/env python # coding: utf-8 # # Distributed Computation of Attributions using Captum # In this tutorial, we provide some examples of using Captum with the torch.distributed package and DataParallel, allowing computing attributions in a distributed manner across processors, machines or GPUs. # # In the firs...
camera_pi.py
#https://github.com/miguelgrinberg/flask-video-streaming/blob/master/camera_pi.py import time import io import threading import picamera class Camera(object): thread = None # background thread that reads frames from camera frame = None # current frame is stored here by background thread def __init__(se...
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...
producer.py
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 # -------------------------------------------------------------------------------------------------- # Imports # -------------------------------------------------------------------------------------------------- # Ge...
ant.py
# Ant # # Copyright (c) 2012, Gustav Tiger <gustav@tiger.name> # # 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, m...
app.py
import time, datetime, threading, random from pyhtmlgui import PyHtmlGui, PyHtmlView, Observable # App Logic class CounterApp(Observable): def __init__(self): super().__init__() self.value = 0 self.worker_thread = threading.Thread(target=self._worker_thread, daemon=True) self.worke...
zk.py
import json import logging import os import threading import time import yaml from kazoo.client import KazooClient from kazoo.exceptions import NoNodeError from kazoo.protocol.states import KazooState from PyPark.util.zk_util import path_join class ZK: """ ZK 基础客户端 """ def __init__(self, zk_host, zk_name, ...
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...
jobs.py
# coding=utf-8 import copy import datetime import sys import threading import time if sys.version_info.major >= 3: str = str str = str py3 = True else: py3 = False try: import queue except ImportError: import queue as Queue class released(object): """A context manager that releases a l...
destroy_user_vms.py
''' Test utility for destroy all current user vms, not including appliance VMs. @author: Youyk ''' import zstackwoodpecker.operations.vm_operations as vm_ops import zstackwoodpecker.test_lib as test_lib import zstackwoodpecker.test_util as test_util import threading import time def test(): vms = test_lib.lib_ge...
__init__.py
import aiml import os import bot.config as cfg from .processing import Processor import threading import requests f = open(".token") token = f.readline().rstrip() f.close() PROD = os.getenv('PROD') class MiamBot(aiml.Kernel): # Create the kernel and learn AIML files def __init__(self,properties=cfg.BOT_PROPE...
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...
collect-tweets.py
import time import requests import threading from django.core.management.base import BaseCommand, CommandError from django.conf import settings class Command(BaseCommand): """ A management command to call the /get/tweets endpoint. By calling this end point the app will gather tweet information for the sp...
_metadata_flags_test.py
# Copyright 2018 gRPC authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
cpu_bound_demo_multi.py
""" cpu bound demo multi""" from typing import Generator import itertools import multiprocessing import time def fibonacci() -> Generator[int, None, None]: """ generate an infinite fibonacci sequence """ num_1 = 0 num_2 = 1 yield 0 while True: next_num = num_1 + num_2 yield nex...
app.py
import os from threading import Thread from datetime import datetime from flask import Flask, request, make_response, redirect, abort, render_template, url_for, session, flash from flask_bootstrap import Bootstrap from flask_moment import Moment from flask_wtf import FlaskForm from wtforms import StringField, SubmitFi...
piUtils.py
#!/usr/bin/python3 # File name : piUtils.py # Description : utility module for pi import threading from datetime import datetime def timePrint(msg): """ print with time stamp """ print(str(datetime.now()) + ' ' + msg) def splitAndTrim(string, delimiter): """ split the string and remove all empty parts ...
controller.py
"""A pythonic Xbox 360 controller library for Linux. Partly inspired by the following libraries/codes: - https://www.freebasic.net/forum/viewtopic.php?t=18068 (libjoyrumble) - https://gist.github.com/rdb/8864666 """ import os import select import struct import sys import time from array import array from collections ...
scripting.py
# Utilities # # Copyright (c) 2012, Gustav Tiger <gustav@tiger.name> # # 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, c...
model.py
import threading, gym, tensorflow as tf, numpy as np, sys from numpy.linalg import inv class Balancer(object): #stop = True #use_checkpoint = True def __init__(self, sess, test_render, ignore_checkpoint, manual, save, learning_rate, beta1, beta2, discount_rate, epochs, max_steps, games_per_update, ...
noise_recorder.py
from talon import Context, Module, actions, cron, imgui, scope, ui from talon.lib import flac # `cubeb` was moved to `lib` on newer Talon try: from talon import cubeb except ImportError: from talon.lib import cubeb import inspect import logging import os import random import re import struct import subprocess...
monitor_test.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function import multiprocessing import os import subprocess import time import unittest import ray from ray.test.test_utils import run_and_get_output class MonitorTest(unittest.TestCase): def _testCleanupOnDrive...
test_failure.py
import json import logging import os import signal import sys import tempfile import threading import time import numpy as np import pytest import redis import ray import ray.utils import ray.ray_constants as ray_constants from ray.exceptions import RayTaskError from ray.cluster_utils import Cluster from ray.test_uti...
__init__.py
from __future__ import print_function import argparse import io import itertools import json import os import random import re import shlex import string import sys import traceback import warnings from collections import OrderedDict from fnmatch import fnmatchcase from subprocess import list2cmdline from threading im...
robot_connection.py
#! python3 import socket import threading import select import queue class RobotConnection(object): """ Create a RobotConnection object with a given robot ip. """ VIDEO_PORT = 40921 AUDIO_PORT = 40922 CTRL_PORT = 40923 PUSH_PORT = 40924 EVENT_PORT = 40925 IP_PORT = 40926 def ...
subproc_vec_env.py
""" Taken from https://github.com/openai/baselines """ from multiprocessing import Process, Pipe import numpy as np from . import VecEnv, CloudpickleWrapper def worker(remote, parent_remote, env_fn_wrapper): parent_remote.close() env = env_fn_wrapper.x() try: while True: cmd, data = ...
sshtun.py
# Copyright (c) 2011 - 2017, Intel Corporation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agre...
util.py
"""Utilities for working with mulled abstractions outside the mulled package.""" import collections import hashlib import logging import re import sys import tarfile import threading from io import BytesIO import packaging.version import requests log = logging.getLogger(__name__) QUAY_REPOSITORY_API_ENDPOINT = "htt...
controller.py
# Copyright Allen Institute for Artificial Intelligence 2017 """ ai2thor.controller Primary entrypoint into the Thor API. Provides all the high-level functions needed to control the in-game agent through ai2thor.server. """ import atexit from collections import deque, defaultdict from itertools import product import ...
lock.py
#!/usr/bin/env python from __future__ import print_function import sys import threading import weakref import time sys.path.append("../") from pysyncobj import SyncObj, replicated, SyncObjConf import asyncio import sys import tornado.web class LockImpl(SyncObj): def __init__(self, selfAddress, partnerAddrs, aut...
ysynth4.py
# -*- coding: utf-8 -*- #!/usr/bin/env python #オリジナルのソースコード/Original Source # https://github.com/YoutechA320U/ysynth4 #ライセンス/Licence # [MIT] https://github.com/YoutechA320U/ysynth4/blob/master/LICENSE ##--リリースノート--## #v1.75[2019/09/07] #スクリーンキーボードを使ってスタンドアロンにWiFiの設定が出来る様になりました. #これで有線LANを用意したり,キーボードとディスプレイを繋いで設定しなくて...
test_signal.py
import unittest from test import support from contextlib import closing import select import signal import socket import struct import subprocess import sys, os, time, errno from test.support.script_helper import assert_python_ok, spawn_python try: import threading except ImportError: threading = None try: ...
Translator.py
import asyncio import json import os import shutil import threading import zipfile import aiohttp import requests from Util import Configuration, GearbotLogging, Emoji LANGS = dict() bot = None def on_ready(bot_in): global bot bot = bot_in load_translations() def load_translations(): directory = os...
__init__.py
#!/usr/bin/env python3 import time import serial from enum import Enum import logging import threading from threading import Thread from .protocol import * _LOGGER = logging.getLogger(__name__) class Gateway(): def __init__(self, port, baudrate=9600, refresh_time=5): """ Argume...
swarm.py
from .tello import Tello from threading import Thread, Barrier from queue import Queue class TelloSwarm: """Swarm library for controlling multiple Tellos simultaneously """ @staticmethod def fromFile(path: str): """Create TelloSwarm from file. The file should contain one IP address per line. Arguments: p...
race.py
from threading import Thread class Counter(object): def __init__(self): self.value = 0 def increment(self): self.value += 1 c = Counter() def go(): for i in range(1000000): c.increment() # Run two threads that increment the counter: t1 = Thread(target=go) t1.start() t2 = Thread(t...
keep_alive.py
from flask import Flask from threading import Thread app = Flask('') @app.route('/') def home(): return "Hello. I am alive!" def run(): app.run(host='0.0.0.0',port=8080) def keep_alive(): t = Thread(target=run) t.start()
base.py
# Copyright 2013 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 # # Unless required by applicable law or agre...
pack.py
import logging import shutil import threading import tkinter as tk from pathlib import Path from tkinter import ttk from PIL import Image, ImageTk from modlunky2.assets.assets import AssetStore from modlunky2.assets.exc import MissingAsset from modlunky2.assets.patcher import Patcher from modlunky2.constants import B...
profiles.py
#!/usr/bin/env python import os import xmlrpclib from SimpleXMLRPCServer import SimpleXMLRPCServer import threading from minidc.roles import * cfd = os.path.dirname(os.path.abspath(__file__)) resdir = os.path.normpath(os.path.join(cfd, "../resources")) webdir = os.path.normpath(os.path.join(cfd, "../websrv")) class...
ur5_reacher_6D.py
# Copyright (c) 2018, The SenseAct Authors. # 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 sys import time import copy import numpy as np import pickle as pkl import baselines.common.tf_util as U from mul...
zahmeethContigFilterServer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from wsgiref.simple_server import make_server import sys import json import traceback import datetime from multiprocessing import Process from getopt import getopt, GetoptError from jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError,\ JSONRPCError, Inva...
test_redis.py
import threading import unittest from time import sleep from uuid import uuid4 from dq.redis import init_redis, Redis class TestRedis(unittest.TestCase): def test_init(self): assert init_redis('redis') assert not init_redis('none') assert not init_redis('faulty_redis') def test_exis...
main_1.py
import time import multiprocessing def deposit(balance, lock): for _ in range(100): time.sleep(0.01) lock.acquire() balance.value += 1 lock.release() def withdraw(balance, lock): for _ in range(100): time.sleep(0.01) lock.acquire() balance.value -= 1 ...
tempmailapi.py
from selenium.common.exceptions import NoSuchElementException from pytempmail.tempmail import TempMail import pytempmail.consts as consts from time import sleep from pytempmail.mail import Mail import logging from threading import Thread from pytempmail.timer import Clock from pytempmail.excep import TimerException, Ma...
Security.py
from time import sleep from time import time import threading import pygame import random import subprocess import hashlib import datetime from Security.SerialReader import SerialReader from Security.PhoneDetect import PhoneDetect from Security.Camera import Camera from Messenger.Messenger import Messenger class Secu...
_test_multiprocessing.py
# # Unit tests for the multiprocessing package # import unittest import unittest.mock import queue as pyqueue import time import io import itertools import sys import os import gc import errno import signal import array import socket import random import logging import subprocess import struct import sysconfig import ...
videocaptureasync.py
import threading import cv2 class VideoCaptureAsync: def __init__(self, src=0, width=640, height=480): self.src = src self.cap = cv2.VideoCapture(self.src) self.cap.set(cv2.CAP_PROP_FRAME_WIDTH, width) self.cap.set(cv2.CAP_PROP_FRAME_HEIGHT, height) self.grabbed, self.fram...
azurecli.py
import json import os import signal import subprocess import sys from io import StringIO from threading import Thread, Timer from azure.cli.core import get_default_cli from fstrings import f from . import telemetry output_io_cls = StringIO def get_query_argument_for_id_and_name(token): return "[?starts_with(@....
ArduinoHandler.py
import serial from sys import stderr import multiprocessing import time from Queue import Queue from collections import Counter import sys import json import logging import threading class ArduinoHandler(multiprocessing.Process): threadLock = threading.Lock() serialPort = serial.Serial() m = multiprocessi...
client.py
import json import base64 import requests import threading from uuid import UUID from os import urandom from time import timezone, sleep from typing import BinaryIO from binascii import hexlify from time import time as timestamp from locale import getdefaultlocale as locale from .lib.util import exceptions, headers, ...
auto_visualizer.py
# Visualizer is for debugging purposes only import logging import math import random import threading import http.server import socketserver import os import re from shapely import wkt import matplotlib.pyplot as plt import mpld3 import screeninfo import tempfile import webbrowser import owlready2 from shapely import ...