source
stringlengths
3
86
python
stringlengths
75
1.04M
netattack2.py
#!/usr/bin/env python # imports that won't cause errors import sys import os import signal import subprocess from threading import Thread from time import sleep import datetime import logging logging.getLogger("scapy.runtime").setLevel(logging.ERROR) # scapy, please shut up.. # terminal colors RED = "\033[1;31m" BL...
test_threads.py
# MIT License # # Copyright (c) 2018-2019 Tskit Developers # Copyright (c) 2016-2017 University of Oxford # # 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 with...
reco.pyw
# --------------- # # Reco PC Server | # --------------- # # Version No: 6.0 | # --------------- # # Basic bot dependencies import discord from discord.client import Client from discord.ext.commands import Bot import platform import os import asyncio from threading import Thread # Import configurations import confi...
data_manager.py
import threading import socket import random import time import socket import threading import queue import string import time import os import math import sys PORT_DETECTOR = 9001 PORT_WARNING = 9002 MAX_LENGTH = 100000 BATCH_SIZE = 64 PORT_REPORT = 9004 PORT_QUERY = 9005 batch_size = 4 model_path = '/home/ubuntu/...
client.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import sys sys.path.append("../utility") from openie_utility import OpenieUtility from utility import Utility from prepro...
set_proxy_win7.py
#!/usr/bin/env python2 # -*- coding: utf-8 -*- ''' # Title : Set Proxy on Windows 7 Through Registry # Author: Solomon Xie ''' # === 必备模块 === import urllib2, urllib, re, os, sys, time, random, datetime, getopt import requests # 第三方 from threading import Thread from bs4 import BeautifulSoup # 第三方 ...
tasks.py
# -*- coding: utf-8 -*- from ..tasks import celery from celery import current_app import requests import traceback import json import os from pylibdmtx.pylibdmtx import decode from PIL import Image import sys import subprocess import time import logging from models import ThreadPool from PyPDF2 import PdfFileWriter, P...
clean_util.py
''' Clean up test case remnants @author: Youyk ''' import threading import time import sys import os import errno import traceback import apibinding.api as api import apibinding.inventory as inventory import apibinding.api_actions as api_actions import zstacklib.utils.http as http import zstacklib.utils.jsonobject a...
meitulu3.py
#coding=utf-8 # Download all of a model's pictures # use: python3 meitulu3.py <tag page>(like: https://www.meitulu.com/t/ebeinaicha/) <son page number> import requests import os import sys from lxml import etree import multiprocessing import time import numpy as np headers = {"User-Agent": "Mozilla/5.0...
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...
tracker.py
import os import numpy as np import math import cv2 import onnxruntime import time import queue import threading import copy from similaritytransform import SimilarityTransform from retinaface import RetinaFaceDetector from remedian import remedian def resolve(name): f = os.path.join(os.path.dirname(__file__), nam...
camera.py
import time from datetime import datetime from imutils.video import WebcamVideoStream from imutils.video import FPS from trainer import Trainer import imutils from PIL import Image import numpy as np import cv2 import os import openface import imagehash from app import db from app.models import Face, User # directorie...
web_server.py
import socket import re import multiprocessing import time import dynamic.mini_frame class WSGIServer(object): def __init__(self, ip, port): # 1. 创建套接字 self.tcp_server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.tcp_server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_...
overview.py
from django.shortcuts import render, redirect, HttpResponse from django.views.generic import View from django.contrib.auth.mixins import LoginRequiredMixin from core.adapter.django import DjangoAdapter from dashboard.views.utils import Util, page_manage from dashboard.models import App import os import threading impor...
elara.py
""" Copyright (c) 2021, Saurabh Pujari All rights reserved. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. """ import multiprocessing import os import atexit from .elarautil import Util from .exceptions import InvalidCacheParams from .lru i...
music_interface.py
# -*- coding: utf-8 -*- """ For encode song id """ from Scripts.settings import decode_text from Scripts.elements import * from Scripts.draw_song import DrawSong from Scripts.parse_music import ParseMusic from Scripts.music_storage import MusicStorage from Scripts.playlist_storage import PlaylistStorage fro...
testserver.py
import hashlib import os import sys import threading from functools import partial from http import HTTPStatus from http.server import HTTPServer from loguru import logger from RangeHTTPServer import RangeRequestHandler class TestRequestHandler(RangeRequestHandler): def __init__(self, *args, **kwargs): #...
test_parameters.py
"""CSI Node plugin parameters feature tests.""" import os import pytest import threading import time from pytest_bdd import given, scenario, then, when, parsers import subprocess import csi_pb2 as pb from common.apiclient import ApiClient from common.deployer import Deployer from common.nvme import nvme_find_device f...
analyzer.py
import logging from Queue import Empty from redis import StrictRedis from time import time, sleep from threading import Thread from collections import defaultdict from multiprocessing import Process, Manager, Queue from msgpack import Unpacker, unpackb, packb from os import path, kill, getpid, system from math import c...
multi_proxy_server.py
import socket import sys import time from multiprocessing import Process HOST = "" PORT = 8001 BUFFER_SIZE = 1024 def handle_request(conn,addr,proxy_end): request_data = conn.recv(BUFFER_SIZE) time.sleep(0.5) proxy_end.sendall(request_data) proxy_end.shutdown(socket.SHUT_WR) def main(): host = 'ww...
__init__.py
# -*- coding: utf-8 -*- import http.cookiejar import importlib import json import logging import os import sublime import threading import urllib.request from ..libs import config from ..libs import printer from ..libs.exception import OjException, ExitScript logger = logging.getLogger(__name__) oj...
graph.py
import asyncio import sys from threading import Thread from ..base import StreamEnd, StreamNone, StreamRepeat, TributaryException # noqa: F401 class StreamingGraph(object): """internal representation of the entire graph state""" def __init__(self, node): self._stop = False self._starting_no...
batch.py
#!/usr/bin/python3 import time, os, sys import multiprocessing as mp from main.run_sample import main class batch: ### Data and methods for managing deployment of individual samples from project sample list ### def __init__(self, project_dict): self.proj_dict = project_dict self.project_id = proj...
notifier.py
# -*- coding: utf-8 -*- from bs4 import BeautifulSoup from threading import Thread import xml.etree.ElementTree as et import pygame import http.client import feedparser import googletrans import random import gtts import time import sys import re import os def playaudio(path): with open(path) as f: pygam...
handler.py
import multiprocessing from tft import parser, board, utils ShopTask = "shop" HealthbarsTask = "healthbars" FinishTask = "finish" class Handler: def __init__(self, result_queue, debug=None): ctx = multiprocessing.get_context('spawn') self.__processes = [] self.__task_queue = ctx.Queue() ...
util.py
#!/usr/bin/env impala-python # # 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 (...
WrapItUp.py
# Max van Leeuwen - maxvanleeuwen.com/WrapItUp # WrapItUp - 1.8 # # Collect all media, gizmos and files associated with a nuke script, and copy it all to a separate folder - along with a relinked duplicate of the nuke script. WIU_Title = 'WrapItUp 1.8 - maxvanleeuwen.com' WIU_Log = '[WrapItUp] ' # imp...
sync_p2p.py
import os import torch import torch.distributed as dist import torch.multiprocessing as mp def run(rank_id, size): tensor = torch.zeros(1) if rank_id == 0: tensor += 1 # Send the tensor to process 1 dist.send(tensor=tensor, dst=1) print('after send, Rank ', rank_id, ' has data '...
monitor.py
# Copyright 2018 Microsoft 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 to in...
p01_start_stop_thread.py
import socket import time def countdown(n): while n > 0: print('T-minus', n) n -= 1 time.sleep(5) # Create and launch a thread from threading import Thread t = Thread(target=countdown, args=(10,)) t.start() print('Still running' if t.is_alive() else 'Completed') t.join() t = Thread(t...
RLOCK_.py
""" 1-normally you cannot acquire normal lock more than once 2-A Lock object can be released by any thread. 3-rlock is the opposite of that ,but they are slower """ import threading import time class X: def __init__(self): self.a = 1 self.b = 2 self.lock = threading.RLock() def cha...
bombardier.py
#!/usr/bin/python3 import requests, threading, logging, argparse, time, sys, json, yaml, urllib, os, ast class TargetDefinition(object): def __init__(self, target): if os.path.isfile(target): with open(target) as f: c = yaml.load(f) self.target = c.get("target")...
run.py
from wtpy import BaseExtParser, BaseExtExecuter from wtpy import WTSTickStruct from ctypes import byref import threading import time from wtpy import WtEngine,EngineType from Strategies.DualThrust import StraDualThrust class MyExecuter(BaseExtExecuter): def __init__(self, id: str, scale: float): ...
app.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """This is a simple audio recorder that uses PyAudio and wave to record .wav files.""" __author__ = "Hannan Khan" __copyright__ = "Copyright 2020, Audio Recorder" __credits__ = ["Hannan Khan"] __license__ = "MIT" __version__ = "1.0" __maintainer__ = "Hannan Khan" __email_...
terminal.py
import sys import pyte import operator import threading from contextlib import contextmanager import time import os if sys.platform.startswith("win"): import winpty else: import ptyprocess __all__ = ["PtyProcess", "Screen", "ByteStream", "Terminal"] if sys.platform.startswith("win"): ParentPtyProcess =...
test_threads.py
import threading import queue as stdlib_queue import time import pytest from .. import _core from .. import Event, CapacityLimiter, sleep from ..testing import wait_all_tasks_blocked from .._threads import ( to_thread_run_sync, current_default_thread_limiter, from_thread_run, from_thread_run_sync, ) ...
__init__.py
""" This module contains test utilities. The tests for test utilities should be placed inside `test.utils.test` (``test/utils/tests/``). """ from __future__ import print_function import email.message import pprint import random import unittest from contextlib import AbstractContextManager, contextmanager from http.s...
test_run.py
""" Test the actual run """ import py import sys import tempfile import time import gzip import time import pytz import vmprof import six import pytest from cffi import FFI from datetime import datetime import requests from vmshare.service import Service, ServiceException from vmprof.show import PrettyPrinter from vmpr...
camera.py
""" Wraps the pyrealsense layer to return a format that Open3D can consume """ import logging import pyrealsense2 as rs import cv2 import numpy as np import queue import multiprocessing import time import open3d as o3d from multiprocessing import Process, Manager from scanner3d.exceptions import NoDeviceDetectedExcepti...
main.py
# pylama:ignore=E722,E303,E302,E305 import subprocess import os import re import sys import random import threading import socket import time import errno import configparser from http.server import BaseHTTPRequestHandler, HTTPServer from multiprocessing import Process import LocastService import SSDPServer from templ...
plugin.py
#! /usr/bin/env python # -*- coding: utf-8 -*- """ GhostXML Plugin Authors: See (repo) This plugin provides an engine which parses tag/value pairs into transitive Indigo plugin device states. """ # TODO: Additional auth types: Oauth2, WSSE # =============================== Stock Imports ============================...
upgrade_all_packages_command.py
import time import threading import functools import sublime import sublime_plugin from ..thread_progress import ThreadProgress from ..package_installer import PackageInstaller, PackageInstallerThread from ..package_renamer import PackageRenamer USE_QUICK_PANEL_ITEM = hasattr(sublime, 'QuickPanelItem') class Upgra...
test_posix.py
import sys import asyncio import os import time from signal import SIGINT, SIGTERM from concurrent.futures import ThreadPoolExecutor from typing import List from enum import Enum from aiorun import run, shutdown_waits_for, _DO_NOT_CANCEL_COROS, ShutdownCallback import pytest import multiprocessing as mp from contextl...
rpc_test.py
import concurrent.futures import contextlib import json import os import sys import threading import time from collections import namedtuple from functools import partial from threading import Event from threading import Lock from unittest import mock import torch import torch.nn as nn import torch.distributed as dis...
microtvm_api_server.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...
mining.py
from multiprocessing import Event, Process, Queue, Pool from threading import Thread import datetime import queue import logging import koppercoin.logsetup class NoBlockFoundError(Exception): pass def _setup(event): global finished finished = event def _find_next_block(block, transactions, id, idrange)...
batched_predictor.py
import os import logging import glob import re import math import time import csv import multiprocessing from queue import Empty from collections import defaultdict from copy import copy import pickle import numpy as np from trainers.batched import BatchedTrainer logger = logging.getLogger(__name__) logger.setLevel(...
LatestMessages.py
# SPDX-FileCopyrightText: 2017 Fermi Research Alliance, LLC # SPDX-License-Identifier: Apache-2.0 """The LatestMessages class listens for messages from a set of queues and retains only the last unconsumed message from each queue. The latest messages are consumed by calling the consume() instance method, which returns...
emergency_slicing.py
from ryu.base import app_manager from ryu.controller import ofp_event from ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER from ryu.controller.handler import set_ev_cls from ryu.ofproto import ofproto_v1_3 from ryu.lib.packet import packet from ryu.lib.packet import ethernet from ryu.lib.packet import ...
foo.py
# Python 3.3.3 and 2.7.6 # python fo.py from threading import Thread # Potentially useful thing: # In Python you "import" a global variable, instead of "export"ing it when you declare it # (This is probably an effort to make you feel bad about typing the word "global") i = 0 def incrementingFunction(): glob...
_testing.py
import bz2 from collections import Counter from contextlib import contextmanager from datetime import datetime from functools import wraps import gzip import operator import os import re from shutil import rmtree import string import tempfile from typing import Any, Callable, ContextManager, List, Optional, Type, Union...
scanner.py
#!/usr/bin/env python __author__ = "bt3" import threading import time import socket import os import struct import ctypes from netaddr import IPNetwork, IPAddress from ICMPHeader import ICMP # host to listen on HOST = '192.168.1.114' # subnet to target (iterates through all IP address in this subnet) # our local n...
test_core.py
import threading import time import unittest from datetime import datetime from unittest.mock import patch from pygtasks.core import PygTasks def sleep(): time.sleep(0.01) class TestCore(unittest.TestCase): @patch('pygtasks.core.Connection') @patch('pygtasks.core.Terminal') def setUp(self, mox_termi...
meshtool_regression.py
import list import pprint import sys import os import os.path import urllib2 import shutil from meshtool.filters import factory from meshtool.filters.print_filters.print_render_info import getRenderInfo import collada import unicodedata import math import traceback import itertools from multiprocessing import Process, ...
trainer_utils.py
# coding=utf-8 # Copyright 2020-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
test_scheduler.py
import os from datetime import datetime, timedelta, timezone from multiprocessing import Process import mock from rq import Queue from rq.compat import PY2 from rq.exceptions import NoSuchJobError from rq.job import Job, Retry from rq.registry import FinishedJobRegistry, ScheduledJobRegistry from rq.scheduler import R...
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...
test_synchronize.py
import os import sys import time import pytest import signal import threading from loky.backend import get_context from .utils import TimingWrapper loky_context = get_context("loky") DELTA = 0.1 TIMEOUT1 = .1 TIMEOUT2 = .3 @pytest.mark.skipif(sys.platform == "win32", reason="UNIX test") def test_semlock_failure()...
ec_utils.py
#!/usr/bin/python """ (C) Copyright 2020-2021 Intel Corporation. SPDX-License-Identifier: BSD-2-Clause-Patent """ import re import threading import queue import time from nvme_utils import ServerFillUp from daos_utils import DaosCommand from test_utils_container import TestContainer from apricot import TestWithSe...
dired_file_operations.py
# coding: utf8 '''This module contains all commands for operations with files: create, delete, rename, copy, and move ''' from __future__ import print_function import sublime from sublime import Region from sublime_plugin import TextCommand import os, shutil, tempfile, itertools, threading from os.path import bas...
main.py
import copy import json import nfc import ndef import nfc.ndef from multiprocessing import Process, Lock, Queue, Event, Manager from Queue import Empty as QueueEmpty import time import re import argparse import buttons from email_client import Email import RPi_I2C_driver as i2c_lcd from keep_client import Keep as Keep...
Chuckyself (Belum Jadi).py
# -*- coding: utf-8 -*- #Chucky_Bot import LINETCR from LINETCR.lib.curve.ttypes import * from datetime import datetime from bs4 import BeautifulSoup from threading import Thread from googletrans import Translator from gtts import gTTS import time,random,sys,json,codecs,threading,glob,urllib,urllib2,urllib3,re,ast,os,...
app.py
# Copyright 2014 OpenStack Foundation # Copyright 2014 Hewlett-Packard Development Company, L.P. # # 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...
variable_scope_test.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...
emails.py
# -*- coding: utf-8 -*- """ :author: Qin Haining (秦海宁) :url: http://greyli.com :copyright: © 2018 Qin Haining <2364839934@qq.com> :license: MIT, see LICENSE for more details. """ from threading import Thread from flask import current_app, render_template from flask_mail import Message from albumy.exte...
test_meta_runner.py
import threading import pytest import time import asyncio import trio from cobald.daemon.runners.base_runner import OrphanedReturn from cobald.daemon.runners.meta_runner import MetaRunner class TerminateRunner(Exception): pass def run_in_thread(payload, name, daemon=True): thread = threading.Thread(target...
SimVM.py
#------------------------------------------------------------------------------- # Name: SimVM # Purpose: 实现一个线程安全仿真环境,其中包含多条自主航行船舶、观测者、环境数据 # # Author: Youan # Helper: Bruce # Created: 27-01-2020 # Copyright: (c) Youan 2020 # Licence: <your licence> #-------------------------------------...
main.py
#!/usr/bin/python3 import re import socket import sqlite3 import asyncore import os from os.path import isfile from json import load, dump from time import sleep, time from threading import Thread, Timer #external libraries from lib.switch_controller import * TWITCH_HOST = "irc.chat.twitch.tv" TWITCH_PORT = 6667 SE...
InputHandlerThread.py
from Queue import Queue, Empty from threading import Thread import sys import time class InputHandlerThread(Thread): def __init__(self, device): Thread.__init__(self) self.queue = Queue() self.device = device self.daemon = True t = Thread(target=self.enqueue_input, args=(s...
log_server.py
# -*- coding: utf-8 -*- """ pytestsalt.fixtures.log_server_tornado ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Tornado Log Server Fixture """ import logging import threading from contextlib import contextmanager import msgpack import zmq log = logging.getLogger(__name__) @contextmanager def log_server_list...
communication_pattern_test.py
import os import sys import time from absl import app from absl import flags from multiprocessing import Process sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import erdos.graph from erdos.data_stream import DataStream from erdos.message import Message from erdos.op import Op from erdos...
rates_server.py
""" rate server module """ from typing import Optional, Any from multiprocessing.sharedctypes import Synchronized # type: ignore import multiprocessing as mp import sys import socket import threading import re import json import requests import pyodbc conn_options = [ "DRIVER={ODBC Driver 17 for SQL Server}", ...
data_utils.py
# Lint as python3 # Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
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...
watcher.py
import inotify.adapters import os from threading import Thread class Watcher(): def __init__(self, folders): self.folders = folders # file => [tamanho, nr de leituras] self.info = {} self.reset() def reset(self): for folder in self.folders: for basename in ...
1.py
# -*- coding: utf-8 -*- import LINETCR from LINETCR.lib.curve.ttypes import * from datetime import datetime import time, random, sys, ast, re, os, io, json, subprocess, threading, string, codecs, requests, ctypes, urllib, urllib2, urllib3, wikipedia, tempfile from bs4 import BeautifulSoup from urllib import urlopen fr...
peershandler.py
""" Peers handler module for Bismuth nodes @EggPoolNet """ import json import os import re import sys import threading import time import socks import regnet __version__ = "0.0.11" # TODO : some config options are _conf and others without => clean up later on def most_common(lst: list): """Used by consensus"...
wp-brute.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Author: GUS-andre X SassaAllen # Special thank's to: allah swt # PLEASE DON'T DELETE THIS COPYRGHT # -------------------------------------------- import urllib import urllib2 import httplib import httplib2 import time import socket, sys, os, os.path, argparse, random fro...
main.py
from __future__ import print_function import argparse import os import torch import torch.multiprocessing as mp if __name__ == "__main__": mp.set_start_method("spawn") import my_optim from model import ActorCritic from test import test from train import train from pong import Pong import time # Based on # https...
base_scraping_manager.py
import threading from multiprocessing import Queue from time import sleep from typing import List, Tuple, Type, Dict, Set from definitions import ONE_HOUR from src.base.base_logger import BaseClassWithLogger from src.base.base_scraper import BaseScraper from src.db_utils import get_settings from src.models.settings im...
Tab4.py
# coding: utf-8 from tkinter import messagebox as mBox import tkinter as tk from tkinter import ttk from tkinter import scrolledtext from tkinter import filedialog as fd import sys from threading import Thread sys.path.append('../') from Fun.summary import summary class Tab4(): def __init__(self,tab,i18n): ...
test_agent.py
import logging import socket import time from unittest.mock import MagicMock import pendulum import pytest from prefect.agent import Agent from prefect.engine.state import Scheduled, Failed, Submitted from prefect.utilities.configuration import set_temporary_config from prefect.utilities.exceptions import Authorizati...
test_s3.py
import boto3 import botocore.session from botocore.exceptions import ClientError from botocore.exceptions import ParamValidationError from nose.tools import eq_ as eq from nose.plugins.attrib import attr from nose.plugins.skip import SkipTest import isodate import email.utils import datetime import threading import re ...
player.py
""" The MIT License (MIT) Copyright (c) 2015-present Rapptz 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, merg...
server_flask copy.py
import cv2 import time import threading from flask import Response, Flask # Image frame sent to the Flask object global video_frame video_frame = None # Use locks for thread-safe viewing of frames in multiple browsers global thread_lock thread_lock = threading.Lock() # GStreamer Pipeline to access the Raspberry...
cooling_system.py
# # An implementation of a technology which allows us to control an industrial # cooling system in an efficient way. # # Author: Joeri Hermans # import sys import socket import struct import time from threading import Thread from numpy import * # Global members, which are required for the communication # with the rem...
__init__.py
import copy import json import operator import pytz import re import threading import time from datetime import datetime, timedelta from urllib.request import urlopen from urllib.error import HTTPError, URLError from i3pystatus import SettingsBase, Module, formatp from i3pystatus.core.util import user_open, internet, ...
pipe.py
from multiprocessing import Process, Pipe def f(conn): conn.send(Pipe()) conn.close() parent_conn, child_conn = Pipe() p = Process(target=f, args=(child_conn,)) p.start() print parent_conn.recv() p.join()
ppar.py
# Copyright 2014-2020 Chris Cummins <chrisc.101@gmail.com>. # # 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...
subproc_vec_env.py
import multiprocessing as mp import numpy as np from .vec_env import VecEnv, CloudpickleWrapper, clear_mpi_env_vars def worker(remote, parent_remote, env_fn_wrappers): def step_env(env, action): ob, reward, done, info = env.step(action) if done: ob = env.reset() return ob, rew...
runtime_manager_dialog.py
#!/usr/bin/env python """ Copyright (c) 2015, Nagoya University 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 notice, this ...
thread.py
from multiprocessing.pool import ThreadPool from threading import Thread from promise import Promise from .utils import process class ThreadExecutor(object): pool = None def __init__(self, pool=False): self.threads = [] if pool: self.execute = self.execute_in_pool s...
test_page.py
import time import pytest import threading from flask import request, Blueprint from selenium import webdriver import alfred3_interact as ali from alfred3.testutil import get_app from alfred3.testutil import clear_db from alfred3.testutil import forward testing = Blueprint("test", __name__) @testing.route("/stop") ...
utils.py
# coding=utf-8 # Copyright 2019 The SEED 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 agre...
game.py
import logging import socket from threading import Thread from QRServer.game.gameclient import GameClientHandler from QRServer.game.gameserver import GameServer log = logging.getLogger('game_listener') def game_listener(conn_host, conn_port): log.info('Game starting on ' + conn_host + ':' + str(conn_port)) ...
run.py
import logging import os import signal import subprocess import threading from contextlib import contextmanager from dvc.utils import fix_env from .decorators import relock_repo, unlocked_repo from .exceptions import StageCmdFailedError logger = logging.getLogger(__name__) CHECKPOINT_SIGNAL_FILE = "DVC_CHECKPOINT"...
_training.py
# Copyright (2013) Sandia Corporation. Under the terms of Contract # DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government # retains certain rights in this software. # # This software is released under the FreeBSD license as described # in License.txt import time as Timer import string import pickle import ...
TProcessPoolServer.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...
originServer2.py
# 4 main components # Serve edge servers # Send heartbeat to backup # Receive data from Content providers # Replicate data to backup from _thread import * import socket import sys import time import sched from threading import Timer, Thread import selectors import os from enum import Enum import pickle from threadin...
test_daemon.py
# Copyright 2018 Microsoft 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 to in...