source
stringlengths
3
86
python
stringlengths
75
1.04M
__init__.py
#!/usr/bin/python import base64 from binascii import hexlify from cryptography import x509 from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import hashes from distutils.spawn import find_executable from kvirt import common from kvirt.common import error, pprint, warning from...
watcher.py
import dataclasses import multiprocessing from multiprocessing import Queue import os from pathlib import Path import queue import sys import time import signal from typing import * from crosshair.auditwall import engage_auditwall from crosshair.auditwall import opened_auditwall from crosshair.core_and_libs import ana...
pubsub.py
import os, threading class PublishSubscribeBroker: """ Diese Klasse implementiert einen einfachen lokalen Message Broker zur Umsetzung des Publish/Subscribe (oder auch Observer) Patterns. Beliebige Threads kรถnnen รผb er die publish()-Methode beliebige Nachrichten an beliebige Topics senden, wob...
background.py
"""Helpers functions to run log-running tasks.""" from web import utils from web import webapi as web def background(func): """A function decorator to run a long-running function as a background thread.""" def internal(*a, **kw): web.data() # cache it tmpctx = web._context[threading.currentThr...
test_multithread.py
# -*- coding: utf-8 -*- import threading import time def print_workload(node, tasks): print "node id=%d, tasks=%d" % (node, tasks) def process(node, tasks): print_workload(node, tasks) while tasks > 0: tasks -= 1 print_workload(node, tasks) time.sleep(0.2) for i in range(1, 6): t = threading.Thr...
test_new_kvstore.py
import os import time import numpy as np import socket from scipy import sparse as spsp import dgl import backend as F import unittest, pytest from dgl.graph_index import create_graph_index import multiprocessing as mp from numpy.testing import assert_array_equal if os.name != 'nt': import fcntl import struct ...
plugin_event_multiplexer.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...
thread.py
from concurrent.futures import ThreadPoolExecutor import threading pool = ThreadPoolExecutor(max_workers=10) def run_in_thread(*actions): threading.Thread(target=lambda x: run_actions(*x), daemon=True, args=(actions,)).start() # pool.submit(run_actions, *actions) def run_actions(*lambda_args): raise NotI...
main.py
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf import threading import numpy as np import signal import random import math import os import time from environment.environment import Environment from model.mod...
youtube.py
# -*- coding: utf-8 -*- """ Copyright (C) 2014-2016 bromix (plugin.video.youtube) Copyright (C) 2016-2018 plugin.video.youtube SPDX-License-Identifier: GPL-2.0-only See LICENSES/GPL-2.0-only for more information. """ import copy import json import re import threading import traceback import requests...
i3-cycle-focus.py
#!/usr/bin/env python3 import os import socket import selectors import threading from argparse import ArgumentParser import i3ipc SOCKET_FILE = '/tmp/i3-cycle-focus' MAX_WIN_HISTORY = 16 UPDATE_DELAY = 2.0 class FocusWatcher: def __init__(self): self.i3 = i3ipc.Connection() self.i3.on('window::...
test_remote.py
import logging import os import socket import time from multiprocessing import Queue from threading import Thread import env import pytest import plumbum from plumbum import ( NOHUP, CommandNotFound, ProcessExecutionError, ProcessTimedOut, RemotePath, SshMachine, local, ) from plumbum._tes...
route_reprogram.py
import tornado from jupyter_server.base.handlers import APIHandler import os import json from . import webds from .programmer_manager import ProgrammerManager from .touchcomm_manager import TouchcommManager import threading from queue import Queue import time import sys from tornado import gen from tornado.iostream ...
status.py
import threading import time import fonts from screen import Screen from widgets.scrollingtext import ScrollingText class StatusScreen(Screen): def __init__(self, screen_manager, keyboard_manager, client): super(StatusScreen, self).__init__(screen_manager, keyboard_manager) self._client = client ...
basicViewerPython.py
# Copyright (C) 2016-2017 RealVNC Limited. 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, # this list of conditions and...
env_stock_papertrading_rllib.py
import datetime import threading import time import alpaca_trade_api as tradeapi import gym import numpy as np import pandas as pd from finrl_meta.data_processors.alpaca import Alpaca class StockEnvEmpty(gym.Env): # Empty Env used for loading rllib agent def __init__(self, config): st...
server.py
#!/usr/bin/env python import sys import io import os import shutil from subprocess import Popen, PIPE from string import Template from struct import Struct from threading import Thread from time import sleep, time from http.server import HTTPServer, BaseHTTPRequestHandler from wsgiref.simple_server import make_server ...
cnn_util.py
# coding=utf-8 # Copyright 2022 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
MicrosoftTeams.py
import demistomock as demisto from CommonServerPython import * from CommonServerUserPython import * ''' IMPORTS ''' import requests from distutils.util import strtobool from flask import Flask, request, Response from gevent.pywsgi import WSGIServer import jwt import time from threading import Thread from typing import ...
install_utils.py
import getopt import re import subprocess import sys import threading import time sys.path = [".", "lib"] + sys.path import testconstants from remote.remote_util import RemoteMachineShellConnection, RemoteUtilHelper from membase.api.rest_client import RestConnection import install_constants import TestInput import log...
processor.py
'''Processor ''' import multiprocessing import logging as log from subprocess import Popen, PIPE class Processor(object): '''Processor ''' def __init__(self): '''Init ''' self.processes = {} def stop(self, worker): '''Stop a Process''' w_id = worker['id'] log.in...
executorwebdriver.py
import json import os import socket import threading import traceback import urlparse import uuid from .base import (CallbackHandler, RefTestExecutor, RefTestImplementation, TestharnessExecutor, extra_timeout, strip_server) ...
workers.py
import logging from threading import Thread, current_thread from json import dumps import requests import s3 logger = logging.getLogger() HEADERS = {'Content-type': 'application/json'} def download_and_pass_data_thread(filesystem, bucket, uri, next_service): """Spawn a thread worker for data downloading task. ...
main.py
import argparse import sys import signal import time import os import subprocess from multiprocessing import Process, Pool from multiprocessing.managers import BaseManager from itertools import product from termcolor import colored from server_comm import ServerConnection, set_vars from vlc_comm import player from uti...
test_operator.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
client.py
import logging try: import queue except ImportError: # pragma: no cover import Queue as queue import signal import ssl import threading import time import six from six.moves import urllib try: import requests except ImportError: # pragma: no cover requests = None try: import websocket except Impo...
threaded_video_stream.py
import cv2 from threading import Thread class threadedVideoStream(object): def __init__(self, src=0, resolution=None, fps=None): self.stream = cv2.VideoCapture(src) if resolution != None: self.stream.set(cv2.CAP_PROP_FRAME_WIDTH, resolution[0]) self.stream.set(cv2.CAP_PROP_...
camera_stream.py
########################################################################## # threaded frame capture from camera to avoid camera frame buffering delays # (always delivers the latest frame from the camera) # Copyright (c) 2018-2021 Toby Breckon, Durham University, UK # Copyright (c) 2015-2016 Adrian Rosebrock, http://w...
broker.py
# -*- coding: utf-8 -*- # # Copyright 2015 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 requir...
benchmarker.py
from setup.linux.installer import Installer from benchmark import framework_test import os import json import subprocess import time import textwrap import pprint import csv import sys import logging import socket from multiprocessing import Process from datetime import datetime class Benchmarker: ################...
test_tcp.py
import sys import time import logging import threading from poap.strategy import FixedSampleStrategy from poap.tcpserve import ThreadedTCPServer from poap.tcpserve import SocketWorker # Set up default host, port, and time TIMEOUT = 0 def f(x): logging.info("Request for {0}".format(x)) if TIMEOUT > 0: ...
test_throttle.py
# -*- coding: utf-8 -*- import time import threading import pytest from xTool.utils.throttle import ( BoundedEmptySemaphore, GlobalThrottle, LocalThrottle, throttle, ) def test_BoundedEmptySemaphore(): max_unused = 2 semaphore = BoundedEmptySemaphore(max_unused) semaphore.release() s...
feature_shutdown.py
#!/usr/bin/env python3 # Copyright (c) 2018 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test amerox shutdown.""" from test_framework.test_framework import BitcoinTestFramework from test_framework...
util.py
# Electrum - lightweight Bitcoin 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 t...
__init__.py
import subprocess as sp import multiprocessing as mp from finntk.omor.anlys import pairs_to_dict def analysis_to_pairs(ana): for bit in ana.split("]|["): k, v = bit.strip("[]").split("=", 1) yield k, v def parse_finnpos_line(line): surf, _, lemma, feats, _ = line.split("\t") return surf,...
test_browser_credential.py
# ------------------------------------ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ import functools import random import socket import threading import time from azure.core.exceptions import ClientAuthenticationError from azure.core.pipeline.policies ...
threading-worker.py
#!/usr/bin/env python # -*- coding: utf8 -*- import threading import logging import time logging.basicConfig(level=logging.DEBUG, format='[%(levelname)s] (%(threadName)-10s) %(message)s') def worker(_id): logging.debug("Worker: %d" % i) time.sleep(1) return [threading.Thread(name="...
3.ThreadLocal1.py
from multiprocessing.dummy import threading global_local = threading.local() def show_name(): print(f"[{threading.current_thread().name}]{global_local.name}") def task1(): global_local.name = "ๅฐๆ˜Ž" show_name() def task2(): global_local.name = "ๅฐๅผ " show_name() def main(): t1 = threading.T...
elg_demo.py
#!/usr/bin/env python3 """Main script for gaze direction inference from webcam feed.""" import argparse import os import queue import threading import time import coloredlogs import cv2 as cv import numpy as np import tensorflow as tf from datasources import Video, Webcam from models import ELG import ...
multiprocessing.py
# # Copyright 2021-2022 Johannes Laurin Hรถrmann # # ### MIT license # # 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, co...
test_rsocket.py
import py, errno, sys from rpython.rlib import rsocket from rpython.rlib.rsocket import * import socket as cpy_socket from rpython.translator.c.test.test_genc import compile def setup_module(mod): rsocket_startup() def test_ipv4_addr(): a = INETAddress("localhost", 4000) assert a.get_host() == "127.0.0.1...
main.py
from schema import Schema from connection import OracleConnection,MongoConnection import redis from log import main_logger import datetime import config import threading import uuid # try to connect to redis server try: r6 = redis.StrictRedis(host="localhost",port=6379,db=6) r6.ping() r6.set("start",str(da...
data_collector.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/licenses...
QueueRunner.py
""" QueueRunner plugin ################## QueueRunner plugin implements simple queue for task execution instead of starting threads for ongoing tasks. For example, if number of threads 10, but task need to be executed on 20 hosts, threaded runner will start first 10 threads to run task for first 10 hosts, after that ...
runKeywordAsync.py
import sys import os import time from robot.libraries.BuiltIn import BuiltIn from robot.output.logger import LOGGER class runKeywordAsync: def __init__(self): self._thread_pool = {} self._last_thread_handle = 1 #self._robot_log_level = BuiltIn().get_variable_value("${LOG_LEVEL}") def r...
run_unittests.py
#!/usr/bin/env python3 # Copyright 2016-2017 The Meson development 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 ...
manager.py
#!/usr/bin/env python3.7 import os import sys import fcntl import errno import signal import subprocess import datetime from common.spinner import Spinner from common.basedir import BASEDIR sys.path.append(os.path.join(BASEDIR, "pyextra")) os.environ['BASEDIR'] = BASEDIR def unblock_stdout(): # get a non-blocking s...
session_debug_testlib.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...
util.py
from asyncio import ( AbstractEventLoop, get_event_loop, new_event_loop, set_event_loop, ) from functools import lru_cache, wraps from threading import Thread from typing import ( TYPE_CHECKING, Any, Callable, Coroutine, Optional, Type, TypeVar, ) T = TypeVar("T") def cach...
utils.py
""" Lot of the code here is stolen from C-lightning's test suite. This is surely Rusty Russell or Christian Decker who wrote most of this (I'd put some sats on cdecker), so credits to them ! (MIT licensed) """ import bip32 import coincurve import itertools import json import logging import os import re import socket im...
usage.py
import psutil import GPUtil from flask import Flask from dataclasses import dataclass, field from collections import defaultdict import logging from typing import List, Dict import pickle from threading import Thread, Event FORMAT = '[%(asctime)s] %(levelname)-8s %(message)s' logging.basicConfig(level=logging.DEBUG, ...
apt.py
# pylint: disable=C0111,R0903 """Displays APT package update information (<to upgrade>/<to remove >) Requires the following debian packages: * python-parse * aptitude """ import threading from parse import * import bumblebee.util import bumblebee.input import bumblebee.output import bumblebee.engine APT_CH...
auth.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2012-2021 Snowflake Computing Inc. All right reserved. # import codecs import copy import json import logging import tempfile import time import uuid from datetime import datetime from os import getenv, makedirs, mkdir, path, remove, removedirs, rmdir fro...
using_with_statement.py
import threading import logging """ Mostra que um lock pode ser adquirido usando with ao invรฉs de usar lock.aquire() Isso foi testado para lock, RLock, Semรกforo, Condiรงรฃo e semรกforo """ logging.basicConfig(level=logging.DEBUG, format='(%(threadName)-10s) %(message)s',) def threading_with...
vg_to_imdb.py
# coding=utf8 import argparse, os, json, string from queue import Queue from threading import Thread, Lock import h5py import numpy as np from scipy.misc import imread, imresize def build_filename_dict(data): # First make sure all basenames are unique basenames_list = [os.path.basename(img['image_path']) for...
tcp_server.py
import socketserver as ss import threading from typing import cast, List, Optional, Tuple from typing_extensions import Type import netifaces from ymmsl import Reference from libmuscle.mcp.server import Server from libmuscle.mcp.tcp_util import (recv_all, recv_int64, send_int64, So...
interface.py
import sys, time, json, threading from PyQt5.QtWidgets import * from PyQt5.QtGui import QIcon, QPalette, QColor, QPixmap from PyQt5.QtCore import pyqtSlot, pyqtSignal, QObject, QTimer, Qt, QModelIndex, qInstallMessageHandler, QPoint from Interface.ui_classes import * from Interface.problem_ui import * from Interface.su...
_utils.py
""" Various helpers. For internal use only. """ import collections import traceback import sys import queue import logging import threading from ._importer import logger, get_debug_level, set_debug_level # Export utilities implemented in importer module logger = logger get_debug_level = get_debug_level set_debug_le...
gps_main.py
""" This file defines the main object that runs experiments. """ import logging import imp import os import os.path import sys import copy import argparse import threading import time import traceback import matplotlib as mpl sys.path.append('/'.join(str.split(__file__, '/')[:-2])) # Add gps/python to path so that im...
bundlecontroller.py
# #******************************************************************************* #* Copyright (C) 2018, International Business Machines Corporation. #* All Rights Reserved. * #******************************************************************************* # # WML specific imports from ibm_watson_machine_learning imp...
test_web_backtest.py
#!usr/bin/env python3 #-*- coding:utf-8 -*- """ @author: yanqiong @file: test_web.py @create_on: 2020/2/12 @description: "Users/yanqiong/Documents/geckodriver-v0.26.0-macos.tar.gz" """ import os import sys import time import unittest import multiprocessing as mp from selenium import webdriver from selenium.webdriver.fi...
datasets.py
# YOLOv5 ๐Ÿš€ by Ultralytics, GPL-3.0 license """ Dataloaders and dataset utils """ import glob import hashlib import json import logging import os import random import shutil import time from itertools import repeat from multiprocessing.pool import ThreadPool, Pool from pathlib import Path from threadin...
plugin.py
import time from threading import Thread import helper from brewtils.plugin import RemotePlugin from brewtils.decorators import system, parameter thread_map = {} def start_plugin(plugin, client): global thread_map t = Thread(target=plugin.run) t.daemon = True t.start() t.join(1) if t.is_aliv...
plotting.py
""" vtki plotting module """ import collections import ctypes import logging import os import time from threading import Thread from subprocess import PIPE, Popen import imageio import numpy as np import vtk from vtk.util import numpy_support as VN import vtki from vtki.export import export_plotter_vtkjs from vtki.ut...
development_server.py
import logging import signal from contextlib import contextmanager from threading import Thread from time import sleep from typing import Union, Callable, Generator, List from wsgiref.simple_server import make_server, WSGIServer LOGGER = logging.getLogger(__name__) class DevelopmentServer: def __init__(self, wsg...
miner.py
import time import hashlib import json import requests import base64 from flask import Flask, request from multiprocessing import Process, Pipe import ecdsa from miner_config import MINER_ADDRESS, MINER_NODE_URL, PEER_NODES node = Flask(__name__) class Block: def __init__(self, index, timestamp, ...
test_basic_3.py
# coding: utf-8 import gc import logging import os import sys import time import subprocess import numpy as np import pytest import ray.cluster_utils from ray._private.test_utils import ( dicts_equal, wait_for_pid_to_exit, wait_for_condition, ) from ray.autoscaler._private.constants import RAY_PROCESSES f...
configuration.py
# Copyright 2021 Amazon.com. # SPDX-License-Identifier: MIT import typing from . import _asyncio_wrapper import asyncio from threading import Thread from typing import Callable import awsiot.greengrasscoreipc.client as client from awsiot.greengrasscoreipc import connect from awsiot.greengrasscoreipc.model import ( ...
_debugger_case_check_tracer.py
import threading, atexit, sys from collections import namedtuple import os.path if sys.version_info[0] >= 3: from _thread import start_new_thread else: from thread import start_new_thread FrameInfo = namedtuple('FrameInfo', 'filename, name, f_trace') def _atexit(): sys.stderr.flush() sys.stdout.flus...
gps.py
import argparse from functools import reduce import logging import operator import os import platform import threading import time import pynmea2 import serial import utm logger = logging.getLogger(__name__) def is_mac(): return "Darwin" == platform.system() class Gps: def __init__(self, serial:str, baudrat...
Layer4.py
from base64 import encode from fastapi import APIRouter, Request from denialofservice import Layer4 from globals import NUMBER_OF_THREADS from threading import Thread from log import log router = APIRouter() @router.post("/synflood") async def read_parameters(time: int, target: str, port: int, request: Request): ...
__init__.py
"""Helper operations and classes for general model building. """ from __future__ import print_function from __future__ import division from __future__ import unicode_literals import warnings import collections import pickle import os import time import warnings import numpy as np import pandas as pd import tensorflow ...
lock.py
#!/usr/bin/env python3 # # Copyright (C) 2019 Jayson # from threading import Thread, Lock amount = 0 lock = Lock() def worker(count): global amount for i in range(count): lock.acquire(True) amount = amount + 1 lock.release() if __name__ == '__main__': t1 = T...
spl.py
# coding=utf-8 # Licensed Materials - Property of IBM # Copyright IBM Corp. 2015,2017 """ SPL Python primitive operators. ******** Overview ******** SPL primitive operators that call a Python function or class methods are created by decorators provided by this module. The name of the function or callable class becom...
SerialMonitor.py
# # Serial Monitor Utility # # Rob Dobson 2020-21 # import threading import time import sys import os import logging import serial from serial.serialutil import SerialException import argparse import KeyboardUtils class LogHelper: def __init__(self, logToFile, logsFolder): self._logger = logging.getLogge...
wr_arp.py
# This is Control Plane Assistent test for Warm-Reboot. # The test first start Ferret server, implemented in Python. Then initiate Warm-Rebbot procedure. # While the host in Warm-Reboot test continiously sending ARP request to the Vlan member ports and # expect to receive ARP replies. The test will fail as soon as ther...
multi_process_runner_test.py
# Copyright 2019 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
tasks.py
#!/usr/local/bin/python3 # coding: utf-8 # ytdlbot - tasks.py # 12/29/21 14:57 # __author__ = "Benny <benny.think@gmail.com>" import json import logging import os import pathlib import re import subprocess import tempfile import threading import time from urllib.parse import quote_plus import psutil import requests...
work_controller.py
""" Copyright (c) 2015 Michael Bright and Bamboo HR 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...
tracker.py
""" This script is a variant of dmlc-core/dmlc_tracker/tracker.py, which is a specialized version for xgboost tasks. """ # pylint: disable=invalid-name, missing-docstring, too-many-arguments, too-many-locals # pylint: disable=too-many-branches, too-many-statements, too-many-instance-attributes import socket import str...
vm_util.py
# Copyright 2014 PerfKitBenchmarker 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...
mark_for_deployment.py
#!/usr/bin/env python # Copyright 2015-2016 Yelp 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 ...
GuiUtils.py
import queue import os import threading import tkinter as tk from Utils import local_path def set_icon(window): er16 = tk.PhotoImage(file=local_path(os.path.join("data","ER16.gif"))) er32 = tk.PhotoImage(file=local_path(os.path.join("data","ER32.gif"))) er48 = tk.PhotoImage(file=local_path(os.path.join("d...
leo_cloud.py
#@+leo-ver=5-thin #@+node:ekr.20170925083314.1: * @file ../plugins/leo_cloud.py #@+<< docstring >> #@+node:ekr.20210518113636.1: ** << docstring >> """ leo_cloud.py - synchronize Leo subtrees with remote central server Terry N. Brown, terrynbrown@gmail.com, Fri Sep 22 10:34:10 2017 This plugin allows subtrees within ...
utils.py
"""Globally shared common utilities functions/classes/variables""" import config import constants import cPickle import logging import pymongo import string import threading import time from bson.son import SON def _make_logger(): """Create a new logger""" logger = logging.getLogger("parse.flashback") logg...
models.py
import logging import os import threading import uuid from ipaddress import ip_address, ip_interface import yaml from django.db import models from ansible_api.models.mixins import AbstractExecutionModel from cloud_provider import get_cloud_client from common import models as common_models from kubeoperator import sett...
Day11-04.py
## ์˜์ƒ ์ฒ˜๋ฆฌ ๋ฐ ๋ฐ์ดํ„ฐ ๋ถ„์„ ํˆด from tkinter import *; import os.path ;import math from tkinter.filedialog import * from tkinter.simpledialog import * ## ํ•จ์ˆ˜ ์„ ์–ธ๋ถ€ def loadImage(fname) : global window, canvas, paper, filename, inImage, outImage, inW, inH, outW, outH fsize = os.path.getsize(fname) # ํŒŒ์ผ ํฌ๊ธฐ ํ™•์ธ inH = inW = ...
main_window.py
import re import os import sys import time import datetime import traceback from decimal import Decimal import threading import asyncio from typing import TYPE_CHECKING, Optional, Union, Callable, Sequence from electrum.storage import WalletStorage, StorageReadWriteError from electrum.wallet_db import WalletDB from el...
test_qt_notifications.py
import sys import threading import time import warnings from unittest.mock import patch import dask.array as da import pytest from qtpy.QtCore import Qt from qtpy.QtWidgets import QPushButton from napari._qt.dialogs.qt_notification import NapariQtNotification from napari.utils.notifications import ( ErrorNotifica...
shell_backend.py
from . import Backend, SeamlessTransformationError, JoblessRemoteError import asyncio import sys, os, tempfile, shutil import psutil import json import subprocess, tarfile from functools import partial import numpy as np from io import BytesIO import multiprocessing as mp import traceback PROCESS = None def kill_ch...
growl.py
#__LICENSE_GOES_HERE__ from util.packable import Packable from util.primitives.error_handling import traceguard from util.primitives import Storage from gui.toast import popup from threading import Thread, currentThread from peak.util.addons import AddOn from logging import getLogger; log = getLogger('growl') GROWL_U...
lambda_executors.py
import os import re import sys import glob import json import time import logging import threading import traceback import subprocess import six import base64 from multiprocessing import Process, Queue try: from shlex import quote as cmd_quote except ImportError: from pipes import quote as cmd_quote # for Pyth...
email.py
from flask import Flask from threading import Thread from flask_mail import Message from app import app, mail def send(recipient, subject, body): ''' Send a mail to a recipient. The body is usually a rendered HTML template. The sender's credentials has been configured in the config.py file. ''' se...
build.py
## @file # build a platform or a module # # Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR> # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR> # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD Li...
input.py
from displayarray.subscriber_window import window_commands import threading import time from typing import Callable class MouseEvent(object): """Holds all the OpenCV mouse event information.""" def __init__(self, event, x, y, flags, param): self.event = event self.x = x self.y = y ...
query_alarm_state.py
import multiprocessing import sys import time import argparse import MySQLdb query = ("select alarm.alarm_definition_id as definition_id, alarm_definition.name as definition_name, " "count(distinct alarm.id) as num_alarms from alarm join alarm_definition on alarm_definition.id = " "alarm.alarm_defin...
queue_sample.py
#!/usr/bin/env python3.6 # coding=utf8 import six import time import threading if six.PY2: import Queue # PY2 share_q = Queue.Queue() elif six.PY3: from queue import Queue share_q = Queue(maxsize=3) def randomeSleep(n,m): ''' n,m indicate the sleep range ''' ''' process will be stopped betwee...
actor_definition.py
import contextlib import logging import os import pkgutil import sys from io import UnsupportedOperation from multiprocessing import Process, Queue import leapp.libraries.actor from leapp.actors import get_actors, get_actor_metadata from leapp.exceptions import ActorInspectionFailedError, MultipleActorsError, Unsuppor...
views.py
import json import asyncio, threading import requests from django.shortcuts import render, redirect from django.http import HttpResponse, Http404 from django.conf import settings from django.contrib.auth.decorators import login_required from .models import CustomAction, AuthorizationMethod, ThingAuthorization from .thi...
cisd.py
#!/usr/bin/env python # Copyright 2014-2021 The PySCF Developers. 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 # # U...