source
stringlengths
3
86
python
stringlengths
75
1.04M
chatbot.py
from chatterbot import ChatBot from chatterbot.trainers import ListTrainer from tkinter import * import pyttsx3 as pp import speech_recognition as s import threading import wikipedia engine = pp.init() voices = engine.getProperty('voices') print(voices) engine.setProperty('voice', voices[1].id) def speak(word): ...
systray.py
import time from threading import Lock, Thread from typing import List from PyQt5.QtCore import QThread, pyqtSignal, QCoreApplication, Qt from PyQt5.QtGui import QIcon from PyQt5.QtWidgets import QSystemTrayIcon, QMenu from bauh import __app_name__ from bauh.core import resource, system from bauh.core.controller impo...
serve_tei_tx_ui.py
import PySimpleGUIQt as sg import tendon.py.edit_settings as es from pathlib import Path import os import threading from tendon.py.serve_tei_transcriptions.serve_tei import launch_tei_viewer as launch # pylint: disable=no-member def layout(settings: dict): tei_repo_frame = [ [sg.I(settings['tei_dir'], ke...
master.py
import argparse import asyncio import ipaddress import psutil import random import time from collections import deque from threading import Thread from typing import Optional, List, Union, Dict, Tuple from quarkchain.cluster.miner import Miner, MiningWork, validate_seal from quarkchain.cluster.p2p_commands import ( ...
older.py
#coding = utf-8 #running in python3.6 import requests import base64 from multiprocessing import Process url_test = 'http://xxxxxxx'#接口 black_w = [ ] black_m = [ ] white_w =[ ] white_m = [ ] yellow_w = [ yellow_m = [ ] bw = [ ] bm = [ ] ww = [ ] wm = ...
main.py
import tkinter import cv2 import PIL.Image,PIL.ImageTk from functools import partial import threading import time import imutils stream =cv2.VideoCapture("clip.mp4") flag=True def play(speed): global flag print(f"You clicked on play. Speed is {speed}") frame1 = stream.get(cv2.CAP_PROP_POS_FRAMES) stream...
sftp_test.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################### # Copyright 2016 Kitware 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 cop...
bridge.py
#!/usr/bin/env python3 # type: ignore import carla # pylint: disable=import-error import time import math import atexit import numpy as np import threading import cereal.messaging as messaging import argparse from common.params import Params from common.realtime import Ratekeeper, DT_DMON from lib.can import can_functi...
run_derive_ckpts.py
# pylint: disable=invalid-name,missing-docstring,redefined-outer-name # -- coding: utf-8 -*- import os import copy import argparse import subprocess import multiprocessing from io import StringIO import yaml GPUs = [0, 1, 2, 3] _HOME_DIR = os.path.abspath(os.path.expanduser(os.environ.get("AWNAS_HOME", "~/awnas"))) ...
co2meter.py
""" Class for reading data from CO2 monitor. (c) Vladimir Filimonov, 2016-2018 E-mail: vladimir.a.filimonov@gmail.com """ try: import hid except AttributeError as e: if 'windll' in e.message: raise ImportError(('Import failed with an error "AttributeError: %s". ' 'Pos...
view.py
import sys import time import cv2 import threading import PySimpleGUI as sg from viewcontroller import wipe_database, face_detection, register, verify, get_registered from utils.constants import ACCESS_DENIED, ACCESS_GRANTED, DB_ACCESS_DENIED, TITLE, SUCCESS, FAIL, NO_FACE, DB_ACCESS_GRANTED, KEEP_IN_FRAME, LOGO, CLOS...
experiment_queue.py
##################################################################### # # # /experiment_queue.py # # # # Copyright 2013, Monash Univ...
ps5.py
# 6.0001/6.00 Problem Set 5 - RSS Feed Filter # Name: # Collaborators: # Time: import feedparser import string import time import threading from project_util import translate_html from mtTkinter import * from datetime import datetime import pytz #----------------------------------------------------------------------...
vm_test.py
import fixtures import re from ipam_test import * from vn_test import * from util import * import time import traceback from fabric.api import env from fabric.api import run from fabric.state import output from fabric.state import connections as fab_connections from fabric.operations import get, put from fabric.context...
emulator_runtime_job.py
# This code is part of Qiskit. # # (C) Copyright IBM 2017, 2018. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivat...
face_lulala_alphaduck_back.py
#!/usr/bin/env python import rospy import cv2 from cv_bridge import CvBridge, CvBridgeError from sensor_msgs.msg import CompressedImage, Image from duckietown_msgs.msg import Segment, SegmentList, Vector2D from line_detector.WhiteBalance import * from visualization_msgs.msg import Marker from geometry_msgs.msg import P...
__init__.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright 2020 Félix Chénier # 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 requ...
plugins_api.py
# coding: utf-8 import psutil import time import os import slemp import re import json import sys reload(sys) sys.setdefaultencoding('utf8') import threading import multiprocessing from flask import request class pa_thread(threading.Thread): def __init__(self, func, args, name=''): ...
gae_handler.py
#!/usr/bin/env python # coding:utf-8 """ GoAgent local-server protocol 3.2 request: POST /_gh/ HTTP/1.1 HOST: appid.appspot.com content-length: xxx http content: 此为body { pack_req_head_len: 2 bytes,#POST 时使用 pack_req_head : deflate{ 此为负载 original request line, original reque...
text_preprocessing.py
# © 2020 Nokia # # Licensed under the BSD 3 Clause license # # SPDX-License-Identifier: BSD-3-Clause # ============================================ import re import time from threading import Thread from traceback import print_exc import spacy from codesearch.stopwords import stopwords def async_fn(f): def wra...
setting.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import ctypes import hashlib import inspect import math import struct import shutil import weakref import array import re import threading import copy import ConfigParser import time import wx import pygame import pygame.locals i...
energy_dataset.py
# HAT: Hardware-Aware Transformers for Efficient Natural Language Processing # Hanrui Wang, Zhanghao Wu, Zhijian Liu, Han Cai, Ligeng Zhu, Chuang Gan and Song Han # The 58th Annual Meeting of the Association for Computational Linguistics (ACL), 2020. # Paper: https://arxiv.org/abs/2005.14187 # Project page: https://han...
cv.py
#!/usr/bin/env python3 import numpy, sys, io, os, time, threading import scipy.misc from skimage import color, transform from skimage.io import imread from skimage.util import img_as_ubyte from skimage.feature import canny, peak_local_max, corner_fast, corner_foerstner, corner_harris, corner_kitchen_rosenfeld, corner...
server.py
# -*- coding: utf-8 -*- # Python module: ModbusServer class (ModBus/TCP Server) from . import constants as const from .utils import test_bit, set_bit import socket import struct from threading import Lock, Thread # for python2 compatibility try: from socketserver import BaseRequestHandler, ThreadingTCPServer exc...
plot_serial.py
#python 3.6.5 #matplotlib==3.0.3 #numpy==1.16.2 #pyserial==3.4 import time, threading import numpy as np from matplotlib.lines import Line2D import matplotlib.pyplot as plt import matplotlib.animation as animation import serial import pylab import struct import string import time import queue Baud = 115200 ...
custom.py
# pylint: disable=too-many-lines # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -----------------------------------...
CameraReceiverProcess.py
# Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC organizers # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the above copyright notice, ...
video.py
# -*- coding: utf-8 -*- import os import json import struct import hashlib import re import threading from .kodi import xbmc, xbmcvfs, get_bool_setting from . import logger, cache, utils, request __64k = 65536 __longlong_format_char = 'q' __byte_size = struct.calcsize(__longlong_format_char) def __sum_64k_bytes(fil...
java.py
import socketserver import socket import sys import re from threading import Thread import py4j import hail class FatalError(Exception): """:class:`.FatalError` is an error thrown by Hail method failures""" class Env: _jvm = None _gateway = None _hail_package = None _jutils = None _hc = None...
BigFrameTest.py
# Copyright (c) Facebook, Inc. and its affiliates. # # 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 ...
c.py
import sys, socket, select, threading def prompt(user) : sys.stdout.write('%s> ' % user) sys.stdout.flush() if __name__ == "__main__": if len(sys.argv) < 3: print('Usage : python %s user host' % sys.argv[0]) sys.exit() (user, host), port = sys.argv[1:3], 5001 server_sock = socket.s...
Scheduler.py
from CronMatch import cron_match from datetime import datetime from time import sleep from threading import Thread from threading import Lock from threading import Event class Scheduler: _running = False _entries = [] _last_tick = None _tick_thread = None _lock = None fn = None _exit = Non...
async_batch_builder.py
# Copyright 2019-2020 the ProGraML authors. # # Contact Chris Cummins <chrisc.101@gmail.com>. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
base.py
""" Copyright 2019 EUROCONTROL ========================================== Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and...
photo_import.py
import threading from gi.repository import GLib from gi.repository import Gtk class ImportOptions(Gtk.ListBox): def __init__(self): super(ImportOptions, self).__init__() self.set_selection_mode(Gtk.SelectionMode.NONE) copy_photo_row = Gtk.ListBoxRow() copy_photo_box = Gtk.Box( ...
test_PROTON_2116_blocking_connection_object_leak.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...
search_url_tweets.py
""" Iteratively search for tweets containing one of the URLs on in $TWNEWS_DATA/urls.tsv. Store the result in $TWNEWS_DATA/tweets.json. Each tweet json is modified to include two new fields: - url_query: the url (from balance.org) submitted as a search query - url_score: the score for that url (from balance.org) Que...
runserver.py
#!/usr/bin/env python from multiprocessing import Process import subprocess import os import configparser _conf = configparser.ConfigParser() _conf.read('src/deploy.conf') OutIp = _conf.get('host', 'ipaddress') BASEPATH = os.path.dirname(os.path.abspath(__file__)) def startdjango(): os.chdir(os.path.join(BASEPATH...
fgoFunc.py
# Stars Cosmos Gods Animus Antrum Unbirth Anima Animusphere # 星の形.宙の形.神の形.我の形.天体は空洞なり.空洞は虚空なり.虚空には神ありき. # 地を照らし,空に在り,天上の座標を示せ. # カルディアの灯よ. # どうか今一度,旅人の標とならん事を. # ここで,Bgo運営の敗北を宣言する! # . OO---O---O-o\ # . // \ / \ / \ \\ # . OO O O O \\ # . // \ \ / / \ \\ # . oO---O---O--...
__init__.py
from flask import Flask from flask_migrate import Migrate from . import file_monitor import config import threading from .cache import cache migrate = Migrate() def create_app(): """ Application factory method """ app = Flask(__name__) # Add SQLAlchemy configuration to the app config app.c...
ReflectedXSSDetector.py
# coding:utf-8 from http.server import BaseHTTPRequestHandler, HTTPServer from urllib.parse import urlparse, parse_qs, urlencode import threading import time import base64 import html import logging from lib.exceptions import NoRequestsException from selenium import webdriver from browsermobproxy import Server xss_...
system.py
""" Geosoft system functions. .. note:: Regression tests provide usage examples: `Tests <https://github.com/GeosoftInc/gxpy/blob/master/geosoft/gxpy/tests/test_system.py>`_ """ import time import inspect import os import gc import shutil import zipfile import threading import sys from itertools import count impo...
server.py
import errno import http.server import os import socket from socketserver import ThreadingMixIn import ssl import sys import threading import time import traceback import uuid from collections import OrderedDict from queue import Empty, Queue from h2.config import H2Configuration from h2.connection import H2Connection...
app_mt.py
''' Copyright 2020 Xilinx 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 writing, software distr...
multi_wcs.py
# -*- mode: python; coding: utf-8 -*- # Copyright 2020-2021 the AAS WorldWide Telescope project # Licensed under the MIT License. """ Generate tiles from a collection of images with associated WCS coordinate systems. This module has the following Python package dependencies: - astropy - reproject - shapely (to optim...
hangman.py
import random from bs4 import BeautifulSoup import urllib.request import requests def display_hangman(tries): stages = [ """ -------- | | | O | \\|/ | | | / \\ ...
initialize.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import print_function from __future__ import division from __future__ import unicode_literals from ..api import deviot from ..libraries.project_check import ProjectCheck from ..libraries.tools import save_sysetting, g...
test_xla_profiler.py
# Copyright The PyTorch Lightning 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 applicable law or agreed to i...
e2e.py
""" This is an end to end release test automation script used to kick off periodic release tests, running on Anyscale. The tool leverages app configs and compute templates. Calling this script will run a single release test. Example: python e2e.py --test-config ~/ray/release/xgboost_tests/xgboost_tests.yaml --test-...
fsfilemanager.py
import threading import os from PyQt5.QtCore import QThread from util.fslogger import FSLogger from model.fstreeitem import FSTreeItem, FSExtensionType from task.fsfilescannertask import FSFileScannerContext, FSFileScannerTask class FSFileManager(object): _INST_LOCK = threading.Lock() _INSTANCE = None @...
ArnoldRenderTest.py
########################################################################## # # Copyright (c) 2012, John Haddon. All rights reserved. # Copyright (c) 2013, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that ...
test_msvccompiler.py
"""Tests for distutils._msvccompiler.""" import sys import unittest import os import threading from distutils.errors import DistutilsPlatformError from distutils.tests import support from test.support import run_unittest SKIP_MESSAGE = (None if sys.platform == "win32" else "These tests are only for w...
test_generator_mt19937.py
import sys import hashlib import pytest import numpy as np from numpy.linalg import LinAlgError from numpy.testing import ( assert_, assert_raises, assert_equal, assert_allclose, assert_warns, assert_no_warnings, assert_array_equal, assert_array_almost_equal, suppress_warnings) from numpy.random import G...
ServerSide.py
import socket import threading def removeTokenandSendMessage(encryptedmsg): msg = '' for i in range(0, len(encryptedmsg) - 1): msg += encryptedmsg[i] for i in range(0, len(ipA)): server.sendto(msg.encode('utf8'), (ipA[i], ipB[i])) def serverSide(): global ipA, ipB while True: ...
httpserver.py
import json import socket import threading import logging import re from urllib.parse import urlparse from pprint import pprint #from MockHttpRequest import MockHttpRequest #from MockHttpResponse import MockHttpResponse from FileManager import FileManager class MockHttpServer: BUFFER_SIZE = 1024 # 1 KiB #HOST = 'l...
helpers.py
# -*- coding: utf-8 -*- ''' :copyright: Copyright 2013-2017 by the SaltStack Team, see AUTHORS for more details. :license: Apache 2.0, see LICENSE for more details. tests.support.helpers ~~~~~~~~~~~~~~~~~~~~~ Test support helpers ''' # pylint: disable=repr-flag-used-in-string,wrong-import-order ...
numbafollower.py
from multiprocessing import Process from numba import jit import math import time import decimal import os import random @jit def computeit( ): decimal.getcontext().prec = 200 runsize = 1000 x = 0 y = 0 z = 0 face1 = decimal.Decimal(int(0)) face2 = decimal.Decimal(int(0)) face3 = ...
countPersons.py
# -*- coding: utf-8 -*- from ctypes import * import math import random import threading import time #テスト用あとで削除 import darknet import main_test def sample(probs): s = sum(probs) probs = [a/s for a in probs] r = random.uniform(0, 1) for i in range(len(probs)): r = r - probs[i] if r <= 0: ...
logic.py
from random import randint, shuffle import socket from socket import AF_INET, SOCK_STREAM, AF_INET6 from threading import Thread from typing import Any, Dict, Tuple from time import sleep from .abstraction import * from ..WP import ChunckedData, _recv, KillableThread from .util import * class Game: ...
models.py
# -*- coding: utf-8 -*- """ Data models for the Deis API. """ from __future__ import unicode_literals import etcd import importlib import logging import os import re import subprocess import time import threading from django.conf import settings from django.contrib.auth import get_user_model from django.core.excepti...
test_runner.py
#!/usr/bin/env python3 import sys import argparse import subprocess import os import serial import threading import re import time SHORT_OUTPUT_TIMEOUT = 0.25 # timeout for resetting and/or waiting for more lines of output TESTCASE_TIMEOUT = 60 TESTRUNNER_BANNER = "esp-open-rtos test runner." RESET_RETRIES = 10 # r...
winpty.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
installwizard.py
import os import sys import threading import traceback from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * from electrum_axe.wallet import Wallet from electrum_axe.storage import WalletStorage from electrum_axe.util import UserCancelled, InvalidPassword from electrum_axe.base_wizard im...
x.py
import argparse import asyncio import importlib.util import logging from multiprocessing import get_context import os import signal import sys import traceback from typing import Iterable, List, Optional, Text, Tuple import aiohttp import ruamel.yaml as yaml from rasa import telemetry from rasa.cli import SubParsersA...
client.py
""" ZPY Card Game """ import threading import time import zmq from zmq import Context, Socket import arcade import os import argparse import utils import gamestate, clientelements from clientelements import Card, GameFlatButton,ResizableGameFlatButton,GameTextLabel from utils import * from arcade import gui import card...
http_reporter_test.py
import json import threading import tornado.ioloop import tornado.httpserver import tornado.web import Queue from testify import assert_equal, setup_teardown, TestCase from testify.test_runner import TestRunner from testify.plugins.http_reporter import HTTPReporter class DummyTestCase(TestCase): __test__ = False...
main.py
import json import socket import threading import pygame import ball import constants import field import robot pygame.init() screen = pygame.display.set_mode((1200, 600)) # Title and Icon🤖 pygame.display.set_caption('🤖Neon VSS Simulation🤖') icon = pygame.image.load('resources/icon.png') pygame.display.set_icon(...
common.py
import os import threading def threaded(fn): def wrapper(*args, **kwargs): thread = threading.Thread(target=fn, args=args, kwargs=kwargs) thread.start() return thread return wrapper def path_hierarchy(path): hierarchy = os.path.basename(path) try: return { ...
installwizard.py
# Copyright (C) 2018 The Electrum developers # Distributed under the MIT software license, see the accompanying # file LICENCE or http://www.opensource.org/licenses/mit-license.php import os import sys import threading import traceback from typing import Tuple, List, Callable, NamedTuple, Optional from PyQt5.QtCore i...
wsdump.py
#!/Users/alexzisis/Code/Python/apartment-finder/apartment-finder/bin/python3 import argparse import code import sys import threading import time import ssl import six from six.moves.urllib.parse import urlparse import websocket try: import readline except ImportError: pass def get_encoding(): encoding...
music.py
import requests import time import json import re import os from random import randint import threading import youtube_dl import sys import toml from requests_toolbelt import MultipartEncoder, MultipartEncoderMonitor class Uploader: def __init(self, filename, file_host_url): self.filename = filename ...
Battery_notification.py
# use terminal to install """pip install psutil pip install pyttsx3 pip install win10toast""" import psutil import time import pyttsx3 from win10toast import ToastNotifier # also need to install win32api import threading toaster = ToastNotifier() x=pyttsx3.init() x.setProperty('rate',110) x.setPrope...
queues.py
# -*- coding: utf-8 -*- """ logbook.queues ~~~~~~~~~~~~~~ This module implements queue backends. :copyright: (c) 2010 by Armin Ronacher, Georg Brandl. :license: BSD, see LICENSE for more details. """ import json import threading from threading import Thread, Lock import platform from logbook.base ...
SECURITY.py
from tkinter import * from PIL import Image, ImageTk import cv2 import numpy as np import os from os.path import isfile, join from threading import Thread from userHandler import UserData import FACE_UNLOCKER as FU background, textColor = 'white', 'black' face_classifier = cv2.CascadeClassifier('Cascade/haarcascade_fr...
doom_gym.py
import copy import os import random import re import time from os.path import join from threading import Thread import cv2 import gym import numpy as np from filelock import FileLock, Timeout from gym.utils import seeding from vizdoom.vizdoom import ScreenResolution, DoomGame, Mode, AutomapMode from algorithms.utils....
thunder.py
import logging import traceback from time import time, sleep from threading import Thread from multiprocessing import Process import os from os import kill, getpid import os.path from ast import literal_eval import settings from skyline_functions import ( mkdir_p, get_redis_conn, get_redis_conn_decoded, send_grap...
engine.py
# Copyright 2013: Mirantis 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 required b...
upload_wpt_results_test.py
# Copyright 2018 The WPT Dashboard Project. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import BaseHTTPServer import gzip import json import os import shutil import subprocess import sys import tempfile import threading import unittest her...
tweakable-rfi-php.py
#! /usr/bin/env python3 from sys import argv from requests import get from os import path, mkdir, system, remove, rmdir from socketserver import TCPServer from http.server import BaseHTTPRequestHandler from threading import Thread, Timer def main(): if len(argv) != 4: print('Usage: exploit.py target list...
egg_pair.py
# -*- coding: utf-8 -*- # Copyright (c) 2019 - now, Eggroll 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...
cl.py
# -*- coding: UTF-8 -*- import configparser import pyautogui import cv2 import time import winsound import playsound import random import numpy import win32gui import win32con import wmi import tkinter import multiprocessing import os import win32file import struct import requests import re from datetime import datetim...
threadtest.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import arm.arm_controler as ac import arm.servo_controler as sc from core.board import Board from arm.chess_machine import ChessMachine import threading from time import sleep class Dest: def __init__(self): self.st = "prichan" class overall: def test(se...
Rizky.py
#!/usr/bin/python2 # coding=utf-8 ''' DECRYPT BY MAHMUD AZIM (MR. ERROR) ''' import os,re,sys,itertools,time,requests,random,threading,json,random from multiprocessing.pool import ThreadPool from requests.exceptions import ConnectionError reload(sys) sys.setdefaultencoding('utf8') #### LOADING ####...
framework.py
#!/usr/bin/env python3 from __future__ import print_function import gc import sys import os import select import signal import unittest import tempfile import time import faulthandler import random import copy import psutil import platform from collections import deque from threading import Thread, Event from inspect ...
py_utils.py
# Lint as: python3 # Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
protocol.py
# See protocol.hpp for an overview of the protocol import time import struct import sys import threading import traceback #import fibre.utils from fibre.utils import Event, wait_any, TimeoutError import abc if sys.version_info >= (3, 4): ABC = abc.ABC else: ABC = abc.ABCMeta('ABC', (), {}) if sys.version_inf...
is_bst.py
#!/usr/bin/python3 import sys, threading sys.setrecursionlimit(10**9) # max depth of recursion threading.stack_size(2**30) # new thread will get stack of such size result=[] def inordertraversal(tree, root=0): if root ==-1: return inordertraversal(tree, tree[root][1]) result.append(tree[root][0]) inordertrav...
utils.py
import asyncio import atexit import logging import threading from functools import partial, wraps from typing import List _NO_ASYNC = "WHYLOGS_NO_ASYNC" _logger = logging.getLogger(__name__) _threads: List[threading.Thread] = [] def _do_wrap(func): @wraps(func) async def run(*args, loop=None, executor=None...
train_pg_f18.py
""" Original code from John Schulman for CS294 Deep Reinforcement Learning Spring 2017 Adapted for CS294-112 Fall 2017 by Abhishek Gupta and Joshua Achiam Adapted for CS294-112 Fall 2018 by Michael Chang and Soroush Nasiriany """ import numpy as np import tensorflow as tf import gym import logz import os import time im...
zmq_camera.py
import threading import traitlets import sys import zmq import numpy as np import atexit from .camera import Camera def recv_image(socket, dtype, shape): data = socket.recv() buf = memoryview(data) array = np.frombuffer(buf, dtype=dtype) return array.reshape(shape) class ZmqCamera(Camera): ...
test_httplib.py
import errno from http import client import io import itertools import os import array import socket import unittest TestCase = unittest.TestCase from test import support here = os.path.dirname(__file__) # Self-signed cert file for 'localhost' CERT_localhost = os.path.join(here, 'keycert.pem') # Self-signed cert fil...
test_admission_controller.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
context.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...
start.py
from threading import Thread import cv2 from facerecognition.main import main as face from objectrecognition.main import main as object_rec from usb_serial.main import main as usb camera = cv2.VideoCapture(0) face_thread = Thread(target=face, args=(camera,)) object_thread = Thread(target=object_rec, args=(ca...
tcp_test.py
# -*- coding: utf-8 -*- ''' :codeauthor: :email:`Thomas Jackson <jacksontj.89@gmail.com>` ''' # Import python libs from __future__ import absolute_import import os import threading import tornado.gen import tornado.ioloop from tornado.testing import AsyncTestCase import salt.config import salt.utils import salt....
test_core.py
from __future__ import print_function, division, absolute_import import os import time import weakref from collections import MutableMapping from threading import Thread import pytest import skein from skein.exceptions import FileNotFoundError, FileExistsError from skein.test.conftest import (run_application, wait_f...
test_strategy.py
import random import sys import time import threading from typing import * import nni.retiarii.execution.api import nni.retiarii.nn.pytorch as nn import nni.retiarii.strategy as strategy import pytest import torch import torch.nn.functional as F from nni.retiarii import Model from nni.retiarii.converter import convert...
hilo2.py
import threading def worker(count): print ('Este es el %s trabajo que hago hoy' % count) return threads = list() for i in range(3): t = threading.Thread(target=worker, args=(i,)) threads.append(t) t.start()
testweb.py
''' Zed webserver Very basic model of working Webserver @name Zed @author ZaKlaus @version 1.0 @imports socket,re,os @license MIT ''' import socket as bs import re import os.path import os from threading import Thread class Network: def __init__(self, host, port, conn): self.host = host self.port = port ...
joining.py
import time from threading import Thread def print_and_sleep(number): for i in range(number): time.sleep(1) print(i) # Note that args argument must be used for parallelism thread_1 = Thread(target=print_and_sleep, args=(10,)) thread_2 = Thread(target=print_and_sleep, args=(10,)) # By using join...