source
stringlengths
3
86
python
stringlengths
75
1.04M
__init__.py
import sys, string import re import threading import os from Tkinter import * from tkFileDialog import * import tkMessageBox import Pmw from pymol.wizard import cleanup from pmg_tk.Setting import Setting from pmg_tk.SetEditor import SetEditor from pmg_tk.ColorEditor import ColorEditor from pmg_tk.skins import PMG...
cosmoscli.py
import enum import hashlib import json import tempfile import threading import time import bech32 from dateutil.parser import isoparse from .app import CHAIN from .ledger import ZEMU_BUTTON_PORT, ZEMU_HOST, LedgerButton from .utils import build_cli_args_safe, format_doc_string, interact class ModuleAccount(enum.Enu...
task_thread.py
import os import json import threading import time from time import sleep from xml.dom.minidom import parse from backend.settings import BASE_DIR from app_api.models import TestCase, TestTask, TaskCaseRelevance, TestResult from app_api.tasks import running # 测试数据文件 DATA_FILE_PATH = os.path.join(BASE_DIR, "app_api", "d...
util.py
import collections import contextlib import ctypes import datetime import functools import hashlib import inspect import itertools import json import multiprocessing as mp import os import os.path import pickle import queue import signal import threading import traceback import numpy as np import paths import logging...
syncutils.py
import os from queue import Queue, Empty import time from threading import Thread class SyncBatch: def __init__(self, sync_func, num_jobs=3, batch_size=1000): self.num_jobs = num_jobs self.batch_size = batch_size self.sync_func = sync_func self.queue = Queue() self.syncjobs...
_app.py
""" websocket - WebSocket client library for Python Copyright (C) 2010 Hiroki Ohtani(liris) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, ...
TypeSimilarityTool.py
from .SparqlInterface.src import ClientFactory from .Utilities.Logger import log from .ProcessManager.ProcessManager import ProcessManager, OccupiedError from .SQLiteStores.SimilarityStore import SimilarityStore from .SimilarityCalculator.SimilarityCalculator import SimilarityCalculator import time from multiprocessing...
imagenet_to_mr.py
# Copyright 2019 Huawei Technologies Co., Ltd # # 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...
runtests.py
#!/usr/bin/python2.7 # # Copyright 2015 The Rust Project Developers. See the COPYRIGHT # file at the top-level directory of this distribution and at # http://rust-lang.org/COPYRIGHT. # # Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or # http://www.apache.org/licenses/LICENSE-2.0> or the MIT license # ...
wrappers.py
# Copyright 2017 The TensorFlow Agents 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 ag...
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...
livePsychRoom.py
# # This script takes realtime input using pyaudio and communicates via serial.Serial # with devices in the Technites psychedelic room to visualize the # music on them. # ## It talks to 4 devices # WaterFall -- tubes with LEDs and flying stuff fanned to music # DiscoBall -- 8 60 watt bulbs wrapped in colored paper ...
rates_client.py
""" rates client module """ from datetime import date, datetime from typing import TypedDict import time import threading import queue import json import pathlib import csv import requests from datetime_demos.business_days import business_days responses_done = threading.Event() processed_responses_done = threading.E...
gui.py
#!/usr/bin/env python3 import json import multiprocessing import os import threading import time import sys from PyQt5 import QtCore, QtWidgets, uic from PyQt5.QtGui import QIcon from tools.exceptions import ValidationError, MissingValuesError from tools import Modus from tools import kontaktdaten as kontak_tools fr...
http.py
from __future__ import print_function import base64 import copy import json import logging import os import random import ssl import string import sys import time from builtins import object, str from textwrap import dedent from typing import List from flask import Flask, make_response, render_template, request, send...
manager.py
#!/usr/bin/env python2.7 import os import sys import fcntl import errno import signal import subprocess from common.basedir import BASEDIR sys.path.append(os.path.join(BASEDIR, "pyextra")) os.environ['BASEDIR'] = BASEDIR def unblock_stdout(): # get a non-blocking stdout child_pid, child_pty = os.forkpty() if ch...
utils.py
# -*- coding: utf-8 -*- import base64 import functools import logging import os import re import time import warnings import zipfile from datetime import datetime from getpass import getpass from threading import Event, Thread from urllib.parse import quote import requests from plexapi.exceptions import BadRequest, No...
test_streams.py
"""Tests for streams.py.""" import gc import os import queue import socket import sys import threading import unittest from unittest import mock try: import ssl except ImportError: ssl = None import asyncio from asyncio import test_utils class StreamReaderTests(test_utils.TestCase): DATA = b'line1\nlin...
contiguous_arrays_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # 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...
tensor_models.py
# -*- coding: utf-8 -*- # # tensor_models.py # # Copyright 2020 Amazon.com, Inc. or its affiliates. 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.apa...
interval.py
import threading import time class SetInterval: def __init__(self, interval, action): self.interval = interval self.action = action self.stopEvent = threading.Event() thread = threading.Thread(target=self.__setInterval) thread.start() def __setInterval(self): ne...
handlers.py
# Copyright 2001-2013 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, # provided that the above copyright notice appear in all copies and that # both that copyright notice and this permissio...
monitored_session_test.py
# pylint: disable=g-bad-file-header # 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/LICENS...
bank.py
#!/usr/bin/python3 ## author: jinchoiseoul@gmail.com ## brief: sync error between memory and register during context changes among threads from threading import Thread, Lock class UnsafeCounter: def __init__(self): self.tot = 0 def incr(self, n): for _ in range(n): self.tot += ...
main.py
import cv2 import socket import numpy as np import requests from configparser import ConfigParser from threading import Thread, Lock from copy import deepcopy from time import sleep CONFIG_FILE = '../configuration/config.ini' TEST_DATA_FILE = '../test-data/test.mp4' current_frame = None current_frame_lock = Lock()...
object_cache_manager.py
''' Created on May 30, 2013 @author: vieglais TODO: Command line: d1cache [options] [operation] operation: update purge summary serve ''' import os import logging import datetime import time import yaml import shutil import threading import Queue from collections import deque from sqlalchemy import creat...
edge_pts_sharing_runner.py
import os import sys sys.path.append('./src/') sys.path.append('./src/fl-train/') sys.path.append('./src/training/') sys.path.append('./src/dataset/*') import argparse from fl_train import FLTrainer from globalUtils import * import copy from multiprocessing import Process def getConfParamVal(key,conf): keys = ke...
server.py
""" Utilities for creating bokeh Server instances. """ import asyncio import datetime as dt import gc import html import importlib import logging import os import pathlib import signal import sys import traceback import threading import uuid import warnings from collections import OrderedDict from contextlib import co...
modulo_udp.py
""" Prácticas de Redes de comunicaciones 2 Autores: Miguel Arconada Manteca Mario García Pascual """ import socket import threading import time import queue from src.generales import * import src.aplicacion """ Clase del módulo UDP """ class ModuloUDP: def __init__(self): # Band...
mirrored.py
""" Utility functions to retrieve information about available services and setting up security for the Hops platform. These utils facilitates development by hiding complexity for programs interacting with Hops services. """ import os from hops import devices, tensorboard, hdfs from hops.experiment_impl.util import ex...
langserver.py
"""Langserver support for autocompletions.""" # TODO: CompletionProvider # TODO: error reporting in gui somehow from __future__ import annotations import dataclasses import errno import itertools import logging import os import pprint import queue import re import select import signal import socket import subprocess i...
webui.py
#!/usr/bin/env python """ A Web UI for RED, the Resource Expert Droid. """ __author__ = "Mark Nottingham <mnot@mnot.net>" __copyright__ = """\ Copyright (c) 2008-2013 Mark Nottingham Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ...
data_loader_cons.py
import os import numpy as np import json import random import math import log import argparse import params import torch import time import torch_models import pickle from constructor import Constructor import torch.multiprocessing as mp import interface_lm import gc from data_utils import * def DataLoader(args, outq...
demo_landmarks_ld.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import _init_paths import caffe import cv2 import numpy as np from python_wrapper import * import os from timeit import default_timer as timer from picamera.array import PiRGBArray from picamera import PiCamera from threading import Thread import imutils from imutils.video...
streaming_client.py
import socket import cv2 import pickle import struct import threading import argparse import errno # For encryption from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives.asymmetric import dh from cryptography.hazmat.primitives.kdf.hkdf import HKDF from cryptography.hazmat.backends import...
server_util.py
import sys import os sys.path.insert(1,os.path.dirname(os.getcwd())) import socket import threading import os import time import datetime import sqlite3 as sql from imqserver.constant import * from imqserver.database import * from imqserver.MessageQueue import MessageQueue from imqserver.message import * import re i...
WebSpider.py
import multiprocessing import sys from bs4 import BeautifulSoup import mechanize import argparse import urllib import urllib2 import time import MySQLdb class WebSpider(): def __init__(self, webSite, depth, proxyhost, proxyuser, proxypassword, proxyport,proxysecure="http"): try: self.webSite = webSite self.d...
helpers.py
from datetime import datetime from io import BytesIO from ..simulation import SimulatedSource from threading import Thread, Event import tarfile import json all_folders = [ "share", "ssl", "addons/local", "homeassistant" ] all_addons = [ { "name": "Sexy Robots", "slug": "sexy_robots...
app-2020-0802-1320-AAA-TYJ.py
#!/usr/bin/env python3 ##jwc o #!/usr/bin/env python # Key Notes # # jwc 2020-0519 Convert from Crickit_Adafruit to RoboHat_4tronix # jwc 2020-0519 Use 'gpiozero' for noise-free servo-control # jwc Add 'robohat.init()' # jwc Make sure 'servod' copied in from 'RoboHat' dir # jwc Using 'ro...
mavros_vel_controller.py
#!/usr/bin/env python2 """ Zhiang Chen May 2019 """ import rospy import math import numpy as np from geometry_msgs.msg import PoseStamped, Quaternion, TwistStamped from pymavlink import mavutil from std_msgs.msg import Header from threading import Thread from tf.transformations import quaternion_from_euler from tf.tra...
dnsexpire.py
#!/usr/bin/python3.5 # I don't believe in license. # You can do whatever you want with this program. import os import sys import re import socket # import whois import pythonwhois import subprocess import argparse import tldextract from colored import fg, bg, attr from datetime import datetime from threading import T...
queue_tests.py
from queue import Queue from threading import Thread, Lock, RLock lock = RLock() import time def do_something(n): while True: with lock: print("Worker", n, " sleeping") time.sleep(1) t= Thread(target=do_something, args=('1',)) t1= Thread(target=do_something,args=('2',)) t.start() t1.st...
sample_vnf.py
# Copyright (c) 2016-2018 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 agreed...
file_op.py
from importlib.abc import FileLoader import os import shutil import platform import subprocess import multiprocessing from pac import get_dirs from pac import voice_io from pac import invoice audio_file_ext = [".pcm", ".wav", ".aiff", ".mp3", ".aac", ".ogg", ".wma", ".flac", ".alac", ".wma"] def copytree(src, dst, s...
RPC.py
import rpyc from rpyc import ThreadedServer from rpyc.utils.teleportation import export_function,import_function import sys import time sys.path.append(sys.path[0][:-7]) from multiprocessing import Manager, cpu_count from multithr import Process from Languages.Server_lang import lang from collections.abc import Itera...
executor.py
# Copyright Contributors to the OpenCue Project # # 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...
powercfg.py
#!/usr/bin/env python from time import sleep from threading import Thread from subprocess import check_output from artemisremotecontrol import setleds def loop(): while True: output = check_output('powercfg /GetActiveScheme') activeplan = output.decode('utf-8').split('(')[1][:-1] setleds(...
ingest_file_helper.py
import os import logging import threading import subprocess import shutil from hubmap_commons.hubmap_const import HubmapConst from hubmap_commons.hm_auth import AuthHelper from hubmap_commons.exceptions import HTTPException from hubmap_commons import file_helper class IngestFileHelper: # @staticmethod # def save...
test_ssl.py
# Test the support for SSL and sockets import sys import unittest import unittest.mock from test import support from test.support import import_helper from test.support import os_helper from test.support import socket_helper from test.support import threading_helper from test.support import warnings_helper import sock...
utils.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...
flex_index_phase1.py
from .tuq import QueryTests from pytests.fts.random_query_generator.rand_query_gen import DATASET from collections import Mapping, Sequence, Set, deque from deepdiff import DeepDiff import json import threading from pytests.fts.fts_base import CouchbaseCluster from membase.api.exception import CBQError class FlexIndex...
hammer.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- # python 3.3.2+ Hammer Dos Script v.1 # by Can Yalçın # only for legal purpose from queue import Queue from optparse import OptionParser import time,sys,socket,threading,logging,urllib.request,random def user_agent(): global uagent uagent=[] uagent.append("Mozilla/5.0 (...
test_errno.py
import unittest, os, errno from ctypes import * from ctypes.util import find_library import threading class Test(unittest.TestCase): def test_open(self): libc_name = find_library("c") if libc_name is not None: libc = CDLL(libc_name, use_errno=True) if os.name == "nt": ...
websockets.py
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2015 Thomas Voegtlin # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including...
tf_distributed_np_ql.py
import datetime import threading from contextlib import contextmanager from random import random from time import sleep import gym import numpy as np from timer_cm import Timer from distributed.job import Jobs, Job from distributed.producer_consumer import start_local_cluster_multiprocessing from rl.agent.agent impor...
ignite_aware.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 use ...
logs.py
import sys import os import time import math from datetime import datetime import struct import itertools import socket import ssl import urllib3 import traceback import docker import kubernetes import requests_unixsocket from dateutil import parser from threading import Thread from multiprocessing import Queue, Value ...
WtMonSvr.py
from flask import Flask, session, redirect, request, make_response import json import datetime import os import hashlib import sys from .WtLogger import WtLogger from .DataMgr import DataMgr from .PushSvr import PushServer from .WatchDog import WatchDog, WatcherSink from .EventReceiver import EventReceiver,...
test_wait_bg_jobs.py
import time import threading import requests import pytest import tests.fixtures as fxt import tests.server_fixtures.routes as routes class BgTask(object): def __init__(self, url, delayed=True): self.url = url self.bg = threading.Thread(target=self.target) self.delayed = delayed def...
fn_api_runner.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...
fastest-infra-wheel-mirror.py
#!/usr/bin/env python # # Copyright 2016, Rackspace US, 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 applicab...
test_dgx.py
import multiprocessing as mp import os import subprocess from enum import Enum, auto from time import sleep import numpy import pytest from tornado.ioloop import IOLoop from dask import array as da from distributed import Client from distributed.utils import get_ip_interface from dask_cuda import LocalCUDACluster fr...
donations.py
#!/usr/bin/env python3 """ A small donation service so that users can request ln invoices This plugin spins up a small flask server that provides a form to users who wish to donate some money to the owner of the lightning node. The server can run on an arbitrary port and returns an invoice. Also a list of previously...
main.py
import tkinter as tk from tkinter import messagebox from tkinter import filedialog import time import threading import numpy as np import cv2 import mss import mss.tools from pynput import mouse, keyboard import re import json import requests import webbrowser from selenium import webdriver import pytesseract def on_...
thread_.py
import threading from threading import Thread def get_current_thread(): return threading.current_thread() def get_current_thread_name(): return get_current_thread().getName() def is_alive(t): return t.is_alive() def create_and_start(name, target, daemon = True): t = Thread(target= target) ...
data_collector.py
# =============================================================================== # Copyright 2013 Jake Ross # # 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...
code.py
# Copyright (c) 2011-2020 Eric Froemling # # 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,...
run-logged-gcp-playlist.py
#!/usr/bin/env python import sys import threading import time import os.path import json from random import randint from command_args import get_args from GcpDeployer import GcpDeployer from GcpRunner import GcpRunner from GcpBrokerActions import GcpBrokerActions from GcpUniqueConfiguration import GcpUniqueConfigurati...
engine.py
"""""" import sys import importlib import traceback from typing import Sequence, Any from pathlib import Path from datetime import datetime from threading import Thread from pandas import DataFrame from vnpy.event import Event, EventEngine from vnpy.trader.engine import BaseEngine, MainEngine from vnpy.trader.consta...
linkcheck.py
# -*- coding: utf-8 -*- """ sphinx.builders.linkcheck ~~~~~~~~~~~~~~~~~~~~~~~~~ The CheckExternalLinksBuilder class. :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re import sys import Queue import socket import threading from o...
sync.py
# Copyright (C) 2008 The Android Open Source Project # # 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 ...
server.py
import Pyro4 import logging Pyro4.config.REQUIRE_EXPOSE = True log = logging.getLogger(__name__) def main(): opts = getopts() from . import register_deserialization_handlers register_deserialization_handlers() log_forwarder = setup_logging() server = Server(opts['--listen'], log_forwarder) se...
listen.py
import errno import socket from ..context import context from ..log import getLogger from ..timeout import Timeout from .sock import sock log = getLogger(__name__) class listen(sock): """Creates an TCP or UDP-socket to receive data on. It supports both IPv4 and IPv6. The returned object supports all the...
agent.py
# Copyright 2010 New Relic, 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 writ...
test_motor_change_stream.py
# Copyright 2017-present MongoDB, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
run_unit_tests.py
import keyboard import sys import time from importlib import import_module from queue import Queue from threading import Thread from rlbot.setup_manager import SetupManager from rlbot.utils.game_state_util import GameState from rlbot.utils.logging_utils import get_logger from rlbot.utils.python_version_check import c...
test_cursor.py
# Copyright 2009-present MongoDB, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
server.py
import socketserver import socket import threading import time import sys sys.path.append('../editor') import translate import json import subprocess import platform import argparse parser = argparse.ArgumentParser() parser.add_argument('--time', type=int, default=-1) args = parser.parse_args() if args.time != -1:...
bot.py
# coding=utf-8 # Copyright 2008, Sean B. Palmer, inamidst.com # Copyright © 2012, Elad Alfassa <elad@fedoraproject.org> # Copyright 2012-2015, Elsie Powell, http://embolalia.com # Copyright 2019, Florian Strzelecki <florian.strzelecki@gmail.com> # # Licensed under the Eiffel Forum License 2. from __future__ import abs...
PortScanner.py
#!/usr/bin/python3 import socket, time, sys, threading, os, sys from datetime import datetime def print_menu(io): if io == 1: if os.name == 'nt': os.system("cls") else: os.system("ls") print ("\n" + 15 * "-" , "Penetration Testing Software" , 15 * "-") pr...
UQPCE.py
#!/usr/bin/env python from builtins import setattr, getattr from enum import auto, Enum from fractions import Fraction import math from multiprocessing import Process from multiprocessing import Process, Manager import os from warnings import showwarning, warn from numpy.linalg import inv, pinv from scipy i...
test_netbeans.py
#!/usr/bin/python # # Server that will communicate with Vim through the netbeans interface. # Used by test_netbeans.vim. # # This requires Python 2.6 or later. from __future__ import print_function import socket import sys import time import threading try: # Python 3 import socketserver except ImportError: ...
Vendor_details.py
from src.dependencies.imports import * class Vendor_details(Frame): def __init__(self,master,db,flag): super(Vendor_details,self).__init__(master) self.grid() self.db=db self.config(bg="#bdc3c7") self.focus_set() self.canvas = Canvas(self,bg="#bdc3c7") ...
test_autotvm_measure.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
backend_overview.py
# This code is part of Qiskit. # # (C) Copyright IBM 2017, 2018. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivat...
gpio_motor.py
import RPi.GPIO as GPIO import time import threading class GPIO_motor: def __init__(self): self.P_A1 = 4 # adapt to your wiring self.P_A2 = 27 # ditto self.P_B1 = 17 # ditto self.P_B2 = 22 # ditto self.delay = 0.005 # time to settle self._lock = threading.Lock(...
verinet.py
""" This file contains the main class for verification. Author: Patrick Henriksen <patrick@henriksen.as> """ from typing import Any, Optional from src.neural_networks.verinet_nn import VeriNetNN import time import multiprocessing as mp from copy import deepcopy import numpy as np from src.algorithm.verinet_worker i...
quicksweep.py
#!/usr/bin/python2 # Requires scapy and netaddr. Run as root. import argparse import sys import multiprocessing import netaddr import logging logging.getLogger("scapy.runtime").setLevel(logging.ERROR) from scapy.all import * def ping(jobq,resultsq): while True: target = jobq.get() if target is Non...
xla_device_utils.py
# Copyright The PyTorch Lightning team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
deploy.py
# Copyright (c) 2010-2014 Turbulenz Limited """ Controller class for deploying a game """ from urllib3.exceptions import HTTPError, SSLError from simplejson import dump as json_dump, load as json_load, loads as json_loads, JSONDecodeError from os import stat, sep, error, rename, remove, makedirs, utime, access, R_OK, ...
fn_api_runner.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...
aiohttp_test_server.py
import asyncio import logging import threading import time from aiohttp import web from pyctuator.pyctuator import Pyctuator from tests.conftest import PyctuatorServer # mypy: ignore_errors # pylint: disable=unused-variable class AiohttpPyctuatorServer(PyctuatorServer): def __init__(self) -> None: self...
apps.py
from django.apps import AppConfig from django.conf import settings from threading import Thread class DjangoMqConfig(AppConfig): name = 'django_rabbitmq' def ready(self): thr = Thread(name='mq_thread', target=self.run_mq) thr.daemon = True thr.start() def run_mq(self): mq...
test_host_connection_pool.py
# Copyright 2013-2014 DataStax, 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 writi...
infeed_test.py
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
ping_threading.py
import requests import threading STATUS_CODES = { 200: 'OK', 404: 'Not Found', 500: 'Internal Server Error', 524: 'A timeout occured' } def ping(url): res = requests.get(url) print(f'{url}: {STATUS_CODES[res.status_code]}') if __name__ == '__main__': with open('input.txt', 'r') as f: ...
sjqrunner.py
''' Job runner for SJQ - Simple Job Queue SJQ is included with MVpipe as a single-user batch scheduler ''' import os import time import socket import string import multiprocessing import mvpipe.config from mvpipe.runner import Runner, Job import sjq.client import sjq.server def_options = {'env': True, 'cwd': os.pa...
builder.py
#! /usr/bin/env python # -*- coding: utf-8 -*- import concurrent.futures from pathlib import Path from whotracksme.data.loader import DataSource from whotracksme.website.build.home import build_home, build_privacy_policy from whotracksme.website.build.blog import ( build_blogpost_list, build_blogpost_pages,...
test_entry.py
""" datazen - Test the program's entry-point. """ # built-in from multiprocessing import Process import os import signal import time # module under test from vmklib.entry import main as mk_main # internal from . import get_resource, get_args def test_interrupt(): """Test interrupting the process.""" with ...
consumer.py
from xml.etree import ElementTree from time import time from glob import glob import multiprocessing import subprocess import os.path import sys import os import simplejson as json import logging import clustohttp from eventlet.green import socket import eventlet import memcache import bottle import jinja2 #redis = e...