source
stringlengths
3
86
python
stringlengths
75
1.04M
namespaces.py
import contextlib import ctypes import errno import os import pyroute2 import pytest import signal import multiprocessing # All allowed namespace types NAMESPACE_FLAGS = dict(mnt=0x00020000, uts=0x04000000, ipc=0x08000000, user=0x10000000, ...
face.py
import _thread as thread import ast import io import json import os import sqlite3 import sys import time import warnings from multiprocessing import Process sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), ".")) from shared import SharedOptions if SharedOptions.PROFILE == "windows_native":...
report_positions_in_rmf_coord.py
# Code attribution from https://github.com/osrf/rmf/blob/master/ros2/fleet_adapter_mir/fleet_adapter_mir/fleet_adapter_mir/ import enum import math import time import argparse import json import threading import nudged from datetime import datetime import mir100_client from mir100_client.rest import ApiException from...
test_threaded_import.py
# This is a variant of the very old (early 90's) file # Demo/threads/bug.py. It simply provokes a number of threads into # trying to import the same module "at the same time". # There are no pleasant failure modes -- most likely is that Python # complains several times about module random having no attribute # randran...
main.py
# Copyright 2020 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
apmserver.py
from datetime import datetime, timedelta import json import os import re import shutil import subprocess import sys import threading import time import unittest from urllib.parse import urlparse from elasticsearch import Elasticsearch, NotFoundError import requests # Add libbeat/tests/system to the import path. outpu...
main.py
import time import asyncio import threading import click import os import small from raccoon_src.utils.coloring import COLOR, COLORED_COMBOS from raccoon_src.utils.exceptions import RaccoonException, HostHandlerException from raccoon_src.utils.request_handler import RequestHandler from raccoon_src.utils.logger import ...
skipgramtext8.py
from __future__ import absolutclock deprecatede_import, division, print_function import numpy as np import multiprocessing from multiprocessing import Pool, Array, Process, Value, Manager import random import os import unicodedata import time from io import open num_threads = multiprocessing.cpu_count() start = time....
test_state.py
# -*- coding: utf-8 -*- # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import logging import os import shutil import sys import tempfile import textwrap import threading import time # Import Salt Testing libs from tests.support.case import ModuleCase from tests.support.h...
manager.py
#!/usr/bin/env python3.7 import os import time import sys import fcntl import errno import signal import shutil import subprocess import datetime import textwrap from selfdrive.swaglog import cloudlog, add_logentries_handler from common.basedir import BASEDIR, PARAMS from common.android import ANDROID WEBCAM = os.gete...
slidingwindow.py
# -*- coding: utf-8 -*- import threading import time import bucket OPEN = 0 CLOSE = 1 HALF_OPEN = 2 class SlidingWindow(object): def __init__(self, rate, period, half_seconds, sample_count, step, threshold_percentage): """ SlidingWindow """ self.rate = rate self.period =...
k8s_api.py
import yaml import time import datetime import threading import os import re import string import urllib from base64 import b64encode from datetime import timezone from jinja2 import Environment, FileSystemLoader, select_autoescape from kubernetes import client, config from portal import logger from portal import app ...
__init__.py
import http.server import json import webbrowser import socket from abstractions import * from utils import distance def draw_map(centroids, restaurants, ratings): """Write a JSON file containing inputs and load a visualization. Arguments: centroids -- A sequence of positions restaurants -- A sequenc...
scrapers.py
#!/usr/bin/env python3 from scanners import Job from multiprocessing import Process, Queue import os, sys, re, json from os.path import join import collections from log import log from helpers import dict2str debug=True def d(m): if debug: sys.stderr.write("> %s\n"%m) # generic scrape job. is able to run...
build.py
import os, subprocess, threading; sVSCommonTools = os.environ.get("VS120COMNTOOLS", None); assert os.path.isdir(sVSCommonTools), "Cannot find Visual Studio"; gsIDEPath = os.path.normpath(os.path.join(sVSCommonTools, "..", "IDE")); assert os.path.isdir(gsIDEPath), "Cannot find Visual Studio IDE"; gsWDExpressPath ...
strava.py
#!/home/luca/dev/tools/miniconda3/envs/pyscripts/bin/python import http.server import os import socketserver import webbrowser from datetime import datetime from multiprocessing import Process from time import sleep from urllib.parse import urlsplit, parse_qs from stravalib import Client class LogHandler(http.serve...
test_jsonrpc.py
# Copyright (c) 2006-2007 Open Source Applications 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 require...
transaction.py
#!/usr/bin/python3 import functools import re import sys import threading import time from collections import deque from enum import IntEnum from hashlib import sha1 from pathlib import Path from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import black import requests from eth_abi import...
helpers.py
from multiprocessing import Process, Queue from werkzeug.wrappers import Request def make_server(port, handler): from wsgiref.simple_server import make_server, WSGIRequestHandler class QuietHandler(WSGIRequestHandler): def log_request(*args, **kw): pass options = {'handler_class': QuietHandler} return make...
2.py
''' #filter()内置函数 def id_odd(n): return n % 2==0 l=list(filter(id_odd,range(0,15))) print(l) #删除序列中空字符串 def not_empty(s): return s and s.strip() l=list(filter(not_empty,['a','','b',None,'c',' '])) print(l) #用filter求素数 def su(): n=1 while True: n+=2 yield n #n=3 def shaixuan(n): r...
Interfaz.py
try: import tkinter as tk except: import Tkinter as tk import threading import random class Tarjeta(object): """docstring for Tarjeta""" def __init__(self, master = None, coords = None, color = "black", image = None): super(Tarjeta, self).__init__() self.master = master self.coords = coords if (len(self.coo...
Game.py
import time import sys import random import sqlite3 from threading import Thread import pygame.font from files.ui import Bar, Button from files.enemies import * from files.environment_classes import Wall, Floor from files.items import * from files.global_stuff import * from files.units_characteristics import increase...
standalone.py
"""Standalone Authenticator.""" import argparse import collections import logging import random import socket import threading import OpenSSL import six import zope.interface from acme import challenges from acme import crypto_util as acme_crypto_util from acme import standalone as acme_standalone from letsencrypt i...
recording_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 us...
flow_test.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- """Tests for API client and flows-related API calls.""" import io import threading import time from typing import Iterable import zipfile from absl import app from grr_api_client import errors as grr_api_errors from grr_response_core.lib import rdfvalue from grr_respon...
agent_a3c_1.py
#!/usr/bin/env python from __future__ import print_function import numpy as np import cv2 import tensorflow as tf import threading import sys import time import os def MakeDir(path): try: os.makedirs(path) except: pass lab = False load_model = False train = True test_display = False test_wri...
DIIRQ.py
""" NI ELVIS III Digital Input Interrupt Example This example illustrates how to register a digital input interrupt (DI IRQ) on the NI ELVIS III. The program first defines the configuration for the DI IRQ, and then creates a thread to wait for an interrupt. The irq_handler function executes when the DI channel receives...
face_ui.py
from cv2 import circle from cv2 import rectangle from numpy import savez_compressed from PIL import Image, ImageTk from tkinter import Tk, Button, Label, Entry import cv2 import face_utils import numpy as np import PIL import threading import load_dummy_data def CreateDummyDataSet(): trainX, trainy = load_dummy_d...
core.py
# -*- coding: utf-8 -*- u"""SecureTea. Project: ╔═╗┌─┐┌─┐┬ ┬┬─┐┌─┐╔╦╗┌─┐┌─┐ ╚═╗├┤ │ │ │├┬┘├┤ ║ ├┤ ├─┤ ╚═╝└─┘└─┘└─┘┴└─└─┘ ╩ └─┘┴ ┴ Version: 1.1 Module: SecureTea """ # To share mouse gestures import struct import sys import time import threading from securetea import configurations from securet...
merger.py
# -*- coding: utf-8 -*- import threading, io, os, time import gui import CommonVar as cv import subprocess import re import wx from gui.frame_merger import MergerOutputAppendEvent, MergerOutputUpdateEvent SHUTDOWN = False class CustomMethod: def __init__(self, method, format_set): self.method = metho...
SAC_run_v12.py
#!/usr/bin/env python3 import threading, queue import time import os import shutil import numpy as np import math import rospy import tensorflow as tf from sac_v19 import SAC from env_v26 import Test from manipulator_h_base_module_msgs.msg import P2PPose from CheckCollision_v1 import CheckCollision MAX_EPISODES = 100...
ws.py
# -*- coding: utf-8 -*- """This code is not a bit production-ready, just a pimped imitation of uWSGI server behavior """ import logging import time from multiprocessing import Process from wsgiref.simple_server import make_server from ws4py.websocket import WebSocket from ws4py.server.wsgirefserver import WSGIServer, W...
test_errno.py
import unittest, os, errno from ctypes import * from ctypes.util import find_library import threading class Test(unittest.TestCase): def test_open(self): libc_name = find_library("c") if libc_name is not None: libc = CDLL(libc_name, use_errno=True) if os.name == "nt": ...
kb_MiniASMServer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from wsgiref.simple_server import make_server import sys import json import traceback import datetime from multiprocessing import Process from getopt import getopt, GetoptError from jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError,\ JSONRPCError, Inva...
base.py
"""Worker pool executor base classes.""" import os import numbers import threading import time import datetime import pprint import traceback import queue from schema import Or, And, Use from testplan.common.config import ConfigOption, validate_func from testplan.common import entity from testplan.common.remote.remot...
WxLoginHandler.py
#! /usr/bin/python # -*- coding:utf-8 -*- """ Author: AsherYang Email: ouyangfan1991@gmail.com Date: 2018/7/1 Desc: 用于登录运维微信 本类基于wxpy 以及 wechat_sender 同时结合自己weichatutil(私有pypi源) 进行搭建 注意: 1. 后台监听账号需要事先登录 2. 接受者,必须是后台监听的微信号的好友,才能成功发送消息 """ import sys sys.path.append('../') import tornado.web from tornado.web...
test_httpclient.py
#!/usr/bin/env python2 # coding: utf-8 import gc import os import socket import ssl import threading import time import unittest from BaseHTTPServer import BaseHTTPRequestHandler from BaseHTTPServer import HTTPServer from pykit import http from pykit import ututil dd = ututil.dd HOST = '127.0.0.1' PORT = 38002 KB ...
localization_mode.py
#!/usr/bin/env python3 # Copyright 2020, NTRobotics # # 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...
log.py
# Copyright (c) 2016-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import copy import io import logging import os import re import sys import threading import time from typing import List # noqa LOG = logging.get...
multithreading.py
def new_thread(function, *args, **kwargs): """ launches the input 'function' in a separate thread with daemon == True. Explanation: Some threads do background tasks, like sending keepalive packets, or performing periodic garbage collection, or whatever. These are only useful when the main program is runnin...
dataloader_iter.py
# Copyright (c) 2020 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...
functiondict.py
# from abc import ABCMeta, abstractmethod from covertutils.exceptions import * from covertutils.handlers import BaseHandler from covertutils.helpers import defaultArgMerging import marshal, types from threading import Thread # from multiprocessing import Queue try: from queue import Queue # Python 3 except ImportEr...
solution.py
import threading from typing import List, Tuple from solutions.helpers import IntCodeApplication def part_one(data: List[int]) -> int: """Test the Emergency Hull Painting Robot by running its application.""" canvas = {} application = IntCodeApplication( application=data, name="Painting Ap...
launcher.py
import os import threading scriptpath = "C:/Users/..." # MODIFY ME -> this will be the backdoor (clientwin.exe) exepath = "C:/Users/..." # MODIFY ME -> this will be the fron program (minesweeper.exe) backupexe = "C:/Users/..." # MODIFY ME -> this will be bacup.exe or b2.exe def front(): os.startfile(exepath) de...
imudisplay.py
#!/usr/bin/env python3 ''' imudisplay.py - graphical demo of MSPPG Attitude messages Copyright (C) Alec Singer and Simon D. Levy 2015 This code is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either ver...
test_multiprocessing.py
#!/usr/bin/env python # # Unit tests for the multiprocessing package # import unittest import threading import Queue import time import sys import os import gc import signal import array import copy import socket import random import logging # Work around broken sem_open implementations try: import multiprocess...
test_sync.py
import asyncio import threading import time from concurrent.futures import ThreadPoolExecutor from functools import wraps from unittest import TestCase import pytest from asgiref.sync import async_to_sync, sync_to_async @pytest.mark.asyncio async def test_sync_to_async(): """ Tests we can call sync function...
multi-threaded.py
#!/bin/python3 import argparse import multiprocessing as mp import numpy as np from sklearn.preprocessing import LabelEncoder import socket import sys import time import tensorflow as tf import traceback import impute import serialize # disable eager mode -> run in graph mode tf.compat.v1.disable_eager_execution() ...
project.py
#----------------------------------------------------------------------------- # Copyright (c) 2012 - 2021, Anaconda, Inc., and Bokeh Contributors. # All rights reserved. # # The full license is in the file LICENSE.txt, distributed with this software. #-------------------------------------------------------------------...
scheduler.py
import logging from sys import stdout from datetime import datetime from threading import Timer, Thread from django.dispatch import receiver from reminders.models import Reminder, ReminderType from main.utilities import send_reminder_email, create_notification from django.db.models.signals import post_save, pre_delete,...
_ipython_utils.py
"""Utilities for integrating with IPython These functions should probably reside in Jupyter and IPython repositories, after which we can import them instead of having our own definitions. """ from __future__ import print_function import atexit import os try: import queue except ImportError: # Python 2 i...
imgaug.py
from __future__ import print_function, division, absolute_import import random import numpy as np import copy import numbers import cv2 import math from scipy import misc, ndimage import multiprocessing import threading import sys import six import six.moves as sm import os from skimage import draw if sys.version_info...
probe_controller.py
""" The old module responsible for measurement data collection. Currently is not used, was substituted by IVIS. May be plugged back in in the future. """ import time from functools import reduce from multiprocessing.pool import ThreadPool, ApplyResult from typing import List, Tuple, Dict, Optional import threading im...
test_stream_xep_0030.py
import sys import time import threading from sleekxmpp.test import * class TestStreamDisco(SleekTest): """ Test using the XEP-0030 plugin. """ def tearDown(self): self.stream_close() def testInfoEmptyDefaultNode(self): """ Info query result from an entity MUST have at l...
insta.py
#!D:/Python3/python.exe import cgi import re import urllib,urllib.request import time import os import _thread import threading import datetime #os.environ['NO_PROXY'] = 'instagram.com' form = cgi.FieldStorage() # парсинг данных формы l = threading.Lock() #создаём блокировку '''def loadF(newurl, photona...
ray.py
#! /usr/bin/env python # Copyright (c) 2019 Uber Technologies, 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 a...
airplane.py
#!/usr/bin/env python2 """ Basic fixed-wing airplane simulator to test out an intuitive model. This was a thrown-together messy modification of the software in my multicopter repo. """ from __future__ import division from threading import Thread from collections import deque import time import numpy as np; npl = np.l...
meteredwifi4kids.py
# https://github.com/mgthk/meteredwifi4kids # # This program is provided as it, without any warranty. # Thank you for using this program. I hope it works well for you. # Feel free to improve it. # import threading import datetime import time import I2C_LCD_driver from py532lib.i2c import * from py532lib.frame import...
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...
test.py
import random import string import threading import time from multiprocessing.dummy import Pool import pytest from helpers.client import QueryRuntimeException from helpers.cluster import ClickHouseCluster cluster = ClickHouseCluster(__file__) node1 = cluster.add_instance('node1', main_co...
thread_version.py
"""Generate fake useragent using threading. This is only for offering another solution. Not actually called in the published pkg""" import os # import sys import json import random from time import sleep import concurrent.futures from threading import Thread import requests from requests import exceptions from urllib.p...
terminate.py
from multiprocessing import Process import time def myWorker(): t1 = time.time() print(f'Process started at: {t1}') time.sleep(5) myProcess = Process(target=myWorker) print(f'Process {myProcess}') myProcess.start() print('Terminating Process...') myProcess.terminate() myProcess.join() print(f'Process Te...
main.py
#******************************************************************************* # NAME OF THE PROJECT: main.py #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # PURPOSE OF THIS MODULE : # Main input script to execute the heat transfer # project. # #...
etcd_rendezvous.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import json import logging import sys import threading import tim...
getcoredumps.py
#!/usr/bin/env python import getopt import sys import os import time from threading import Thread sys.path.append('.') sys.path.append('lib') from remote.remote_util import RemoteMachineShellConnection from TestInput import TestInputParser def usage(error=None): print("""\ Syntax: getcoredumps.py [options] Opt...
manager.py
import logging logger = logging.getLogger(__name__) logger.debug("Loaded " + __name__) import os import sys import signal from kafka_connector import KafkaConnector import threading class Manager(object): Type = "Manager" def __init__(self, **kwargs): super(Manager, self).__init__() self.behaviour = kwargs.g...
display_grid.py
import threading from time import sleep, time from typing import Callable, Dict, List, Optional from PIL import Image from StreamDeck.Devices.StreamDeck import StreamDeck from StreamDeck.ImageHelpers import PILHelper from StreamDeck.Transport.Transport import TransportError from streamdeck_ui.display.empty_filter imp...
main.py
import os import sys import threading from argparse import ArgumentParser from time import sleep, time import settings as s from environment import BombeRLeWorld, GenericWorld from fallbacks import pygame, tqdm, LOADED_PYGAME from replay import ReplayWorld # Function to run the game logic in a separate thread def ga...
VBS_Rev_Shell_SERVER.py
# https://github.com/bitsadmin/ReVBShell # from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer import cgi import os import sys from Queue import Queue from threading import Thread from shutil import copyfile, rmtree import ntpath PORT_NUMBER = 8080 class myHandler(BaseHTTPRequestHandler): ...
test_threaded_import.py
# This is a variant of the very old (early 90's) file # Demo/threads/bug.py. It simply provokes a number of threads into # trying to import the same module "at the same time". # There are no pleasant failure modes -- most likely is that Python # complains several times about module random having no attribute # randran...
server_mode.py
# -*- coding: utf-8 -*- u"""Server Mode for SecureTea. Project: ╔═╗┌─┐┌─┐┬ ┬┬─┐┌─┐╔╦╗┌─┐┌─┐ ╚═╗├┤ │ │ │├┬┘├┤ ║ ├┤ ├─┤ ╚═╝└─┘└─┘└─┘┴└─└─┘ ╩ └─┘┴ ┴ Author: Abhishek Sharma <abhishek_official@hotmail.com> , Jul 28 2019 Version: 1.5.1 Module: SecureTea """ # Import all the modules necessary for...
transfer.py
#!/usr/bin/env python # # Copyright 2015 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 o...
session_test.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...
main.py
import socket # python3 -m pip install IPy from IPy import IP from threading import Thread """ This is a basic port scanner, when you run it you will be asked for 3 inputs: Enter target(s) to scan (split targets with ','): These are the targets, an example could be: google.com, 192.168.1.1, fac...
sbonly.py
# -*- coding: utf-8 -*- from thrift.transport import TTransport,TSocket,THttpClient,TTransport,TZlibTransport from thrift.protocol import TCompactProtocol,TMultiplexedProtocol,TProtocol from thrift.server import THttpServer,TServer,TProcessPoolServer import lineX from lineX import * from akad.ttypes import * from thrif...
doh-hunter.py
import json import socket import time import sys import configparser import base64 import ipaddress import random import string import os from http.server import HTTPServer, BaseHTTPRequestHandler import logging from threading import Thread from io import BytesIO from parsezeeklogs import ParseZeekLogs ...
cli.py
# Copyright (c) 2017 Sony Corporation. 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 applicabl...
rpc.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright 2020 Alibaba Group Holding Limited. 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...
vcam.py
import cv2 import pyvirtualcam # For making virtual camera from pyvirtualcam import PixelFormat import numpy as np import mediapipe as mp # Face Mesh import multiprocessing # Enables python to run 2 processes at same time import time import speech_recognition as sr # Speech Recognizer import cvzone as cv ## This f...
parallel_sampler.py
import time import datetime from multiprocessing import Process, Queue, cpu_count import torch import numpy as np # from pytorch_transformers import BertModel from transformers import BertModel import dataset.utils as utils import dataset.stats as stats class ParallelSampler(): def __init__(self, data, args, nu...
threads.py
import threading class crackcoinThreader(object): """ Threading class for crackcoin """ def __init__(self): self.threads = [] def startBackgroundThread(self, method, args = False): ''' Start new thread ''' if args: newThread = threading.Thread(target=method, args=args) else: newThread = threading...
rpc_queue_producer.py
#!/usr/bin/env python import pika import uuid import os import time import threading import logging MQ_HOST = os.environ.get('MQ_HOST') class RpcProducer(object): def __init__(self, timeout): self.logger = logging.getLogger(__name__) self.connection = pika.BlockingConnection( pika.Conn...
A3C.py
""" Asynchronous Advantage Actor Critic (A3C), Reinforcement Learning. The BipedalWalker example. Using: tensorflow gym """ import multiprocessing import threading import tensorflow as tf import numpy as np import gym import os import shutil GAME = 'BipedalWalker-v2' OUTPUT_GRAPH = False LOG_DIR = './log' N_WORKER...
core_test.py
# Copyright 2017 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...
run.py
import os import time import logging import threading from functools import wraps import sqlalchemy as sa import ping from db import init_db from app import create_app DB_URL = os.environ.get("DB_URL") ENVIRONMENT = os.environ.get("FLASK_ENV", "development") PING_HOSTS = os.environ.get("PING_HOSTS", "google.com") PI...
prerun.py
"""These are functions we use before we even take pid lock file. They allow updater-supervisor to be suspended for random amount of time or it allows it to wait for internet connection. """ import time import random import typing import subprocess import multiprocessing from . import const, utils def random_sleep(mi...
test_InfluxDBClient.py
import http.server import json import os import threading import unittest from influxdb_client import InfluxDBClient, Point from influxdb_client.client.write_api import SYNCHRONOUS, ASYNCHRONOUS, WriteOptions, WriteType class InfluxDBClientTest(unittest.TestCase): def tearDown(self) -> None: if self.cli...
test_grpc_server_registry.py
import sys import threading import time from dagster import file_relative_path, pipeline, repository from dagster.core.host_representation.grpc_server_registry import ProcessGrpcServerRegistry from dagster.core.host_representation.handle import GrpcServerRepositoryLocationHandle from dagster.core.host_representation.h...
xla_client_test.py
# Copyright 2017 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...
bulk_downloader.py
import os, time, datetime, sys from threading import Thread import requests from time import time, sleep import queue import logging import progressbar class fetchURLs(object): ''' Download and save a list of URLs using parallel connections. A separate session is maintained for each download t...
transport_service.py
# Copyright 2019 Wirepas Ltd licensed under Apache License, Version 2.0 # # See file LICENSE for full license details. # import logging import os from time import time from uuid import getnode from threading import Thread import wirepas_messaging from wirepas_gateway.dbus.dbus_client import BusClient from wirepas_gate...
methods.py
import logging import threading from django.conf import settings from django.contrib import messages from django.contrib.messages import get_messages from django.core.mail import send_mail from django.shortcuts import render from django.test import TestCase from django.utils.crypto import get_random_string # from use...
serial_consumer.py
import time import json import queue import socket import requests import threading from sys import exit from threading import Thread from kafka import KafkaConsumer, KafkaProducer from function_chains_pb2 import ChainState from concurrent.futures import ThreadPoolExecutor # Configuration # Set to True to disable in...
main.py
from pytube import YouTube from tkinter.filedialog import * from tkinter import * from tkinter.messagebox import * from threading import * #total file size container file_size=0 #function for updating percentage while downloading def progress(stream,chunk,file_handle,remaining=None): #fetching percentage of file ...
test_solr.py
# (C) Datadog, Inc. 2010-2017 # All rights reserved # Licensed under Simplified BSD License (see LICENSE) import threading import time from types import ListType import unittest import mock import os from nose.plugins.attrib import attr import logging from aggregator import MetricsAggregator LOG_INFO = { 'log_t...
mta_realtime.py
import gtfs_realtime_pb2, nyct_subway_pb2 import urllib2, contextlib, datetime, copy from operator import itemgetter from pytz import timezone import threading, time import csv, math, json import logging import google.protobuf.message def distance(p1, p2): return math.sqrt((p2[0] - p1[0])**2 + (p2[1] - p1[1])**2) ...
camera_stream.py
import cv2 import os import time from multiprocessing import Process,Queue from tools import Drawing,DrawStatus,Bboxes2JSON class CameraStream: def __init__(self,camera_idx,video_hw=[512,512],show=False,save_dir=""): self._camera_idx=camera_idx self._video_hw=video_hw self._show_bool=show ...
core_test.py
# Copyright 2017 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...
lasthop.py
import os import csv import json import multiprocessing import raw_file_writer import lastfm_user_data as lud from datetime import datetime, timedelta from shared.config import Config # STATS_START_DATE = datetime.today() - timedelta(days=1) STATS_START_DATE = datetime.today() def go(): Lasthop.run...
test_kernel.py
# coding: utf-8 """test the IPython Kernel""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import io import os.path import sys import time import nose.tools as nt from IPython.testing import decorators as dec, tools as tt from ipython_genutils import py3compat...