source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
model_average_optimizer_test.py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
test_browser.py | # coding=utf-8
# Copyright 2013 The Emscripten Authors. All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.
import argparse
import json
import multiprocessing
imp... |
test_runner.py | #!/usr/bin/env python3
# Copyright (c) 2014-2019 The Bitcoin Core developers
# Copyright (c) 2017-2020 The Bitcoin developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Run regression test suite.
This module calls down int... |
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... |
cli.py | import os
import sys
import re
import traceback
import logging
import queue
import signal
import threading
from logging.config import dictConfig
from pathlib import Path
import click
import inotify.adapters
import pidfile
from inotify.constants import (IN_ATTRIB, IN_DELETE, IN_MOVED_FROM,
... |
start_proxy.py | # Copyright 2019 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... |
main_window.py | import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
import electrum
from electrum.bitcoin import TYPE_ADDRESS
from electrum import WalletStorage, Wallet
from electrum_gui.kivy.i18n import _
from electrum.paymentrequest import InvoiceStore
from electr... |
watcher.py | """
Module to watch the CPU and RAM usage as a part of showing the
current usage by the product.
Not using any modules... But running some commands on the linux
machine to retrieve the CPU and RAM usage manually
May upgrade later to use `psutil`
"""
import os
from threading import Thread
from time import sleep
from ... |
utils.py | #
# Copyright 2018 PyWren Team
# Copyright IBM Corp. 2020
# Copyright Cloudlab URV 2020
#
# 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
#
# ... |
test_http.py | import asyncio
import contextlib
import io
import os
import sys
import threading
import time
from collections import ChainMap
from http.server import BaseHTTPRequestHandler, HTTPServer
import pytest
import fsspec.asyn
import fsspec.utils
fsspec.utils.setup_logging(logger_name="fsspec.http")
requests = pytest.import... |
__init__.py | # Copyright 2019 Uber Technologies, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
test_c10d_common.py | # Owner(s): ["oncall: distributed"]
import copy
import os
import sys
import tempfile
import threading
import time
from datetime import timedelta
from itertools import product
from sys import platform
import torch
import torch.distributed as dist
if not dist.is_available():
print("distributed package not availabl... |
generate.py | import random
import os
import sys
import time
import threading
total_questions = 20
time_duration = 1000*60
top_minimum=0
top_maximum=20
bottom_minimum=1
bottom_maximum=20
repeat_incorrect_question=False
bad_colour = '\033[1;31;40m '
good_colour = '\x1b[1,255,0m '
correct_answers = 0
incorrect_questions = []... |
label_positions.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright 2016-2018, 2020 by Jon Dart. All Rights Reserved.
# This code is under the MIT license: see doc directory.
#
# Tool to run matches that add score records (with c2 tag) to an EPD
# input file. Uses cutechess-cli for matches.
# Usage:
# python3 label_positions.py [-... |
client.py | from client.states.logged_out import LoggedOutState
from client.dt3p_adapter import Dt3pAdapter
from threading import Thread
from enum import Enum
import socket
import logging
class State(Enum):
LOGGED_OUT = "logged out"
LOGGED_IN = "logged in"
INVITED = "invited"
PLAYING = "playing"
WAITING = "... |
core.py | # -*- coding: utf-8 -*- {{{
# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et:
#
# Copyright 2017, Battelle Memorial Institute.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www... |
__init__.py | # -*- coding: utf-8 -*-
# Copyright 2015 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
engine.py | """
"""
import logging
from logging import Logger
import smtplib
import os
from abc import ABC
from datetime import datetime
from email.message import EmailMessage
from queue import Empty, Queue
from threading import Thread
from typing import Any, Sequence, Type, Dict, List, Optional
from vnpy.event import Event, Eve... |
foxbms_interface.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @copyright © 2010 - 2019, Fraunhofer-Gesellschaft zur Foerderung der
# angewandten Forschung e.V. All rights reserved.
#
# BSD 3-Clause License
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the fol... |
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,
... |
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_container_file_content,
get_docker_client,
get_host_ip,
pull_from_r... |
_v5_proc_coreTTS.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# COPYRIGHT (C) 2014-2020 Mitsuo KONDOU.
# This software is released under the MIT License.
# https://github.com/konsan1101
# Thank you for keeping the rules.
import sys
import os
import time
import datetime
import codecs
import glob
import queue
impo... |
ShellMenu.py | import threading
import time
from src.EmpireCliState import state
from src.menus.Menu import Menu
from src.utils import print_util
from src.utils.autocomplete_util import position_util
from src.utils.cli_util import register_cli_commands
@register_cli_commands
class ShellMenu(Menu):
def __init__(self):
s... |
ble_manager.py | #!/usr/bin/python3
#
# @file ble_manager.py
#
# @brief
#
# @author Garrett Hagen <garretthagen21@gmail.com>
#
# @date 2020-09-30
#
from peripheral import *
import threading
ble_app = G8BLEApplication(register=False)
ble_adv = G8Advertisement(register=False)
DO_CONTINUE = True
def initialize(start_... |
serving.py | from flask import Response
from flask import Flask
from flask import render_template
from flask import send_from_directory
app = Flask(__name__,template_folder='templates')
@app.after_request
def add_header(response):
response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'
response.headers['Cache-Control']... |
dbapi.py | # pysqlite2/test/dbapi.py: tests for DB-API compliance
#
# Copyright (C) 2004-2010 Gerhard Häring <gh@ghaering.de>
#
# This file is part of pysqlite.
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of t... |
main_window.py | import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
from electrum_spectrumcash.bitcoin import TYPE_ADDRESS
from electrum_spectrumcash.storage import WalletStorage
from electrum_spectrumcash.wallet import Wallet, InternalAddressCorruption
from electru... |
mp_gtk.py | import multiprocessing as mp
from webview import Window, windows
from webview.platforms import gtk as guilib
from uuid import uuid4
from threading import Thread
queue = mp.Queue()
event_queue = mp.Queue()
return_dict = {}
logger = guilib.logger
webkit_ver = guilib.webkit_ver
old_webkit = guilib.old_webkit
renderer ... |
utils.py | """
Changelog:
2018.07.09 use ijson to allow parsing large config files (stream parsing)
2016.11.22 fix function to strip *.i input semantically
2016.08.12 add option to show memory usage
2015.07.10 changed KeyboardInterrupt handling (was not killing the backend on Ubuntu)
2014.10.09 linemarke... |
main.py | from benchmark.benchmarker import Benchmarker, continue_benchmark
from threading import Thread
from sys import argv
from time import sleep
import argparse
from data.io import get_benchmark_folder, read_pickle
from benchmark.formatter import format_benchmark
import os
def start_b(data_set_name, file_name=None):
ben... |
pydoc.py | # uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: pydoc.py
"""Generate Python documentation in HTML or text for interactive use.
In the Python interpreter, do "from pydoc import help" to provide onl... |
project_sync.py | #!/usr/bin/env python
import os
import sys
import json
import time
import datetime as dt
from logging import getLogger
import requests
from website.app import init_app
from website import settings
logger = getLogger(__name__)
CERT = settings.GAKUNIN_SP_CERT
KEY = settings.GAKUNIN_SP_KEY
HOST = settings.CLOUD_GATEW... |
recorder.py | import threading
import time
import subprocess
import os
import platform
import logging
logger = logging.getLogger('agent')
class Recorder:
def __init__(self, env, queue):
self.thread = threading.Thread(target=self.record)
self.thread.setDaemon(True)
self.queue = queue
self.env = e... |
firehose.py | #! /usr/bin/env awx-python
#
# !!! READ BEFORE POINTING THIS AT YOUR FOOT !!!
#
# This script attempts to connect to an AWX database and insert (by default)
# a billion main_jobevent rows as screamingly fast as possible.
#
# tl;dr for best results, feed it high IOPS.
#
# this script exists *solely* for the purpose of ... |
padding_fifo_queue_test.py | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
base_events.py | """Base implementation of event loop.
The event loop can be broken up into a multiplexer (the part
responsible for notifying us of I/O events) and the event loop proper,
which wraps a multiplexer with functionality for scheduling callbacks,
immediately or at a given time in the future.
Whenever a public API takes a c... |
Sort_reads.py | #!/usr/bin/env python
##first step in snp discovery from GT-seq reads pipeline
##requires fastq files form all individuals to be in one folder and to be named: individualname.fastq
##requires giving the file path to the probeseq in the terminal
##optional multiprocessing - give the number of threads you want to use (de... |
test_dump_to_file.py | import io
import os
import pickle
import tempfile
import logging
import threading
from satella.coding import silence_excs
from satella.exception_handling import DumpToFileHandler, exception_handler
from satella.instrumentation import Traceback
from . import ExceptionHandlingTestCase
logger = logging.getLogger(__name... |
exposition.py | #!/usr/bin/python
from __future__ import unicode_literals
import base64
from contextlib import closing
import os
import socket
import sys
import threading
from wsgiref.simple_server import make_server, WSGIRequestHandler
from .openmetrics import exposition as openmetrics
from .registry import REGISTRY
from .utils im... |
bridge.py | #!/usr/bin/env python
#
# Copyright (c) 2018-2020 Intel Corporation
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
#
"""
Rosbridge class:
Class that handle communication between CARLA and ROS
"""
import os
import pkg_resources
try:
import que... |
__init__.py | """Launch the GMaps route planner."""
import os
import shutil
import subprocess
import sys
import threading
from pathlib import Path
from typing import Tuple
from fuzzywuzzy import process
import albertv0 as v0
__iid__ = "PythonInterface/v0.2"
__prettyname__ = "GMaps - Launch route planner"
__version__ = "0.1.0"
__... |
utils.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020 Alibaba Group Holding Limited. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache... |
APT28.py | import urllib.request
import re
import random
from bs4 import BeautifulSoup
import threading
# dichiarazione della lista degli useragents per evitare che il sito ci blocchi per le numerose richieste
useragents=["AdsBot-Google ( http://www.google.com/adsbot.html)",
"Avant Browser/1.2.789rel1 (http://www.avantbrowser... |
base.py | import hashlib
import httplib
import os
import threading
import traceback
import socket
import urlparse
from abc import ABCMeta, abstractmethod
from ..testrunner import Stop
from protocol import Protocol, BaseProtocolPart
here = os.path.split(__file__)[0]
# Extra timeout to use after internal test timeout at which t... |
qparse.py | # -*- encoding: utf8 -*-
import sys
import os
import shutil
import copy
import time
import urllib.request
import json
import pypandoc as pp
import pandocfilters as pf
from collections import namedtuple
from itertools import chain
import io
import logging
import threading
# Mantra imports
from config import cfg
from lo... |
db.py | import sqlite3
import threading, queue
import time
import random
import discord
import helper
import logging
import glob_vars
conn = None
c = None
def check_char_exists(uID, cID):
uID = str(uID)
cID = str(cID)
c.execute("SELECT EXISTS(SELECT * FROM chartable WHERE cID=? AND uID = ?)", (cID, uID))
if(c... |
generator.py | from typing import TextIO
import pika
from pika.exceptions import AMQPConnectionError
import threading
import random
import time
TEMPERATURE_MIN = -50 #w stopniach celcjusz (-35)-(-50)
TEMPERATURE_MAX = -35 #w stopniach celcjusz (-35)-(-50)
WIND_MIN = 14 # w km/h 14-22
WIND_MAX = 22 # w km/h 14-22
PRESSURE_MIN = 80... |
test_process.py | import datetime
import functools
import io
import multiprocessing
import os
import signal
import sys
import threading
import time
import warnings
import pytest
import salt.utils.platform
import salt.utils.process
from salt.utils.versions import warn_until_date
from tests.support.mock import patch
from tests.support.un... |
handler.py | """
Galaxy job handler, prepares, runs, tracks, and finishes Galaxy jobs
"""
import datetime
import os
import time
import logging
import threading
from Queue import Queue, Empty
from sqlalchemy.sql.expression import and_, or_, select, func, true, null
from galaxy import model
from galaxy.util.sleeper import Sleeper
... |
test_io.py | """Unit tests for the io module."""
# Tests of io are scattered over the test suite:
# * test_bufio - tests file buffering
# * test_memoryio - tests BytesIO and StringIO
# * test_fileio - tests FileIO
# * test_file - tests the file interface
# * test_io - tests everything else in the io module
# * test_univnewlines - ... |
main.py | #!/usr/bin/env python3
import os
import sys
import time
import numbers
import math
import multiprocessing
import queue
import threading
import functools
import tkinter as tk
import tkinter.messagebox as tkmb
import pygame
import mpmath
from mpmath import mp, mpc
import worker
PROGRAM_NAME = "Mandelbrot"
WINDOW_WID... |
test_sampling.py | from functools import partial
import math
import threading
import pickle
import pytest
from copy import deepcopy
import numpy as np
from numpy.testing import assert_allclose, assert_equal, suppress_warnings
from numpy.lib import NumpyVersion
from scipy.stats import (
TransformedDensityRejection,
DiscreteAliasUr... |
installwizard.py |
import os
import sys
import threading
import traceback
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from electrum import Wallet, WalletStorage
from electrum.util import UserCancelled, InvalidPassword
from electrum.base_wizard import BaseWizard, HWD_SETUP_DECRYPT_WALLET, GoBack
f... |
utils.py | """Utilities shared by tests."""
import asyncio
import collections
import contextlib
import io
import logging
import os
import re
import selectors
import socket
import socketserver
import sys
import tempfile
import threading
import time
import unittest
import weakref
from unittest import mock
fr... |
params.py | #!/usr/bin/env python3
"""ROS has a parameter server, we have files.
The parameter store is a persistent key value store, implemented as a directory with a writer lock.
On Android, we store params under params_dir = /data/params. The writer lock is a file
"<params_dir>/.lock" taken using flock(), and data is stored in... |
arpPoison.py | """
Arp poison
"""
#!/usr/bin/env python
# -*- coding: utf-8 -*-
print "[*] Initiating Arp Poisoning"
from scapy.all import *
import os
import sys
import threading
import signal
conf.verb = 0
def restore_target(gateway_ip,gateway_mac,target_ip,target_mac):
print "[*] Restoring target..."
send(ARP(op=2,psrc=... |
test_consumer_group.py | import collections
import logging
import threading
import os
import time
import pytest
import six
from kafka import SimpleClient, SimpleProducer
from kafka.common import TopicPartition
from kafka.conn import BrokerConnection, ConnectionStates
from kafka.consumer.group import KafkaConsumer
from test.conftest import v... |
face2rec2.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... |
models.py | """
Models for Azure Custom Vision training.
"""
import datetime
import logging
import threading
import time
import requests
from azure.cognitiveservices.vision.customvision.training.models.custom_vision_error_py3 import \
CustomVisionErrorException
from azure.iot.device import IoTHubModuleClient
from django.db im... |
config.py | import os
import traceback
from abc import abstractmethod, ABC
from pathlib import Path
from threading import Thread
from typing import Optional
import yaml
from bauh.api.paths import CONFIG_DIR
from bauh.commons import util
def read_config(file_path: str, template: dict, update_file: bool = False, update_async: bo... |
Cvirus.py | import os,sys,time,ctypes,winreg,random,base64,requests
import tkinter as tk
from tkinter import ttk
from threading import Thread
from tkinter import filedialog,messagebox
class Scan:
def __init__(self):
self.fp=fp
self.Root()
if self.fp!=None:
if os.path.isfile(self.fp... |
blocking_rate_limiter_test.py | # Copyright 2019 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... |
pollers.py | #!/usr/bin/python
from getpass import getpass
from pyzabbix import ZabbixAPI
import time
import socket
import json
import time
import math
from threading import Thread
from collections import defaultdict
import re
import string
import os
class Poller(object):
def __init__(self, length, interval, vms, meas_server, ... |
util.py | from collections import defaultdict
import struct
from threading import Thread, Event
from kafka.common import BufferUnderflowError
def write_int_string(s):
if s is None:
return struct.pack('>i', -1)
else:
return struct.pack('>i%ds' % len(s), len(s), s)
def write_short_string(s):
if s i... |
locators.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2015 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
import gzip
from io import BytesIO
import json
import logging
import os
import posixpath
import re
try:
import threading
except Imp... |
cam_local.py | import time
import threading
import os
import cv2
try:
from greenlet import getcurrent as get_ident
except ImportError:
try:
from thread import get_ident
except ImportError:
from _thread import get_ident
from sketch import Sketch
class CameraEvent(object):
"""An Event-like class that si... |
test_base_events.py | """Tests for base_events.py"""
import concurrent.futures
import errno
import math
import socket
import sys
import threading
import time
import unittest
from unittest import mock
import asyncio
from asyncio import base_events
from asyncio import constants
from test.test_asyncio import utils as test_utils
from test imp... |
action.py | from django.conf import settings
from django.core.management.base import CommandError
from systems.commands.index import CommandMixin
from systems.commands.mixins import exec
from systems.commands import base, messages
from utility import display
import threading
import re
import logging
import copy
import yaml
impor... |
updating-server.py | #!/usr/bin/env python
'''
Pymodbus Server With Updating Thread
--------------------------------------------------------------------------
This is an example of having a background thread updating the
context while the server is operating. This can also be done with
a python thread::
from threading import Thread
... |
combined_extraction.py | #!/usr/bin/env pyhton3
#!/usr/bin/env python3
import os
import glob
import time
import logging
import functools
import numpy as np
import gzip, bz2, re
from tqdm import tqdm
import multiprocessing as mp
from statsmodels import robust
from collections import defaultdict
from collections import OrderedDict
from deepmp ... |
test_threading.py | import threading
import time
from queue import Queue
from resources import threaded
q = Queue()
print_lock = threading.Lock()
def example_job(worker):
time.sleep(0.5)
with print_lock:
print(threading.current_thread().name, worker) #prevents the print from printing until unlocked
@threaded
def threa... |
connection.py |
import threading
from . import _impl
from .entry import NetworkTableEntry
from .messages import *
__all__ = ["BadMessageError", "StreamEOF", "NetworkTableConnection",
"ReadManager", "PROTOCOL_REVISION"]
class StreamEOF(IOError):
pass
class ReadStream:
def __init__(self, f):
self.f = f
... |
test_transaction.py | #!/usr/bin/env python
# test_transaction - unit test on transaction behaviour
#
# Copyright (C) 2007-2019 Federico Di Gregorio <fog@debian.org>
#
# psycopg2 is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundat... |
Runner.py | import sys
import subprocess
import threading
import time
import uuid
import os.path
from random import randint
from collections import namedtuple
from printer import console_out
class Runner:
def __init__(self):
self._benchmark_status = dict()
self.actor = "RUNNER"
def get_benchmark_statuses(... |
main.py | #!/usr/bin/python
# ENTech SS
# C.H.A.S Network
# ATTENTION:
# +============================================+
# |This script is for LINUX DEVICES ONLY!!!! |
# |This script is configured for MY network! |
# |Using this script will probably not work! |
# +============================================+
# This is th... |
keep_alive_monitor.py | # std
import logging
import urllib.request
from datetime import datetime
from threading import Thread
from time import sleep
from typing import List
# project
from . import EventService, Event, EventType, EventPriority
class KeepAliveMonitor:
"""Runs a separate thread to monitor time passed
since last keep-a... |
controller.py |
#
# YamahaControl App
# Control a Yamaha RX-V1500 receiver connected via RS232 using MQTT
#
import logging
#
# USER SETTINGS
#
MQTT_BROKER_HOST = 'mqtt-broker.local'
MQTT_BROKER_PORT = 1883
MQTT_TOPIC_PREFIX = "yamaha-rxv1500"
MQTT_CLIENT_ID = 'raspi'
MQTT_BROKER_USERNAME = 'mqtt-user'
MQTT_BROKER_PASSWORD = '*******... |
consumers.py | # app/simple_app/consumers.py
from channels.generic.websocket import WebsocketConsumer
from datetime import datetime
import time
import threading
from random import randint
from channels.generic.websocket import JsonWebsocketConsumer
class EchoConsumer(WebsocketConsumer):
def connect(self):
"""Event when ... |
master.py | import json
import logging
import os
import random
import socket
import string
# import hug
import sys
from collections import namedtuple
from threading import Thread
logging.getLogger("falcon").setLevel(logging.WARNING)
input_problem = 'text_problem_good.txt'
NODE = namedtuple('NODE', 'uid,address,demand,tis,tie,st,... |
test_dataloader.py | # -*- coding: utf-8 -*-
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2020 Megvii Inc. All rights reserved.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT ARRANTI... |
test_zeromq.py | # -*- coding: utf-8 -*-
"""
:codeauthor: Thomas Jackson <jacksontj.89@gmail.com>
"""
from __future__ import absolute_import, print_function, unicode_literals
import ctypes
import multiprocessing
import os
import threading
import time
from concurrent.futures.thread import ThreadPoolExecutor
import salt.config
impo... |
RandomizedTopology.py | import math
import random
import threading
from MacawNode import MacawNode
import wsnsimpy.wsnsimpy_tk as wsp
from Utilization import Utilization
PACKET_SIZE = 256
TX_RANGE = 100
NUM_SENDERS = 5
NODE_SPACING = 50
NUM_NODES = 30
GRID_BOUNDS = [50, 50, 600, 600]
class RandomizedTopology:
def __init__(self):
... |
pipelinecontroller.py | # coding=utf-8
"""PipelineController.py - controls (modifies) a pipeline
"""
import csv
import datetime
import hashlib
import io
import logging
import os
import random
import re
import string
import sys
import threading
from functools import reduce, cmp_to_key
from queue import PriorityQueue, Queue, Empty
from urllib... |
main.py | import argparse
import threading
import time
from pathlib import Path
import blobconverter
import cv2
import depthai as dai
import numpy as np
parser = argparse.ArgumentParser()
parser.add_argument('-nd', '--no-debug', action="store_true", help="Prevent debug output")
parser.add_argument('-cam', '--camera', action="st... |
run_glue_epochs.py | import argparse
import math
import os
from pathlib import Path
from pprint import pprint
import subprocess
import threading
import time
import torch
parser = argparse.ArgumentParser()
parser.add_argument(
"--load", default=None, type=str,
help="The model loaded, e.g., snap/vlm/wiki103_small"
)
parser.add_argu... |
genHTML.py | import os
import threading
def gen_html_header():
return '''<!DOCTYPE html>
<html>
<body>
<table border="1">
'''
def gen_html_footer():
return '''
</table>
</body>
</html>
'''
def gen_product_html(icon, jpg, url, name, price, promotion):
if not price or not jpg or not name or not url:
... |
change.py | import tkinter
from tkinter import(Toplevel, Frame, LabelFrame, Message, messagebox,
Text, Entry, Button, ttk, Label, scrolledtext, INSERT, END, BOTH, LEFT, RIGHT, Checkbutton, IntVar, StringVar)
from tkinter.filedialog import askdirectory
import os
import subprocess
import threading
import tkinter.... |
stl_capture_test.py | #!/router/bin/python
from .stl_general_test import CStlGeneral_Test, CTRexScenario
from trex_stl_lib.api import *
import os, sys
import pprint
import zmq
import threading
import time
import tempfile
import socket
from scapy.utils import RawPcapReader
from nose.tools import assert_raises, nottest
def ip2num (ip_str):
... |
fd.py | #!/usr/bin/env python
import sys
import time
import zmq
import threading
import os
from utils import *
class FailureDetector():
"""
Failure Detector (FD) class used to:
(i) Detect node failures;
(ii) Monitor sequencers resource usage;
(iii) Choose which node has the sequencer role.
"""
de... |
onnx_ckpt_convert.py | # Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... |
bootstrap_cluster.py | """Bootstrap the Delinkcious Kubernetes cluster
"""
import json
import os
import subprocess
import time
from getpass import getpass
from itertools import chain
from multiprocessing import Process
platform = None
def verify_requirements():
"""Make sure requirements are present
- kubectl (1.20+)
- helm... |
__init__.py | """
Support to check for available updates.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/updater/
"""
import asyncio
from distutils.version import StrictVersion
import json
import logging
import os
import platform
import subprocess
from subprocess imp... |
watcher.py | from dproxy.tasks.deployment.tasks import rollout, rollback, complete
from threading import Thread
from celery import chord
from celery.utils.log import get_task_logger
logger = get_task_logger(__name__)
class Watcher(object):
def __init__(self, task, inventory):
self.task = task
self.inventory ... |
lisp-rtr.py | # -----------------------------------------------------------------------------
#
# Copyright 2013-2019 lispers.net - Dino Farinacci <farinacci@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... |
worker.py | # PyAlgoTrade
#
# Copyright 2011-2015 Gabriel Martin Becedillas Ruiz
#
# 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 ap... |
utils.py | """ Bunch of helping classes and functions """
import cStringIO as StringIO
import os
import subprocess
import threading
import traceback
from multiprocessing import Process, Queue
import logging
LOGGER = logging.getLogger(__name__)
def encoding_normalazer(messages):
""" encodes message report text to utf-8 """
... |
toolchains.py | #!/usr/bin/env python3
# selenium powered downloader for microchip toolchains
# needs a valid microchip user
import os
import sys
import pickle
import multiprocessing as mp
from time import sleep
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.firefox.firefo... |
conftest.py | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
"""
Copyright 2017-2019 Baidu 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... |
__init__.py | '''
xbrlDB is an interface to XBRL databases.
Two implementations are provided:
(1) the XBRL Public Database schema for Postgres, published by XBRL US.
(2) an graph database, based on the XBRL Abstract Model PWD 2.
(c) Copyright 2013 Mark V Systems Limited, California US, All rights reserved.
Mark V copyright app... |
scoring_functions.py | #!/usr/bin/env python
from __future__ import print_function, division
import numpy as np
from rdkit import Chem
from rdkit import rdBase
from rdkit.Chem import AllChem
from rdkit import DataStructs
from sklearn import svm
import time
import pickle
import re
import threading
import pexpect
rdBase.DisableLog('rdApp.error... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.