source
stringlengths
3
86
python
stringlengths
75
1.04M
worker3.py
from cerebral import logger as l import logging import Pyro4 from ares.main import Ares from cerebral.nameserver import lookup, ports from cerebral.pack1.hippocampus import Android from threading import RLock, Thread, Event import time # Configure pyro. Pyro4.config.SERIALIZERS_ACCEPTED = frozenset(['pickle', 'serpe...
client.py
import socket import threading flag = 0 s = socket.socket(socket.AF_INET , socket.SOCK_STREAM) hostname = input("Enter your host :: ") s.connect((hostname , 1023)) nickname = input("Enter your Name :: ") def recieve(): while True: try: msg = s.recv(1024).decode("utf-8") if msg == '...
parallel_validation.py
# Copyright BigchainDB GmbH and BigchainDB contributors # SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) # Code is Apache-2.0 and docs are CC-BY-4.0 import multiprocessing as mp from collections import defaultdict from bigchaindb import App, BigchainDB from bigchaindb.tendermint_utils import decode_transaction f...
data_table.py
# Copyright 2017 James P Goodwin data table package to manage sparse columnar data """ module that implement a data table package to manage sparse columnar data window and refresh them automatically """ import sys import os from datetime import datetime from dateutil import parser import threading import time import cs...
testM3.py
#!/usr/bin/python import os import sys import numpy as np import cv2 import time import threading from multiprocessing import Process, Queue, Pipe, Manager, Lock print(os.path.dirname(__file__)) print(os.path.basename(__file__)) print(sys.version_info) print(cv2.__version__) class fpsWithTick(object): def __in...
meterpreter.py
#!/usr/bin/python import binascii import code import os import platform import random import re import select import socket import struct import subprocess import sys import threading import time import traceback try: import ctypes except ImportError: has_windll = False else: has_windll = hasattr(ctypes, '...
aedt_test_runner.py
import argparse import datetime import json import os import platform import re import subprocess import tempfile import threading from contextlib import contextmanager from distutils.dir_util import copy_tree from distutils.dir_util import mkpath from distutils.dir_util import remove_tree from distutils.file_util impo...
monitor.py
import raylink import psutil import schedule import threading import time from tabulate import tabulate from psutil._common import bytes2human import subprocess as sp import tracemalloc class HWM(object): @staticmethod def add_cap(cap, log): log = '-' * 20 + f'\n{cap}\n' + '-' * 20 + '\n' + log + '\n'...
errorhandlers.py
import threading import traceback from pygments import highlight from pygments.formatters import HtmlFormatter from pygments.lexers import MarkdownLexer from flask import url_for, render_template, request, redirect, copy_current_request_context from flask_wtf.csrf import CSRFError from flask_mail import Message from ap...
cl_api.py
import logging import subprocess import threading import time import os import queue import re from datetime import datetime, timedelta class DockerMachineError(Exception): """ Exception thrown by machine components. """ def __init__(self, task, message): self.task = task self.message ...
log.py
#!/usr/bin/env python """ Copyright (c) 2014-2019 Maltrail developers (https://github.com/stamparm/maltrail/) See the file 'LICENSE' for copying permission """ from __future__ import print_function import datetime import os import re import signal import socket import sys import threading import time import traceback...
main.py
from multiprocessing import Process import api import reisapi if __name__ == '__main__': # Start API api = Process(target=api.run) api.start() reis = Process(target=reisapi.run) reis.start() api.join() reis.join()
subprocess2.py
# coding=utf8 # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Collection of subprocess wrapper functions. In theory you shouldn't need anything else in subprocess, or this module failed. """ import...
handle_flow.py
#!/usr/bin/python # standard includes from pox.core import core import time as t import pickle import pandas as pd import numpy as np import threading # import minisom import local_outlier_factor as lof_alg import detect_udp_attack import detect_tcp_syn import Backprop import mode # include as part of the betta branch...
IntegrationTests.py
from __future__ import absolute_import import logging import os import multiprocessing import sys import time import unittest import percy import threading import platform import flask import requests from selenium import webdriver from selenium.webdriver.chrome.options import Options class IntegrationTests(unittes...
keep_alive.py
from flask import Flask from threading import Thread app = Flask('') @app.route('/') def home(): return "Hello. I am alive!" def run(): app.run(host='0.0.0.0',port=8080) def keep_alive(): t = Thread(target=run) t.start()
gui_panels.py
#!/usr/bin/env python3 # This file is part of the SBK project # https://github.com/mbarkhau/sbk # # Copyright (c) 2019-2021 Manuel Barkhau (mbarkhau@gmail.com) - MIT License # SPDX-License-Identifier: MIT # messy ui code is messy ... # pylint: disable=too-many-instance-attributes # pylint: disable=too-many-return-stat...
util.py
# # Copyright (C) 2012-2016 The Python Software Foundation. # See LICENSE.txt and CONTRIBUTORS.txt. # import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import shutil import socket try: ...
node.py
from hashlib import sha1 import requests import json import random from source.message import * from source.lib import * import threading ''' Contains code for node class implementing basic insertion, query operations to the network. It handles graceful join and departure ''' def getId(ip): return int(sha1(ip.enco...
flask_helper.py
# Copyright (c) Microsoft Corporation # Licensed under the MIT License. from flask import Flask from .environment_detector import build_environment from .environments.credentialed_vm_environment import CREDENTIALED_VM from .environments.public_vm_environment import PUBLIC_VM import socket import threading import atex...
x8_mmw.py
# # Copyright (c) 2020, Manfred Constapel # This file is licensed under the terms of the MIT license. # # # TI IWR6843 ES2.0 @ mmWave SDK demo of SDK 3.4.0.3 # TI IWR1843 ES1.0 @ mmWave SDK demo of SDK 3.4.0.3 # import sys import json import serial import threading from lib.shell import * from lib.helper import * fr...
rfc2217_server.py
#!/usr/bin/env python # # redirect data from a TCP/IP connection to a serial port and vice versa # using RFC 2217 # # (C) 2009-2015 Chris Liechti <cliechti@gmx.net> # # SPDX-License-Identifier: BSD-3-Clause import logging import socket import sys import time import threading import serial import serial.rfc2217 cl...
DBMgr.py
import pymongo import datetime import time import calendar import pprint import traceback def add_log(msg,obj): print("Got log:"+msg) print(obj) traceback.print_exc() pymongo.MongoClient().log_db.log.insert({ "msg":msg, "obj":obj, "timestamp":datetime.datetime.utcnow() }); def dump_debug_log(): return pp...
PyBirthdayWish.py
import os,random from threading import Thread from time import sleep import playsound from termcolor import colored from config import * import numpy as np from PIL import Image def get_ansi_color_code(r, g, b): if r == g and g == b: if r < 8: return 16 if r > 248: ...
worker.py
import queue from threading import Lock from threading import Thread from time import sleep from py42.exceptions import Py42ForbiddenError from py42.exceptions import Py42HTTPError from code42cli.errors import Code42CLIError from code42cli.logger import get_main_cli_logger class WorkerStats: """Stats about the ...
__init__.py
# -*- encoding: utf-8 -*- from __future__ import unicode_literals import sys, os if sys.version_info[0] < 3: from Queue import Empty else: from queue import Empty from multiprocessing import Process, Queue class ExceptionItem(object): def __init__(self, exception): self.exception = exception cla...
popup.pyw
import os, random as rand, tkinter as tk, time, json, ctypes, pathlib, webbrowser from tkinter import * from tkinter import messagebox from itertools import count, cycle from PIL import Image, ImageTk #Start Imported Code #Code from: https://code.activestate.com/recipes/460509-get-the-actual-and-usable-sizes-of...
dht_msg.py
import sys import random import requests import binascii import umsgpack from ast import literal_eval from future.moves.urllib.parse import urlencode #from multiprocessing import Process as Thread, Event from threading import Thread, Event from pyp2p.lib import is_ip_valid, is_valid_port from twisted.internet import de...
test_concurrent_futures.py
import test.support # Skip tests if _multiprocessing wasn't built. test.support.import_module('_multiprocessing') # Skip tests if sem_open implementation is broken. test.support.import_module('multiprocessing.synchronize') from test.support.script_helper import assert_python_ok import contextlib import itertools imp...
async.py
#!/usr/bin/env python # encoding: utf8 # # Copyright © Burak Arslan <burak at arskom dot com dot tr>, # Arskom Ltd. http://www.arskom.com.tr # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are ...
raputil.py
#!/usr/bin/python from __future__ import division import numpy as np import math import os import time import numpy.linalg as la from tools.tfinterp import interp1d_ sqrt=np.sqrt pi = math.pi def hexagonal_uniform(N,as_complex=False): 'returns uniformly distributed points of shape=(2,N) within a hexagon whose mini...
sqlite_web.py
#!/usr/bin/env python import datetime import hashlib import math import operator import optparse import os import re import sys import threading import time import webbrowser from collections import namedtuple, OrderedDict from functools import wraps from getpass import getpass from io import TextIOWrapper # Py2k co...
camera.py
from threading import Thread import cv2 from balltrack import track_tennis_ball delay = 30 class Camera: def __init__(self, id=0, height=720, width=1280, fps=30): self.cap = cv2.VideoCapture(id) self.cap.set(cv2.CAP_PROP_FRAME_WIDTH, width) self.cap.set(cv2.CAP_PROP_FRAME_HEIGHT, height...
test_dota_r3det.py
# -*- coding:utf-8 -*- from __future__ import absolute_import from __future__ import print_function from __future__ import division import os import sys import tensorflow as tf import cv2 import numpy as np import math from tqdm import tqdm import argparse from multiprocessing import Queue, Process sys.path.append("....
framework.py
#!/usr/bin/env python3 from __future__ import print_function import gc import logging import sys import os import select import signal import subprocess import unittest import tempfile import time import faulthandler import random import copy import psutil import platform from collections import deque from threading i...
ladoServidor.py
# Aluno: Rafael Pais Cardoso # DRE: 116140788 # Atividade: Lab 2 # Lado Servidor import socket import json import os import auxiliarBase import select import sys import threading HOST = '' # '' possibilita acessar qualquer endereco alcancavel da maquina local PORTA = 5000 # porta onde chegarao as men...
test_all_ctrls_wsgi.py
# coding: utf-8 import os from typing import Dict import unittest from threading import Thread from time import sleep import urllib.request import urllib.error import http.client from wsgiref.simple_server import WSGIServer, make_server from simple_http_server.logger import get_logger, set_level import simple_http_se...
lib.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """General purpose functions, not directly linked to clk""" import datetime import difflib import functools import getpass import hashlib import heapq import itertools import json import os import platform import re import shlex import shutil import signal import subproces...
TSConnection.py
from pydoc import cli import socket import threading import time import copy import traceback from queue import Queue class TSConnection: _send_queue = Queue() _recv_queue = Queue() _connected = False _running = False _client_map = {} _channel_map = {} _log = None _client_channel_move...
wrapper.py
# Copyright (c) Facebook, Inc. and its affiliates. from collections import defaultdict import gym import numpy as np import queue import threading class CounterWrapper(gym.Wrapper): def __init__(self, env, state_counter="none"): # intialize state counter self.state_counter = state_counter ...
_io_windows.py
import math import itertools from contextlib import contextmanager import socket as stdlib_socket from select import select import threading from collections import deque import signal import attr from .. import _core from . import _public, _hazmat from ._wakeup_socketpair import WakeupSocketpair from ._windows_cffi...
asyncscheduledtask.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...
__init__.py
import functools import time from threading import Thread import os from flask import Flask def run_function_in_background(target): t = Thread(target=target) t.setDaemon(True) t.start() def http_transponder(port): app = Flask(__name__) @app.route("/") def main(): return 'I am the h...
test_habitat_env.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 multiprocessing as mp import os import numpy as np import pytest import habitat from habitat.config.default imp...
__init__.py
import threading from i3pystatus import SettingsBase, Module, formatp from i3pystatus.core.util import internet, require from i3pystatus.core.desktop import DesktopNotification class Backend(SettingsBase): settings = () updates = 0 class Updates(Module): """ Generic update checker. To use selec...
logreg.py
""" Run with `python -m torch.distributed.launch --nproc_per_node=2 experiments/dist.py` """ import os import shutil import traceback import click import pandas as pd from scipy.io import loadmat import torch import torch.distributed as dist from torch.distributions.gamma import Gamma from torch.distributions.multiva...
perf.py
#!/usr/bin/env python3 import argparse import random import glob import logging import math import os import pathlib import shutil import signal import socket import subprocess import threading import time import docker import grpc_requests import minio import requests import toml import urllib3 ioxperf_name = "ioxp...
chess_trace_list.py
# pylint:disable=unused-argument import typing from typing import List, Optional, Tuple, TYPE_CHECKING import threading import asyncio from tornado.platform.asyncio import AnyThreadEventLoopPolicy import PySide2 from PySide2.QtWidgets import QDialog, QPushButton, QHBoxLayout, QVBoxLayout, QMessageBox, QTableView, \ ...
face-recognition-occupancy.py
# import the necessary packages import numpy as np import argparse import cv2 from time import sleep import paho.mqtt.client as mqtt from threading import Thread import json State = True webcam = None # construct the argument parse and parse the arguments ap = argparse.ArgumentParser() ap.add_argument("-p", "--protot...
algo_three.py
from functools import reduce from sys import * import numpy as np import random as r 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 from netifaces import interfaces, ifaddresses, AF_INET import paho.m...
stress_test.py
""" Stress test for server .. code-block:: bash python stress_test.py """ # import the necessary packages from threading import Thread import requests import time # initialize the Keras REST API endpoint URL along with the input # image path KERAS_REST_API_URL = "http://localhost/predict" IMAGE_PATH = "jemma.png"...
osa_online_drain.py
#!/usr/bin/python """ (C) Copyright 2020-2021 Intel Corporation. SPDX-License-Identifier: BSD-2-Clause-Patent """ import time import random import threading from write_host_file import write_host_file from osa_utils import OSAUtils from daos_utils import DaosCommand from apricot import skipForTicket class OSAOn...
iris.py
#! /usr/bin/python """ Test sequencer for any production testing """ import os import argparse import sys import threading from queue import Queue from test_runner import runner import listener.listener as listener import logging import tornado import json import pathlib import yaml import logging.config PORT = 4321...
spinning_cursor.py
""" source: https://stackoverflow.com/questions/4995733/how-to-create-a-spinning-command-line-cursor """ import sys import time import threading class Spinner: busy = False delay = 0.01 @staticmethod def spinning_cursor(): while 1: for cursor in '|/-\\': yield cursor def __i...
mdns_example_test.py
import re import os import sys import socket import time import struct import dpkt import dpkt.dns from threading import Thread, Event # this is a test case write with tiny-test-fw. # to run test cases outside tiny-test-fw, # we need to set environment variable `TEST_FW_PATH`, # then get and insert `TEST_FW_PATH` to ...
lib_raise_cpu.py
#!/usr/bin/env python # -*- coding: UTF-8 -*- # This file is part of Raise. # Raise is a small build automation tool that ships with your software. # Raise uses a MIT style license, and is hosted at https://github.com/workhorsy/raise . # Copyright (c) 2012-2017 Matthew Brennan Jones <matthew.brennan.jones@gmail.com> #...
test_utils.py
"""Utilities shared by tests.""" import collections import contextlib import io import logging import os import re import socket import sys import tempfile import threading import time from wsgiref.simple_server import WSGIRequestHandler, WSGIServer try: import socketserver from http.server import HTTPServer...
admin.py
import threading from django.db import transaction from django.contrib import admin, messages from Configuration.views import service_start, service_stop from Configuration.models import Configuration, Services, ServicesLog # Register your models here. admin.site.site_header = '阿波罗自动化攻击评估系统' # 设置header admin.site.sit...
cli.py
import collections import csv import multiprocessing as mp import os import datetime import sys from pprint import pprint import re import ckan.logic as logic import ckan.model as model import ckan.include.rjsmin as rjsmin import ckan.include.rcssmin as rcssmin import ckan.lib.fanstatic_resources as fanstatic_resources...
process_video.py
#!/usr/bin/env python import sys import os import shutil import math import numpy as np import argparse import contextlib import itertools import signal import subprocess import tempfile import threading try: import queue # Python 3 except ImportError: import Queue as queue # Python 2 sys.dont_write_bytecode = T...
start.py
#!/usr/bin/python3 import os import glob import multiprocessing import logging as log import sys from podop import run_server from socrate import system, conf log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "WARNING")) def start_podop(): os.setuid(8) url = "http://" + os.environ["ADMI...
Connector.py
# -*- coding:utf-8 -*- import codecs import datetime import json import sched import optparse import os import time import TelethonB import threading import sys from telethon import TelegramClient from telethon import errors from telethon.tl.functions.channels import LeaveChannelRequest from telethon.tl.functions.chan...
dokku-installer.py
#!/usr/bin/env python3 import cgi import json import os import re import shutil try: import SimpleHTTPServer import SocketServer except ImportError: import http.server as SimpleHTTPServer import socketserver as SocketServer import subprocess import sys import threading VERSION = 'v0.24.3' def bytes_t...
network.py
import socket import threading from typing import * from utils.protocol import iter_packets_from_socket, sessions, local def forward(source: socket.socket, destination: socket.socket, process: Callable[[bytes], bytes], session_id: int, direction: int): """ direction: 0:c2s, 1:s2c receive pac...
views.py
from django.shortcuts import render # Create your views here. from django.shortcuts import render from django.http import StreamingHttpResponse from .models import SingleMotionDetector from imutils.video import VideoStream import threading import datetime import imutils import time import cv2 # initial...
datasets.py
# Dataset utils and dataloaders import glob import logging import math import os import random import shutil import time from itertools import repeat from multiprocessing.pool import ThreadPool from pathlib import Path from threading import Thread import cv2 import numpy as np import torch import torch.nn.functional ...
p4.py
import multiprocessing def evenno(numbers, q): for n in numbers: if n % 2 == 0: q.put(n) if __name__ == "__main__": q = multiprocessing.Queue() p = multiprocessing.Process(target=evenno, args=(range(11), q)) p.start() p.join() while q.empty() is Fal...
main.py
import json #import urllib #import urllib.parse import requests import bs4 import threading import urllib import csv headers = { 'authorization': None, 'cache-control': "no-cache", } def chunks(l, n): for i in xrange(0, len(l), n): yield l[i:i + n] def set_api_key(apiKey): headers['authorization'] = "Bearer " + ...
__init__.py
#! python3.4-32 import sys import os import multiprocessing import zlib import pickle from importlib import import_module from urllib.request import urlretrieve from .shared import cachepath, appdata, __version__ from .loadbar import Bar from . import render __author__ = "Fabian Dill" __credits__ = ["Ijwu", "7UR7L...
functions.py
from src import postgresql as pgs # Threading not implemented in these functions due to the # amount of threads spawned for each implementation, # easier when done single threaded # process the message depending on type def more_processing(result): if (result['id'] == 1) or (result['id'] == 2) or (result['id'] =...
test_defects.py
from __future__ import print_function, absolute_import, division import unittest import stackless import gc import sys import types from io import BytesIO import time try: import threading withThreads = True except: withThreads = False from stackless import _test_nostacklesscall as apply_not_stackless from...
enospace.py
#!/usr/bin/python ''' (C) Copyright 2020-2022 Intel Corporation. SPDX-License-Identifier: BSD-2-Clause-Patent ''' import time import threading from apricot import skipForTicket from nvme_utils import ServerFillUp from avocado.core.exceptions import TestFail from daos_utils import DaosCommand from job_manager_util...
config.py
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: r""" A Python module to maintain unique, run-wide *fMRIPrep* settings. This module implements the memory structures to keep a consistent, singleton config. Settings are passed across processes via filesyst...
test_acse.py
"""Unit tests for ACSE""" from datetime import datetime import logging import queue import select import socket from struct import pack, unpack import sys import time import threading import pytest from pynetdicom import ( AE, VerificationPresentationContexts, PYNETDICOM_IMPLEMENTATION_UID, PYNETDICO...
threading_setDeamon.py
#!/usr/bin/env python # -*- coding:utf-8 -*- # Author:Lyon import threading import time def run(name): print("I am %s" % name) time.sleep(2) print("When I'm done, I'm going to keep talking...") if __name__ == '__main__': lyon = threading.Thread(target=run, args=('Lyon',)) kenneth = threading.Thread(...
server.py
import socket import pickle import threading from psycopg2 import connect from dotenv import load_dotenv from os import environ # Client -> Server: Fixed + Custom Size (SQL arguments are unknown) HEADER_FIX_SIZE = 2 # Server -> Client: Fixed Size, no SQL arguments HEADER_FEEDBACK_SIZE = 5 BUFFER = 1024 ...
rdd.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...
open_context.py
# -*- coding: utf-8 -*- """ Market quote and trade context setting """ from .quote_query import * from .trade_query import * from .utils import is_str from multiprocessing import Queue from threading import RLock, Thread import select import sys import pandas as pd import asyncore import socket as sock import tim...
client.py
# Copyright (c) 2012-2014 Roger Light <roger@atchoo.org> # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Eclipse Public License v1.0 # and Eclipse Distribution License v1.0 which accompany this distribution. # # The Eclipse Public License is available at ...
test_sys.py
from test import support from test.support.script_helper import assert_python_ok, assert_python_failure import builtins import codecs import gc import locale import operator import os import struct import subprocess import sys import sysconfig import test.support import textwrap import unittest import warnings # coun...
main.py
#!/usr/bin/env python3 from user import CCU_User from course import Get_Course #from course import Course from debug import logger_init from debug import Error import time def one_cycle(): #account = "407530012" #passwd = "andy0707" account = "407410001" passwd = "NpFcD02-15" user = CCU_User(accoun...
server.py
from random import randint from threading import Thread from threading import RLock import pika # RabbitMQ import time import sys import os class Server: def __init__(self, id): print(f"> Creating Server {id}.\n") self.id = id self.lock = RLock() self.transactions ...
pyshell.py
#! /usr/bin/env python3 import sys if __name__ == "__main__": sys.modules['idlelib.pyshell'] = sys.modules['__main__'] try: from tkinter import * except ImportError: print("** IDLE can't import Tkinter.\n" "Your Python may not be configured for Tk. **", file=sys.__stderr__) raise SystemExit(...
socket_server.py
""" 0。 实例化服务端,绑定窗口,监听 1。 接受连接请求,创建并返回 2。 接收客户端发送过来的信息 3。 向客户端发送信息 注意,socket通信传输的信息是字节码,并且双方都可以关闭通信 """ import socket import threading # 实例化服务端 server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # 绑定 server.bind(('0.0.0.0', 6959)) # 监听 server.listen(5) def handle_sock(sock): while T...
makedecades.py
import argparse import collections from multiprocessing import Process, Queue from Queue import Empty from vecanalysis.representations.explicit import Explicit from cooccurrence.matstore import export_mat_from_dict from ioutils import mkdir, write_pickle, load_pickle def get_index(merged_index, year_list, index): ...
wsgi.py
#! /usr/bin/env python """Utilities for writing applications based on wsgi""" import base64 import binascii import cgi import io import json import logging import mimetypes import optparse import os import quopri import random import sys import threading import time import traceback from hashlib import sha256 from ws...
submit.py
from redis import Redis from choreo.multirq import Queue import time import threading import random def main(): queue = Queue(connection=Redis()) result = queue.enqueue('tasks.sleepy', args=(random.randint(20, 20),), timeout=10) tic = time.time() while result.get_status() not in ('finished', 'failed'...
server.py
# # Copyright (C) 2010-2017 Samuel Abels # The MIT License (MIT) # # 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,...
support.py
""" Assorted utilities for use in tests. """ from __future__ import print_function import cmath import contextlib import enum import errno import gc import math import os import shutil import subprocess import sys import tempfile import time import io import ctypes import multiprocessing as mp from contextlib import c...
kw_runner.py
import threading import time import datetime import sys from os.path import dirname, abspath, pardir, join import logging from uitester.test_manager import utils from uitester.test_manager import device_proxy from uitester.test_manager import reflection_proxy from uitester.test_manager import local_proxy from uitester....
train_imagenet.py
#!/usr/bin/env python """Example code of learning a large scale convnet from ILSVRC2012 dataset. Prerequisite: To run this example, crop the center of ILSVRC2012 training and validation images and scale them to 256x256, and make two lists of space- separated CSV whose first column is full path to image and second colu...
homologator.py
from block import Block, Transaction from blockchain import Blockchain import xmlrpc.server import xmlrpc.client import logging import threading from random import randint from api import * import sys class Homologator(xmlrpc.server.SimpleXMLRPCServer): def __init__(self, addr): super().__init__(addr, log...
api.py
import os import secrets import threading import tornado.web import tornado.escape import logging.config from app.classes.models import Roles, Users, check_role_permission, Remote, model_to_dict from app.classes.multiserv import multi from app.classes.helpers import helper from app.classes.backupmgr import backupmgr ...
multiproc.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Feb 26 09:33:45 2020 @author: majdi """ import os, random #import tensorflow as tf #tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR) # import input parameters from the user from neorl.parsers.PARSER import InputChecker from neorl.rl.runne...
util.py
# -*- coding: utf-8 -*- # # 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 "L...
test_threads.py
import pytest from threading import Thread from godot import Vector3, SurfaceTool, Mesh, MeshInstance def test_simple_thread(): thread_said_hello = False def target(): nonlocal thread_said_hello thread_said_hello = True t = Thread(target=target, daemon=True) t.start() t.join(t...
test_cleaner.py
from cleaner import cleaner from fetcher import fetcher from parse_config import parse_config from loader import load_database from manager import CANNOT_SPAWN, OPS_KILLED, NO_OUTPUT, ExecutorResult from utils import make_pool from db_txn import db_execute, db_insert, db_result, db_txn from functools import partial f...
multiprocessing.py
import multiprocessing import time def action(a, b): for i in range(30): print(a, ' ', b) time.sleep(0.1) if __name__ == '__main__': jc1 = multiprocessing.Process(target=action, args=('进程一', 0)) jc2 = multiprocessing.Process(target=action, args=('进程二', 1)) jc1.start() ...
data_plane_test.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...
mocks.py
# Copyright (c) 2017-2018 CRS4 # # 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, distribut...