source
stringlengths
3
86
python
stringlengths
75
1.04M
functions.py
import threading from neopixel import * import mido import datetime import psutil import time import socket import RPi.GPIO as GPIO def get_ip_address(): s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.connect(("8.8.8.8", 80)) local_ip = s.getsockname()[0] s.close() return local_ip def fin...
http2_connection.py
import Queue import threading import socket import errno import struct from http_common import * from hyper.common.bufsocket import BufferedSocket from hyper.packages.hyperframe.frame import ( FRAMES, DataFrame, HeadersFrame, PushPromiseFrame, RstStreamFrame, SettingsFrame, Frame, WindowUpdateFrame, GoAway...
utils.py
from __future__ import absolute_import, division, print_function from collections import OrderedDict, defaultdict import contextlib import fnmatch import hashlib import json from locale import getpreferredencoding import libarchive import logging import logging.config import mmap import operator import os from os.path...
locators.py
# -*- coding: utf-8 -*- # # Copyright (C) 2012-2015 Vinay Sajip. # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # import gzip from io import BytesIO import json import logging import os import posixpath import re try: import threading except Impo...
test_callback.py
import math import textwrap import sys import pytest import threading import traceback import time import random import numpy as np from numpy.testing import assert_, assert_equal, IS_PYPY from . import util class TestF77Callback(util.F2PyTest): code = """ subroutine t(fun,a) integer a cf2py inten...
solution.py
""" # Sample code to perform I/O: name = input() # Reading input from STDIN print('Hi, %s.' % name) # Writing output to STDOUT # Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail """ # Write your code here import sys import threading from collection...
remote.py
#!/usr/bin/python3 # # Copyright (c) 2021 Beijing Xiaomi Mobile Software Co., Ltd. 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/l...
sources.py
import asyncio import csv import queue import threading import uuid import warnings from datetime import datetime, timezone from typing import List, Optional, Union, Callable, Coroutine, Iterable import pandas from .dtypes import _termination_obj, Event from .flow import Flow, Complete from .utils import url_to_file_...
bot.py
#!/usr/bin/env python3 #Code By Leeon123 #-- Python Bot version v2 --# # Added xor encode traffic # # Improved dos attack code # # New process lock desgin # # More easy for the skid # ############################# import socket import sys import os import time import random import threading import base64 as b64...
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...
imagepanel.py
#!/usr/bin/python ## ## MPlot PlotPanel: a wx.Panel for 2D line plotting, using matplotlib ## import sys import time import os import wx from threading import Thread import numpy as np import matplotlib import matplotlib.cm as cmap from matplotlib.figure import Figure from matplotlib.gridspec import GridSpec from mat...
cleanup.py
""" sentry.runner.commands.cleanup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2015 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import, print_function from datetime import timedelta from uuid import uuid4 import click from djan...
barier.py
from random import randrange from threading import Barrier, Thread from time import ctime, sleep num = 4 # 4 threads will need to pass this barrier to get released. b = Barrier(num) names = ['India', 'Japan', 'USA', 'China'] def player(): name = names.pop() sleep(randrange(2, 5)) print('%s reached the barrier ...
generator.py
# -*- coding: utf-8 -*- """ 模拟生成一组身份证号码区域图片,用来训练神经网络。 """ __author__ = 'gix' import threading import os import shutil import random import sys import getopt from PIL import Image, ImageDraw, ImageFont, ImageEnhance opts, args = getopt.getopt(sys.argv[1:], "r:o:") resource = "./resources" output = "./generated" ...
StreamFileVideo.py
# import the necessary packages from threading import Thread import cv2 import time import logging from CameraSettings import CameraSettings from CameraMemory import CameraMemory """ Implement a File based video stream. Note: for some reason, reading / writing OPENCV cv2.CAP_PROPS* gives an error using Python 3.7 an...
tests.py
""" Unit tests for reverse URL lookups. """ import pickle import sys import threading from admin_scripts.tests import AdminScriptTestCase from django.conf import settings from django.contrib.auth.models import User from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist from django.http import HttpR...
urls.py
# ***************************************************************************** # # Copyright (c) 2020, the pyEX authors. # # This file is part of the pyEX library, distributed under the terms of # the Apache License 2.0. The full license can be found in the LICENSE file. # from __future__ import print_function impor...
lenets.py
from lc.models.torch.lenet5 import lenet5_drop from lc.models.torch.lenet300 import lenet300_classic from lc_for_rank_selection_cvpr2020.utils import AverageMeter, Recorder, format_time, data_loader, compute_acc_loss import torch import time from lc.torch import ParameterTorch as LCParameterTorch, AsIs from torch impor...
kernel.py
from queue import Queue from threading import Thread from ipykernel.kernelbase import Kernel import re import subprocess import tempfile import os import os.path as path import json import shlex import ctypes def rm_nonempty_dir (d): for root, dirs, files in os.walk (d, topdown=False): for name in files:...
single_process.py
from ..args_provider import ArgsProvider import tqdm class SingleProcessRun: def __init__(self): ''' Initialization for SingleProcessRun. Accepted arguments: ``num_minibatch``, ``num_episode``, ``tqdm`` ''' self.args = ArgsProvider( call_from = self, ...
helpers.py
# THIRD PARTY IMPORTS from flask import session from multiprocessing import Process from collections import namedtuple import re import os # LOCAL IMPORTS __all__ = ['mask', 'SecreVault'] class Mask: def __init__(self): self.__p = {} # list of registered mask regex patterns def __c...
supervisor.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...
migration.py
# Copyright 2019 Grakn Labs Ltd # # 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...
using_thread.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' from threading import Thread # pip install pyglet import pyglet def play_song(): song = pyglet.media.load('speak.mp3') song.play() pyglet.app.run() thread = Thread(target=play_song) thread.start() print("Song...")
gen_mask.py
#!/usr/bin/env python # encoding: utf-8 ''' Generate image mask by trained model. Tasks: Input an image file and output a mask image file. @author: Cheng-Lin Li a.k.a. Clark @copyright: 2018 Cheng-Lin Li@Insight AI. All rights reserved. @license: Licensed under the Apache License v2.0. http://www.apache.org/lice...
sdca_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...
wrapper.py
"""Leaf 装饰器函数库""" import time import queue import threading from typing import Callable, NoReturn def thread(function: Callable) -> object: """制造一个新线程执行指定任务""" def params(*args, **kwargs): """接受任务函数的参数""" # 通过线程执行函数 def process(*args, **kwargs): """过程函数包装""" ...
test_cli.py
import datetime import getpass import json import logging import os import re import tempfile import threading import unittest import uuid import pytest from tests.waiter import util, cli @pytest.mark.cli @pytest.mark.timeout(util.DEFAULT_TEST_TIMEOUT_SECS) class WaiterCliTest(util.WaiterTest): @classmethod ...
threading_lock_with.py
#!/usr/bin/env python # encoding: utf-8 # # Copyright (c) 2008 Doug Hellmann All rights reserved. # """Locking via the 'with' statement """ #end_pymotw_header import threading import logging logging.basicConfig(level=logging.DEBUG, format='(%(threadName)-10s) %(message)s', ) de...
idf_monitor.py
#!/usr/bin/env python # # esp-idf serial output monitor tool. Does some helpful things: # - Looks up hex addresses in ELF file with addr2line # - Reset ESP32 via serial RTS line (Ctrl-T Ctrl-R) # - Run "make (or idf.py) flash" (Ctrl-T Ctrl-F) # - Run "make (or idf.py) app-flash" (Ctrl-T Ctrl-A) # - If gdbstub output is...
test_common.py
from __future__ import absolute_import, unicode_literals import pytest import socket from amqp import RecoverableConnectionError from case import ContextMock, Mock, patch from kombu import common from kombu.common import ( Broadcast, maybe_declare, send_reply, collect_replies, declaration_cached, ignore_...
scheduler.py
"""Module that provides a cron-like task scheduler. This task scheduler is designed to be used from inside your own program. You can schedule Python functions to be called at specific intervals or days. It uses the standard 'sched' module for the actual task scheduling, but provides much more: - repeated tasks (at...
generate_training_data.py
from argparse import ArgumentParser from pathlib import Path from tqdm import tqdm, trange from tempfile import TemporaryDirectory import shelve from multiprocessing import Pool from random import random, randrange, randint, shuffle, choice from pytorch_transformers.tokenization_bert import BertTokenizer import numpy ...
sf.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------- # Name: sf # Purpose: Main wrapper for calling all SpiderFoot modules # # Author: Steve Micallef <steve@binarypool.com> # # Created: 03/04/2012 # Copyright: (c) Steve ...
background_thread_factory.py
from typing import Callable from .background_thread import BackgroundThread class BackgroundThreadFactory(object): @staticmethod def new_thread(target): # type: (Callable) -> BackgroundThread return BackgroundThread(target=target)
utils.py
# Copyright 2019 Atalaya Tech, 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, ...
vision.py
#!/usr/bin/env python3 # Author: Steve Lawrence - Ozoid Robotics 2020 - Ozoid Ltd. # import os import time import picamera import numpy as np import cv2 import argparse import io import time import imutils import itertools import rospy from threading import Thread, Lock from flask import Flask, Response from robot5.ms...
job.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # king_phisher/job.py # # 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...
test_queue.py
# Some simple queue module tests, plus some failure conditions # to ensure the Queue locks remain stable. import queue import threading import time import unittest from test import support QUEUE_SIZE = 5 def qfull(q): return q.maxsize > 0 and q.qsize() == q.maxsize # A thread to run a function that unclogs a bl...
_index.py
import asyncio import os import re import shutil from abc import abstractmethod from collections import namedtuple from queue import Empty, Queue from threading import Thread from secedgar.client import NetworkClient from secedgar.exceptions import EDGARQueryError from secedgar.filings._base import AbstractFiling from...
wmd_categorize.py
# -*- coding: utf-8 -*- from __future__ import print_function, unicode_literals import sys reload(sys) sys.setdefaultencoding("utf-8") import os import email import re import json import gensim import codecs import getopt import logging import shutil from nltk.tokenize import word_tokenize, sent_tokenize from gensim.s...
profiling.py
import os import time import threading import psutil import pandas as pd from coconnect.tools.logger import Logger class Profiler: def __init__(self,name=None,interval=0.1): if name == None: name = self.__class__.__name__ else: name = f"{self.__class__.__na...
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 from rasa.exceptions import MissingDependencyException import ruamel.yaml as yaml from...
server.py
#!/usr/bin/env python3 """Server side of MathDraw application should be hosted on $MATHDRAW so the client connects properly """ import socket import os import sys import time from threading import Thread PORT = 8228 MAX_OFFSET = 100 class MathServer(): sfile = dict() sock = None cons = [] def __in...
lunchpad.py
#!/usr/bin/env python3 import datetime import time import turtle import threading import sys import os import multiprocessing import hashlib import platform import argparse import math import atexit # Reads respective csv file and adds the content into a list def get_file_data(filepath): """ Reads respective csv...
wandb_run.py
# # -*- coding: utf-8 -*- from __future__ import print_function import atexit from datetime import timedelta import glob import json import logging import numbers import os import platform import re import sys import threading import time import traceback from types import TracebackType from typing import ( Any, ...
julia.py
import numpy as np from numpy import sin, cos, log from _routines import ffi, lib from threading import Thread, Lock import quaternion def basic_eval(q, a, b, c, max_iter, shape=None): if shape is None: for z in (q, a, b, c): if hasattr(z, 'shape'): if shape is None: ...
eval_v_t_count.py
import numpy as np import os import h5py from multiprocessing import Process, Queue import queue import time import trimesh from sklearn.neighbors import KDTree from utils import remove_useless_and_duplicated_points pred_dir = "samples/" gt_dir = "../objs/" def load_obj(dire): fin = open(dire,'r') lines = ...
main.py
from flask import Flask, request, jsonify, g, json import threading from flask_cors import CORS, cross_origin from src.controllers.dataset_controller import DatasetController from src.controllers.model_controller import ModelController from src.controllers.trained_model_controller import TrainedModelController from sr...
app.py
from datetime import time import logging from flask import Flask, jsonify, request import time from multiprocessing import Process, Value from flask_cors import CORS from flaskext.mysql import MySQL import pymysql import logging import sys from pathlib import Path import uuid import os # initial app set up app = Flask...
basic_gui.py
#!/usr/bin/env python """ Copyright (c) 2015-2018 The University of Tennessee and The University of Tennessee Research Foundation. All rights reserved." This python script is the main script for the basic GUI that just prints data in the terminal. @author Damien Genet...
transport.py
""" A transport layer for communicating with the Agent """ from __future__ import absolute_import, division, print_function, unicode_literals import concurrent import enum import functools import io import json import os import signal import sys from logging import FATAL, WARN from threading import local, Lock, Thread...
service.py
import os import sys import time import socket import signal import threading from datetime import datetime, timedelta import roster CONN_PORT = 3333 def client_thread(connection, client_address): try: print >>sys.stderr, 'connection from', client_address # Receive the data in small chunks and r...
relay_integration.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...
sense_postgresql.py
#!/usr/bin/python from sense_hat import SenseHat from datetime import datetime from time import sleep from threading import Thread import psycopg2 try: conn = psycopg2.connect("dbname='zipcode' user='postgres' host='localhost' password=''") except: print("I am unable to connect to the databse") temp_h=True temp_...
app.py
from __future__ import unicode_literals #backward compatibility for python2 # Module for os or system related stuff import os, sys, threading # Module for HTTP GET import urllib.request # Module for delay from time import sleep # Module for building server from flask import Flask, request, abort from router.router impo...
MAIN_GUI_Thread.py
import sys import threading import time from PyQt5 import QtWidgets, QtGui, QtCore from default.settings.grid_manager import TuplasTabelas from default.settings import SetPaths from default.data_treatment import ExcelToData import sys import pandas as pd from functools import partial from PyQt5.QtWidgets import QTab...
youuuuuuutubedl.py
#!/usr/bin/env python3 # # Author: naisanza@gmail.com import re import os import json import stat import time import psutil import shutil import logging import requests import threading import subprocess import multiprocessing from sys import stdout from queue import Queue from shutil import move from subprocess imp...
mags_mashServer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import datetime import json import os import random as _random import sys import traceback from getopt import getopt, GetoptError from multiprocessing import Process from os import environ from wsgiref.simple_server import make_server import requests as _requests from json...
test_execute.py
# coding: utf-8 from contextlib import contextmanager import re import threading import weakref import sqlalchemy as tsa from sqlalchemy import bindparam from sqlalchemy import create_engine from sqlalchemy import create_mock_engine from sqlalchemy import event from sqlalchemy import func from sqlalchemy import inspe...
xvfb.py
#!/usr/bin/env python # Copyright (c) 2012 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. """Runs tests with Xvfb and Openbox on Linux and normally on other platforms.""" import os import platform import signal import su...
test_request_safety.py
import threading import asyncio import aiohttp_jinja2 from urllib import request from nose.tools import eq_ from aiohttp.test_utils import unittest_run_loop from ddtrace.pin import Pin from ddtrace.provider import DefaultContextProvider from ddtrace.contrib.aiohttp.patch import patch, unpatch from ddtrace.contrib.aio...
screen.py
"""Initialize environments, do pre-screening of power flow cases.""" # noinspection PyUnresolvedReferences,PyPackageRequirements from constants import ENV_DICT, MIN_LOAD_FACTOR_DEFAULT,\ MAX_LOAD_FACTOR_DEFAULT, LOAD_ON_PROBABILITY_DEFAULT,\ LEAD_PF_PROBABILITY_DEFAULT, NUM_TIME_STEPS_DEFAULT,\ NUM_SCENARIO...
airplane.py
import threading import time import algorithm class Airplane(object): ''' Airplane class. Предназначен для хранения промежуточной информации и организации вычислений координат. Метод calculateCoordinates спроектирован для работы в отдельном потоке. По сути, является перемычкой между GUI и Algorithm...
rbk_nas_report.py
#!/usr/bin/python from __future__ import print_function import rubrik_cdm import sys import os import getopt import getpass import urllib3 urllib3.disable_warnings() import datetime import pytz import time import threading try: import queue except ImportError: import Queue as queue import shutil from random ...
client.py
import socket,time,threading,random,sys from win10toast import ToastNotifier from PySide2 import QtCore, QtGui, QtWidgets from PySide2.QtCore import (QCoreApplication, QPropertyAnimation, QDate, QDateTime, QMetaObject, QObject, QPoint, QRect, QSize, QTime, QUrl, Qt, QEvent) from PySide2.QtGui import (QBrush, QColor, QC...
threading_simple_args.py
import threading def worker(num): # Thread worker function print('Worker: %s' % num) threads = [] for i in range(5): """ 'worker' is the function that the worker threads will run when spawned. 'args=(i,)' passes the 'i' variable to the 'worker' function, since tha...
server.py
import socket import threading #those imports where added by luca from matplotlib import pyplot as plt import os from os import path from PyQt5 import QtWidgets, QtCore from pyqtgraph import PlotWidget, plot import pyqtgraph as pg import sys HEADER = 64 # It's header length, it can be change. PORT = 5050 # port n...
futures_tests.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- import os import subprocess from time import * from datetime import * import unittest import ast sys.path.append(os.getenv('SCRIPT_DIR')) from constants import * sys.path.append(os.getenv('CEPS_DIR') + "binance") sys.path.append(os.getenv('CEPS_DIR') + "bybit") from strategy...
task.py
""" Backend task management support """ import itertools import json import logging import os import re import sys import warnings from copy import copy from datetime import datetime from enum import Enum from multiprocessing import RLock from operator import itemgetter from tempfile import gettempdir from threading im...
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...
testserver.py
# import the necessary packages import socket import sys import traceback from threading import Thread import cv2 import pickle import numpy as np import struct ## new import zlib import datetime import time import subprocess import argparse import face_recognition def main(): start_server() def start_server(): ...
A3C.py
import multiprocessing import threading import tensorflow as tf import numpy as np import gym import os import shutil import matplotlib.pyplot as plt import pandas as pd GAME = 'CartPole-v0' OUTPUT_GRAPH = True LOG_DIR = './log' N_WORKERS = multiprocessing.cpu_count() MAX_GLOBAL_EP = 500 GLOBAL_NET_SCOPE = 'Global_Ne...
run_qt.py
import asyncio import datetime import os import copy import json import sys import time import traceback import webbrowser from queue import Queue import qasync import pymongo import requests from constant import Constant import utils from danmaku import Danmaku from danmaku_logger import DanmakuLogger from running_co...
imap.py
# -*- coding: utf-8 -*- """ Display number of unread messages from IMAP account. Configuration parameters: allow_urgent: display urgency on unread messages (default False) cache_timeout: refresh interval for this module (default 60) criterion: status of emails to check for (default 'UNSEEN') debug: log...
parallel_validation.py
# Copyright © 2020 Interplanetary Database Association e.V., # Planetmint and IPDB software contributors. # SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) # Code is Apache-2.0 and docs are CC-BY-4.0 import multiprocessing as mp from collections import defaultdict from planetmint import App from planetmint.lib im...
main.pyw
from PyQt5 import QtCore, QtGui, QtWidgets import time import skimage import skimage.io import skimage.feature import skimage.viewer import sys, os import pyautogui import threading from pynput.mouse import Button, Controller from pynput import keyboard from tkinter import messagebox import tkinter as tk i...
scheduler_job.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...
twisterlib.py
#!/usr/bin/env python3 # vim: set syntax=python ts=4 : # # Copyright (c) 2018 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import contextlib import string import mmap import sys import re import subprocess import select import shutil import shlex import signal import threading import concurrent.fut...
RC.py
from __future__ import print_function import XInput from inputs import get_gamepad import inputs import time import threading import random import vgamepad as vg # Array of the buttons (using 0 for LT and 1 for RT) button = [None] * 10 button = [vg.XUSB_BUTTON.XUSB_GAMEPAD_A, vg.XUSB_BUTTON.XUSB_GAMEPAD_Y, vg.XUSB_BUT...
subproc_env_vec.py
# Inspired from OpenAI Baselines import numpy as np from multiprocessing import Process, Pipe from rl.common.vec_env import VecEnv, CloudpickleWrapper from rl.common.tile_images import tile_images def worker(remote, parent_remote, env_fn_wrapper): parent_remote.close() env = env_fn_wrapper.x() while True:...
main.py
#!/usr/bin/env python import subprocess from flask import Flask from flask import request import requests import time import threading app = Flask(__name__) from scenarios import * kill_container_after = 5 #sec # e.g. /GET/cli/python/docker/1337 @app.route('/GET/<reqtype>/<platform>/<cont>/<int:inp>', methods=['GET'...
simple_recorder.py
""" Simply looks out for Notify events from the chosen smart contract """ import threading from time import sleep from logzero import logger from twisted.internet import reactor, task from neo.contrib.smartcontract import SmartContract from neo.Network.NodeLeader import NodeLeader from neo.Core.Blockchain import Bloc...
watch2.py
from threading import Thread class Watch: """ Watch class to implement a data-observer pattern on the encapsulated data item. The event-handlers/callbacks will be ran when the data is changed/set. """ def __init__(self, data=None): """ Pass constructor the data item to be watched. None by def...
generate_contains_questions.py
import pdb import os import time from generate_questions.episode import Episode import random import numpy as np import h5py import multiprocessing from utils import game_util from utils import py_util from graph import graph_obj from generate_questions.questions import ExistenceQuestion import copy import constants ...
qt.py
#!/usr/bin/env python # # Electrum - Lightweight Bitcoin Client # Copyright (C) 2015 Thomas Voegtlin # # 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...
dbapi.py
# pysqlite2/test/dbapi.py: tests for DB-API compliance # # Copyright (C) 2004-2010 Gerhard Häring <gh@ghaering.de> # # This file is part of pysqlite. # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages # arising from the use of t...
mp2.py
#main process sends data to child process via queue from multiprocessing import Process, Queue import time import sys def f(q,name): stop_flag=0 while True: while not q.empty(): try: data = q.get(False) if data[0] == -1: stop_flag=1 ...
run.py
# coding: utf-8 """ Usage: python [options] Options: -h,--help 显示帮助 -a,--algorithm=<name> 算法, specify the training algorithm [default: ppo] -c,--copys=<n> 指定并行训练的数量, nums of environment copys that collect data in parallel [default: 1] -e,--env=<file> ...
workflow.py
# Copyright (c) 2014-2018, Dr Alex Meakins, Raysect Project # 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, # ...
gmnode.py
from bitarray import bitarray from random import * from time import sleep from threading import Thread from subprocess import call import sys, os, re, datetime from cqc.pythonLib import * ############################## # # QGMNode class derived from CQCConnection, with reg* attributes # class GMNode(): def __ini...
__init__.py
# We import importlib *ASAP* in order to test #15386 import importlib import importlib.util from importlib._bootstrap_external import _get_sourcefile import builtins import marshal import os import platform import py_compile import random import shutil import subprocess import stat import sys import threading import ti...
main.py
# Copyright 2016 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
plugin.py
# Copyright (c) 2015 SONATA-NFV, 2017 5GTANGO # 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 ...
transfer.py
"""Upload and download support for apitools.""" import email.mime.multipart as mime_multipart import email.mime.nonmultipart as mime_nonmultipart import httplib import io import json import mimetypes import os import threading import mimeparse from googlecloudapis.apitools.base.py import exceptions from googleclouda...
_generic.py
# -*- coding: utf-8 -*- from threading import Thread, Lock import traceback import functools from ._keyboard_event import normalize_name try: from queue import Queue except ImportError: from Queue import Queue class GenericListener(object): lock = Lock() def __init__(self): self.handlers = []...
component.py
import logging import os.path import time import kombu import uuid import threading import yaml import jsonschema from jsonschema import Draft202012Validator import importlib import importlib.resources as resources from villas.controller.exceptions import SimulationException class Component: def __init__(self,...
users.py
################# #### imports #### ################# from flask import render_template, url_for from flask_mail import Message from threading import Thread from itsdangerous import URLSafeTimedSerializer from sqlalchemy.exc import SQLAlchemyError from system import app, mail, db from system.portfolio.models import Us...
test_c10d_nccl.py
# Owner(s): ["oncall: distributed"] import copy import math import os import random import signal import sys import tempfile import threading import time from contextlib import contextmanager from datetime import timedelta from itertools import product from unittest import mock import torch import torch.distributed a...
tests.py
from __future__ import unicode_literals from datetime import datetime import threading from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned from django.db import connections, DEFAULT_DB_ALIAS from django.db import DatabaseError from django.db.models.fields import Field from django.db.models....