source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
parallel_training.py | import time
import threading as T
import queue
from cfg import Opts
from typing import Any, List, TypeVar, Callable
from mlutils.log import Log
Queue = TypeVar('Queue')
S_CallBack = Callable[[TypeVar('ParallelTrainer')], None]
GR_CallBack = Callable[[TypeVar('ParallelTrainer'), List[Any]], None]
class Msg(object):
... |
manager.py | import logging
from multiprocessing import Value, Process, Manager
import pantilthat as pth
import signal
import sys
from detect.camera import run_pantilt_detect
from control.pid import PIDController
logging.basicConfig()
LOGLEVEL = logging.getLogger().getEffectiveLevel()
RESOLUTION = (320, 320)
SERVO_MIN = -90
SE... |
i.py | import threading
import tkinter.messagebox
threading.Thread(
target=lambda: tkinter.messagebox.showmessage('hi', 'hi')).start()
from queue import Queue
Q = Queue()
def p():
print(Q.get())
t = threading.Thread(target=p)
t.start()
while True:
Q.put(input('type to send a message to t: '))
|
main.py | import json
import time
import traceback
import logging.config
from threading import Thread, Event
import arrow
import datetime
from slavem import Reporter
from wash import Washer
from aggregatebar import AggregateBar
from contracter import Contracter
from hiscontract import HisContracter
settingFile = 'conf/kwarg.j... |
test_automap.py | import random
import threading
import time
from sqlalchemy import create_engine
from sqlalchemy import ForeignKey
from sqlalchemy import Integer
from sqlalchemy import MetaData
from sqlalchemy import String
from sqlalchemy import testing
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.ext.automap impor... |
console.py | from __future__ import absolute_import, division, print_function
import asyncio
import copy
import json
import logging
import os
import random
import string
import threading
from code import InteractiveConsole
from collections import OrderedDict
from decimal import Decimal
from enum import Enum
from os.path import exi... |
tests.py | # Unit tests for cache framework
# Uses whatever cache backend is set in the test settings file.
import copy
import io
import os
import pickle
import re
import shutil
import tempfile
import threading
import time
import unittest
import warnings
from unittest import mock
from django.conf import settings
from django.core... |
multiiters.py | from __future__ import division
import math
# import multiprocessing
import itertools
import time
from decimal import *
from django.forms.models import model_to_dict
from core.models import Factor,Radiators,Horizontal,Vertical,Fins
class MultiIters(object):
counter=0
basic={}
core={}
tapping={}
lv={}
hv={}
cca=... |
queue_handler.py | #!/usr/bin/env python
"""
QueueHandler and QueueListener Python 2.7. See
- http://plumberjack.blogspot.hu/2010/09/using-logging-with-multiprocessing.html
- http://gist.github.com/591589 (improved version from the link above)
- http://plumberjack.blogspot.hu/2010/09/improved-queuehandler-queuelistener.html
"""
# Copyri... |
adb.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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
test_run.py | import run
from multiprocessing import Process
def test_main():
p = Process(target=run.main, args=('ls', ))
p.start()
assert p.is_alive()
p.terminate()
# todo: simulate process exit and check if watchdog restarts it
|
monitors.py | from __future__ import absolute_import
import logging
import threading
from .sleeper import Sleeper
log = logging.getLogger(__name__)
DEFAULT_MONITOR_THREAD_JOIN_TIMEOUT = 5
class Monitors:
def _init_monitor_thread(self, name, target_name=None, target=None, start=False, config=None):
self.monitor_joi... |
profile_process.py | # coding=utf-8
import time
import multiprocessing
def profile(func):
def wrapper(*args, **kwargs):
import time
start = time.time()
func(*args, **kwargs)
end = time.time()
print 'COST: {}'.format(end - start)
return wrapper
def fib(n):
if n<= 2:
return 1
... |
main.py | from __future__ import print_function
import argparse
import os
import sys
import pickle as pkl
import torch
import torch.optim as optim
import torch.multiprocessing as mp
import torch.nn as nn
import torch.nn.functional as F
from envs import create_atari_env
from model import ActorCritic
from train import train
from... |
arp_cache_poisoner.py | #!/usr/bin/env python3
# Example script to perform an ARP cache poisoning attack using SCAPY
# v: 0.1
# Omar Santos @santosomar
from scapy.all import *
import os
import signal
import sys
import threading
import time
#network and interface parameters
gateway_ip = "192.168.78.1"
target_ip = "192.168.78.123"
packet_coun... |
16_edf_wait_die_NS.py | from functools import reduce
from sys import *
import numpy as np
import random as r
import ping_code as pc
import socket
import struct
import subprocess as sp
import threading
from threading import Thread
import ast
import time
import datetime as dt
import os
import psutil
import getpass as gp
from netifaces import in... |
wsdump.py | #!/home/ubuntu/beats/src/github.com/haringattu/lsbeat/build/python-env/bin/python3
import argparse
import code
import sys
import threading
import time
import ssl
import six
from six.moves.urllib.parse import urlparse
import websocket
try:
import readline
except ImportError:
pass
def get_encoding():
en... |
cli.py | # -*- coding: utf-8 -*-
"""
flask.run
~~~~~~~~~
A simple command line application to run flask apps.
:copyright: (c) 2014 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import os
import sys
from threading import Lock, Thread
from functools import update_wrapper
import click
... |
exercise6.py | #!/usr/bin/env python
from netmiko import ConnectHandler
from getpass import getpass
from datetime import datetime
from net_system.models import NetworkDevice, Credentials
import django
import threading
def show_version(a_device):
creds = a_device.credentials
remote_conn = ConnectHandler(device_type=a_device... |
trezor.py | from binascii import hexlify, unhexlify
import traceback
import sys
from electrum.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException
from electrum.bitcoin import TYPE_ADDRESS, TYPE_SCRIPT
from electrum.bip32 import deserialize_xpub
from electrum import constants
from electrum.i18n import _
from el... |
qt.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... |
ipythonwidget.py | import os
import csv
import time
from threading import Thread
from IPython.core.display import display, HTML
from traitlets import Unicode, Dict, default
from ipywidgets import DOMWidget, Layout, widget_serialization
class CatboostIpythonWidget(DOMWidget):
_view_name = Unicode('CatboostIpythonWidgetView').tag(syn... |
test_weather_ledger.py | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the ... |
csv_import_http_server.py | from http.server import HTTPServer, BaseHTTPRequestHandler
from http import HTTPStatus
import threading
# noinspection PyPep8Naming
class CSVTestRequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
self.log_message("received %s %s", self.command, self.path)
path = self.path
if path ==... |
workbench.py | # -*- coding: utf-8 -*-
import ast
import collections
import importlib
import logging
import os.path
import pkgutil
import platform
import queue
import re
import socket
import sys
import tkinter as tk
import tkinter.font as tk_font
import tkinter.messagebox as tk_messagebox
import traceback
import webbrowser
from thre... |
bot.py | import io
import logging
import os
import sys
from threading import Thread
import telegram
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
from utils.image_processing import Model
from utils.database import DbConnection
class Bot: # pylint: disable=too-few-public-methods
def __init__(s... |
coap.py | import copy
import logging
import logging.config
from coapthon.messages.response import Response
import os
import random
import socket
import struct
import threading
from coapthon.messages.message import Message
from coapthon import defines
from coapthon.utils import Tree, create_logging
from coapthon.layers.blocklaye... |
functional_tests.py | #!/usr/bin/env python
"""
This script cannot be run directly, because it needs to have test/functional/test_toolbox.py in sys.argv in
order to run functional tests on repository tools after installation. The install_and_test_tool_shed_repositories.sh
will execute this script with the appropriate parameters.
"""
import ... |
bot.py | # coding=utf-8
import os
import re
import threading
import asyncio
import base64
import json
import importlib
import random
import time
import discord
from discord.ext import commands
from core import updates
from core.log_manager import logger
from core.lang_manager import LangManager
from core.conf... |
test_indexes.py | import datetime
import queue
import time
from threading import Thread
from django.test import TestCase
from test_haystack.core.models import (
AFifthMockModel,
AnotherMockModel,
AThirdMockModel,
ManyToManyLeftSideModel,
ManyToManyRightSideModel,
MockModel,
)
from haystack import connections, i... |
main.py | from flask import Flask, render_template
from flask_socketio import SocketIO, emit
from threading import Thread
app = Flask(__name__)
app.config['SECRET_KEY'] = 'TOP SECRET'
app.debug = True
socketio = SocketIO(app)
stop_thread = False
board = None
thr = None
start_thread = False
pins = {
'COM': None,
'A0'... |
dispatcher.py | # Copyright 2017, 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,... |
test_io.py | import numpy as np
import numpy.ma as ma
from numpy.ma.testutils import *
from numpy.testing import assert_warns
import sys
import gzip
import os
import threading
from tempfile import mkstemp, NamedTemporaryFile
import time
from datetime import datetime
from numpy.lib._iotools import ConverterError, ConverterLockEr... |
mc_sniffer.py | # -*- coding: utf-8 -*-
#! /usr/bin/env python2.7
import sys
import os
import pcap
import string
import time
import socket
import struct
import threading
import re
import subprocess
import MySQLdb
import MySQLdb.constants
import MySQLdb.converters
import MySQLdb.cursors
import logging
from logging import handlers
from... |
httpd.py | """
This file is part of dispy project.
See http://dispy.sourceforge.net for details.
"""
import sys
import os
import threading
import json
import cgi
import time
import ssl
import re
import functools
import copy
import traceback
import dispy
from dispy import DispyJob, DispyNodeAvailInfo, logger
if sys.version_info... |
record_process.py | # -*- coding:utf-8 -*-
import datetime
import os
from threading import Thread
import pynput
from PIL import ImageGrab
from pynput.keyboard import Key
# 监听鼠标
last_time = datetime.datetime.now()
operate_record = []
id = 0
status_flag = True
# 截取指定位置
def make_screenshot(x1, y1, x2, y2):
"""截图
:param x1: 开始截图的... |
utility.py | import os
import math
import time
import datetime
from multiprocessing import Process
from multiprocessing import Queue
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import imageio
import torch
import torch.optim as optim
import torch.optim.lr_scheduler as lrs
### [y]
... |
tree_if_root.py | import logging
import traceback
from threading import Thread
from . import data_packets_socket
from .tree_interface import TreeInterface
from .root_state_machine import SFMRNewRootState #SFMRRootState
class TreeInterfaceRoot(TreeInterface):
LOGGER = logging.getLogger('hpim.KernelEntry.RootInterface')
def __... |
test_telnetlib.py | import socket
import selectors
import threading
import contextlib
from test import support
from test.support import socket_helper, warnings_helper
import unittest
support.requires_working_socket(module=True)
telnetlib = warnings_helper.import_deprecated('telnetlib')
HOST = socket_helper.HOST
def server(evt, serv):... |
run_client.py | import config
from node.client import Client
from threading import Thread
def main():
client_threads = []
for client_index in range(1, config.REPLICA_NUM+1):
client_thread = Thread(target=run, args=(client_index,))
client_thread.start()
client_threads.append(client_thread)
for cli... |
bolt.py | """Base bolt classes."""
from __future__ import absolute_import, print_function, unicode_literals
import logging
import os
import re
import signal
import sys
import threading
import time
from collections import defaultdict, namedtuple
from six import iteritems, itervalues, reraise
from .component import Component, T... |
v1.py | import multiprocessing as mp
import sqlite3
# IDEA:
# - baza partycjonowana po czasie oparta o sqlite
# - partycja obslugiwana w osobnym, rownoleglym procesie
# - map -> zapytania sql wewnatrz partycji
# - combine -> za pomoca sqla lub pythona
# - reduce -> za pomoca pythona
def worker(id,pipe):
db = sqlite3.connect... |
main.py | import logging
import multiprocessing
import os
import signal
import sys
import time
from typing import Any
from datastore.reader.app import register_services
from gunicorn.app.base import BaseApplication
from .shared.env import is_dev_mode
from .shared.interfaces.logging import LoggingModule
from .shared.interfaces.... |
daemonProcess.py | import multiprocessing
import time
def daemonProcess():
print("Starting my Daemon Process")
print("Daemon process started: {}".format(multiprocessing.current_process()))
time.sleep(3)
print("Daemon process terminating")
def main():
print("Main process: {}".format(multiprocessing.current_process())... |
test_lightningd.py | from concurrent import futures
from decimal import Decimal
import copy
import json
import logging
import queue
import os
import random
import re
import shutil
import socket
import sqlite3
import stat
import string
import subprocess
import sys
import tempfile
import threading
import time
import unittest
import utils
f... |
smi.py | # ============================================================================ #
# Copyright (c) 2011-2019, NVIDIA Corporation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributi... |
client.py | ### Reference
### https://seolin.tistory.com/98?category=762768 ###
### Socket programming Client code
from socket import *
import threading
import time
class client():
def __init__(self, port, host):
self.port = port
self.host = host
self.clientSock = socket(AF_INET, SOCK_STRE... |
data_generator.py |
import numpy as np
from threading import Semaphore, Thread
from time import sleep
from random import choice, randint
from pdb import set_trace as pause
class DataGenerator(object):
def __init__( self, data, process_data_item_func, xshape, yshape, \
data_item_selector = choice, \
nthreads = 2, \
... |
Scheduler.py | import time
from multiprocessing import Process
from ProxyPool.Api import app
from ProxyPool.Getter import Getter
from ProxyPool.Tester import Tester
from ProxyPool.DB import RedisClient
from ProxyPool.Setting import *
class Scheduler():
def scheduleTester(self, cycle=TESTER_CYCLE):
tester = Tester()
... |
Main.py | import time
import sys
import signal
import atexit
import random as rand
import RPi.GPIO as GPIO
import threading
# Initialize Pin (const)
LED = {"r": 18, "g": 16, "b": 12}
# Frequecy in Hz
FREQ = 500
STEP = 200.0
# Rainbow Colors
colorEffect = [
{"r": 0xFF, "g": 0x00, "b": 0x00},
{"r": 0xFF, "g": 0x7F, "b"... |
geneminer_gui.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2021/10/20 16:58
# @Author : xiepulin
# @File : geneminer.py
# @Software: PyCharm
import argparse
import sys
import subprocess
import datetime
import os
import logging
import re
import multiprocessing
import signal
import threading
... |
tcp_server.py | import socket
import sys
import threading
IP = '127.0.0.1'
PORT = 4444
SOCKET = IP, PORT
def main():
try:
tcp_server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
tcp_server.bind((SOCKET))
tcp_server.listen(5)
print(f'[*] Listening on {IP}:{PORT}')
while True:
... |
aidemo.py | # Copyright (c) 2020 PHYTEC Messtechnik GmbH
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import time
import gi
import cv2
import numpy as np
from threading import Event, Thread, Lock
from queue import Queue
gi.require_version('Gtk', '3.0')
gi.require_version('GdkPixbuf', '2.0')
from gi.repository.GdkPi... |
client.py | import socket
import os
import threading
import hashlib
from Crypto import Random
from Crypto.Cipher import PKCS1_OAEP, AES
from Crypto.PublicKey import RSA
import signal
from lazyme.string import color_print
def RemovePadding(s):
return s.replace('`','')
def Padding(s):
return s + ((16 - len(s) % 16) * '`')... |
client.py | from xmlrpc.client import ServerProxy, Fault
from cmd import Cmd
from random import choice
from string import ascii_lowercase
from server import Node, UNHANDLED
from threading import Thread
from time import sleep
import sys
SECRET_LENGTH = 100
HEAD_START = 0.1
def random_string(length):
chars = []
letters = ... |
main.py | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import argparse
import sys
from collections import defaultdict
from multiprocessing import Process
from os import makedirs
from os.path import dirname, join, realpath
from maro.rl import (
Actor, ActorProxy, DQN, DQNConfig, FullyConnectedBl... |
tests.py | from __future__ import unicode_literals
import sys
try:
import threading
except ImportError:
threading = None
import time
from unittest import skipIf, skipUnless
from django.db import (connection, transaction,
DatabaseError, IntegrityError, OperationalError)
from django.test import TransactionTestCase, sk... |
sign_cam.py | # 표지판 classifier
# 현지웅, 김성우
import threading
import time
import cv2
import numpy as np
import tensorflow as tf
# ==========================================
from src.shape_detection import shape_detect
class SignCam:
def __init__(self):
self.sign_trigger = 0
self.is_in_mission = False
se... |
test_util.py | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
subcommands.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# =======================================================
"""subcommand
* pydorkをコマンドとして動作させる際の処理を記載しているモジュール
"""
import sys
import threading
import json
import os
from .engine import SearchEngine, ENGINES
from .common import Color
from .common import Message
# サ... |
multithread.py | # -*- coding: utf-8 -*-
"""
Multi-threaded crawler
"""
import queue
import time
import threading
class MultiThreadingCrawler(object):
def __init__(self):
self.queue = queue.Queue()
self.gap = 1
def producer(self):
for i in range(100):
self.queue.put(i)
... |
subprocess.py | """
Some light wrappers around Python's multiprocessing, to deal with cleanly
starting child processes.
"""
import multiprocessing
import os
import signal
import sys
multiprocessing.allow_connection_pickling()
spawn = multiprocessing.get_context("spawn")
def get_subprocess(config, target, sockets):
"""
Calle... |
camera_cv.py | import time
import io
import threading
import numpy as np
import cv2
# Release everything if job is finished
class Camera(object):
thread = None # background thread that reads frames from camera
frame = None # current frame is stored here by background thread
last_access = 0 # time of last client ac... |
dag_processing.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... |
infoleak.py | # -*- coding:utf-8 -*-
import os
import json
import requests
import threading
from ..randheader.randheader import get_ua
STATUS_CODES = [200, 206, 401, 305, 407] # HTTP响应状态码,判断认为存在风险链接的状态码
RESULT = []
THREADMAX = threading.BoundedSemaphore(32) # 限制线程的最大数量为32个
def get_html(url=''):
"""
判断URL访问是否... |
rforward.py | # rforward.py 192.168.100.133 -p 8080 -r 192.168.100.128:80 --user fearless --password
import getpass
import select
import socket
import sys
import threading
import paramiko
def main():
options, server, remote = parse_options()
password = None
if options.readpass:
password = getpass.getpass('Enter... |
scheduler.py | #!/home/yinhao/anaconda3/bin/python
#-*- coding=utf-8 -*-
##################################################################
# File : scheduler.py
# Author : H.Yin
# Email : csustyinhao@gmail.com
# Created : 2019-06-01 23:23:30(+0800)
# Modified : 2020-05-17 01:05:54(+0800)
# GitHub ... |
test_primitives_ops.py | # coding=utf-8
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2017
# Import the SPL decorators
from streamsx.spl import spl
#------------------------------------------------------------------
# Test passing in SPL types functions
#------------------------------------------------------------------
# Def... |
main.py | """
"""
import os
import sys
import zipfile
import json
import importlib
import threading
import time
import traceback
import hashlib
try:
import sublime
import sublime_plugin
pc = importlib.import_module('Package Control.package_control.package_manager')
pdm = importlib.import_module('Package Contro... |
chat_server.py | import grpc
import chat_pb2 as chat
import chat_pb2_grpc as rpc
import threading
from server import myserver
class ChatClass:
def __init__(self, address, port):
channel = grpc.insecure_channel(address + ':' + str(port))
self.conn = rpc.ChatServerStub(channel)
self.username = input("Enter y... |
module_init.py | import subprocess
import threading
from instances import xlog
import os
import sys
import config
import web_control
import time
proc_handler = {}
current_path = os.path.dirname(os.path.abspath(__file__))
root_path = os.path.abspath( os.path.join(current_path, os.pardir))
if root_path not in sys.path:
sys.path.ap... |
threading.py | import asyncio
import threading
import datetime
from queue import Queue
from random import randint
import re
import sys
import traceback
import inspect
from datetime import timedelta
import logging
import iso8601
from appdaemon import utils as utils
from appdaemon.appdaemon import AppDaemon
class Threading:
def ... |
parallel.py | import os
import sys
import signal
import time
import numpy as np
import threading
import multiprocessing
try:
import queue
except ImportError:
import Queue as queue
class ParallelGenerator:
"""
Builds a queue out of a data generator.
Args:
generator: a generator function which endlessly... |
main.py | #
# TODO: after posting UI forms there is an option for user to send form again on page reload, need to change it
# TODO: some bug: user logs in via google account, then suddenly may (or may not) become logged out for no reason
# TODO: need to set some DB size limit upon which there will be red warning on web frontend,... |
__init__.py | # Copyright 2011,2013,2017 James McCauley
#
# 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 t... |
tests.py | # -*- coding: utf-8 -*-
# Unit tests for cache framework
# Uses whatever cache backend is set in the test settings file.
from __future__ import unicode_literals
import copy
import io
import os
import re
import shutil
import tempfile
import threading
import time
import unittest
import warnings
from django.conf import... |
server.py | import socket
from threading import Thread,Lock
from queue import Queue
from sys import argv
from sys import stdin
from argparse import ArgumentParser
import select
def printv(s):
if args.v:
print(f'\x1B[1;34m{s}\x1B[0m')
def read(fd):
msg = b''
try:
while not msg.endswith(b'\r\n\r\n'):
... |
proxy.py | # -*- coding: utf-8 -*-
# Copyright 2019-2020 Mircea Ulinic. All rights reserved.
#
# The contents of this file are 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/licen... |
proxy.py | #!/usr/bin/python3
import requests
import multiprocessing
import sys
from bs4 import BeautifulSoup
import os
import argparse
import time
# Python program to print colored text and background
def prRed(skk): print("\033[91m {}\033[00m" .format(skk))
def prGreen(skk): print("\033[92m {}\033[00m" .format(skk))
def prYel... |
vimeo90k_Create.py | import torch
import sys
from torch.autograd import Variable
import numpy as np
import cv2
from options.train_options import TrainOptions
opt = TrainOptions().parse() # set CUDA_VISIBLE_DEVICES before import torch
from data.data_loader import CreateDataLoader
from models.models import create_model
from skimage import i... |
multiprocessing_daemon.py | import multiprocessing
import time
import sys
def daemon():
p = multiprocessing.current_process()
print("Starting", p.name, p.pid)
sys.stdout.flush()
time.sleep(2)
print("Exiting", p.name, p.pid)
sys.stdout.flush()
def non_daemon():
p = multiprocessing.current_process()
print("Starti... |
views_api.py | from webinterface import webinterface
from flask import render_template, send_file, redirect, request, url_for, jsonify
from lib.functions import find_between, theaterChase, theaterChaseRainbow, sound_of_da_police, scanner, breathing, \
rainbow, rainbowCycle, fastColorWipe, play_midi, clamp
import psutil
import thr... |
test_maxpool2d_fpga.py | # MaxPool expansion, simple testing
# TODO: add more testing
import torch
import torch.nn as nn
import torch.nn.functional as F
import dace
import pytest
import numpy as np
from dace.transformation.interstate import FPGATransformSDFG, InlineSDFG
from daceml.util import utils
import daceml.onnx as donnx
from daceml.p... |
view_model.py | # encoding: utf-8
"""
model.view_model -- Functionality for Model-based GUIs
This is complementary to the AbstractModel class and not a subclass of it.
Subclasses should inherit from both Model (or a Model subclass) and this class
to take advantage of the visualization capability:
class MyModelGUI(ViewModel, Model):... |
test_python_server_image_builder.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... |
proxier.py | import atexit
from concurrent import futures
from dataclasses import dataclass
import grpc
import logging
from itertools import chain
import json
import socket
import sys
from threading import Lock, Thread, RLock
import time
import traceback
from typing import Any, Callable, Dict, List, Optional, Tuple
import ray
from... |
run.py | import OnlineHeart
import Silver
import LotteryResult
import Tasks
import connect
from rafflehandler import Rafflehandler
from rafflehandler import Delay_Joiner
import asyncio
from printer import Printer
from statistics import Statistics
from bilibili import bilibili
from configloader import ConfigLoader
import threadi... |
main.py | import asyncio
import sys
import time
import datetime
from queue import Queue
from threading import Thread
from typing import Optional
from fastapi import FastAPI, Form, HTTPException, Request
from fastapi.middleware.cors import CORSMiddleware
from sse_starlette.sse import EventSourceResponse
from google.protobuf imp... |
tello.py | """Library for interacting with DJI Ryze Tello drones.
"""
# coding=utf-8
import logging
import socket
import time
from threading import Thread
from typing import Optional, Union, Type, Dict
import cv2 # type: ignore
from .enforce_types import enforce_types
threads_initialized = False
drones: Optional[dict] = {}
cl... |
services.py | import json
from queue import Queue
from modules import discord
import threading
checked_services: list[str] = [] #services that are enabled
current_service: str = 'blah' #the current service displayed on RP
last_json: str = 'blah' #the last json recieved
def MainHandler(jsonQ: Queue, checkedQ: Queue):
... |
mo.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import copy
import numpy as np
from sklearn.base import RegressorMixin
from multiprocessing import Process, Manager, set_start_method
class MORegression(RegressorMixin):
def __init__(self, models=None, model=None):
if models and isinstance(models, (... |
learner.py | from __future__ import division
from __future__ import print_function
from builtins import zip
from builtins import range
from builtins import object
# Copyright 2018 The TensorFlow Authors All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in com... |
masterbot-chris.py | # -*- coding: utf-8 -*-
import LINETCR
from LINETCR.lib.curve.ttypes import *
from LINETCR.LineApi import *
from datetime import datetime
import time, random, sys, ast, re, os, io, json, subprocess, threading, string, codecs, requests, tweepy, ctypes, urllib, urllib2, wikipedia, goslate, unicodedata
import time... |
pypanda_target.py | from threading import Thread
from time import sleep
from os.path import abspath
from avatar2.targets import PandaTarget
from ..watchmen import watch
from .target import action_valid_decorator_factory, TargetStates
class PyPandaTarget(PandaTarget):
'''
The pypanda target is a PANDA target, but uses pypanda to... |
tello_controller.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 3 10:28:41 2020
@author: jakeluo
"""
# -*- coding: utf-8 -*-
# import sys
import time
import tello_manager
import queue
# import time
import os
# import binascii
# import threading
from threading import Thread
class Tell_Controller:
def __ini... |
metrics.py | from __future__ import absolute_import
__all__ = ['timing', 'incr']
import logging
from contextlib import contextmanager
from django.conf import settings
from random import random
from time import time
from threading import Thread
from six.moves.queue import Queue
metrics_skip_internal_prefixes = tuple(settings.SE... |
xbee_fake_client.py | #!/usr/bin/env python
from XBEE.xbee_template import BLUE_COM
from global_var.global_logger import logger
from global_var.global_param import XBEE_HOST_IP , CLIENT_NAME
import signal
import threading
import time
import json
######################
### Exit handler ###
######################
is_running = True
def ... |
run.py | #!/usr/bin/env python3
import struct
import threading
import time
from computer import sodevice, rdmadevice
def main():
ram_config = struct.pack('@I', 4 * (1<<10))
ramdev = sodevice.SODevice('ram/libbridgesimram.so', ram_config)
rdmadev = rdmadevice.RDMADevice('127.0.0.1', 8080)
cpu_config = struct.p... |
sendalerts.py | from datetime import timedelta as td
import signal
import time
from threading import Thread
from django.core.management.base import BaseCommand
from django.utils import timezone
from hc.api.models import Check, Flip
from statsd.defaults.env import statsd
SENDING_TMPL = "Sending alert, status=%s, code=%s\n"
SEND_TIME_... |
trainer_utils.py | # coding=utf-8
# Copyright 2020-present the HuggingFace Inc. 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 ap... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.