source
stringlengths
3
86
python
stringlengths
75
1.04M
elasticImporter.py
# -*- coding: utf-8 -*- # encoding=utf8 import sys if sys.version_info >= (3,0,0): long = int import elasticsearch_dsl es_dsl_version = elasticsearch_dsl.__version__ from six import iteritems from elasticsearch import Elasticsearch, helpers from elasticsearch_dsl import * from elasticsearch_dsl.connections import conn...
allAlign.py
#!/usr/bin/python import datetime, time import subprocess, threading import shlex import shutil import os import os.path import sys import tinys3 import glob import urllib.request import boto from boto.s3.key import Key import requests import json import random from time import sleep import time from datetime import da...
util.py
# Electrum - lightweight ZClassic client # Copyright (C) 2011 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 limitation the rights ...
tello.py
# coding=utf-8 import logging import socket import time import threading import cv2 from threading import Thread drones = None client_socket = None class Tello: """Python wrapper to interact with the Ryze Tello drone using the official Tello api. Tello API documentation: [1.3](https://dl-cdn.ryzerobotics...
train_abstractive.py
#!/usr/bin/env python """ Main training workflow """ from __future__ import division import argparse import glob import os import random import signal import time import torch from pytorch_transformers import BertTokenizer import distributed from models import data_loader, model_builder from models.data_loader i...
session.py
""" Module containing Session class for the server as well as game managing utilities. """ from threading import Thread class Session(object): """ Class representing a session. The session is a single established and ongoing connection between two remote players. """ def __init__(self, c1, c2): ...
async.py
#!/usr/bin/env python # encoding: utf8 # # Copyright © Burak Arslan <burak at arskom dot com dot tr>, # Arskom Ltd. http://www.arskom.com.tr # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are ...
sc_parallel.py
''' Parallelization functions, allowing multiprocessing to be used simply. NB: Uses ``multiprocess`` instead of ``multiprocessing`` under the hood for broadest support across platforms (e.g. Jupyter notebooks). Highlights: - ``sc.parallelize()``: as-easy-as-possible parallelization - ``sc.loadbalancer()``: v...
test.py
# coding=utf-8 #开进程的方法一: import os import re import time import random import requests from bs4 import BeautifulSoup from multiprocessing import Process,Pool def test(name): print('%s process starts' % name) print('Run task %s (%s)...' % (name, os.getpid())) time.sleep(1) print('%s process ended\n' % n...
cli.py
# -*- coding: utf-8 -*- """ flask.run ~~~~~~~~~ A simple command line application to run flask apps. :copyright: (c) 2014 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import os import sys from threading import Lock, Thread from functools import update_wrapper import click ...
parser.py
from __future__ import division from bs4 import BeautifulSoup from .robots import RobotsAnalyzer, urlparse from urlparse import urljoin from .UrlFetcher import UrlFetcher, Thread from Queue import Queue from threading import Lock class Parser(object): url_fetcher_lock = Lock() url_fetcher = UrlFetcher() I...
manage.py
from subprocess import Popen, PIPE from queue import Queue, Empty # python 3.x from threading import Thread import sys from time import sleep import atexit import os import tempfile import shutil from .general import Veneer from pathlib import Path # Non blocking IO solution from http://stackoverflow.com/a/4896288 O...
assignment.py
import os import warnings from argparse import ArgumentParser import threading import concurrent.futures from typing import Match import numpy as np from PIL import Image import shutil import os import cv2 blackblankimage = 255 * np.zeros((1080,1920,3), np.uint8) def getFrame(cap): flag, img = cap.read() if(...
currency.py
# coding=utf-8 import traceback import multiprocessing as mp from time import time from functools import partial def run(func, queue, client_name): start_time = time() try: result = func() except BaseException: result = {"error": traceback.format_exc()} queue.put([result, client_nam...
Calistir.py
import sys from PyQt5 import QtWidgets, QtCore from PyQt5.QtGui import QIcon from PyQt5.QtCore import * from NickzscheBot import Ui_MainWindow from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QMessageBox, QShortcut, QFileDialog from selenium import webdriver import time import os from selenium.webdriver....
submit-crab.py
""" Script to submit CRAB jobs https://twiki.cern.ch/twiki/bin/view/CMSPublic/WorkBookCRAB3Tutorial#1_CRAB_configuration_file_to_run """ import os def main(input_datasets="config/crab-datasets.txt"): from CRABClient.UserUtilities import config config = config() from CRABAPI.RawCommand import crabComman...
spark.py
from __future__ import print_function import copy import threading import time import timeit from hyperopt import base, fmin, Trials from hyperopt.base import validate_timeout, validate_loss_threshold from hyperopt.utils import coarse_utcnow, _get_logger, _get_random_id try: from pyspark.sql import SparkSession ...
server.py
from kivy.logger import Logger from threading import Thread from sys import version_info import socket PY = version_info[0] if PY == 3: from queue import Queue, Empty else: from Queue import Queue, Empty class SimpleServer(object): max_clients = None port = None ip = None queue = Queue() c...
pykms_GuiBase.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import sys import threading from time import sleep import tkinter as tk from tkinter import ttk from tkinter import messagebox from tkinter import filedialog import tkinter.font as tkFont from pykms_Server import srv_options, srv_version, srv_config, server_ter...
__init__.py
# -*- coding: utf-8 -*- ''' Set up the Salt integration test suite ''' # Import Python libs from __future__ import absolute_import, print_function import os import re import sys import copy import time import stat import errno import signal import shutil import pprint import atexit import socket import logging import...
depcheck.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2016,2017 Christoph Reiter # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any...
util.py
# -*- coding: utf-8 -*- """ (C) 2014-2019 Roman Sirokov and contributors Licensed under BSD license http://github.com/r0x0r/pywebview/ """ import inspect import json import logging import os import re import sys import traceback from platform import architecture from threading import Thread from uuid import uuid4 i...
passgen.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- import random import tkinter import multiprocessing lowercase_letters = [chr(i) for i in range(ord('a'), ord('z')+1)] uppercase_letters = [chr(i) for i in range(ord('A'), ord('Z')+1)] digits = [chr(i) for i in range(ord('0'), ord('9')+1)] special_characters = ['+', '-', '!',...
unittest.py
#!/usr/bin/python # (c) 2018 Jim Hawkins. MIT licensed, see https://opensource.org/licenses/MIT # Part of Blender Driver, see https://github.com/sjjhsjjh/blender-driver """Blender Driver Application with Python unit test integration. This module is intended for use within Blender Driver and can only be used from withi...
bacnet_scan.py
# -*- coding: utf-8 -*- {{{ # vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et: # # Copyright 2019, 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...
scripts_runner.py
from pyto import Python, PyOutputHelper, ConsoleViewController, EditorViewController, __Class__, ignored_threads_on_crash from time import sleep from console import run_script from rubicon.objc import ObjCClass, objc_method, NSObject, SEL import threading import traceback import stopit import sys import os import ctype...
comm_autobahn.py
from __future__ import print_function import logging import threading from autobahn.twisted.websocket import WebSocketClientFactory from autobahn.twisted.websocket import WebSocketClientProtocol from autobahn.twisted.websocket import connectWS from autobahn.websocket.util import create_url from twisted.internet impor...
observe.py
from threading import Thread from time import sleep, time import numpy from couchbase.bucket import Bucket from couchbase.n1ql import N1QLQuery from decorator import decorator from cbagent.collectors import Latency from cbagent.collectors.libstats.pool import Pool from logger import logger from perfrunner.helpers.mis...
target.py
# Copyright (c) 2018 DDN. All rights reserved. # Use of this source code is governed by a MIT-style # license that can be found in the LICENSE file. import json import re import logging import uuid from collections import namedtuple from chroma_core.lib.cache import ObjectCache from django.db import models, transact...
service.py
# Copyright (c) 2010-2013 OpenStack, LLC. # # 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 ...
real_time_object_detection.py
# USAGE # python real_time_object_detection.py --prototxt MobileNetSSD_deploy.prototxt.txt --model MobileNetSSD_deploy.caffemodel --picamera 1 --time 1 --detections 0 # import the necessary packages from imutils.video import VideoStream from imutils.video import FPS import numpy as np import argparse import imutils im...
create_indexes.py
#!/usr/bin/python __author__ = 'Nitin' import marisa_trie as mt import csv import os.path import marshal as Pickle import threading import commons import preprocessing as pp DEBUG_MODE = False TARGET_INDEX_FILE = '_target_index.marisa' NAME_INDEX_FILE = '_name_index.marisa' COMBINED_NAME_INDEX_FILE = ...
run_bot.py
#===== description =====# """ itoDiscord Copyright (c) 2021 brave99 This software is released under the MIT License. http://opensource.org/licenses/mit-license.php This script is a discord bot that can be a GM of ito game. Required libraly is only "discord.py" Have fun with your BOT!! """ #===== modules =====# import...
gatosRatones_v2.py
import threading import random import time numeroPlatos = 8 #Indica el numero de platos numeroGatos = 8 #Indica la cantidad total de gatos ฅ/ᐠ。ᆽ。ᐟ \ numeroRatones = 13 #Indica el total de ratones ᘛ⁐̤ᕐᐷ ratones=0 #Indica la cantidad de ratones en el cuarto debilidadRatones = 0.05 #Esta variable indica la probabilidad ...
test_discovery_and_monitoring.py
# Copyright 2014-present MongoDB, 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 wri...
evaluate_on_examples.py
import threading from pathlib import Path import lovpy from lovpy.exceptions import PropertyNotHoldsException from lovpy.monitor.wrappers import clear_previous_raised_exceptions EXAMPLES_DIR = "../../examples" LONGEST_ESTIMATED_SCRIPT_RUNTIME = 120. # 120 seconds def evaluate_proving_methods(): valid_script_p...
conjur.py
from .plugin import CredentialPlugin import base64 import os import stat import tempfile import threading from urllib.parse import urljoin, quote_plus from django.utils.translation import ugettext_lazy as _ import requests conjur_inputs = { 'fields': [{ 'id': 'url', 'label': _('Conjur URL'), ...
cbas_utils_v2.py
""" Created on 08-Dec-2020 @author: Umang Very Important Note - All the CBAS DDLs currently run sequentially, thus the code for executing DDLs is hard coded to run on a single thread. If this changes in future, we can just remove this hard coded value. """ import json import urllib import time from threading import T...
Threading.py
# lesson 44 Threading # multiple tasks at one time import threading from queue import Queue import time ## a lock per shared variable or shared function print_lock = threading.Lock() def exampleJob(worker): time.sleep(1.0) with print_lock: print(threading.current_thread().name, worker) ## assignin...
non_shared_substring.py
import sys import suffix_tree from collections import namedtuple import threading # DFS traversal on the tree def dfs_non_shared_substring(stree, node): if len(stree.nodes[node]) == 0: return (-1, 0, False) text_len = (len(stree.text) - 2) // 2 shortest_substr_end = 0 shortest_substr_len = 2001 right_part = ...
BobClientU.py
# Copyright (c) 2016 Gabriel Oliveri (<gabrieloandco@gmail.com>) # # 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,...
status_monitor.py
# =============================================================================== # Copyright 2014 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...
api.py
import threading from typing import Union import jesse.helpers as jh from jesse.models import Order from jesse.services import logger class API: def __init__(self) -> None: self.drivers = {} if not jh.is_live(): self.initiate_drivers() def initiate_drivers(self) -> None: ...
test_local_task_job.py
# -*- coding: utf-8 -*- # # 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 #...
conftest.py
# Copyright (c) 2011 Florian Mounier # Copyright (c) 2011 Anshuman Bhaduri # Copyright (c) 2014 Sean Vig # Copyright (c) 2014-2015 Tycho Andersen # # 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 Soft...
start-VNF-LISTENER_3_from_1.py
#---- Python VM startup for LISTENER_3_from_1 --- import multiprocessing import time import LISTENER_3_from_1 import DECRYPT_3_from_1 import ENCRYPT_1_to_3 import WRITER_1_to_3 processes = [] if __name__ == '__main__': p = multiprocessing.Process(target=LISTENER_3_from_1.startLISTENER_3_from_1) processes.append(p) ...
mavros_vlc_controller.py
#!/usr/bin/env python2 """ Zhiang Chen April 2019 """ import rospy import math import numpy as np from geometry_msgs.msg import PoseStamped, Quaternion, TwistStamped from pymavlink import mavutil from std_msgs.msg import Header from threading import Thread from tf.transformations import quaternion_from_euler from mavr...
Logger.py
# SPDX-License-Identifier: BSD-3-Clause # # Copyright (c) 2021 Vít Labuda. 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...
model.py
import os import logging import sys import time import json import redis import attr import io try: import torch.multiprocessing as mp try: mp.set_start_method('spawn') except RuntimeError: pass except ImportError: import multiprocessing as mp import importlib import importlib.util impor...
my_terminal.py
from enum import Enum from tkinter.ttk import Label, Button, Combobox, Radiobutton, Spinbox import serial from serial.tools import list_ports from tkinter import Tk, StringVar, ttk, messagebox import tkinter as tk import logging import threading import time from utility import Utility from tkinter import scrolledtext ...
rcv_lr_grad_avg.py
import argparse import os import sys import time from torch.multiprocessing import Process sys.path.append("../../") def dist_is_initialized(): if dist.is_available(): if dist.is_initialized(): return True return False def broadcast_average(args, weights): dist.al...
test_poll.py
# Test case for the os.poll() function import os import random import select import _testcapi try: import threading except ImportError: threading = None import time import unittest from test.test_support import TESTFN, run_unittest, reap_threads try: select.poll except AttributeError: raise unittest.S...
node.py
import socket, select, threading, time, string, sys, os, signal from clint.textui import puts, colored, indent from colorama import init, Fore, Style init() class Node(object): busy_nodes = [] infected_nodes=[] count = 0 def __init__(self,port,connected_nodes): sys.stdout.flush() self...
label.py
""" https://github.com/shu681/multiple-label-yolo5 bug报告请联系微信: oo-shu6-oo """ import cv2 from tkinter import * import os, argparse import numpy as np from PIL import Image, ImageDraw, ImageFont from functools import partial winW = 1920 winH = 1080 # pypath = "D:\label-sl" pypath = os.path.dirname(__file__) global img...
driver.py
import os import logging import time import threading import grpc import pickle import base64 from . import nullabletypes_pb2 as types from .eapi_pb2 import * from .wavemq_pb2 import * from .wavemq_pb2_grpc import * from . import xbos_pb2 from . import iot_pb2 from . import system_monitor_pb2 from pyxbos.exceptions im...
demo.py
# Copyright (c) 2021 PaddlePaddle 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 appli...
qt_transformator.py
import sys import time import traceback from PyQt5.QtCore import Qt from threading import Thread import matplotlib.animation as animation import matplotlib.pyplot as plt import numpy as np import pydicom from PyQt5.QtWidgets import * from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas from...
02_tcp_server.py
#!/user/bin/python3 # -*- coding: utf-8 -*- ''' 服务端 ''' import socket import threading import time def tcplink(sock, addr): print('Accept new connection from %s:%s...' % addr) sock.send(b'Welcome!') while True: data = sock.recv(1024) time.sleep(1) if not data or data.decode('u...
remote_websocket.py
# -*- coding: utf-8 -*- from __future__ import print_function import base64 import logging import threading import ssl import websocket import requests import time import json from . import art_mode from . import application from . import websocket_base from .utils import LogIt, LogItWithReturn logger = logging.getLo...
hello.py
from java import jclass import sys import time import imp import threading import inspect import ctypes thread1=None Python2Java = jclass("com.matatalab.matatacode.model.Python2Java") android = Python2Java("python") sys.stdout=android def _async_raise(tid, exctype): tid = ctypes.c_long(tid) if not inspect.isc...
dumping_wrapper_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...
main.py
''' =================== AUTHORED BY LorenzoPixel CrazyDud22 =================== main.py is the only file to run. Contains the main while loop runner for constant connection and manipulation to the Tello Drone. The program is recommended to run in Python 3.9 and above. Please ...
io.py
# # Copyright (C) 2018 Neal Digre. # # This software may be modified and distributed under the terms # of the MIT license. See the LICENSE file for details. # # The DataWriter helper class of this module is based on the TensorFlow # "im2txt" models input pipeline, so here is their license: # # Copyright 2016 The Tensor...
i_pingee_tests.py
# (C) Copyright 2018-2021 Enthought, Inc., Austin, TX # All rights reserved. # # This software is provided without warranty under the terms of the BSD # license included in LICENSE.txt and may be redistributed only under # the conditions described in the aforementioned license. The license # is also available online at...
sqlreview.py
# -*- coding: UTF-8 -*- import simplejson as json import time from threading import Thread from django.db import connection from django.utils import timezone from django.conf import settings from .dao import Dao from .const import Const, WorkflowDict from .sendmail import MailSender from .sendwechat import WechatSen...
player.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author: omi # @Date: 2014-07-15 15:48:27 # @Last Modified by: omi # @Last Modified time: 2015-01-30 18:05:08 ''' 网易云音乐 Player ''' # Let's make some noise from __future__ import ( print_function, unicode_literals, division, absolute_import ) import subprocess imp...
files.py
import sys if not ".." in sys.path: sys.path.insert(0,"..") import module from datetime import datetime import glob import os import time import re import socket from IGD import addPortMapping, delPortMapping, getExternalIpAddress def decode_ip_addr(address_int): """decodes a 32-bit int into IP octets (for DCC use)...
monitor.py
import time from ctypes import c_bool from typing import Optional, List from multiprocessing import Process, Value class MonitorComponent: def run(self): raise NotImplementedError() def shutdown(self): pass class Monitor: """ Generic Monitor that runs in parallel""" def __init__(s...
pcaptools.py
import pandas as pd from scapy.all import * import glob import os import multiprocessing from utils import split_list def pcap_cleaner(dir): """ This method can be used for cleaning pcap files. :param dir: Directory containing the pcap files that should be filtered :return: None """ for fulln...
task.py
from datetime import datetime import threading from time import sleep import socket class STATUS(): START = 1 UPDATE = 2 DEAD = 4 ALIVE = 5 WARNING = 6 TIMEOUT = 8 FINISHED = 9 class Task(object): def get_computer_name(self): # 获取计算机名 hostname = s...
monitor.py
# Copyright 2018 Microsoft Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
cefjs.py
# -*- coding: UTF-8 -*- from cefpython3 import cefpython from threading import Thread, Lock import signal import Queue import wx import os import HTMLParser application_settings = { "cache_path": "/tmp/cef/cache/", "debug": False, "log_severity": cefpython.LOGSEVERITY_WARNING, "log_file": "/tmp/cef/deb...
localstore.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Tests for johnny-cache. Much of johnny cache is designed to cache things forever, and because it aims to keep coherency despite that it's important that it be tested thoroughly to make sure no changes introduce the possibility of stale data in the cache.""" from threa...
server.py
""" Serve 'dank', 'random' request from MgClient with ZMQ. """ import os from gensim.models import KeyedVectors import numpy as np from collections import OrderedDict import re from random import randint import random from lxml import objectify import base64 import json import threading import zmq from .helper import...
app.py
# -*- coding: utf-8 -*- import json import os import re import sys, getopt import threading from warnings import simplefilter from fastapi import FastAPI, HTTPException from fastapi.middleware.cors import CORSMiddleware import uvicorn import ssl from utils import nlp_config from utils import log_util from utils.log_c...
data.py
import threading from functools import wraps from abc import ABCMeta, abstractmethod import numpy as np class DatasetSplit(object): """Represent a dataset split such as training or validation. Is meant to be used as an organized dictionary to help BaseDataLoader """ def __init__(self, name, filepath...
decompress.py
import subprocess as sp from os import listdir from os.path import isfile, join from multiprocessing import Queue, Process import argparse def decompress(queue, unzipped_dir): while not queue.empty(): file = queue.get() print("decompressing {}".format(file)) sp.check_output("unzip -o {} -d {}".format(fi...
base.py
import getpass import os import psycopg2 import pytest import shutil import signal import socket import subprocess import sys import threading import time from functools import wraps BOOTSTRAPPED_BASE = './.pdbbase' INSTALL_FORMAT = './.pdb-%d' class NamedRow(dict): pass class PipelineDB(object): def __init__...
test_logging.py
# Copyright 2001-2021 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, # provided that the above copyright notice appear in all copies and that # both that copyright notice and this permissio...
ezsocket_client.py
""" EZ Socket Client for Python Jordan Zdimirovic - https://github.com/jordstar20001/ez-sockets.git """ import socket, json, threading from typing import Dict, Callable DEBUG = False # TRUE to enable debug console messages #region Helper Functions def get_event_and_content(data): event_end = data.find("\n") ...
config_simulator.py
import os from multiprocessing import Process from os import listdir from os.path import isfile, join input_path = "../input/2018_7.2/" #input_path = "input/2020_7.4/" def arrange_files(input_path): """ Read a directory and organize files to start reading in order """ # Create an empty object to allocate the f...
materialize_with_ddl.py
import time import pymysql.cursors import pytest from helpers.network import PartitionManager import pytest from helpers.client import QueryRuntimeException from helpers.cluster import get_docker_compose_path, run_and_check import random import threading from multiprocessing.dummy import Pool from helpers.test_tools ...
test_result_server_fake.py
# Copyright 2014 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 law or ag...
resources.py
from datetime import datetime, timedelta import time import random import subprocess import os import os.path import time from collections import defaultdict import json import logging import numbers import yaml from django.db import models from django.contrib.auth.models import AbstractUser import pexpect, getpass i...
test_logging.py
# Copyright 2001-2019 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, # provided that the above copyright notice appear in all copies and that # both that copyright notice and this permissio...
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...
run_hill_climb.py
import gym from gym_molecule.envs.molecule import GraphEnv import numpy as np env = gym.make('molecule-v0') # in gym format env.init(data_type='zinc',reward_type='qed',force_final=True) # env.reset() # act = np.array([[0,1,0,0]]) # ob,reward,new,info = env.step(act) # print(reward,new,info['smile']) # print(env.get_o...
server.py
# coding=utf-8 """ This is the server who worker on a lot of machine, it will get a remote call from the client """ from rpyc.utils.server import ThreadedServer from dash_service import WrapService import argparse import logging from net import NetIOCounters from log import Logs import threading import time import ...
btctl.py
import usb1 import sys from binascii import hexlify, unhexlify from threading import Thread, Event, Lock from queue import Queue from struct import pack, unpack from time import sleep from ubtbr.lmp import LMPMaster, LMPSlave, p32, p16, p8 import logging log = logging.getLogger("btctl") log.setLevel(logging.DEBUG) log_...
__init__.py
# Copyright 2019, OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
client_demo.py
from nih_mpd_lib import MPDClient import asyncio import logging # import sys logging.basicConfig(level=logging.DEBUG) # MPDClientLogger = logging.getLogger("nih_mpd_lib.MPDClient") # MPDClientLogger.setLevel(logging.DEBUG) # stdout_stream = logging.StreamHandler(sys.stdout) # MPDClientLogger.addHandler(stdout_stream...
test_events.py
"""Tests for events.py.""" import collections.abc import concurrent.futures import functools import io import os import platform import re import signal import socket try: import ssl except ImportError: ssl = None import subprocess import sys import tempfile import threading import time import errno import uni...
manage.py
import argparse import os import subprocess from multiprocessing import Process import sys BASE_DIR = os.path.dirname(__file__) APP_DESC = """ Crawlab CLI tool. usage: python manage.py [action] action: serve: start all necessary services to run crawlab. This is for quick start, please checkout Deployment guide...
agent.py
import threading import socket import select from baseagent import * # ----------------------------------------------------- # iAgent using UDP sockets and Threading # ----------------------------------------------------- DEFAULT_ADDRESS = ('', 20000) BROADCAST_ADDR = (BROADCAST, DEFAULT_ADDRESS[1]) class Agent(iAg...
dask.py
# pylint: disable=too-many-arguments, too-many-locals # pylint: disable=missing-class-docstring, invalid-name # pylint: disable=too-many-lines """Dask extensions for distributed training. See https://xgboost.readthedocs.io/en/latest/tutorials/dask.html for simple tutorial. Also xgboost/demo/dask for some examples. Th...
test_weakref.py
import gc import sys import unittest import UserList import weakref import operator import contextlib import copy import time from test import test_support # Used in ReferencesTestCase.test_ref_created_during_del() . ref_from_del = None class C: def method(self): pass class Callable...
mainbackend.py
from threading import Timer, Thread from time import time class RepeatedTimer(): def __init__(self, interval, function, func_handle, timelimit = 1e6, countlimit = None, callback = None): # announce interval to class self.interval = interval # announce func handle self.func_handle = func_handle # ann...
gstreamer_sv.py
# Copyright 2019 Google LLC # # 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, ...
videostream.py
import threading import time import logging import cv2 class VideoStream: def __init__(self, source): self.source = source self.stream = cv2.VideoCapture(self.source) self.grabbed, self.frame = None, None self.stopped = False def start(self): t = threading.Thread(ta...
yeelight_device.py
import threading import time from gateway_addon import Device from pkg.yeelight_property import BrightProperty, OnOffProperty, ColorProperty from pkg.yeelight_effects import YeelightEffect from yeelight import Bulb _POLL_INTERVAL = 5 class YeelightDevice(Device): def __init__(self, adapter, _id, ip): ...