source
stringlengths
3
86
python
stringlengths
75
1.04M
utils.py
import os import sys import re import yaml import argparse import logging import subprocess import platform import time import io import json import shlex import signal import builtins import requests import progressbar import rfc6266 import locale import codecs from datetime import datetime __all__ = [ 'run_proc...
client.py
import socket import threading name = input("Введите имя: ") # Connecting To Server client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) client.connect(('127.0.0.1', 3415)) def receive(): while True: try: message = client.recv(1024).decode('utf-8') if message == 'NICK': ...
keep_alive.py
from flask import Flask from threading import Thread app = Flask('') @app.route('/') def main(): return """ Currently an error, haven't found it yet. but causes some servers not able to perform commands including the support server, im working on trying to fix it but cannot find the error anyw...
telegramcontroller.py
""" Processing/relaying telegram messages""" import collections import functools import threading import telegram import telegram.bot import telegram.ext from spottelbot import botconfig from spottelbot import botexceptions from spottelbot import spotifycontroller max_message_length = 4096 def __parse_last_arg(par...
handler.py
import argparse from functools import partial import glob import multiprocessing as mp import os from pathlib import Path import random import resource import string import sys import numpy as np from raster_processing import * import rasterio.warp from shapely.geometry import mapping import torch from torch.utils.dat...
main.py
#!/usr/bin/env python # coding=utf-8 # @Author: Manuel Rodriguez <valle> # @Date: 02-May-2017 # @Email: valle.mrv@gmail.com # @Last modified by: valle # @Last modified time: 10-Mar-2018 # @License: Apache license vesion 2.0 import sys import os reload(sys) sys.setdefaultencoding('UTF8') BASE_DIR = os.path.dirnam...
liqui.py
from befh.restful_api_socket import RESTfulApiSocket from befh.exchanges.gateway import ExchangeGateway from befh.market_data import L2Depth, Trade from befh.util import Logger from befh.instrument import Instrument from befh.clients.sql_template import SqlClientTemplate from functools import partial from datetime impo...
train.py
# -*- coding: utf-8 -*- ''' @Time : 2020/05/06 15:07 @Author : Tianxiaomo @File : train.py @Noice : @Modificattion : @Author : @Time : @Detail : ''' import time import logging import os, sys, math import argparse from collections import deque import datetime imp...
1gui_user.py
#!/usr/bin/env python3 import matplotlib matplotlib.use('TkAgg') import socket import os import ast import struct from threading import Thread import random as r import time import datetime as dt import subprocess as sp import paho.mqtt.client as mqtt import matplotlib.pyplot as plt from drawnow import * import smtplib...
test_decoder.py
import os import threading import time import inspect import sys import traceback from avnav_util import AVNUtil from avnav_api import AVNApi allData={} class ApiImpl(AVNApi): def __init__(self): self.patterns = None # type: dict self.prefix='' def log(self, str, *args): print("###LOG### %s%s" % (s...
server.py
import json from tornado.websocket import WebSocketHandler from robot import config, utils, logging, constants, Updater, weatherGet import base64 import requests import tornado.web import tornado.ioloop from tornado import gen import tornado.httpserver import tornado.options import hashlib import threading import asy...
conftest.py
# -*- coding: utf-8 -*- try: from http.server import HTTPServer from http.server import SimpleHTTPRequestHandler except ImportError: from BaseHTTPServer import HTTPServer from SimpleHTTPServer import SimpleHTTPRequestHandler import ssl import tempfile import threading import pytest from hackurllib.c...
goods_review_thread.py
import pandas as pd import requests from lxml import etree import re, time, random, datetime from queue import Queue import threading class Review: headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 \ (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36" ...
monitored_session_test.py
# pylint: disable=g-bad-file-header # 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/LICENS...
test_connection_pooling.py
import threading import timeit import unittest import tests.integration.init_utils as init_utils from onlinepayments.sdk.factory import Factory from tests.integration.init_utils import MERCHANT_ID class ConnectionPoolingTest(unittest.TestCase): """Performs multiple threaded server requests with connection poolin...
Facade.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Facade.py # # Copyright 2010-2015 Jose Riguera Lopez <jriguera@gmail.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # ...
run.py
#!/usr/bin/env python3 try: import eventlet eventlet.monkey_patch() print('Using eventlet') create_thread_func = lambda f: f start_thread_func = lambda f: eventlet.spawn(f) except ImportError: try: import gevent import gevent.monkey gevent.monkey.patch_all() pr...
slideshare_downloader.py
# slideshare downloader from bs4 import BeautifulSoup import requests import itertools import threading import time import sys import urllib.request import img2pdf import os task = False process = "getting the slides " def animate(): for i in itertools.cycle(['|', '/', '-', '\\']): if task: b...
stock_resampler.py
# **************************************************************************** # # # # ::: :::::::: # # stockResampler.py :+: :+: :+: ...
Client.py
import socket import logging import time, datetime import rpyc import psutil, platform from re import finditer from Languages.Server_lang import lang from multiprocessing import Manager from Clients import * from os import listdir from collections import defaultdict try: import Server except Import...
SentenceTransformer.py
import json import logging import os import shutil from collections import OrderedDict from typing import List, Dict, Tuple, Iterable, Type, Union, Callable from zipfile import ZipFile import requests import numpy as np import transformers import torch from numpy import ndarray from torch import nn, Tensor, device from...
spotify_web_helper.py
from json.decoder import JSONDecodeError import logging from random import choices from socket import SOCK_STREAM from string import ascii_lowercase import threading import psutil from psutil import CONN_LISTEN import requests from requests.exceptions import ConnectionError, Timeout __all__ = ('wait_for_helper', 'con...
set_posture.py
#!/usr/bin/env python """ Tool that use to set Baxter into different modes """ import os import rospy import argparse import baxter_interface import yaml from ik_solver import solve_IK import threading import alloy.ros def move_arm_to_pose(limb_name, pose): #create the baxter interface limb_interface = bax...
conftest.py
# Copyright The PyTorch Lightning team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
handler.py
import logging import time from collections import defaultdict from queue import Queue from threading import Thread from kube_hunter.conf import config from kube_hunter.core.types import ActiveHunter, HunterBase from kube_hunter.core.events.types import Vulnerability, EventFilterBase logger = logging.getLogger(__name...
gui.py
# -*- coding: utf-8 -*- """ Created on Sun Feb 2 19:11:28 2020 @author: victor """ from tkinter import * from timeit import default_timer as timer from tkinter import messagebox import threading import copy from sudokucsp import SudokuCSP # if you want to verify that my csp.py does a better job just c...
push_pipe.py
# -*- coding:utf8 -*- # File : push_pipe.py # Author : Jiayuan Mao # Email : maojiayuan@gmail.com # Date : 4/2/17 # # This file is part of TensorArtist. from . import configs, utils from ...core.utils.meta import notnone_property import zmq import threading import queue import contextlib import collections imp...
custom_datablock.py
#!/usr/bin/env python """ Pymodbus Server With Custom Datablock Side Effect -------------------------------------------------------------------------- This is an example of performing custom logic after a value has been written to the datastore. """ # -------------------------------------------------------------------...
simplemonitor.py
import serial import sys from binascii import hexlify import threading def monitor(portname, outfile=sys.stdout, stop_evt=None): data = b"" extra = b"" with serial.Serial(portname, 115200, timeout=0.01) as sp: while True if stop_evt is None else not stop_evt.wait(0): data += sp.read() ...
online_extend.py
#!/usr/bin/python """ (C) Copyright 2020-2022 Intel Corporation. SPDX-License-Identifier: BSD-2-Clause-Patent """ import time import threading from test_utils_pool import add_pool from write_host_file import write_host_file from daos_racer_utils import DaosRacerCommand from dmg_utils import check_system_query_sta...
engine.py
import json import copy import rules import threading import inspect import random import time import datetime import os import sys import traceback def _unix_now(): dt = datetime.datetime.now() epoch = datetime.datetime.utcfromtimestamp(0) delta = dt - epoch return delta.total_seconds() class Closur...
twitch_broker.py
import json import re from dataclasses import dataclass, field from pathlib import Path from threading import Thread from typing import List, Dict from rlbot.agents.base_script import BaseScript from rlbot.utils.game_state_util import GameState, GameInfoState from rlbot_action_client import Configuration, ActionApi, A...
chess.py
from math import inf import pygame_menu import queue import sys import threading import time from board import * from timer import Timer # Initialize Pygame pygame.init() # Fonts FONT = pygame.font.Font(pygame_menu.font.FONT_OPEN_SANS_BOLD, 18) BIG_FONT = pygame.font.Font(pygame_menu.font.FONT_OPEN_SANS...
usage_statistics.py
import atexit import copy import datetime import enum import json import logging import platform import signal import sys import threading import time from functools import wraps from queue import Queue from types import FrameType from typing import Callable, List, Optional import jsonschema import requests from grea...
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...
ViewWinRenderedGrid.py
''' Created on Oct 5, 2010 @author: Mark V Systems Limited (c) Copyright 2010 Mark V Systems Limited, All rights reserved. ''' import os, threading, time, logging from tkinter import Menu, BooleanVar, font as tkFont from arelle import (ViewWinTkTable, ModelDocument, ModelDtsObject, ModelInstanceObject, XbrlConst, ...
test_multiplexer.py
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2018-2019 Fetch.AI Limited # # 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 ...
test_base.py
# Copyright 2014 Scalyr 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, so...
test_runner_local.py
import os import threading import time from unittest import TestCase from galaxy.util import bunch from galaxy.jobs.runners import local from galaxy.jobs import metrics from galaxy import model from tools_support import ( UsesApp, UsesTools ) class TestLocalJobRunner( TestCase, UsesApp, UsesTools ): de...
keep_alive.py
from flask import Flask from threading import Thread app = Flask('') @app.route('/') def home(): return "Hello. The bot is online!" def run(): app.run(host='0.0.0.0',port=8080) def keep_alive(): t = Thread(target=run) t.start()
pytelebot.py
# PoHelper (PoHelper Telegram bot powered by Python) # Copyright (C) 2022 drlorente97.eth <drlorente97@gmail.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/li...
LegsControl.py
import time from multiprocessing import Process import navio.pwm import navio.util navio.util.check_apm() SERVO_MIN = 0.700 # ms SERVO_MAX = 1.500 # ms PERIOD = 50 MAX_h1_front = 80 MAX_h1_rear = 130 h1_moving_angle = 70 MIN_h1_front = MAX_h1_front - h1_moving_angle MIN_h1_rear = MAX_h1_rear - h1_moving_angle MI...
GaitGenerator.py
import numpy as np import threading import time import LegTrajectory as lt import IK import TimerIMU as ti import DynamixelController as dc class quadrupedGait(): def __init__(self, _leg_centers, _leg_start_states, _body_h, _leg_up_h, _h_offset, _T, _dt, _classIMU): self.leg_center = _leg_centers ...
utils.py
# encoding: utf-8 from contextlib import contextmanager import cStringIO import os import random from subprocess import Popen, PIPE, call import sys import threading # ======================= GENERAL UTILILITIES ======================= def extract_column(text, column, start=0, sep=None): """ Extracts columns fr...
inference.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Inference Pipeline. """ from __future__ import annotations import os import threading from queue import Queue from typing import Any from typing import Optional from typing import Union import cv2 import numpy as np import torch from torch import Tensor from torchvis...
mass_calibrator.py
# =============================================================================== # Copyright 2013 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...
pomo.py
import threading from pypresence import Presence import time from tkinter import * from tkinter.ttk import * # Creating and connecting presence rpc = Presence(client_id="857867709618061324") rpc.connect() def window(): """ Tkinter window initialisation """ # Create Object root = Tk() # Init...
startDask.py
# original source code is from "Azure Machine Learning examples" repo. # url : https://github.com/Azure/azureml-examples/tree/main/cli/jobs/single-step/dask/nyctaxi import os import argparse import time from dask.distributed import Client, get_task_stream import sys, uuid import threading import subprocess import soc...
wrappers.py
# Copyright 2019 The PlaNet 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 applicable...
io.py
# -*- coding: utf-8 -*- """io functions for ddf files""" import os import shutil import json import threading import time import typing from urllib.parse import urlsplit from io import BytesIO import pandas as pd import requests as req from ddf_utils.str import format_float_digits from ddf_utils.package import get_d...
ddos.py
import requests,cfscrape,socks,os,sys,urllib,socket,random,time,threading,ssl import urllib3 urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) #import the dependencies for each python version if sys.version_info < (3,0): # Python 2.x import httplib import urllib2 from scapy.config imp...
CommonLogger.py
#!/usr/bin/python # -*- indent-tabs-mode: nil -*- vi: set expandtab: """ECOMP Common Logging library in Python. CommonLogger.py # Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this code except in compliance # ...
scheduler.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- # vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8: # Author: Binux<i@binux.me> # http://binux.me # Created on 2014-02-07 17:05:11 import itertools import json import logging import os import time from collections import deque from six import iteritems, itervalues...
exit.py
""" Exit the program gracefully when certain signals arrive. """ import threading import signal import sys from threading import Thread,Semaphore import collections this = sys.modules[__name__] this.lock = threading.Lock() this.exit_worker = None this.exit_barrier = None this.exit_list = [] this.finish_barrier = No...
patch-stdout.py
#!/usr/bin/env python """ An example that demonstrates how `patch_stdout` works. This makes sure that output from other threads doesn't disturb the rendering of the prompt, but instead is printed nicely above the prompt. """ from __future__ import unicode_literals import threading import time from prompt_toolkit2 im...
pull.py
import contextlib from threading import Thread import zmq from osgar.bus import BusShutdownException import osgar.lib.serialize class Pull: def __init__(self, config, bus): bus.register(*config['outputs']) self.is_bind_set = config.get("bind", False) self.endpoint = config.get('endpoint...
mock.py
import functools from PyQt5 import QtCore from PyQt5.QtWidgets import QMainWindow, QApplication, QAction, qApp from PyQt5.QtCore import pyqtSlot import global_style from frames.frame1.frame1 import Frame1 from frames.frame2.frame2 import Frame2 from frames.frame3.frame3 import Frame3 from frames.frame4.frame4 import ...
server.py
from awidom import utils from awidom.utils import CONFIG from awidom.utils import Ternary import os from platform import system as system_name import PySide.QtCore as QtCore from PySide.QtCore import QDir from PySide.QtCore import QPoint from PySide.QtCore import QSize import PySide.QtGui as QtGui import rand...
pysh.py
#!/usr/bin/env python import time import sys import threading import subprocess import shlex from pcaspy import Driver, SimpleServer prefix = 'MTEST:' pvdb = { 'COMMAND' : { 'type' : 'char', 'count': 128, 'asyn' : True }, 'OUTPUT' : { 'type' : 'char', 'count': 500...
train_cv_multi_gpu.py
import dgl import numpy as np import torch as th import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import dgl.multiprocessing as mp import dgl.function as fn import dgl.nn.pytorch as dglnn import time import argparse import tqdm import traceback import math from dgl.data import RedditDat...
training_threading.py
# Тренировка использования пакета threading import random import time import threading class SolveFactorial: def __init__(self): self.answer = 0 def handler_solve_fact_async(self, fact: int): answer = str(fact) + '! = ' + str(self.solve_fact(fact)) print(answer, end='\n') def so...
video_capture.py
""" Ffmpeg-based video file reader with timestamp support and optional GPU decoding """ import os import re import time import cv2 from typing import Union, Tuple import numpy as np import bisect import subprocess import threading import logging logger = logging.getLogger() class YUV2RGB_GPU(): """ High performanc...
fuse.py
import argparse import logging import os import stat import threading import time from errno import EIO, ENOENT from fuse import FUSE, FuseOSError, LoggingMixIn, Operations from fsspec import __version__ from fsspec.core import url_to_fs logger = logging.getLogger("fsspec.fuse") class FUSEr(Operations): def __...
managers.py
# # Module providing the `SyncManager` class for dealing # with shared objects # # multiprocessing/managers.py # # Copyright (c) 2006-2008, R Oudkerk # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are m...
halo.py
# -*- coding: utf-8 -*- # pylint: disable=unsubscriptable-object """Beautiful terminal spinners in Python. """ from __future__ import absolute_import, unicode_literals import atexit import functools import sys import threading import time import cursor from log_symbols.symbols import LogSymbols from spinners.spinners...
testbatteries.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import shutil import subprocess import sys import threading import time import traceback from queue import Queue, Empty as QEmpty from booltest import egenerator from booltest import common from booltest.booltest_main import * logger = logging.getLogger(__name...
election.py
from __future__ import absolute_import, print_function from kazoo.client import KazooClient import os.path import threading from . import log from . import state ELECTION_PATH = '/dispatch/election' class MasterElection(object): def __init__(self): self.zk = KazooClient(hosts=state.ARGS.zookeeper) ...
_debugger_case_get_thread_stack.py
import threading event_set = False inner_started = False def method(): global inner_started inner_started = True while not event_set: import time time.sleep(.1) t = threading.Thread(target=method) t.start() while not inner_started: import time time.sleep(.1) print('break h...
run.py
with open("./proxies") as f: proxies = f.readlines() from selenium import webdriver from selenium.webdriver.chrome.options import Options import os import time import os import random import threading mem_gib = int(input("How many bots do you want to spawn? (too many will crash your pc/vps): ")) print "\nOkay good,...
installwizard.py
from functools import partial import threading from kivy.app import App from kivy.clock import Clock from kivy.lang import Builder from kivy.properties import ObjectProperty, StringProperty, OptionProperty from kivy.core.window import Window from kivy.uix.button import Button from kivy.utils import platform from kivy...
test_viewer.py
#!/usr/bin/env python3 """ Quick and simple script to see if the viewer is functional. FIXME(ycho): Not an actual test, more like an example. """ import time import numpy as np import functools from abc import abstractmethod, ABC import multiprocessing as mp from tqdm import tqdm import threading import logging from t...
prototype.py
import nltk from nltk.tokenize import RegexpTokenizer import speech_recognition as SpeechRecog import pyaudio from random_word import RandomWords import random import time import threading init_rec = SpeechRecog.Recognizer() score = 0 num_ques = 0 def word_filter(string): # removes punctuation tokenizer = Reg...
test_promise.py
# Copyright 1999-2020 Alibaba Group Holding 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 a...
app.py
# -*- coding: utf-8 -*- """Lambda application to process sending sub-minute events to SNS.""" import re import time import json import threading import boto3 sns = boto3.client('sns') def set_interval(rate): seconds = re.search('rate\((\d+) seconds*\)', rate).group(1) def decorator(function): de...
step_checksum.py
"""Batching file prepare requests to our API.""" import collections import os import shutil import threading import wandb.util from wandb.filesync import step_upload RequestUpload = collections.namedtuple( "RequestUpload", ( "path", "save_name", "artifact_id", "copy", ...
base_crash_reporter.py
# Electrum - lightweight Bitcoin client # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including without limitation the rights to use, copy, modify, merge, # publish...
plot_mode_base.py
from pyglet.gl import * from plot_mode import PlotMode from threading import Thread, Event, RLock from color_scheme import ColorScheme from sympy.core.basic import S from time import sleep class PlotModeBase(PlotMode): """ Intended parent class for plotting modes. Provides base functionality in conjunc...
__main__.py
import threading import sys import os import os.path import platform import subprocess import json import time import requests import logging import netifaces import click from wifi_scanner.oui import load_dictionary, download_oui from wifi_scanner.analysis import analyze_file from wifi_scanner.colors import * def g...
connection.py
# Copyright (c) 2015 Red Hat, 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 ...
vec_envs.py
import numpy as np from gym import spaces # from . import VecEnv from collections import OrderedDict from abc import ABC, abstractmethod import gym import cloudpickle import multiprocessing import pickle class VecEnv(ABC): """ An abstract asynchronous, vectorized environment. Used to batch data from multip...
test_mputil.py
import multiprocessing import time import pytest from itertools import product from astropy.io import fits from astropy.utils.data import get_pkg_data_filename from stsci.tools.mputil import launch_and_wait, best_tile_layout SUPPORTED_START_METHODS = [] for sm in ['spawn', 'fork', 'forkserver']: try: mu...
state.py
# -*- coding: utf-8 -*- ''' Tests for the state runner ''' # Import Python Libs from __future__ import absolute_import import errno import os import shutil import signal import tempfile import textwrap import yaml import threading from salt.ext.six.moves import queue # Import Salt Testing Libs from salttesting import...
train_cv_multi_gpu.py
import dgl import numpy as np import torch as th import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torch.multiprocessing as mp import dgl.function as fn import dgl.nn.pytorch as dglnn import time import argparse import tqdm import traceback import math from _thread import start_ne...
llcm.py
# Copyright (c) 2018 SONATA-NFV, 5GTANGO and Paderborn University # 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 # #...
blockchain.py
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2012 thomasv@ecdsa.org # # 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 witho...
test_tensorflow2_autolog.py
# pep8: disable=E501 import collections import pytest from distutils.version import LooseVersion import numpy as np import pandas as pd import tensorflow as tf from tensorflow.keras import layers import mlflow import mlflow.tensorflow import mlflow.keras from mlflow.utils.autologging_utils import BatchMetricsLogger ...
deep_learning_container.py
# Copyright 2018-2020 Amazon.com, Inc. or its affiliates. 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. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" fil...
test_swf_integration.py
from __future__ import print_function import os import sys import multiprocessing import time import json import uuid import functools import gzip import vcr import vcr.cassette import vcr.errors import vcr.serialize import vcr.request from flowy import restart from flowy import wait from flowy import TaskError from ...
supervisor.py
# Copyright (C) 2016 Nokia Corporation and/or its subsidiary(-ies). import ConfigParser from functools import wraps import importlib from logging import getLogger import os import threading import time import beanstalkc from . import api from . import execution, mail, notification, websocket, database from .instanceh...
cmd.py
# cmd.py # Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors # # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php from __future__ import annotations from contextlib import contextmanager import io import logging import ...
scheduler.py
# coding=utf-8 """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: * repea...
manager.py
import logging import threading import time import traceback from concurrent.futures.thread import ThreadPoolExecutor from dataclasses import dataclass from pathlib import Path from typing import Any, Callable, Dict, Iterator, List, Optional, Set, Tuple from blspy import G1Element from chiapos import DiskProver from ...
demo01.py
# 上下文对象 # threadlocal # 在同一线程中传递值,线程隔离的,保证变量的线程安全 import threading # flask = werkzeug(接受请求) + jinja2(模板) + sqlalchemy(数据库) from werkzeug.local import Local local = threading.local() local.a = 10 l = Local() def aa(i) : # 子线程 #local.a = 20 l.request = i bb() def bb() : print(l.request) #print...
test_modelcontext.py
# Copyright 2020 The PyMC Developers # # 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...
iterators.py
"""Various helpful iterators""" from queue import Empty, Queue from threading import Thread class IteratorWithAggregation: """ An iterable over an iterable which also makes an aggregate of the values available asap It iterates over the iterable in a separate thread. A use case is a generator which ...
scalene_sigqueue.py
import queue import threading class ScaleneSigQueue: def __init__(self, process): self.queue = queue.SimpleQueue() self.process = process self.thread = None self.lock = threading.RLock() # held while processing an item def put(self, item): self.queue.put(item) def...
http.py
#!/usr/bin/env python3 # MIT License # # Copyright (C) 2020, Entynetproject. All Rights Reserved. # # 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 lim...
manager.py
from dataclasses import dataclass import logging import threading import time import traceback from pathlib import Path from typing import Any, Callable, Dict, List, Optional, Set, Tuple from concurrent.futures.thread import ThreadPoolExecutor from blspy import G1Element from chiapos import DiskProver from stai.conse...
plot_from_pp_geop_height_aind_Rain_by_day_18Aug.py
""" Load pp, plot and save 8km difference """ import os, sys #%matplotlib inline #%pylab inline import matplotlib matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab! from matplotlib import rc from matplotlib.font_manager import FontProperties from matplotlib import rcParams from mpl_to...
test_payload.py
# -*- coding: utf-8 -*- ''' :codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)` tests.unit.payload_test ~~~~~~~~~~~~~~~~~~~~~~~ ''' # Import Salt libs from __future__ import absolute_import, print_function, unicode_literals import time import errno import threading # Import Salt Testing libs from t...