source
stringlengths
3
86
python
stringlengths
75
1.04M
decorators.py
from functools import wraps from threading import Thread from flask import abort from flask_login import current_user def permission_required(permission): """检查用户权限""" def decorator(func): @wraps(func) def wrapper(*args, **kwargs): if not current_user.can(permission): ...
env_player.py
# -*- coding: utf-8 -*- """This module defines a player class exposing the Open AI Gym API. """ from abc import ABC, abstractmethod, abstractproperty from gym.core import Env # pyre-ignore from queue import Queue from threading import Thread from typing import Any, Callable, List, Optional, Tuple, Union from poke_...
cloud_synchronizer.py
import sys import os import sqlite3 import threading import time import requests from base64 import b64encode from scripts.database import DATABASE, dictfetchone, dictfetchall def get_record(record_id): db = sqlite3.connect(DATABASE) cur = db.cursor() query = """SELECT * FROM records WHERE record_id=?"""...
events.py
import os import re import sqlite3 import subprocess from datetime import datetime from multiprocessing import Process from multiprocessing.context import TimeoutError as ThreadTimeoutError from multiprocessing.pool import ThreadPool from typing import NoReturn from executors.logger import logger from modules.audio im...
bs_old.py
# -*- coding: utf-8 -*- """ Created on Tue Dec 14 19:49:25 2021 @author: avinash """ import os import time import threading import multiprocessing import shutil import pymysql conn = pymysql.connect( host='localhost', user='root', password = "", db='test' )...
experimental.py
from tkinter import * import time import threading import os # Blank window global root root = Tk() LAMAO = False def testFunc(event): threading.Thread(target=threadedFunc).start() def threadedFunc(): global LAMAO for i in range(10): if LAMAO: break else: print...
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...
test_marathon.py
import contextlib import json import os import re import threading from dcos import constants import pytest from six.moves.BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer from .common import (app, assert_command, assert_lines, config_set, config_unset, exec_command, list_deployments, po...
ProcessManager.py
from subprocess import Popen, PIPE, DEVNULL from threading import Timer, Lock, Thread import os import errno from queue import Queue, Empty from datetime import datetime from sys import executable from Logic.settings import AGENT_LOG_DESTINATION, AGENT_LOG, AGENT_LOG_TO_FILE from Logic.Logger import * class Process(...
test_failure.py
import json import logging import os import signal import sys import tempfile import threading import time import numpy as np import pytest import redis import ray from ray.experimental.internal_kv import _internal_kv_get from ray.autoscaler._private.util import DEBUG_AUTOSCALING_ERROR import ray.utils from ray.util....
test_deleter.py
#!/usr/bin/env python3 import os import time import threading import unittest from collections import namedtuple from common.timeout import Timeout, TimeoutException import selfdrive.loggerd.deleter as deleter from selfdrive.loggerd.tests.loggerd_tests_common import UploaderTestCase Stats = namedtuple("Stats", ['f_ba...
eval_cityscapes.py
# Copyright 2018 Division of Medical Image Computing, German Cancer Research Center (DKFZ). # # 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_image_embedding.py
# coding : UTF-8 import sys sys.path.append("../../tests") import time import threading from towhee import pipeline from common import common_func as cf embedding_size = 1000 class TestEmbeddingInvalid: """ Test case of invalid embedding interface """ def test_embedding_no_image(self): """ ta...
event_handler.py
import ast import logging import sys import time import traceback from functools import partial from multiprocessing import Manager from multiprocessing import Process from typing import List, Optional, Set from typing import Tuple from activitystreams import Activity from activitystreams import parse as parse_as from...
__init__.py
import time import subprocess import traceback import re import json from abc import ABC from threading import Thread from modules import ModuleBase from utils.log import init_logger from utils.cmd_builder import GetCmdBuilder, WalkCmdBuilder, version, securityLevel logger = init_logger(__name__) class CollectDataMo...
tcp_recieve.py
import socket import threading def send_tcp(cnc_ip = '127.0.0.1', cnc_port = 8000, send_data = "01"): # 1.创建套接字socket tcp_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # 2.连接服务器 #cnc_ip = input("请输入服务器ip:") #cnc_port = int(input("请输入服务器port:")) cnc_addr = (cnc_ip, cnc_po...
singleton.py
from plugin.core.environment import Environment from SocketServer import TCPServer, StreamRequestHandler from threading import Thread import logging import os import socket import time log = logging.getLogger(__name__) PORT_DEFAULT = 35374 PORT_PATH = os.path.join(Environment.path.plugin_data, 'Singleton') def get...
application.py
import os import re import threading import webbrowser from datetime import date from functools import partial import tkinter as tk import tkinter.ttk as ttk from tkinter import PhotoImage from tkinter import messagebox from services import RoverImageDownloader, rover_info, CredentialWindow, read_credenti...
hydrus_client.py
#!/usr/bin/env python3 # Hydrus is released under WTFPL # You just DO WHAT THE FUCK YOU WANT TO. # https://github.com/sirkris/WTFPL/blob/master/WTFPL.md import locale try: locale.setlocale( locale.LC_ALL, '' ) except: pass try: import os import argparse import sys from hydrus.core import H...
manual_task_scheduler_test.py
# Copyright 2021 Google LLC. 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 applicable law or a...
test_github.py
import json import logging import multiprocessing import time import unittest from datetime import timedelta, datetime from multiprocessing import Process from unittest import mock import pika import pika.exceptions from freezegun import freeze_time from parameterized import parameterized from src.alerter.alerter_sta...
main2.py
from vidstream import StreamingServer import tkinter as tk import socket import threading from vidstream.audio import AudioReceiver, AudioSender from vidstream.streaming import CameraClient, ScreenShareClient local_ip_address = socket.gethostbyname(socket.gethostname()) # 192.168.244.1 # public_ip_address = requests...
easy_config.py
"""a graphical config manager for StaSh""" import ast import os import threading from six import string_types import console import pythonista_add_action as paa import ui from stash.system.shcommon import _STASH_CONFIG_FILES _stash = globals()["_stash"] ORIENTATIONS = ("landscape", "landscape_left", "landscape_righ...
MesonhCachedProbe.py
import threading import time from nephelae.array import DimensionBounds class MesonhCachedProbe: """MesoNHCachedProbe This is a class to handle quick successive reads in a MesoNH array. Original goal was to make a virtual UAV fly in real time in a MesoNH dataset while reading a single variable (se...
serial_reader.py
import serial, json from MisProject.arduino import MIS_Arduino from time import time,sleep from random import randint from threading import Thread, Lock SERIAL_PATH = "COM5" BAUD = 115200 arduino = MIS_Arduino("/dev/ttyACM0", 115200) lockduino = Lock() def random_message(): value = randint(2, 6) state = rand...
server_test.py
import os import threading import traceback from asyncio import set_event_loop_policy from unittest import TestCase from unittest.mock import patch import requests from parameterized import parameterized from tornado.ioloop import IOLoop from auth.authorization import Authorizer, ANY_USER, EmptyGroupProvider from con...
test_nntplib.py
import io import socket import datetime import textwrap import unittest import functools import contextlib import os.path import re from test import support from nntplib import NNTP, GroupInfo import nntplib from unittest.mock import patch try: import ssl except ImportError: ssl = None try: import threadin...
mtgox-streaming.py
import websocket # https://github.com/liris/websocket-client/tree/py3 import threading def on_message(ws, message): print(message) def on_error(ws, error): print(error) def on_close(ws): print("### closed ###") def run(*args): command = '{"op": "mtgox.subscribe", "type": "depth"}' ws.send...
hiddencraft.py
#!/usr/bin/env python3 ''' A tool for connecting to minecraft hidden servers. For more info, look at README.md ''' from socket import socket, SOL_SOCKET, SO_REUSEADDR from socket import error as sock_err import selectors import torsocks import sys import threading import queue import logging MC_PORT = 25565 BUFFSIZE =...
forward-shell-v2.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- # # Forward Shell Skeleton code that was used in IppSec's Stratosphere Video # -- https://www.youtube.com/watch?v=uMwcJQcUnmY # Authors: ippsec, 0xdf, lupman, phra import base64 import random import sys import requests import threading import time import readli...
test_data_requests.py
import os from pathlib import Path import threading import unittest import bblfsh import grpc import lookout.core from lookout.core.analyzer import ReferencePointer, UnicodeFile from lookout.core.api.event_pb2 import PushEvent, ReviewEvent from lookout.core.api.service_analyzer_pb2 import EventResponse from lookout.c...
trainer_controller.py
# # Unity ML-Agents Toolkit # ## ML-Agent Learning """Launches trainers for each External Brains in a Unity Environment.""" import os import threading from typing import Dict, Optional, Set, List from collections import defaultdict import numpy as np from mlagents.tf_utils import tf from mlagents_envs.logging_util i...
server.py
""" Author: Tarun Gupta ID: 201403002 """ import socket import time import threading class WebProxyServer: """Intercept proxy request from clients""" cache_responses = {} def __init__(self, port=8080, listen_address="127.0.0.1", debug=False, cache=True): self.port = port self.listen_add...
views.py
import random import re import threading from django.contrib.contenttypes.models import ContentType from django.core.paginator import Paginator, PageNotAnInteger, InvalidPage, EmptyPage from django.http import HttpResponse, JsonResponse from django.shortcuts import render from utils.spider_test import get_soup, spider...
test_cgo_engine.py
import json import os import sys import threading import unittest import logging import time import torch from pathlib import Path from nni.retiarii.execution.cgo_engine import CGOExecutionEngine from nni.retiarii.execution.logical_optimizer.logical_plan import LogicalPlan from nni.retiarii.execution.logical_optimize...
multiprocess_process_comments.py
#!/usr/bin/env python3 from os import listdir, makedirs, rename, remove from os.path import isfile, join, split, isdir import json from tqdm import tqdm import sys import argparse from datetime import date from multiprocessing import Process, Queue def process_file(file): # Work for each file goes here print(...
run_parameter_sweep_color.py
''' Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. ''' import time import subprocess from multiprocessing import Process, Queue def do_work(work): while not work.empty(): experiment = work.get() print(experiment) subprocess.call(experiment.split(" ...
main.py
import logging import re import time from copy import deepcopy from enum import Enum from typing import List, Optional from datetime import datetime import threading import traceback import html import json import peewee import telegram.error from telegram import Update, InlineKeyboardMarkup, InlineKeyboardButton, Bot...
watch_room.py
import tkinter as tki import tkinter.font as tkf import tkinter.ttk as ttk import client.asset.font as fontMod import client.frame.base as baseMod import client.frame.stack as stackMod import client.client as clientMod import tkinter.messagebox as msgMod import typing as typ import traceback import threading import tim...
multi_proxy_server.py
import socket,time, sys from multiprocessing import Process HOST = "" PORT = 8001 BUFFER_SIZE = 1024 #get host information def get_remote_ip(host): print(f'Getting IP for {host}') try: remote_ip = socket.gethostbyname( host ) except socket.gaierror: print ('Hostname could not be resolved. Ex...
output.py
# /psqtraviscontainer/output.py # # Helper classes to monitor and capture output as it runs. # # See /LICENCE.md for Copyright information """Helper classes to monitor and capture output as it runs.""" import sys import threading def monitor(stream, modifier=None, live=False, out...
video2frame_lite.py
# import argparse import os, sys import shutil import subprocess import json from path import Path import matplotlib.pyplot as plt from tqdm import tqdm # Opencv import cv2 from threading import Lock,Thread import numpy as np parser = argparse.ArgumentParser(description="Video2Frames converter") parser.add_argument(...
04.multprocessing_com2.py
from multiprocessing import Process, JoinableQueue def ping(queue): queue.put('ping') def pong(queue): msg = queue.get() print(f'{msg} -> pong') def main(): queue = JoinableQueue() # duas pontas do cano p1 = Process(target=ping, args=(queue, )) p2 = Process(target=pong, args=(queue, )) ...
server.py
import socket import multiprocessing import time from common.fucnctions import * from common.utils import * from common.server_messages import * from common.config_sample import * from database_controller import conn def listener(q): server_s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ...
test_plc_ams.py
import socket import struct import threading import unittest from contextlib import closing from pyads.constants import PORT_REMOTE_UDP from pyads.pyads_ex import adsGetNetIdForPLC class PLCAMSTestCase(unittest.TestCase): PLC_IP = "127.0.0.1" PLC_AMS_ID = "11.22.33.44.1.1" def plc_ams_request_receiver(...
ethernet_provider.py
import os import struct import time import json import datetime import threading import math import re import struct from ..widgets import (NTRIPClient, EthernetDataLogger, EthernetDebugDataLogger, EthernetRTCMDataLogger) from ...framework.utils import (helper, resource) from ...framework.context...
common.py
import io import os import sys import json import time import fcntl import heapq import types import base64 import shutil import struct import decimal import fnmatch import hashlib import logging import binascii import builtins import tempfile import warnings import functools import itertools import threading import tr...
test_threading_trace.py
# Copyright 2018, OpenCensus Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
hack_manager_tk.py
#!/usr/bin/env python3 # GBA FE Hack Manager by MinN # # Simple tk interface import sys import os import threading import tkinter as tk from tkinter import scrolledtext import hack_manager class RedirectText: def __init__(self, text_ctrl): self.output = text_ctrl def write(self, string): sel...
functional_tests.py
#!/usr/bin/env python from __future__ import absolute_import import os import sys import shutil import tempfile import re import string import multiprocessing import unittest import time import sys import threading import random import httplib import socket import urllib import atexit import logging import os import s...
utils.py
from __future__ import absolute_import, division, print_function from collections import OrderedDict, defaultdict import contextlib import fnmatch import hashlib import json from locale import getpreferredencoding import libarchive import logging import logging.config import mmap import operator import os from os.path...
test_logging.py
# -*- coding: utf-8 -*- """Stupid tests that ensure logging works as expected""" from __future__ import (division, absolute_import, print_function, unicode_literals) import sys import threading import logging as log from StringIO import StringIO import beets.logging as blog from beets import ...
test_repo_server.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import email import hashlib import os import socket import sqlite3 import tempfile import threading import unittest f...
print_codes_testing.py
import os,shutil import pandas as pd import matplotlib.pyplot as plt import matplotlib.image as mpimg import yaml import tqdm import multiprocessing import numpy as np def create_code_base_data(image_path,txt_path,classes_txt_path): # read all txt files txt_files = [txt_path+"/"+x for x in os.listdir(txt_pa...
test_cymj.py
import numpy as np import pytest import sys import unittest from io import BytesIO, StringIO from multiprocessing import get_context from numbers import Number from numpy.testing import assert_array_equal, assert_array_almost_equal # from threading import Thread, Event from PIL import Image from mujoco_py import (MjS...
Onitama_source.py
# Standard Imports from std_imports import * from MCTS import * # The onitama class represents the board game state at any instant of gameplay class Onitama: """ Represents the board game state of the game Onitama """ def __init__(self, verbose = 1): """ Class constructor, all game state variables are defin...
base_crash_reporter.py
# Electrum - lightweight Bitcoin client # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including without limitation the rights to use, copy, modify, merge, # publish...
test_eventprocessor.py
#------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. #-------------------------------------------------------------------------- import pyte...
async_socket.py
import time import json import asyncio import threading import websockets from sys import _getframe as getframe from .lib.util import objects, helpers class AsyncSocketHandler: def __init__(self, client, debug = False): self.socket_url = "wss://ws1.narvii.com" self.client = client self.de...
test.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # vim:ts=4:sw=4:expandtab # ''' Unit tests for githooks How it works: * Create a workspace tmp/ in cwd, set up a dummy STASH_HOME, a remote repo and a local repo there. * Replace temp/remote_repo.git/hooks/update in the remote repo with hook_fixture.py. The hook_fixt...
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...
ditCamera.py
from picamera.array import PiRGBArray from picamera import PiCamera import time import numpy as np import cv2 as cv import time import threading import serial import logging import multiprocessing as mp import struct class ContourRectangle(): def __init__(self, shape, rectangle): self.shape = shape ...
motion_recorder.py
#!/usr/bin/python3 import io import os import threading import picamera import picamera.array import queue import signal import logging import time import numpy as np from PIL import Image from motion_vector_reader import MotionVectorReader current_dir = os.path.dirname(os.path.realpath(__file__)) class MotionRecor...
main.py
''' ************************* Robotic Pollinator: Mechanics, Planning, Computer Vision and Serial Communication ************************* Authors: Daniel Medina, Nicolás Contreras Email: dlmedina@uc.cl, nucontreras@uc.cl Date: December 2020 ************************* ''' from serial_communication import init_...
util.py
# Copyright (c) 2020 # Author: xiaoweixiang # # import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket try: import ssl except ImportError: # pragma: no cover ssl = N...
__init__.py
import enum import threading import time from typing import Dict, List from platypush.context import get_bus from platypush.message.event.zeroborg import ZeroborgDriveEvent, ZeroborgStopEvent from platypush.plugins import Plugin, action class Direction(enum.Enum): DIR_UP = 'up' DIR_DOWN = 'down' DIR_LEF...
app_mt.py
''' Copyright 2020 Xilinx 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, software distr...
xla_client_test.py
# Lint as: python3 # 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 ...
email.py
""" This file email.py contains functions for sending text and html rendered emails asynchronously """ from threading import Thread from flask import current_app from flask import render_template from flask_mailman import EmailMultiAlternatives def _send_email_helper(app, msg): """ Helper function used for s...
trie_server.py
import socket from queue import Queue from threading import Thread, Event import ast from struct import unpack, pack import pickle from pathlib import Path if Path('save_trie.pkl').is_file(): with open('save_trie.pkl', 'rb') as f: trie = pickle.load(f) else: trie = {'size': 0} q = Queue() if Path('save...
go_tool.py
from __future__ import absolute_import import argparse import copy import json import os import re import shutil import subprocess import sys import tempfile import threading import six from functools import reduce import process_command_files as pcf import process_whole_archive_option as pwa arc_project_prefix = 'a....
Hiwin_RT605_ArmCommand_Socket_20190627173301.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 * from std_msgs.msg import Int32MultiArray import math import enum pos_feedback_times = 0 mode_feedback_times = 0 msg_feedback = 1 #接收策略端...
test_socketutils.py
# -*- coding: utf-8 -*- import sys import time import errno import socket import threading from boltons.socketutils import (BufferedSocket, NetstringSocket, ConnectionClosed, NetstringMessageTooLong, ...
lock_yes.py
# -*- coding: utf-8 -*- import time, threading balance = 0 lock = threading.Lock() 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.re...
utils.py
# -*- coding: utf-8 -*- from __future__ import division import os import sys import socket import signal import functools import atexit import tempfile from subprocess import Popen, PIPE, STDOUT from threading import Thread try: from Queue import Queue, Empty except ImportError: from queue import Queue, Empty f...
automatix.py
# Copyright 2013-2018 CERN for the benefit of the ATLAS collaboration. # # 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...
main.py
import random, json from flask import Flask, render_template, request, Response, jsonify from network import * app = Flask(__name__) network = Network("wlan0mon") @app.route("/") def index(): return render_template("index.html") @app.route("/address") def address(): return render_template("address.html") ...
ws_thread.py
import sys import websocket import threading import traceback import ssl from time import sleep import json import decimal import logging from market_maker.settings import settings from market_maker.auth.APIKeyAuth import generate_expires, generate_signature from market_maker.utils.log import setup_custom_logger from m...
pipeline_parallel.py
import glob import logging import os import threading import time from pathlib import Path import cv2 import numpy as np import skimage import skimage.filters as sk_filters from skimage import img_as_ubyte, io from skimage.color import rgb2gray import BaseImage logging.basicConfig(level=logging.DEBUG) logger = loggi...
WebsocketServer.py
from Client import Client, ClientUpdater from SocketNetworker import SocketNetworker import threading import socket import physics import os import json import cherrypy from ws4py.server.cherrypyserver import WebSocketPlugin, WebSocketTool from ws4py.websocket import WebSocket cherrypy.config.update( { 'server.socke...
logic_queue.py
import traceback import time from threading import Thread from framework.logger import get_logger from .model import ModelSetting, ModelQueue from .api_youtube_dl import APIYoutubeDL package_name = __name__.split('.')[0] logger = get_logger(package_name) class LogicQueue(object): _thread = None @staticmet...
thredCamera.py
############################################################################### # OpenCV video capture # Uses opencv video capture to capture system's camera # Adapts to operating system and allows configuation of codec # BitBuckets FRC 4183 # 2019 #######################################################################...
app3.py
from flask import Flask, render_template, redirect, url_for, request, jsonify,Response from werkzeug import secure_filename import os import threading import random import pickle import cv2 import numpy as np #this command only for linux users os.system("chmod -R 777 dataset") # to maintain and keep track of what to ...
test_threading.py
""" Tests for the threading module. """ import test.support from test.support import (verbose, import_module, cpython_only, requires_type_collecting) from test.support.script_helper import assert_python_ok, assert_python_failure import random import sys import _thread import threading import...
streaming.py
from queue import Queue import threading class StreamingClient(object): def __init__(self): self.streamBuffer = bytes() self.streamQueue = Queue() self.streamThread = threading.Thread(target=self.stream) self.streamThread.daemon = True self.connected = True self.kil...
hmmer_wrapper.py
#!/usr/bin/env python __author__ = 'etseng@pacificbiosciences.com' import os, sys, shutil, subprocess, multiprocessing from Bio import SeqIO from collections import defaultdict, namedtuple """ Steps for running HMMER to identify & trim away barcodes (0) create output directory (1) create forward/reverse primers (2) c...
git_integration.py
import os import subprocess import threading from io import open from designer.components.designer_content import DesignerCloseableTab from designer.uix.action_items import ( DesignerActionSubMenu, DesignerSubActionButton, ) from designer.uix.input_dialog import InputDialog from designer.uix.py_code_input impo...
experiments.py
from __future__ import print_function from .. import datasets from . import metrics from . import models from . import methods from .. import __version__ import numpy as np import sklearn import os import pickle import sys import time import subprocess from multiprocessing import Pool import itertools import copy impor...
mock_server.py
# Copyright (c) 2015 Uber Technologies, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publ...
test.py
# -*- coding: utf-8 -*- import serial from threading import Thread from Tkinter import * import time import traceback class RackEntry(LabelFrame): def __init__(self, label, row, column): LabelFrame.__init__(self, text=label) self.grid(row=row, column=column, sticky='nesw', ipadx=5, ipady=5, padx=5,...
control_server.py
### Constellation Control Server ### A centralized server for controling museum exhibit components ### Written by Morgan Rehnberg, Fort Worth Museum of Science and History ### Released under the MIT license # Standard modules from http.server import HTTPServer, SimpleHTTPRequestHandler from socketserver import Threadi...
configuration.py
# coding: utf-8 """ Copyright 2016 SmartBear Software 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 l...
main.py
""" Технически, плагины являются модулями и мало чем отличаются от базовых систем загружаемых в loader.py, но т.к. "модули" уже заняты - пусть будут плагины. Основные отличия плагинов: - Хранятся в директории src/plugins/, содержимое которой занесено в .gitignore терминала. - Загружаются и запускаются динамически после...
test_capture.py
import contextlib import io import os import pickle import subprocess import sys import textwrap from io import StringIO from io import UnsupportedOperation import pytest from _pytest import capture from _pytest.capture import CaptureManager from _pytest.main import ExitCode # note: py.io capture tests where copied f...
multithreading.py
import threading def run_chunked_threads(most_active_stocks, method, thread_count): partitioned_most_active_stock = partition_array(most_active_stocks, thread_count) threads = [] for partition in partitioned_most_active_stock: threads.append(threading.Thread(target=method, ...
triangulate.py
from operator import index from turtle import pos from scipy import optimize as opt import numpy as np import time import cv2 from time import sleep from multiprocessing import Process, Queue from wiimotes_calibrate import Init_wiimotes, d width, height = 1024, 768 x = 0 y = 0 z = 0 fovw = 41.3 fovh = 33.2 # f...
main.py
#!/usr/bin/env python3 # date: 2019.12.21 # import multiprocessing import time import tkinter.ttk as ttk #from tkinter import * # not preferred import tkinter as tk class SubWindow: def __init__(self, master): self.master = master self.win = tk.Toplevel(master) #self.win.wm_attrib...
common_utils.py
r"""Importing this file must **not** initialize CUDA context. test_distributed relies on this assumption to properly run. This means that when this is imported no CUDA calls shall be made, including torch.cuda.device_count(), etc. torch.testing._internal.common_cuda.py can freely initialize CUDA context when imported....
analyzer.py
""" .. A wrapper for the Analyzer. It runs it as an XML-RPC server to isolate from lengthy grammar-building times. .. moduleauthor:: Luca Gilardi <lucag@icsi.berkeley.edu> ------ See LICENSE.txt for licensing information. ------ """ import sys from utils import Struct, update, display # @UnusedImport from xm...
mp_loader.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue May 12 11:33:03 2020 @author: worklab """ import os import numpy as np import random import time import cv2 from PIL import Image import torch from torchvision.transforms import functional as F import torch.multiprocessing as mp import timestamp_ut...