source
stringlengths
3
86
python
stringlengths
75
1.04M
grpc_util_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...
ProducerManager.py
from KafkaProducer import KafkaProducer from printer import console_out import threading class ProducerManager: def __init__(self, broker_manager, actor, topic_name): self.broker_manager = broker_manager self.producers = list() self.producer_threads = list() self.actor = actor ...
test_client.py
"""Tests for parallel client.py""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. from __future__ import division import socket from concurrent.futures import Future from datetime import datetime import os import sys from threading import Thread import time try: ...
test_bigquery.py
import unittest import os import json from unittest.mock import patch import threading from test.support import EnvironmentVarGuard from urllib.parse import urlparse from http.server import BaseHTTPRequestHandler, HTTPServer from google.cloud import bigquery from google.auth.exceptions import DefaultCredentialsError ...
builder.py
import os, tempfile, threading, time import common from bibliopixel.builder import Builder from bibliopixel.animation.tests import StripChannelTest from bibliopixel.drivers.simpixel import SimPixel SAVE_FILE = 'save.yml' def run(): common.test_prompt('builder') with tempfile.TemporaryDirectory() as td: ...
vsearch4web.py
from flask import Flask, render_template, request, session from flask import copy_current_request_context from threading import Thread from string import capwords from typing import Any from dbcm import UseDatabase from checker import check_logged_in from vsearch import search4letters #################################...
metadata_widget.py
#!/usr/bin/python # -*- coding:utf-8 -*- import sys import os import io import threading import time import requests from PIL import Image from PyQt5.Qt import * from PyQt5.QtCore import * from PyQt5.QtWidgets import * from PyQt5.QtGui import * from components.modify_widget.metadata_setting import MetadataSetting f...
ioloop_test.py
#!/usr/bin/env python from __future__ import absolute_import, division, print_function, with_statement import contextlib import datetime import functools import socket import sys import threading import time from tornado import gen from tornado.ioloop import IOLoop, TimeoutError from tornado.stack_context import Exc...
trained.py
#/usr/bin/python # -*- coding: utf-8 -*- import io import numpy as np import argparse import cv2 from cv2 import * import picamera import threading from threading import Thread from os import listdir from os.path import isfile, join, isdir import sys import math import time import imutils from imutils.video.pivideost...
ion_gauge.py
# =============================================================================== # Copyright 2011 Jake Ross # # 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/licens...
serial_comm.py
#!/usr/bin/python3 ''' This file handle serial read and write Developed by - SB Components http://sb-components.co.uk ''' import serial import threading import logging from tkinter import messagebox class SerialComm(object): """ Low level serial operations """ log = logging.getLogger('pimecha.serial.SerialCo...
mikiedit.py
import os from threading import Thread from multiprocessing import Process from PyQt5.QtCore import Qt from PyQt5 import QtCore, QtGui, QtWidgets, QtNetwork """ from PyQt4.QtCore import Qt, QDir, QFile, QFileInfo, QMimeData, QIODevice, QTextStream, QUrl from PyQt4.QtGui import QAction, QCursor, QFileDialog, QFont, QTe...
main.py
#!/usr/bin/python3.6 ## # @file main.py # @author Lukas Koszegy # @brief Nacitanie konfiguracie a spustanie hlavnych modulov ## from aggregator import Aggregator import time from sys import exit from manager.manager import TestManager from threading import Thread import logging.config from configparser import ConfigP...
test_server.py
# coding=utf-8 # Copyright 2018-2020 EVA # # 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 ...
train_faster_rcnn_alt_opt.py
#!/usr/bin/env python3 # -------------------------------------------------------- # Faster R-CNN # Copyright (c) 2015 Microsoft # Licensed under The MIT License [see LICENSE for details] # Written by Ross Girshick # -------------------------------------------------------- """Train a Faster R-CNN network using alterna...
batchRunner.py
#!/usr/bin/env python3 """ uses instances to compute frames in "batch" mode """ # pylint: disable=maybe-no-member # standard library modules import argparse import asyncio import collections #import contextlib from concurrent import futures import errno import datetime #import getpass import json import logging #impor...
run_similarity.py
import os from queue import Queue from threading import Thread import pandas as pd import tensorflow as tf import collections import args from bert import tokenization from bert import modeling from bert import optimization # os.environ['CUDA_VISIBLE_DEVICES'] = '1' class InputExample(object): """A single trai...
Ray-Concepts.py
#!/usr/bin/env python # coding: utf-8 # In[ ]: import ray # In[ ]: from typing import * # In[ ]: #tag::pip_pkg_reqs[] runtime_env = {"pip": "requirements.tt"} #end::pip_pkg_reqs[] # In[ ]: #tag::pip_pkg_list[] runtime_env = {"pip": ["bs4"]} #end::pip_pkg_list[] # In[ ]: if False: #tag::ray_obj_st...
wechatbot.py
#!/usr/bin/python3 import itchat,os,threading,requests from apscheduler.schedulers.blocking import BlockingScheduler def kline(symbol): queryurl = f"https://api.huobi.pro/market/history/kline?period=1day&size=1&symbol={symbol}usdt" res_dict = requests.request("GET", queryurl).json() if 'status' in res_dict ...
server.py
from flask import Flask, render_template, session, redirect, url_for, flash, request from flask.ext.script import Manager from flask.ext.bootstrap import Bootstrap from flask.ext.moment import Moment from flask.ext.wtf import Form from wtforms import StringField, SubmitField from wtforms.validators import Require...
plotter.py
# -*- coding: utf-8 -*- """ This module holds the plotting and data-visualization tools. Motto: don't know how it is interpreted? i'll show you! #Plotim example filename = "t2.jpg" win = "test" img = cv2.resize(cv2.imread(filename), (400, 400)) # (height, width) plot = Plotim(win,img) plot.show() """ # http://docs.o...
client.py
import socket import threading from queue import Queue from tkinter import * ##This version of the client does not use OOP IT FUCKING WORKS ##TODO: send a username/alias to server to be shown instead of IP server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) queue = Queue() def error(err): errorWin = Tk() er...
9.Queue.PriorityQueue.py
# coding: utf-8 import Queue import threading class Job(object): def __init__(self,priority, description): self.priority=priority self.description=description print 'New Job:',description return def __cmp__(self, other): return cmp(self.priority, other.p...
adversarial_env_parallel.py
# coding=utf-8 # Copyright 2022 The Google Research 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 applicab...
__init__.py
# Copyright 2013-2014 OpenStack Foundation # # 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 ...
server.py
import socket import threading class Colors: red: str = "\033[31m" blue: str = "\033[34m" green: str = "\033[32m" purple: str = "\033[35m" brown: str = "\033[33m" yellow: str = "\033[1;33m" cyan: str = "\033[36m" pink: str = "\033[35;1m" reset: str = "\033[0m" # The port that the...
test_io.py
"""Unit tests for the io module.""" # Tests of io are scattered over the test suite: # * test_bufio - tests file buffering # * test_memoryio - tests BytesIO and StringIO # * test_fileio - tests FileIO # * test_file - tests the file interface # * test_io - tests everything else in the io module # * test_univnewlines - ...
test_dataloader.py
import math import sys import errno import multiprocessing import os import ctypes import faulthandler import torch import gc import time import signal import unittest import itertools import warnings import tempfile from torch import multiprocessing as mp from torch.utils.data import ( ChainDataset, ConcatData...
event_engine.py
# -*- coding: UTF-8 -*- # **********************************************************************************# # File: Event engine # **********************************************************************************# from Queue import Queue, Empty from threading import Thread from utils.error import HandleDataExcep...
block.py
from OpenGL.GL import * import threading import random import time def execute_with_delay(func, delay): threading.Thread(target=lambda: threading.Timer(delay, func).start(), daemon=True).start() class Block: """ Block * Base block class """ def __init__(self, name, renderer): """ ...
utils.py
# -*- coding: utf-8 -*- # Copyright 2012-2021 CERN # # 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 a...
test_util.py
# Copyright 2015 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...
read.py
# Copyright 2022 AI Singapore # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
test_manager.py
import datetime import queue import multiprocessing import pytest from honcho.printer import Message from honcho.manager import Manager from honcho.manager import SYSTEM_PRINTER_NAME HISTORIES = { 'one': { 'processes': {'foo': {}}, 'messages': (('foo', 'start', {'pid': 123}), ...
printer.py
# -*- coding: utf-8 -*- try: import cups except ImportError: cups = None # CUPS is optional import tempfile import threading import collections import os.path as osp import pygame from PIL import Image from xml.etree import ElementTree try: from http.server import HTTPServer, BaseHTTPRequestHandler excep...
test_context.py
import mock import threading from unittest import TestCase from nose.tools import eq_, ok_ from tests.test_tracer import get_dummy_tracer from ddtrace.span import Span from ddtrace.context import Context, ThreadLocalContext from ddtrace.ext.priority import USER_REJECT, AUTO_REJECT, AUTO_KEEP, USER_KEEP class TestTr...
mpvrunner.py
#!/usr/bin/env python # vim:set et sw=4 ts=4 foldmethod=manual foldlevel=99: # ===============================================================================# # MIT License # # ...
routes.py
from . import users_blueprint from flask import render_template, flash, abort, request, current_app, redirect, url_for from .forms import RegistrationForm, LoginForm from project.models import User from project import database, mail from sqlalchemy.exc import IntegrityError from flask import escape from flask_lo...
test_partition.py
import threading import logging import time from multiprocessing import Pool, Process import pytest from utils import utils as ut from common.constants import default_entities, default_fields from common.common_type import CaseLabel TIMEOUT = 120 default_nb = ut.default_nb default_tag = ut.default_tag class TestCrea...
email.py
from threading import Thread from flask import current_app, render_template from flask.ext.mail import Message from . import mail def send_async_email(app, msg): with app.app_context(): mail.send(msg) def send_email(to, subject, template, **kwargs): app = current_app._get_current_object() msg = ...
server.py
# Copyright 2020,2021 Sony Corporation. # Copyright 2021,2022 Sony Group 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 # # Un...
trezor.py
from binascii import hexlify, unhexlify import traceback import sys from electrum_pac.util import bfh, bh2u, versiontuple, UserCancelled from electrum_pac.bitcoin import (b58_address_to_hash160, xpub_from_pubkey, deserialize_xpub, TYPE_ADDRESS, TYPE_SCRIPT, is_address) from electrum_p...
runner.py
#!/usr/bin/env python2 # 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 ...
chatserve.py
# Derrick Li - CS 372 Section 400 - Jul. 29, 2018 # Project 1 - Part 2 of 2: chatserve.py # # A server chat program with basic multi-threading functionality. Pairs with executable compiled from chatclient.c. # USAGE: python3 chatserve_ec.py port # # Citation: Used boilerplate code 'TCPServe.py' from Computer Net...
differential_evolution.py
""" Differential evolution implementation """ import random from collections import OrderedDict import os from hops import hdfs, tensorboard, devices, util from hops.experiment_impl.util import experiment_utils from hops.experiment import Direction import threading import six import time import copy import json imp...
Hci.py
import threading import math import time from . import Emit from .BluetoothHCI import * #from constants import * from .constants2 import * from os import popen import codecs from .Io import * from .HciStatus import * class Hci: STATUS_MAPPER = STATUS_MAPPER def __init__(self): self._events = {} ...
northPole.py
#!/usr/bin/python3 from threading import Thread, Semaphore from time import sleep from random import randint #Signal pattern to control Santa Claus' operation santa = Semaphore(0) #Barrier pattern. One barrier for the elves and another for the reindeer elves = Semaphore(1) reindeerReturning = Semaphore(1) #Mutex p...
key.py
from typing import List, Callable import zipfile import os import time import hashlib from io import BytesIO import threading from axel import Event from keymanager.encryptor import encrypt_data, pad_key, is_encrypt_data, decrypt_data from keymanager.utils import write_file, read_file, read_header, get_md5_data_dir ...
snapraid-runner.py
#!/usr/bin/env python3 import argparse import configparser import logging import logging.handlers import os.path import subprocess import sys import threading import time import traceback from collections import Counter, defaultdict from io import StringIO # Global variables config = None email_log = None def tee_lo...
test_manager.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...
util.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ File: util.py Description: util module for Python SDK sample. """ from threading import Thread import operator import os.path from PIL import Image import wx try: import cognitive_face as CF except ImportError: import sys ROOT_DIR = os.path.dirname(os.pat...
core.py
# -*- coding: utf-8 -*- """ Created on Tue Apr 17 14:13:39 2018 @author: bella Foreground core for 21cmmc """ import logging from os import path from astropy.io import fits import numpy as np from astropy import constants as const from astropy import units as un from powerbox import LogNormalPowerBox, PowerBox from ...
local_pi.py
""" This file is intended to be run on the pi itself and both draws input data from the Input class and displays them in a GUI on the pi itself. A monitor will need to be attached and the pi must be booted to Desktop instead of CLI. """ from Pi.hyper.io import * from tkinter import * from tkinter.ttk import * import th...
conftest.py
# *************************************** # |docname| - pytest fixtures for testing # *************************************** # # To get started on running tests, see tests/README.rst # # These fixtures start the web2py server then submit requests to it. # # **NOTE:** Make sure you don't have another server running, ...
localscene.py
""" Loads scene files to be locally in naali, currently all scene related files need to be copied to naali specific media folders by hand """ import rexviewer as r from circuits import Component from PythonQt.QtUiTools import QUiLoader from PythonQt.QtCore import QFile import window import loader import dotsceneman...
test_threading_handler.py
import threading import unittest import mock from nose.tools import assert_raises from nose.tools import eq_ from nose.tools import raises class TestThreadingHandler(unittest.TestCase): def _makeOne(self, *args): from kazoo.handlers.threading import SequentialThreadingHandler return SequentialThr...
env_runner.py
import collections import logging import os import signal import time from multiprocessing import Value from threading import Thread from typing import List from typing import Union import numpy as np import torch from yarr.agents.agent import Agent from yarr.agents.agent import ScalarSummary from yarr.agents.agent im...
safe_t.py
from binascii import hexlify, unhexlify import traceback import sys from typing import NamedTuple, Any, Optional, Dict, Union, List, Tuple, TYPE_CHECKING from electrum_dash.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException from electrum_dash.bip32 import BIP32Node from electrum_dash import consta...
test_index.py
import logging import time import pdb import copy import threading from multiprocessing import Pool, Process import numpy import pytest import sklearn.preprocessing from utils import * from constants import * uid = "test_index" BUILD_TIMEOUT = 300 field_name = default_float_vec_field_name binary_field_name = default_b...
listener.py
'''Python listener class''' import copy import os import struct import threading import zmq try: from queue import Queue except: from Queue import Queue from pyvoyager.CLICommon import printError from pyvoyager.CLICommon import ERROR_DICT def processNotifMsg(notifMsg, pb_class): '''Parse a serialized no...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
wizard.py
import base64 import random import os import re import time from datetime import datetime import copy import traceback import sys import json from pydispatch import dispatcher from requests import Request, Session #Empire imports from lib.common import helpers from lib.common import agents from lib.common import encry...
mp_test1.py
import multiprocessing as mp import time # https://www.maxlist.xyz/2020/03/15/python-threading/ def main(url, num): print('開始執行', url) time.sleep(2) print('結束', num) url_list1 = ['11111, 1-1-1-1-1'] url_list2 = ['22222, 2-2-2-2-2'] url_list3 = ['33333, 3-3-3-3-3'] # 定義線程 p_list = [] p1 = mp.Process(ta...
scheduler.py
from datetime import datetime from multiprocessing import Queue from threading import Semaphore, Thread, Lock from undine.utils.system import System from undine.utils import logging from time import sleep import subprocess class TaskThread: def __init__(self): self._state = None self._result = 'E...
wurlitzer.py
"""Capture C-level FD output on pipes Use `wurlitzer.pipes` or `wurlitzer.sys_pipes` as context managers. """ from __future__ import print_function __version__ = '2.0.1' __all__ = [ 'pipes', 'sys_pipes', 'sys_pipes_forever', 'stop_sys_pipes', 'Wurlitzer', ] from contextlib import contextmanager ...
test_setup.py
"""Test component/platform setup.""" # pylint: disable=protected-access import asyncio import os from unittest import mock import threading import logging import voluptuous as vol from homeassistant.core import callback from homeassistant.const import ( EVENT_HOMEASSISTANT_START, EVENT_COMPONENT_LOADED) import ho...
main.py
import asyncio import threading from threading import Lock import fasteners class Count(): def __init__(self, filename): self.filename = filename self.count = 0 def get_from_file(self): with open(self.filename, 'r') as f: a = int(f.read()) return a async de...
pyminer.py
#!/usr/bin/python # # Copyright (c) 2011 The Bitcoin developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # import time import json import pprint import hashlib import struct import re import base64 import httplib import...
remind_client.py
from typing import Any, TYPE_CHECKING import time import os import threading import pickle import asyncio import heapq if TYPE_CHECKING: from discord import Message, Client import discord from lib.utils import get_params, friendly_name_of_messageable from lib.config import get_config usage = """```Usage: remind...
collect_tweets.py
#!/usr/bin/env python from urllib import request import urllib.request import config import requests import json import os import re import time from bs4 import BeautifulSoup from tweepy import OAuthHandler, Stream from tweepy.streaming import StreamListener import queue from threading import Thread output = 'tweets...
test_urllib.py
"""Regresssion tests for urllib""" import urllib import httplib import unittest from test import test_support import os import mimetools import tempfile import StringIO def hexescape(char): """Escape char as RFC 2396 specifies""" hex_repr = hex(ord(char))[2:].upper() if len(hex_repr) == 1: hex_rep...
loop_sino.py
import numpy as np from timeit import default_timer as timer import time import warnings from .communicator import rank, mpi_size, get_loop_chunk_slices, get_chunk_slices, mpi_barrier bold='\033[1m' endb= '\033[0m' verboseall = True and (rank == 0) verbose_iter= (1/20) * int(verboseall) # print every 20 iterations d...
gui_control.py
# Importing modules import ntpath from SubtitleSearcher.data.imdb_metadata import search_imdb_by_title from SubtitleSearcher.main import sg, log from SubtitleSearcher.data.movies import GetFileHash, GetFileSize, Movie, titloviComSub import threading import queue # Sets queves to use with threads movieQueve = queue.Qu...
test_dota_r3det_ms.py
# -*- coding:utf-8 -*- from __future__ import absolute_import from __future__ import print_function from __future__ import division import os import sys import tensorflow as tf import cv2 import numpy as np import math from tqdm import tqdm import argparse from multiprocessing import Queue, Process sys.path.append("....
__init__.py
import functools import inspect import os import re import sys import threading import warnings from timeit import default_timer from flask import Flask, Response from flask import request, make_response, current_app from flask.views import MethodViewType from prometheus_client import Counter, Histogram, Gauge, Summar...
example_test.py
# This example code is in the Public Domain (or CC0 licensed, at your option.) # Unless required by applicable law or agreed to in writing, this # software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR # CONDITIONS OF ANY KIND, either express or implied. # -*- coding: utf-8 -*- from __future__ import pri...
grab_debug.py
# coding: utf-8 import os import threading from mock import patch from tests.util import BaseGrabTestCase from tests.util import build_grab, exclude_grab_transport, temp_dir from tests.util import reset_request_counter from grab.error import GrabTimeoutError from grab import Grab from grab import base class TestCoo...
iptestcontroller.py
# -*- coding: utf-8 -*- """IPython Test Process Controller This module runs one or more subprocesses which will actually run the IPython test suite. """ #----------------------------------------------------------------------------- # Copyright (C) 2009-2011 The IPython Development Team # # Distributed under the t...
portscanner.py
import queue import socket import threading from datetime import datetime q = queue.Queue() def scan_port_range(remote_server_ip, start_port, end_port): """ scan a port range for open ports :param remote_server_ip: system to scan :param start_port: start of port range (inclusive) :param end_port:...
AutoUpdateThread.py
# -*- coding: utf-8 -*- import threading import traceback from time import sleep class AutoUpdateThread: def __init__( self, update_function, update_interval=30 * 60, initial_update=True ): self.update_function = update_function self.update_interval = update_interval self.initi...
rem-server.py
#!/usr/bin/env python from __future__ import with_statement import logging import os import re import select import signal import socket import sys import time import threading from SimpleXMLRPCServer import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler from SocketServer import ThreadingMixIn import Queue as StdQueue ...
barman.py
#!/usr/bin/env python ''' The barman. This is a simple script for use on a Raspberry Pi to drive my mini cocktail maker. That maker drives a bunch of INTLLAB 12V DC DIY Peristaltic Liquid Pump Dosing Pumps using a Kootek 8 Channel DC 5V Relay Module hooked up to the GPIO pins. The screen is the standard Pi Found...
notification.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the Apache 2.0 License. import os import threading import socketserver import queue import json from contextlib import contextmanager from loguru import logger as LOG class NotificationServer(socketserver.BaseRequestHandler): def __ini...
test_docxmlrpc.py
from xmlrpc.server import DocXMLRPCServer import http.client import re import sys import threading import unittest def make_request_and_skipIf(condition, reason): # If we skip the test, we have to make a request because # the server created in setUp blocks expecting one to come in. if not conditi...
drowsinessDetector.py
'''**------------------------------DROWSINESS DETECTOR WITH OPENCV/scipy,dlib,imutils-------------------------------**''' from scipy.spatial import distance as dist from imutils.video import VideoStream from imutils import face_utils from threading import Thread import numpy as np import playsound import argparse impo...
__init__.py
from json import loads, dumps from codecs import getincrementaldecoder from time import time from select import select from os import read, environ, get_terminal_size, isatty, write, execvpe, pipe, O_NONBLOCK, waitpid, close from array import array from fcntl import ioctl, fcntl, F_GETFL, F_SETFL from signal import sig...
test_main.py
import sys import asyncio import os import time import threading from signal import SIGINT, SIGTERM from concurrent.futures import ThreadPoolExecutor from aiorun import run, shutdown_waits_for, _DO_NOT_CANCEL_COROS import pytest def kill(sig=SIGTERM, after=0.01): """Tool to send a signal after a pause""" def ...
trainers.py
from threading import Thread from queue import Queue import torch from torch import Tensor import torch.nn as nn import torch.nn.functional as F from torch.utils.data import DataLoader from torchvision.transforms import Compose, Lambda from torch.optim import Adam import tqdm from tqdm import tqdm tqdm.monitor_interv...
gpcrondump.py
#!/usr/bin/env python # # Copyright (c) Greenplum Inc 2008. All Rights Reserved. # from gppylib.mainUtils import addMasterDirectoryOptionForSingleClusterProgram, addStandardLoggingAndHelpOptions, gp, simple_main, \ ExceptionNoStackTraceNeeded, UserAbortedException import os import re impor...
viewer.py
from builder import get_graph, get_dataset, list_entities, list_activities from rdflib import Graph, ConjunctiveGraph from IPython.display import HTML import hashlib import requests import os import SimpleHTTPServer import SocketServer import threading import json import logging from provoviz.views import generate_...
readrssfeed.py
import configparser import feedparser import logging import threading import time import aiy.audio class ReadRssFeed(object): """Reads out headline and summary from items in an RSS feed.""" ####################################################################################### # constructor # config...
barrier_ops_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...
utils.py
# -*- coding: utf-8 -*- {{{ # vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et: # # Copyright 2020, Battelle Memorial Institute. # # 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...
base_crash_reporter.py
# Electrum - lightweight Bitcoin client # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including without limitation the rights to use, copy, modify, merge, # publish...
property.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Apr 4 15:01:32 2019 @author: lordxuzhiyu """ import requests import re import datetime import random import time from random import randint, choice import threading from bs4 import BeautifulSoup as bs url = "http://www.xicidaili.com/nn" headers = { ...
util.py
# # Copyright (C) 2012-2017 The Python Software Foundation. # See LICENSE.txt and CONTRIBUTORS.txt. # import codecs import contextlib import csv import io import json import logging import os import py_compile import re import socket from collections import deque from glob import iglob as std_iglob try: import ssl...
main.py
from spotify import DOWNLOADMP3 as SONGDOWNLOADER import telepot import spotify import requests import threading token = '1904517705:AAEgyezo_Ks5qOJ6ryEt6BZpsa5QoO9j0oQ' bot = telepot.Bot(token) sort = {} def txtfinder(txt): a = txt.find("https://open.spotify.com") txt = txt[a:] return txt def do...
util.py
import threading, xmlrpc.server, xmlrpc.client import argparse, signal, sys, time DEFAULT_HOST = "0.0.0.0" DEFAULT_PORT = 8000 class SimpleServer: def __init__(self, host=DEFAULT_HOST, port=DEFAULT_PORT, verbose=True): # create server listening on host:port self.verbose = verbose self.serv...
vtctl_sandbox.py
# Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
DeusExMachine.py
from random import randrange from PyQt5.QtCore import QThread, pyqtSignal, QObject, pyqtSlot from PyQt5.QtGui import QPixmap from PyQt5.QtWidgets import QLabel from time import sleep from Constants import * from multiprocessing import Queue, Process class DeusExMachine(QLabel): def __init__(self, x, parent): ...