source
stringlengths
3
86
python
stringlengths
75
1.04M
train_rfcn_alt_opt_5stage.py
#!/usr/bin/env python # -------------------------------------------------------- # R-FCN # Copyright (c) 2016 Yuwen Xiong, Haozhi Qi # Licensed under The MIT License [see LICENSE for details] # -------------------------------------------------------- """Train a R-FCN network using alternating optimization. This tool ...
main.py
from __future__ import print_function, division import os os.environ["OMP_NUM_THREADS"] = "1" import argparse import torch import torch.multiprocessing as mp from environment import atari_env from utils import read_config from model import A3Clstm from train import train from test import test from shared_optim import S...
conflictedARGsClass.py
import json from pymongo import MongoClient import sys import requests import json import networkx as nx # from rest.DataBaseInterface.DataBaseClass import DataBase import threading class ConflictedARGs(): def __init__(self, DataBase): self.database = DataBase self.table = 'master' self.se...
gpx_example.py
from ftssim import gpx from threading import Thread player = gpx.GpxPlayer('192.168.3.2', 'test_file.gpx', "A1_Walk", speed_kph=5, max_time_step_secs=4) player2 = gpx.GpxPlayer('192.168.3.2', 'test.gpx', "A2_Walk", speed_kph=5, max_time_step_secs=4, repeated_objects=5) # Setup A thread for each player player_thread =...
run_crate.py
import argh import os import json import re import subprocess import tempfile import sys import shutil import contextlib import logging import random import time import gzip import io import tarfile import threading import fnmatch import socket import ssl import platform from datetime import datetime from hashlib impor...
conftest.py
import asyncio import json import os import threading import time import typing import pytest import trustme from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives.serialization import ( BestAvailableEncryption, Encoding, PrivateFormat, load_pem_private_key, ) from...
clusterTest.py
# Copyright 2017-present Open Networking Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
installwizard.py
from functools import partial import threading from kivy.app import App from kivy.clock import Clock from kivy.lang import Builder from kivy.properties import ObjectProperty, StringProperty, OptionProperty from kivy.core.window import Window from kivy.uix.button import Button from kivy.utils import platform from kivy...
test.py
import threading def app (x, eventForApp, eventForSet): for i in range(1): eventForApp. wait (); eventForApp. clear (); if x == 0: print ("hello"); if x == 1: print ("fuck"); eventForSet. set (); e1 = threading. Event (); e2 = threading. Event (); t1 = threading. Thread ...
Hiwin_RT605_ArmCommand_Socket_20190627194935.py
#!/usr/bin/env python3 # license removed for brevity import rospy import os import socket ##多執行序 import threading import time import sys import matplotlib as plot import HiwinRA605_socket_TCPcmd as TCP import HiwinRA605_socket_Taskcmd as Taskcmd import numpy as np from std_msgs.msg import String from ROS_Socket.srv imp...
process_tests.py
from __future__ import print_function import errno import os import socket import subprocess import sys import threading import time from contextlib import contextmanager from logging import getLogger try: import fcntl except ImportError: fcntl = False try: import Queue except ImportError: import queu...
main2.py
import keep_alive from discord.ext import commands import threading import discord import asyncio import aiohttp import random import socket import ctypes import time import json import ssl import re import os token = '' prefix = '/' intents = discord.Intents().all() bot = commands.Bot(command_prefix=prefix, case_ins...
thread2.py
import time,threading #多线程锁定执行完一个方法才能被打断 lock = threading.Lock() balance = 0 def change_it(n): global balance balance = balance+n balance = balance-n def run_thread(n): for i in range(100000): lock.acquire() try: change_it(n) finally: lock.release() t1 =...
cameraspooferprocess.py
# Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC organizers # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the above copyright notice, ...
worker.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...
camera.py
import configparser import logging import math import os import pathlib import threading import time import glob from contextlib import contextmanager from functools import wraps from io import BytesIO from pathlib import Path from queue import Queue from typing import List import cv2 from PIL import Image, _webp from...
client.py
#!/usr/bin/env python # coding:utf-8 import os import pickle import socket import sys import time from threading import Event, Thread from typing import Tuple, List from psy import network from psy.client.message import Message from psy.client.config import bus from psy.client.config import logging class Client: ...
test.py
# -*- coding: utf-8 -*- import redis import unittest from hotels import hotels import random import time from RLTest import Env def testAdd(env): if env.is_cluster(): raise unittest.SkipTest() r = env env.assertOk(r.execute_command( 'ft.create', 'idx', 'schema', 'title', 'text', 'body', ...
codecs_socket_fail.py
import sys import socketserver class Echo(socketserver.BaseRequestHandler): def handle(self): # Get some bytes and echo them back to the client. data = self.request.recv(1024) self.request.send(data) return if __name__ == '__main__': import codecs import socket impor...
douftpserver.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """DouFTP Server""" from multiprocessing import Process, freeze_support from os.path import dirname import utils.global_variable as g from app import App # 全局变量 g.init() g.set_item('APP_NAME', 'DouFTP Server') g.set_item('APP_BOUNDLE_ID', 'org.douftp.server.desktop') g....
__init__.py
# -*- coding: utf-8 -*- """The initialization file for the Pywikibot framework.""" # # (C) Pywikibot team, 2008-2018 # # Distributed under the terms of the MIT license. # from __future__ import absolute_import, division, unicode_literals __version__ = __release__ = '3.1.dev0' __url__ = 'https://www.mediawiki.org/wiki/...
main.py
"""Team Lightning Project 2017 Pet Pal Home-Care System Author: Ben Dodd (mitgobla) Version: 1.0.2 Date: 20/03/17""" import socket #Used to create the server import sys #Used to terminate the program import time #Used to pausing and time management import os #Used to gather temperature from threading import Thread #Us...
nanny.py
import asyncio import errno import logging import os import shutil import threading import uuid import warnings import weakref from contextlib import suppress from multiprocessing.queues import Empty from time import sleep as sync_sleep import psutil from tornado import gen from tornado.ioloop import IOLoop, PeriodicC...
shield.py
import paramiko import os import sys import socket import threading, time from termcolor import colored exit_tag = 0 shield = ''' ,----. ,-. ,----.,------. ,-. ,-.,-. ,-. / ,-,_/ ,' | / / /`-, ,-',' | / // |/ / / / __ ,' ,| | / ,---' / / ,' ,| | / // / / / '-' /,' ,--. |/ / / /,' ,--. ...
index.py
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Vinay Sajip. # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # import hashlib import logging import os import shutil import subprocess import tempfile try: from threading import Thread except ImportErr...
wui.py
# Copyright (c) 2019 Tamas Keri. # Copyright (c) 2019-2021 Renata Hodovan, Akos Kiss. # # Licensed under the BSD 3-Clause License # <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>. # This file may not be copied, modified, or distributed except # according to those terms. import logging import os import s...
common3.py
# Copyright (c) 2011 - 2017, Intel Corporation. # # 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 agre...
keep_alive.py
from flask import Flask from threading import Thread app = Flask('') @app.route('/') def main(): return "Creator Steus#0001" def run(): app.run(host="0.0.0.0", port=8080) def keep_alive(): server = Thread(target=run) server.start()
master_daemon.py
#! /bin/bash "source" "find_python.sh" "--local" "exec" "$PYTHON" "$0" "$@" import os import sys import shutil import threading import logging import time from collections import OrderedDict from argparse import * from glob import glob import signal from functools import partial sys.path.append(os.path.join('automati...
soundserver_threaded.py
import flask import os from os.path import join import sys import hemlib try: import simplejson as json except: import json app = flask.Flask(__name__) import pyaudio from numpy import zeros, linspace, short, fromstring, hstack, transpose from scipy import fft HOST = "localhost" PORT = 9294 NUM_SAMPLES...
test_generator_api.py
import threading import unittest import pytest import numpy import cupy from cupy import random from cupy import testing from cupy.testing import _condition from cupy_tests.random_tests import common_distributions @pytest.mark.skipif(cupy.cuda.runtime.is_hip, reason='HIP does not support this')...
IPUtilities.py
# !/usr/bin/python3.6 # -*- coding: UTF-8 -*- # @author: guichuan import requests import os from scrapy.selector import Selector import pandas as pd import numpy as np import datetime import random import multiprocessing as mp import time import warnings def crawl_xici_ip(item_count, fileName='xici_iplist.par'): ...
test_tune_restore.py
# coding: utf-8 import signal from collections import Counter import multiprocessing import os import shutil import tempfile import threading import time from typing import List import unittest import ray from ray import tune from ray._private.test_utils import recursive_fnmatch from ray.rllib import _register_all fro...
pickletester.py
import collections import copyreg import dbm import io import functools import os import math import pickle import pickletools import shutil import struct import sys import threading import unittest import weakref from textwrap import dedent from http.cookies import SimpleCookie try: import _testbuffer except Impo...
test_urllib.py
"""Regresssion tests for urllib""" import urllib import httplib import unittest from test import test_support import os import mimetools import tempfile import StringIO def hexescape(char): """Escape char as RFC 2396 specifies""" hex_repr = hex(ord(char))[2:].upper() if len(hex_repr) == 1: ...
ip_streamer.py
# -*- coding: utf-8 -*- """ Created on Fri Jul 10 15:11:48 2020 @author: Nikki """ import cv2 import datetime import sys import multiprocessing as mp import time from ctypes import c_bool #ip streams #multiple video cap objsects #change detection to output to csv, save every 5 min or so #make separate processes #n...
api.py
"""Interact with the Globus API. All endpoint connections happen here.""" import threading import time from globusonline.transfer import api_client class GlobusAPI(object): def __init__(self, local_endpoint, remote_endpoint): """Create a wrapper around the Globus API Client.""" # Get credentials...
pytorch.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import atexit import logging import os import socket import time from dataclasses import dataclass from pathlib import Path from subprocess import Popen from threading import Thread from typing import Any, List, Optional, Union import colorama i...
compare_to_seasonal_cycles.py
from constants_and_util import * import pandas as pd from traceback import print_exc import random import numpy as np from scipy.signal import argrelextrema import statsmodels.api as sm import warnings import statsmodels.formula.api as smf from copy import deepcopy import json from IPython import embed from collections...
test__xxsubinterpreters.py
from collections import namedtuple import contextlib import itertools import os import pickle import sys from textwrap import dedent import threading import time import unittest from test import support from test.support import script_helper interpreters = support.import_module('_xxsubinterpreters') ##############...
dataset.py
# Copyright 2020 - 2021 MONAI Consortium # 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 wri...
clusterScalerTest.py
# Copyright (C) 2015-2018 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...
terminalUI.py
#!/usr/bin/env python3 """Minesweeper Game - Terminal Interface Runs the game in the Terminal using npyscreen. Use --help to show the possible flags and their use. TODO: ranking - add datetime FIXME: improve flags to change the TUI before initializing FIXME: improve flags to start game immediately at X difi...
multiprocess.py
#!/usr/bin/python # # Interactive (server) publisher for market price domain # import time import multiprocessing import random import pyrfa def publish(): try: p = pyrfa.Pyrfa() p.createConfigDb("./pyrfa.cfg") p.acquireSession("Session4") p.createOMMProvider() p.login() ...
app_test.py
from __future__ import unicode_literals from SimpleWebSocketServer import SimpleWebSocketServer, WebSocket from tiny_test_fw import Utility import glob import json import os import re import threading import ttfw_idf class IDEWSProtocol(WebSocket): def handleMessage(self): try: j = json.loads...
urls.py
# ***************************************************************************** # # Copyright (c) 2020, the pyEX authors. # # This file is part of the pyEX library, distributed under the terms of # the Apache License 2.0. The full license can be found in the LICENSE file. # from __future__ import print_function...
node.py
''' @author: Deniz Altinbuken, Emin Gun Sirer @note: Master class for all nodes @copyright: See LICENSE ''' import argparse import os, sys import random, struct import cPickle as pickle import time, socket, select from Queue import Queue from threading import Thread, RLock, Lock, Condition, Timer, Semaphore from concoo...
main_pult.py
import os import pygame import logging import threading import configparser from pprint import pprint from time import sleep from ast import literal_eval from datetime import datetime from signal import signal, SIGTERM, SIGHUP, pause from rpi_lcd import LCD import serial DEBUG = False PATH_CONFIG = '/home/pi/SoftAcade...
test.py
import time from multiprocessing import Process import shmarray def worker(data): while True: data += 1 time.sleep(1) def monitor(data): while True: print(data) time.sleep(0.5) data = shmarray.zeros(10) procs = [Process(target=worker, args=(data,)), Process(target=monitor...
donkey_sim.py
''' file: donkey_sim.py author: Tawn Kramer date: 2018-08-31 ''' import os import json import shutil import base64 import random import time from io import BytesIO import math from threading import Thread import numpy as np from PIL import Image from io import BytesIO import base64 import datetime...
batch_sender.py
import json import logging import threading import queue import time import gzip import requests from specklepy.logging.exceptions import SpeckleException LOG = logging.getLogger(__name__) class BatchSender(object): def __init__( self, server_url, stream_id, token, max_ba...
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 from elec...
grading-script.py
#!/usr/bin/python # ./grading-script.py <test-dir> import os,re,sys,shutil,random,subprocess,threading test_dir = 'tests' if len(sys.argv) > 1: test_dir=sys.argv[1] # Set up scratch space for grading dir="grading" try: shutil.rmtree(dir) except: pass os.mkdir(dir) os.mkdir(dir + '/src') re_cp=re.compile(...
test_timeoutqueue.py
# Copyright (c) 2001-2004 Twisted Matrix Laboratories. # See LICENSE for details. """ Test cases for timeoutqueue module. """ import time from twisted.trial import unittest from twisted.python import timeoutqueue from twisted.internet import reactor, interfaces class TimeoutQueueTest(unittest.TestCase): d...
py_chat.py
# -*- coding: utf-8 -*- """ py_chat.py - Main class for a simple chat program""" __author__ = "topseli" __credits__ = ["Deepak Sritvatsav"] __license__ = "0BSD" import sys import os import socket import threading import base64 import logging from PyQt5 import QtWidgets, uic import login_view import chat_view class P...
test_lockable.py
#!/usr/bin/env python __author__ = "Radical.Utils Development Team (Andre Merzky)" __copyright__ = "Copyright 2013, RADICAL@Rutgers" __license__ = "MIT" import time import threading as mt import radical.utils as ru # ------------------------------------------------------------------------------ # def test...
utils.py
#!/usr/bin/env python3 ############################################################################### # Module Imports ############################################################################### import logging import re import time import threading import signal import functools import inspect #################...
main_window.py
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2012 thomasv@gitorious # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including witho...
threading.py
import threading class Threader(): __author__ = "Lloyd Albin (lalbin@fredhutch.org, lloyd@thealbins.com)" __version__ = "0.0.23" __copyright__ = "Copyright (C) 2019 Fred Hutchinson Cancer Research Center" from scharp_py_tools import scharp_logging logger = scharp_logging.Logger() MAX_THRE...
multi_ping_model.py
"""Continuously pings devices for troubleshooting""" from pydispatch import dispatcher from threading import Thread import datetime import os import csv from . import win_ping class PingUnit: def __init__(self, obj, path, logging=False): self.obj = obj self.ping_data = [] self.hostname ...
test_lock.py
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). import os import shutil import tempfile import unittest from multiprocessing import Manager, Process from threading import Thread from pants.process.lock import OwnerPrintingInterProcessF...
websockets.py
#!/usr/bin/env python3 # # 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 withou...
main.py
from __future__ import print_function import argparse import os import torch import torch.multiprocessing as mp import my_optim from envs import create_atari_env from model import ActorCritic from test import test from train import train import time # Based on # https://github.com/pytorch/examples/tree/master/mnist...
datasources.py
"""This module holds classes that can be used as data soures. Note that it is easy to create other data sources: A data source must be iterable and provide dicts that map from attribute names to attribute values. """ # Copyright (c) 2009-2020, Aalborg University (pygrametl@cs.aau.dk) # All rights reserved. # Re...
resultdump.py
import os import json import time import logging from glob import glob from threading import Thread from threading import RLock from queue import Queue from queue import Empty from datetime import datetime from datetime import timedelta from enum import Enum from sbws.globals import RESULT_VERSION, fail_hard from sbws....
engine.py
# -*- coding: utf-8 -*- u"""Firewall-Engine module for SecureTea Firewall. Project: ╔═╗┌─┐┌─┐┬ ┬┬─┐┌─┐╔╦╗┌─┐┌─┐ ╚═╗├┤ │ │ │├┬┘├┤ ║ ├┤ ├─┤ ╚═╝└─┘└─┘└─┘┴└─└─┘ ╩ └─┘┴ ┴ Author: Abhishek Sharma <abhishek_official@hotmail.com> , Feb 12 2019 Version: 1.1 Module: SecureTea """ import datetime from...
worker.py
import attr from threading import Thread, Event from time import time from ....config import deferred_config from ....backend_interface.task.development.stop_signal import TaskStopSignal from ....backend_api.services import tasks class DevWorker(object): prefix = attr.ib(type=str, default="MANUAL:") report...
demo_dp_interface.py
import logging from time import sleep from random import random from threading import Thread from datetime import datetime, timezone logger = logging.getLogger(__name__) class DemoDPInterface(): """ This is a demo version of a datapoint interface which pushes dummy values and metadata into the DB to supp...
main_gan_L2_regularized_yelp.py
import datetime import numpy as np import tensorflow as tf import threading import os from ganrl.common.cmd_args import cmd_args from ganrl.experiment_user_model.data_utils import Dataset from ganrl.experiment_user_model.utils import UserModelLSTM, UserModelPW def multithread_compute_vali(): global vali_sum, va...
scheduler.py
#!/usr/bin/python import pigpio from datetime import datetime import time import os from apscheduler.schedulers.background import BackgroundScheduler import SocketServer import threading ### TBD # Start a thread to update variables when notified by settings.py # Automatic delay when precipitation is reported by fore...
process.py
from multiprocessing import Process, Queue from promise import Promise from .utils import process def queue_process(q): promise, fn, args, kwargs = q.get() process(promise, fn, args, kwargs) class ProcessExecutor(object): def __init__(self): self.processes = [] self.q = Queue() d...
Hiwin_RT605_ArmCommand_Socket_20190627160325.py
#!/usr/bin/env python3 # license removed for brevity import rospy import os import numpy as np from std_msgs.msg import String from ROS_Socket.srv import * from ROS_Socket.msg import * import math import enum pos_feedback_times = 0 mode_feedback_times = 0 msg_feedback = 1 #接收策略端命令 用Socket傳輸至控制端電腦 import socket ##多執行序 i...
mainwindow.py
""" A GUI for PY GPS NMEA written with tkinter """ import os import multiprocessing import threading import tkinter import tkinter.filedialog import tkinter.messagebox import tkinter.scrolledtext import tkinter.ttk import serial import pygpsnmea.capturefile as capturefile import pygpsnmea.export as export import pyg...
test_lock.py
""" TestCases for testing the locking sub-system. """ import time import unittest from test_all import db, test_support, verbose, have_threads, \ get_new_environment_path, get_new_database_path if have_threads : from threading import Thread import sys if sys.version_info[0] < 3 : from thr...
tkgpio.py
from .base import TkDevice, SingletonMeta from .base import PreciseMockTriggerPin, PreciseMockFactory, PreciseMockChargingPin from gpiozero import Device from gpiozero.pins.mock import MockPWMPin from PIL import ImageEnhance, Image, ImageDraw, ImageFont, ImageTk # from sounddevice import play, stop import numpy import ...
GuardpianService.py
import logging import sys from time import sleep from threading import Thread log = logging.getLogger(__name__) class GuardpianService: def __init__(self, base_path, camera, gpio, email_sender, ifttt_enabled, ifttt_client): self.base_path = base_path self.camera = camera self.gpio = gpio ...
client.py
# Copyright 2019 Mycroft AI 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 writin...
test_ssl.py
# Test the support for SSL and sockets import sys import unittest from test import support import socket import select import time import datetime import gc import os import errno import pprint import urllib.request import traceback import asyncore import weakref import platform import functools ssl = support.import_...
exchange_rate.py
from datetime import datetime import inspect import requests import sys import os import json from threading import Thread import time import csv import decimal from decimal import Decimal from .bitcoin import COIN from .i18n import _ from .util import PrintError, ThreadJob # See https://en.wikipedia.org/wiki/ISO_42...
test_file2k.py
import sys import os import errno import unittest import time from array import array from weakref import proxy try: import threading except ImportError: threading = None from test import support from test.support import TESTFN, run_unittest from collections import UserList class AutoFileTests(unittest.TestCa...
__init__.py
import logging import os import signal import sys import time logger = logging.getLogger(__name__) class Patroni(object): def __init__(self): from patroni.api import RestApiServer from patroni.config import Config from patroni.dcs import get_dcs from patroni.ha import Ha ...
util.py
# Electrum - lightweight Bitcoin client # Copyright (C) 2011 Thomas Voegtlin # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including without limitation the rights t...
buck.py
# Copyright 2004-present Facebook. All rights reserved. # pyre-unsafe import functools import glob import json import logging import os import subprocess import sys import tempfile import threading from collections import namedtuple from json.decoder import JSONDecodeError from typing import Dict, Iterable, List, Op...
webcam.py
"""Raspberry Pi Face Recognition Treasure Box Webcam OpenCV Camera Capture Device Copyright 2013 Tony DiCola Webcam device capture class using OpenCV. This class allows you to capture a single image from the webcam, as if it were a snapshot camera. This isn't used by the treasure box code out of the box, but is usef...
programmatic_aea.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 ...
val.py
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license """ Validate a trained YOLOv5 model accuracy on a custom dataset Usage: $ python path/to/val.py --data coco128.yaml --weights yolov5s.pt --img 640 """ import argparse import json import os import sys from pathlib import Path from threading import Thread import numpy as...
client_no_tf.py
# Copyright 2021 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.org/licenses/LICENSE-2.0 # # Unless required by ...
OSC.py
#!/usr/bin/python3 """ 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)...
main.py
#!/usr/sbin/env python import click import ipaddress import json import netaddr import netifaces import os import re import subprocess import sys import threading import time from minigraph import parse_device_desc_xml from portconfig import get_child_ports from sonic_py_common import device_info, multi_asic from son...
worker.py
import argparse import copy import os import sys import os.path import glob import json import random import shutil import subprocess import tempfile import traceback import logging import uuid import socket from time import sleep, gmtime, strftime import datetime import threading from flask import Flask import arch...
Light_Control_GPIO.py
from flask import Flask, g, render_template, request, session, url_for, redirect import time import datetime import threading import csv import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) #GPIO 0 to 11 in output mode at 0 for i in range(12): GPIO.setup(i, GPIO.OUT, initial=GPIO.LOW) app = Flask(__name__) app.secret...
multithread_fib.py
'''Compute fibonacci numbers with multiple threads to show the GIL''' import random import threading import compute import syscall def thread_func_monitor(func): def wrapper(*args, **kargs): print(f'Function {func.__name__} executed by thread {syscall.gettid()}') return func(*args, **kargs) re...
mp.py
from multiprocessing import Process, Value, Array, Lock import numpy as np # not used in the final code, but some multiprocessing practice in python. x = [1] def f(a, lock): lock.acquire() for i in range(len(a)): a[i] = -a[i] lock.release() if __name__ == '__main__': lock = Lock() jobs = []...
io.py
# -*- coding: utf-8 -*- # Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import absolute_import, division, print_function, unicode_literals from collections import defaultdict from concurrent.futures import ThreadPoolExecutor, _base, as_completed from concurrent.futures.thread...
labels.py
import hashlib import requests import threading import json import sys import traceback import base64 import electrum from electrum.plugins import BasePlugin, hook from electrum.i18n import _ class LabelsPlugin(BasePlugin): def __init__(self, parent, config, name): BasePlugin.__init__(self, parent, con...
inference.py
# -*- coding: utf-8 -*- {{{ # vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et: # # Copyright (2021) Battelle Memorial Institute # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions #...
runDataRecording.py
# encoding: UTF-8 from __future__ import print_function import multiprocessing from time import sleep from datetime import datetime, time from vnpy.event import EventEngine2 from vnpy.trader.vtEvent import EVENT_LOG, EVENT_ERROR from vnpy.trader.vtEngine import MainEngine, LogEngine from vnpy.trader.gateway import ct...
pyto_ui.py
""" UI for scripts The ``pyto_ui`` module contains classes for building and presenting a native UI, in app or in the Today Widget. This library's API is very similar to UIKit. .. warning:: This library requires iOS / iPadOS 13. This library may have a lot of similarities with ``UIKit``, but subclassing isn't supp...
utils.py
#!/usr/bin/env python from __future__ import print_function """ utils.py Created by Jason Sundram, on 2010-04-05. Copyright (c) 2010 The Echo Nest. All rights reserved. Expanded Chris Angelico 2014 with additional utilities. """ import threading, os import binascii import hashlib import collections import random def ...
tornado.py
import asyncio import fnmatch import json import logging import os import threading import time import webbrowser from functools import partial from typing import Dict from urllib.parse import urlparse import tornado import tornado.httpserver import tornado.ioloop from tornado.web import StaticFileHandler from tornado...