source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
__init__.py | '''
Docker Monitor component
For more details about this component, please refer to the documentation at
https://github.com/Sanderhuisman/home-assistant-custom-components
'''
import logging
import threading
import time
from datetime import timedelta
import homeassistant.helpers.config_validation as cv
import voluptuo... |
collatzPlotly.py | import plotly.express as px
import multiprocessing
import pandas as pd
import time
print('Number of CPUs:', multiprocessing.cpu_count())
def collatz(starting_number) -> dict:
"""
Call with an int and it will return a dict
dict Key : Value -> Starting number(int) : steps(list of ints)
"""
step_dic... |
requests_manager.py | import os
import hashlib
import pickle
import threading
import logging
from socketserver import BaseRequestHandler
import typing
import paramiko
class RequestsManager():
"""A class for creating requests for the client and manage control messages protocol"""
# ----------Constants----------
READY = "ready"
... |
onnxruntime_test_python.py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# -*- coding: UTF-8 -*-
import unittest
import os
import numpy as np
import onnxruntime as onnxrt
import threading
import sys
from helper import get_name
from onnxruntime.capi.onnxruntime_pybind11_state import Fail
class Tes... |
registry.py | import logging
import math
import sys
import threading
from spectator.clock import SystemClock
from spectator.counter import Counter, NoopCounter
from spectator.distsummary import DistributionSummary, NoopDistributionSummary
from spectator.gauge import Gauge, NoopGauge
from spectator.http import HttpClient
from specta... |
runner.py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the Apache 2.0 License.
import getpass
import time
import http
import logging
from random import seed
import infra.jwt_issuer
import infra.network
import infra.proc
import infra.remote_client
import infra.rates
import cimetrics.upload
import t... |
OSC.py | #!/usr/bin/python
"""
This module contains an OpenSoundControl implementation (in Pure Python), based (somewhat) on the
good old 'SimpleOSC' implementation by Daniel Holth & Clinton McChesney.
This implementation is intended to still be 'Simple' to the user, but much more complete
(with OSCServer & OSCClient classes)... |
hfo_agent.py | #!/usr/bin/env python
# encoding: utf-8
import latte
import numpy as np
from random import random, randint
from threading import Thread
from memoire import ReplayMemoryClient
import math, time
class RuleAgent(object):
def __init__(self):
pass
def reset(self):
pass
def act(self, obs):
dir_ball = li... |
groupMessage.py | # -*-coding: UTF-8-*-
import os
import time
import webbrowser
from bottle import template
from flask import Flask
from flask import request
import configparser
from libs.mysql import ConnectMysql
from threading import Thread
app = Flask(__name__)
config = configparser.ConfigParser()
config.read('config.conf', encodin... |
kv_server.py | # Copyright (c) 2022 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... |
berrymon.py | #!/usr/bin/env python3
# Copyright (c) 2018 by Advay Mengle - https://github.com/madvay/berrymon
#
# WARNING: You are responsible for following all relevant safety
# precautions and using your device responsibly. You must independently
# assess whether any advice or recommendations contained in this
# software (includ... |
sql_db.py | import os
import concurrent
import queue
import threading
import asyncio
import sqlite3
from .logging import Logger
def sql(func):
"""wrapper for sql methods"""
def wrapper(self, *args, **kwargs):
assert threading.currentThread() != self.sql_thread
f = asyncio.Future()
self.db_request... |
store.py | import json
import uuid as uuid_builder
import os.path
from os import path
from threading import Lock
from copy import deepcopy
import logging
import time
import threading
# Is there an existing library to ensure some data store (JSON etc) is in sync with CRUD methods?
# Open a github issue if you know something :)... |
trustedcoin.py | #!/usr/bin/env python
#
# Electrum - Lightweight Bitcoin Client
# Copyright (C) 2015 Thomas Voegtlin
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without... |
main.py | import commands
from time import strftime
import subprocess
import os
import glob
from handlers import view_controller
view_controller.scoreboard_before_freeze()
import threading
import time
import sys
def func1():
while True:
time.sleep(300)
USER = "postgres"
PASS = "postgresql"
HOST = "localhost"
BA... |
agnostic_query.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2021, Arcangelo Massari <arcangelomas@gmail.com>
#
# Permission to use, copy, modify, and/or distribute this software for any purpose
# with or without fee is hereby granted, provided that the above copyright notice
# and this permission notice appear in all cop... |
threading_concurrent_timeout.py | import socket
import threading
import time
def worker_thread(id_, port):
print(f"[{id_}] Connecting {port}!")
worker_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
worker_sock.settimeout(2)
start = time.time()
try:
worker_sock.connect(("127.0.0.1", port))
except socket.timeo... |
code_executor.py | # Copyright (c) 2015, CodiLime Inc.
import ast
import traceback
from pyspark import SQLContext
from pyspark.sql.dataframe import DataFrame
from threading import Thread
class CodeExecutor(object):
"""
This class handles code execution requests from Session Executor.
"""
TRANSFORM_FUNCTION_NAME = 'tran... |
launcher.py | '''
The SNAP experiment launcher program. To be run on the subject's PC.
* Installation notes: see INSTALLATION NOTES.TXT
* This program can launch experiment modules that are specified in the modules directory
(one at a time).
* The module to be launched (and various other options) can be specified at the command... |
backtester_coin_vc.py | import os
import sys
import sqlite3
import pandas as pd
from matplotlib import pyplot as plt
from multiprocessing import Process, Queue
sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
from utility.static import now, strf_time, timedelta_day
from utility.setting import db_setting, db_backtes... |
streamer.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Twitter stream consumer module
"""
import sys
import threading
import time
import concurrent.futures
from typing import List, Optional
from queue import Queue
# 3rd
from twython import TwythonStreamer # type: ignore
sys.path.insert(1, '.')
sys.path.insert(2, '..'... |
local_scheduler_test.py | #!/usr/bin/env python3
# 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 abc
import json
import multiprocessing as mp
import os
import shutil
import signal
... |
_nixcommon.py | # -*- coding: utf-8 -*-
import struct
import os
import atexit
from time import time as now
from threading import Thread
from glob import glob
try:
from queue import Queue
except ImportError:
from Queue import Queue
event_bin_format = 'llHHI'
# Taken from include/linux/input.h
# https://www.kernel.org/doc/Docu... |
common.py | """Test the helper method for writing tests."""
import asyncio
import collections
import functools as ft
import json
import logging
import os
import uuid
import sys
import threading
from collections import OrderedDict
from contextlib import contextmanager
from datetime import timedelta
from io import StringIO
from uni... |
game_helper.py | import atexit, os, re, sys, threading, time
import chess
import common
colors = 'WB'
def start_bot(player, color, seed):
try:
bot = common.start(player, colors[color].lower(), seed)
except OSError:
print(colors[color ^ 1] + 'e')
print()
sys.exit()
atexit.register(bot.termin... |
server.py | import pathlib
import ssl
import threading
from base64 import b64encode
from contextlib import contextmanager
from textwrap import dedent
from typing import TYPE_CHECKING, Any, Callable, Dict, Iterable, Iterator
from unittest.mock import Mock
from werkzeug.serving import BaseWSGIServer, WSGIRequestHandler
from werkzeu... |
run.py | import sys
import subprocess
import threading
import shlex
try:
from Queue import Queue, Empty
except:
from queue import Queue, Empty
ON_POSIX = 'posix' in sys.builtin_module_names
class Run:
def __init__(self):
return
def _read_output(self, pipe, q):
while True:
try:
... |
test_multithreaded_lockers.py | import threading
from edera.exceptions import LockAcquisitionError
def test_locker_is_multithreaded(multithreaded_locker):
def try_to_lock(key, lock_flag, fail_flag):
try:
with multithreaded_locker.lock(key):
lock_flag.set()
fail_flag.wait(3.0)
except ... |
test_failure.py | import json
import logging
import os
import sys
import tempfile
import threading
import time
import numpy as np
import pytest
import redis
import ray
import ray.ray_constants as ray_constants
from ray.cluster_utils import Cluster
from ray.test_utils import (
relevant_errors,
wait_for_condition,
wait_for_e... |
managers.py | #
# Module providing the `SyncManager` class for dealing
# with shared objects
#
# multiprocessing/managers.py
#
# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt
#
__all__ = [ 'BaseManager', 'SyncManager', 'BaseProxy', 'Token' ]
#
# Imports
#
import os
import sys
import weakref
import threading
import array
... |
session.py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root
# for license information.
from __future__ import print_function, with_statement, absolute_import
import contextlib
import os
import socket
import subprocess
import sys
import threading
import... |
smtio.py | #
# yosys -- Yosys Open SYnthesis Suite
#
# Copyright (C) 2012 Clifford Wolf <clifford@clifford.at>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#... |
run_tests.py | #!/bin/env python3
#
# This script tests various functions of the ODrive firmware and
# the ODrive Python library.
#
# Usage:
# 1. adapt test-rig.yaml for your test rig.
# 2. ./run_tests.py
import yaml
import os
import sys
import threading
import traceback
import argparse
from odrive.tests import *
from odrive.utils i... |
synctex-katarakt-vim.py | #!/usr/bin/env python3
# Dependencies (Debian/Ubuntu package names):
#
# python3-gi
# python3-dbus
#
# Thorsten Wißmann, 2015
# in case of bugs, contact: edu _at_ thorsten-wissmann _dot_ de
def print_help():
print("""Usage: {0} SESSIONNAME [PDFFILE]
A katarakt wrapper for synctex communication between ... |
analytics_frame.py | import sys, math, time, threading
from PyQt5 import QtCore
from api.agent_analytics_frame import AgentAnalyticsFrameAPI
from network_diagram import NeuralNetwork, Layer
from settings import *
from frame_styles import *
from frame_text import *
from PyQt5.QtWidgets import QGridLayout, QVBoxLayout, QMainWindow, QLineEd... |
test_grpc_server_registry.py | import sys
import threading
import time
import pytest
from dagster import file_relative_path, pipeline, repository
from dagster.core.errors import DagsterUserCodeProcessError
from dagster.core.host_representation.grpc_server_registry import ProcessGrpcServerRegistry
from dagster.core.host_representation.origin import ... |
monitorar_se-drone_voando.py | ##########DEPENDENCIES#############
from dronekit import connect,VehicleMode,LocationGlobalRelative,APIException
#import dronekit
import time
import socket
import math
import argparse
from pymavlink import mavutil
import dronekit_sitl
################Outros imports############
import threading
from click import except... |
wsgui.py | #! /usr/bin/env python
"""Tkinter-based GUI for websucker.
Easy use: type or paste source URL and destination directory in
their respective text boxes, click GO or hit return, and presto.
"""
from Tkinter import *
import Tkinter
import string
import websucker
import sys
import os
import threading
import Queue
import... |
event-test.py | #!/usr/bin/python -u
#
#
#
#################################################################################
# Start off by implementing a general purpose event loop for anyones use
#################################################################################
import sys
import getopt
import os
import libvirt
impor... |
ib_gateway.py | """
IB Symbol Rules
SPY-USD-STK SMART
EUR-USD-CASH IDEALPRO
XAUUSD-USD-CMDTY SMART
ES-202002-USD-FUT GLOBEX
SI-202006-1000-USD-FUT NYMEX
ES-2020006-C-2430-50-USD-FOP GLOBEX
"""
from copy import copy
from datetime import datetime
from queue import Empty
from threading import Thread, Condition
from typing impor... |
main.py | #!/usr/bin/python3
############################################################
# import
import asyncio as aio
import os
import re
import parse_rating_page
import parse_work_page
from aiohttp import ClientSession
from pageloader import LoadPageTask, PageLoader
from nvxlira import Lira
from nvxaex import Exec... |
parasol.py | # Copyright (C) 2015-2016 Regents of the University of California
#
# 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 app... |
kmeans.py | import logging
import random
from server import Server
from sklearn.cluster import KMeans
from threading import Thread
import utils.dists as dists # pylint: disable=no-name-in-module
class KMeansServer(Server):
"""Federated learning server that performs KMeans profiling during selection."""
# Run federated ... |
chrome_test_server_spawner.py | # Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A "Test Server Spawner" that handles killing/stopping per-test test servers.
It's used to accept requests from the device to spawn and kill instances of ... |
Lidar_recv.py | #
# Created on Wed Sep 22 2021
# Author: Owen Yip
# Mail: me@owenyip.com
#
# Socket number:
# RpLidar is 5450, IMU is 5451, Driver is 5452
#
import os,sys
pwd = os.path.abspath(os.path.abspath(__file__))
father_path = os.path.abspath(os.path.dirname(pwd) + os.path.sep + "..")
sys.path.append(father_path)
import threa... |
test_overall.py | import time
import os
from multiprocessing import Process
from somebox.server.server import main as server_main
from somebox.client.watcher import Watcher
from somebox.client.client import Client
def client(watch_folders):
Watcher.EventHandlerClass = lambda *args: Client(watch_folders)
w = Watcher(watch_fold... |
scheduler.py | #!/usr/bin/env python3
"""
Schedule containerized avocado-cloud tests for Alibaba Cloud.
"""
import argparse
import logging
import toml
import json
import subprocess
import shutil
import threading
import os
import time
import random
REPO_PATH = os.path.split(os.path.realpath(__file__))[0]
LOG = logging.getLogger(__n... |
master.py | from bottle import Bottle, HTTPResponse, BaseRequest, request, response, route, run, template, static_file
from http.server import BaseHTTPRequestHandler, HTTPServer
from urllib3.exceptions import NewConnectionError
from flask import Flask
from tinydb import TinyDB, Query
import os
import time
import json
i... |
AnalyseStandingsService.py | from typing import List
import random, os
from collections import defaultdict
from threading import Thread
from services import UpdateService
from codeforces import codeforces as cf
from utils import util
from utils.util import logger
from utils import database as db
from codeforces import standings
from telegram impo... |
test_arpack.py | from __future__ import division, print_function, absolute_import
__usage__ = """
To run tests locally:
python tests/test_arpack.py [-l<int>] [-v<int>]
"""
import warnings
import threading
import numpy as np
from numpy.testing import assert_allclose, \
assert_array_almost_equal_nulp, run_module_suite, \
... |
app.py | #!/usr/bin/env python
#
# Copyright 2018 IBM Corp. 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... |
JobDispatcher.py | import sys
import multiprocessing
import gc
import time
import traceback
import queue
import random
import datetime
import threading
import signal
import contextlib
import socket
import common.stuck
# import sqlalchemy.exc
# from sqlalchemy.sql import text
import cachetools
if '__pypy__' in sys.builtin_module_nam... |
func.py | """
面向用户的函数 ,提供极其便捷的体验
"""
import logging
from datetime import time, datetime
from inspect import isfunction
from multiprocessing import Process
from time import sleep
from typing import Text, Any, List
from ctpbee.constant import \
(OrderRequest, CancelRequest, Direction, Exchange,
Offset, OrderType, Accou... |
a3c.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2018 Hsin-Yu Chang <acht7111020@gmail.com>
# Licensed under the MIT License - https://opensource.org/licenses/MIT
import argparse
import threading
import os
import tensorflow as tf
import numpy as np
from a3c_network import *
import os
os.environ['TF_CPP... |
toolbar.py | """Module for dealing with the toolbar.
"""
import math
import os
import ipyevents
import ipyleaflet
import ipywidgets as widgets
from ipyfilechooser import FileChooser
from .common import *
from .pc import *
def tool_template(m=None):
"""Generates a tool GUI template using ipywidgets.
Args:
m (leafm... |
cefweb.py | """
pip install cefpython3==57.0
"""
from cefpython3 import cefpython as cef
import os
import platform
import subprocess
import sys
import time
from threading import Thread
from datetime import datetime
class CEFBrowser:
def __init__(self):
self.browser = None
self.data = {}
def start(self)... |
common.py | import os
import re
import subprocess
import threading
import time
from contextlib import contextmanager
from pathlib import Path
import docker
import requests
from tests.helpers import fake_backend
from tests.helpers.util import get_docker_client, get_host_ip, pull_from_reader_in_background, retry, run_container
from... |
test.py | import csv
import os
import subprocess
import threading
# Gather the packages to test.
PREFIX = './packages/node_modules/'
CISCOSPARK = os.path.join(PREFIX, '@ciscospark')
WEBEX = os.path.join(PREFIX, '@webex')
PROD_ENV_VARS = {
# 'ACL_SERVICE_URL': 'https://acl-a.wbx2.com/acl/api/v1', ?
'ATLAS_SERVICE_URL': 'ht... |
Spider.py | import requests
import queue
import threading
import bs4
import time
import re
# Hope this work. No more bugs. God bless me. Ramen.
# Hope this work. No more bugs. God bless me. Ramen.
# Hope this work. No more bugs. God bless me. Ramen.
debug = True
class Spider():
def __init__(self):
self.Url = None... |
postgres_nonblocking_put_request.py | import threading
import requests
import psycopg2
from rassh.config.postgres_config import PostgresConfig
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
class PostgresNonBlockingPutRequest(object):
"""This is just like a NonBlockingPutRequest except this also updates t... |
worker.py | #
# Copyright (C) 2016 Tomas Nilsson (joekickass). All rights reserved.
#
import boto3
import threading
import queue
class Worker(object):
"""
Polls queue for next batch of log data and sends it to kinesis
TODO:
Each PutRecords request can support up to 500 records. Each record in the
request c... |
GUI.py | # -*- coding: utf-8 -*-
"""
Created on Wed May 12 15:51:03 2021
@author: Akhil
"""
import csv
import PySimpleGUI as sg
import os.path
from os import path
import time
import datetime
import requests
import json
import threading
def get_faqs(context,limit,window):
headers = {'content-type': 'application/json'}
p... |
mp.py | #!/usr/bin/env python
from multiprocessing import Process, Queue
import mkl
class ParmapError(Exception):
def __init__(self,errors):
msg = 'errors were raised when evaluating parmap:\n'
for i,e in enumerate(errors):
if e is not None:
msg += (' task %s: ' % i) + repr(e) + '\n'
self.msg =... |
denylist_updater.py | import dataclasses
import datetime
from http import HTTPStatus
import logging
import queue
import threading
import pyhocon
import requests
from sqlalchemy import delete
from sqlalchemy.dialects.postgresql import insert
from ngk.log import get_logger
from ngk.schema import BannedUser, ScopedSession
L = get_logger('d... |
module.py | #!/usr/bin/env python
#
# Copyright 2007 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... |
game_thread.py | from gameplay.setup import Setup
from gameplay.turn import Turn
import threading
class GameThread:
"""
The game thread that drives the turn sequence
"""
def __init__(self, game):
"""
Constructor
game: The game to run
"""
self._game = game
... |
login.py | import asyncio
import os, time, re, io
import threading
import json
import random
import traceback
import logging
try:
from httplib import BadStatusLine
except ImportError:
from http.client import BadStatusLine
import requests # type: ignore
from pyqrcode import QRCode
from .. import config, utils
from ..ret... |
Love_Dec.py | # Decompile At : Mon Mar 9 14:53:32 2020
# Python bytecode 2.7
# Decompiled from: Python 2.7.17 (default, Oct 23 2019, 08:25:46)
# [GCC 4.2.1 Compatible Android (5220042 based on r346389c) Clang 8.0.7 (https://
# Embedded file name: dg
import os, sys, time, datetime, random, hashlib, re, threading, json, getpass, ur... |
test_multiprocessing.py | #!/usr/bin/env python3
#
# Unit tests for the multiprocessing package
#
import unittest
import queue as pyqueue
import time
import io
import sys
import os
import gc
import errno
import signal
import array
import socket
import random
import logging
import test.support
# Skip tests if _multiprocessing wasn't built.
_... |
test_sys.py | from test import support
from test.support import os_helper
from test.support.script_helper import assert_python_ok, assert_python_failure
import builtins
import codecs
# import gc
import locale
import operator
import os
import struct
import subprocess
import sys
import sysconfig
import test.support
import textwrap
imp... |
chat_app.py | from argparse import ArgumentParser
from dataclasses import dataclass
from datetime import datetime
from enum import Enum
from multiprocessing import current_process, Process
from multiprocessing.connection import Listener, Connection, Client
from random import shuffle
from threading import get_ident, Thread
from typin... |
main.py | """Pichu bot."""
import importlib
import irc.bot
# import argparse as ap
import asyncio
import threading
import json
import traceback
import sys
from random import randint
import commands
import reactions
import routines
class Bot(irc.bot.SingleServerIRCBot):
"""Main bot class."""
def __init__(self):
... |
distributed_demo.py | import multiprocessing as mp
import torch
import torch.distributed as dist
init_method='tcp://127.0.0.1:1234'
def run(queue, rank):
dist.init_process_group(
backend='gloo',
init_method=init_method,
world_size=2,
rank=rank)
keys = torch.arange(0, 10, dtype=torch.... |
run_server.py | import os
import argparse
import threading
import fileserve
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--ip", type=str, default="localhost", help="Address to use")
parser.add_argument("--port", type=int, default=60000, help="Port to use")
args = parser.parse_a... |
task_running_resources_test.py | # -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... |
delldrac.py | #!/usr/bin/env python
# coding=utf-8
###########################################
#
# Dell DRAC and Chassis Scanner
# Default Credential Check
# UN: root PW: calvin
#
# Written by Dave Kennedy (ReL1K)
# Company: TrustedSec, LLC
# Website: https://www.trustedsec.com
# @TrustedSec
#
######################################... |
contiguous_arrays_test.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# 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 ... |
furnace_manager.py | # ===============================================================================
# Copyright 2015 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... |
monitor.py | import psutil
from threading import Thread
from time import sleep
from const import INTERVAL
from ws import socketio
from sys import platform
running = False
threads = []
net_previous = {
"bytes_sent": 0,
"bytes_recv": 0
}
def cpu_usage_thread():
while running:
cpu = psutil.cpu_percent(interval=... |
objectfs_operations.py | # Copyright 2017 IBM Corporation
# Copyright 2017 The Johns Hopkins University
#
# 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... |
ig_attack.py | """
Topology Attack and Defense for Graph Neural Networks: An Optimization Perspective
https://arxiv.org/pdf/1906.04214.pdf
Tensorflow Implementation:
https://github.com/KaidiXu/GCN_ADV_Train
"""
import numpy as np
import scipy.sparse as sp
import torch
from torch.nn import functional as F
from... |
test_ipc.py | # -*- coding: utf-8 -*-
"""
:codeauthor: Mike Place <mp@saltstack.com>
"""
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import errno
import logging
import os
import socket
import threading
import salt.config
import salt.exceptions
import salt.ext.tornado.gen
impor... |
test_ssl.py | # Test the support for SSL and sockets
import sys
import unittest
import unittest.mock
from test import support
from test.support import import_helper
from test.support import os_helper
from test.support import socket_helper
from test.support import threading_helper
from test.support import warnings_helper
import sock... |
run.py | from os import getenv
from os.path import abspath, dirname, join
from coverage import coverage
from flask_script import Manager, Shell
# Coverage debe empezar antes de las importaciones
# de los módulos de las aplicación
COV = coverage(branch=True, include='app/*')
COV.start()
from app import create_app
from app.mode... |
C2Server.py | #!/usr/bin/env python3
import os, sys, datetime, time, base64, logging, signal, re, ssl, traceback, threading
from urllib.request import urlopen, Request
from urllib.error import HTTPError, URLError
from socketserver import ThreadingMixIn
from http.server import BaseHTTPRequestHandler, HTTPServer
from poshc2.server.I... |
mqtt_agent.py | """
Copyright (c) 2021 Software AG, Darmstadt, Germany and/or its licensors
SPDX-License-Identifier: Apache-2.0
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/lice... |
weibo.qrcode.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
在python2.7中测试通过
Required
- requests (必须)
- pillow (可选)
Info
- author : "fangc"
- email : "swjfc22@163.com"
- date : "2016.3.16"
'''
import requests
import cookielib
import time
import re
import sys
try:
from PIL import Image
except:
pass
import threading
# ... |
upload_task_runner.py | import os
import sys
import importlib
import json
import argparse
import Queue
from threading import Thread
from time import time, localtime, strftime, sleep
from ConfigParser import SafeConfigParser
import random
from prettytable import PrettyTable
import runner_util
from benchcloud.traffic import capturer
class U... |
test_datastream.py | # ----------------------------------------------------------------------
# noc.core.datastream test
# ----------------------------------------------------------------------
# Copyright (C) 2007-2021 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
# Pyt... |
lang08.py | """
多线程示例
@author Aaric
@version 0.5.0-SNAPSHOT
"""
# 线程函数
import time
from threading import Thread, current_thread
def thread_body():
t = current_thread()
for i in range(5):
print("{0} - {1}".format(i, t.getName()))
time.sleep(1)
print("{0} over!".format(t.getName()))
t1 = Thread(targ... |
rlock_ex.py | # rlock_ex.py
#
# An example of code-based locking. Every method of the class
# below uses the same RLock object. However, some methods call
# other methods. These nested calls will work within the same
# thread.
import threading
class Foo(object):
lock = threading.RLock() # Reentrant Mutex
def __init__(... |
wrapper.py | """
Contains the wrappers for all preprocessing components.
"""
# There is some redundancy left between the PreprocessorWrapper on the one hand
# and the TokenizerWrapper, TaggerWrapper and ChunkerWrapper on the other. Much
# of it has been removed but in some cases changes on one end need to be
# accompanied by sim... |
SBlock.py | import time
import threading
import config
from config import *
class SBlock:
def __init__(self):
self.cells = 4 # Number of cells occupied by the block
config.block_count += 1
config.item_id["blocks"][f"{config.block_count}"] = {} # Add a new key to dictionary to add block IDs
... |
lambda_executors.py | import os
import re
import sys
import glob
import json
import time
import logging
import threading
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 Python 2.7
from local... |
commander.py | import os
import signal
import subprocess
import threading
import time
from smiler.instrumenting.general_exceptions import MsgException
TIMEOUT_ERROR_VALUE = 1111
def runOnce(cmd, timeout_time=None, return_output=True, stdin_input=None):
"""Spawns a subprocess to run the given shell command.
Args:
... |
Game_state.py | import Classes.Wall as w
import Classes.Brick as b
import Classes.Bomb as bomb
import Classes.Player_object_board as Player_ob
import json
from PyQt5 import QtCore
import random
from Classes.Powerup import Powerup
import time
from threading import Thread
class Game_state(QtCore.QObject):
bomb_must_blow = QtCore.p... |
VasoTrackerTestingGround2.py | ##################################################
## VasoTracker Pressure Myograph Software
##
## This software provides diameter measurements (inner and outer) of pressurised blood vessels
## Designed to work with Thorlabs DCC1545M
## For additional info see www.vasostracker.com and https://github.com/VasoTracker/Va... |
imagenet_to_mr.py | # Copyright 2019 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
worker.py |
import os
import logging
import contextlib
import hashlib
import threading
import json
from multiprocessing import Process
try:
from configparser import ConfigParser
except ImportError:
from ConfigParser import ConfigParser
# dependencies
import pysftp
import paramiko
main_logger = logging.getLogger("avalo... |
main.py | import tkinter as tk
import tkinter.ttk as ttk
import tkinter.font as tkfont
from tkinter.scrolledtext import ScrolledText
from tkinter import messagebox as msgbox
import gettext
import winreg
import subprocess
import os
import sys
import queue as q
from time import sleep
from ruamel.yaml import YAML
from PIL import Im... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.