source
stringlengths
3
86
python
stringlengths
75
1.04M
test.py
''' This File tests neutuse HTTP APIS. If everything is fine, you should see 'OK' at the bottom of the screen. ''' import unittest import json import threading import time import requests as rq import neutuse ADDR = '127.0.0.1:8080' JSON_HEADER = {'Content-Type':'application/json'} BASE_URL = 'http://'+ AD...
test_pooling_base.py
# Copyright 2012 10gen, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, soft...
email.py
""" For the ability of sending emails in the app. Must set the config.py first. """ from threading import Thread from flask import current_app, render_template from flask.ext.mail import Message from . import mail # we send asynchronous emails because otherwise we would have the # browser unresponsive during...
writer.py
import os import time from threading import Thread from queue import Queue import cv2 import numpy as np import torch import torch.multiprocessing as mp from alphapose.utils.transforms import get_func_heatmap_to_coord from alphapose.utils.pPose_nms import pose_nms DEFAULT_VIDEO_SAVE_OPT = { 'savepath': 'examples...
interaction_molecular_processor.py
import logging import multiprocessing import csv import re import json import os import sys import urllib.request from tqdm import tqdm from datetime import datetime from string import Template from processor import Processor logger = logging.getLogger(__name__) class HeaderTemplate(Template): delimiter = '%' ...
test_change_stream.py
# Copyright 2017 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 writing, so...
test_call.py
import unittest import nationstates as ns from random import choice import datetime USERAGENT = "Automated Testing Builds by Circle CI for the nationstates API wrapper by The United Island Tribes. dolphdevgithub@gmail.com" import os test_nation = 'Python Nationstates API wrapper' test_nation_r = 'pynationstates_telegr...
test_multithreading.py
import os import sys import time from threading import Thread import pytest from podpac import settings from podpac.core.managers.multi_threading import FakeLock, thread_manager class TestFakeLock(object): def test_enter_exist_single_thread(self): lock = FakeLock() assert lock._locked == False ...
test_bert_thor_mlperf.py
# Copyright 2020 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...
ue_mac.py
""" Copyright 2020 The Magma Authors. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES O...
printer.py
# coding: utf8 from __future__ import unicode_literals, print_function import datetime from collections import Counter from contextlib import contextmanager from multiprocessing import Process import itertools import sys import time import os import traceback from .tables import table, row from .util import wrap, sup...
utils.py
from __future__ import annotations import asyncio import contextvars import functools import importlib import inspect import json import logging import multiprocessing import os import pkgutil import re import socket import sys import tempfile import threading import warnings import weakref import xml.etree.ElementTre...
test_file2k.py
import sys import os import unittest import itertools import time from array import array from weakref import proxy try: import threading except ImportError: threading = None from test import test_support from test.test_support import TESTFN, run_unittest from UserList import UserList class AutoFileTests(unit...
main_window.py
import re import os import sys import time import datetime import traceback from decimal import Decimal import threading import asyncio from typing import TYPE_CHECKING, Optional, Union, Callable, Sequence from electrum.storage import WalletStorage, StorageReadWriteError from electrum.wallet_db import WalletDB from el...
sb.py
#!/usr/bin/python3 from LMSTools import LMSServer, LMSPlayer, LMSTags as tags from time import sleep import requests import textwrap import re #import numpy as np from datetime import datetime from evdev import InputDevice, categorize, ecodes from threading import Thread from PIL import Image from PIL import ImageFon...
ProxyRefreshSchedule.py
# -*- coding: utf-8 -*- # !/usr/bin/env python """ ------------------------------------------------- File Name: ProxyRefreshSchedule.py Description : 代理定时刷新 Author : JHao date: 2016/12/4 ------------------------------------------------- Change Activity: 20...
login.py
from tkinter import * from pickle import dump, load from tkinter.ttk import * from time import sleep import tkinter.messagebox as tkMessageBox import threading import paramiko import Pmw import os from datetime import datetime class Login: def __init__(self, parent, parameters, all): parent.__init__ self.parent ...
__init__.py
# -*- coding: utf-8 -*- import threading import sys from PyQt5 import QtWidgets from updateServer.HotUpdate import myfunction import redis import random import importlib from updateServer.HotUpdate.HotFixSample import Ui_MainWindow class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): def __init__(s...
signals_files_group.py
# # Copyright (c) 2017 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 to...
conftest.py
import sys import threading from functools import partial, wraps from http.server import SimpleHTTPRequestHandler import pytest import torch.multiprocessing as mp def pytest_configure(config): config.addinivalue_line("markers", "spawn: spawn test in a separate process using torch.multiprocessing.spawn") @pytes...
configurationService.py
import etcd3 import logging import threading import datetime import uuid import traceback import json import version import simpleProducer DEFAULT_HOST="etcd" DEFAULT_PORT=2379 DEFAULT_LEADER_KEY = 'leader' DEFAULT_LEASE_TTL = 5 DEFAULT_SLEEP = 1 DEFAULT_ETCD_ROOT = "CryptoDataAnalyzer" DIR_VALUE = "." def combine...
WeChatAssistant.py
# -*- coding:utf-8 -*- """ 实现功能: 1、自动回复 2、图形界面 3、自定义回复内容 4、 """ import itchat import re from tkinter import * from tkinter import ttk import tkinter.scrolledtext as tst import threading import queue import time from basedata import jsonManage Listen_Flag = False js = jsonManage() keyword_dict = {}...
ws.py
from json import dumps from logging import getLogger from os import getenv from time import sleep from threading import Thread from websocket import WebSocketApp from .ws_settings import ws_settings PYPLAN_API_HOST = getenv( 'PYPLAN_API_HOST', default='http://pyplanapi:8000/api') WS_PROTOCOL = 'wss' if 'https' i...
WatchDog.py
import gc import os import sys import time import logging import win32api import win32job import win32con import threading import subprocess try: from Queue import Queue, Empty except ImportError: from queue import Queue, Empty # python 3.x #os.environ['COMSPEC'] = '%SystemRoot%\system32\cmd.exe' def nope(...
python_instance.py
#!/usr/bin/env 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 (the # "...
process_one.py
from __future__ import absolute_import, division, print_function import logging; _L = logging.getLogger('openaddr.process_one') from urllib.parse import urlparse from os.path import join, basename, dirname, exists, splitext, relpath from shutil import copy, move, rmtree from argparse import ArgumentParser from os impo...
runner.py
#!/usr/bin/env python3 # Copyright 2010 The Emscripten Authors. All rights reserved. # Emscripten is available under two separate licenses, the MIT license and the # University of Illinois/NCSA Open Source License. Both these licenses can be # found in the LICENSE file. """This is the Emscripten test runner. To run ...
test1.py
#!/usr/bin/python from __future__ import absolute_import, print_function, unicode_literals from optparse import OptionParser, make_option import dbus import time import dbus.mainloop.glib import bleAdapter try: from gi.repository import GObject except ImportError: import gobject as GObject import testutils import...
cc.py
#!/usr/bin/python3 #Coded by Leeon123 import requests import socket import socks import time import random import threading import sys import ssl print (''' ///// ///// ///////////// CCCCC/ CCCCC/ | CC-attack |/ CC/ CC/ |-----------|/ CC/ CC/ | Layer 7 |/ ...
datasets.py
import glob import math import os import random import shutil import time from pathlib import Path from threading import Thread import cv2 import numpy as np import torch from PIL import Image, ExifTags from torch.utils.data import Dataset from tqdm import tqdm from utils.utils import xyxy2xywh, xywh2xyxy help_url =...
simplerpc.py
# -*- coding: utf-8 -*- # @Author: gzliuxin # @Email: gzliuxin@corp.netease.com # @Date: 2017-07-12 16:56:14 import json import time import traceback import uuid from .jsonrpc import JSONRPCResponseManager, dispatcher from .jsonrpc.jsonrpc2 import JSONRPC20Response from .jsonrpc.exceptions import JSONRPCServerErro...
test_threading.py
# Very rudimentary test of threading module import test.test_support from test.test_support import verbose, is_jython import random import sys import threading import thread import time import unittest # A trivial mutable counter. class Counter(object): def __init__(self): self.value = 0 def inc(self)...
test_mongoexp.py
import six.moves.cPickle as pickle import os import signal import subprocess import sys import traceback import threading import time import unittest import numpy as np import nose import nose.plugins.skip from hyperopt.base import JOB_STATE_DONE, STATUS_OK from hyperopt.mongoexp import parse_url from hyperopt.mongoe...
shairport_sync_pipe_reader.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # cat /tmp/shairport-sync-metadata | python3 output_text.py import base64 import binascii import codecs import json import logging import math import os import re import shutil import sys import tempfile import time from multiprocessing import Process try: from asci...
decode.py
# mypy: ignore-errors # This line can be removed when typing in pyModeS is complete and released. from __future__ import annotations import heapq import logging import os import socket import sys import threading import time from datetime import datetime, timedelta, timezone from operator import itemgetter from pathl...
tcp_server.py
#!/usr/bin/env python __author__ = "bt3" import socket import threading # Defining constants # The IP address and port we want the server to listen on BIND_IP = '0.0.0.0' BIND_PORT = 9090 # Start a thread to handle client connection def handle_client(client_socket): # Get data from client request = clien...
scheduler.py
#!/usr/bin/env python ################################################################################# # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # # # Licensed under the Apache License, Version 2.0 ...
tk_window.py
from datetime import datetime from json import dumps, load as load_json_from_file import os from pathlib import Path from platform import system import random import subprocess import sys from threading import Thread from time import sleep from tkinter import ( Tk, ttk, # Core pieces PhotoImage, # for taskbar...
ui.py
import tkinter as tk import main import image import hardware import threading,json,time typelist = ['可回收', '有害', '厨余(湿)', '其他(干)'] def startui(): serverThread = threading.Thread(target=start) serverThread.start() window = None l = None b1 = None sleeptime=10 def ontake(path): if window == None: ...
scan.py
import os import socket import multiprocessing import subprocess import os def pinger(job_q, results_q): DEVNULL = open(os.devnull, 'w') while True: ip = job_q.get() if ip is None: break try: subprocess.check_call(['ping', '-c1', ip], ...
admin_lib.py
# Copyright (c) 2006-2007 Open Source Applications Foundation # Copyright (c) 2008-2009 Mikeal Rogers <mikeal.rogers@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 # # ...
log.py
# Copyright (c) 2016-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # pyre-strict import argparse import copy import io import logging import os import re import sys import threading import time from typing import L...
pyminer.py
#!/usr/bin/python # # Copyright (c) 2011 The Bitcoin developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # import time import json import pprint import hashlib import struct import re import base64 import httplib import...
install_utils.py
import getopt import re import subprocess import sys import threading import time sys.path = [".", "lib"] + sys.path import testconstants from remote.remote_util import RemoteMachineShellConnection, RemoteUtilHelper from membase.api.rest_client import RestConnection import install_constants import TestInput import log...
saba_server.py
import socket from threading import Thread import sys from urllib.parse import unquote, unquote_plus from http.client import responses import datetime def _500(): return 'HTTP/1.1 500 {0}\r\n\r\n {0}\n'.format(responses[500]).encode("utf-8") def _301(host, path): print("{} {}".format(301, r:=responses[301])...
Multithreading.py
from Algorithm import SearchTree, GraphContainer from multiprocessing import Process, Queue import time def runJob(env, container, q): tree = SearchTree(container, env) iterations = 0 startTime = time.time() for i in range(10000): if container.isEmpty(): break tree.nextIt...
run.py
# Copyright (c) 2020 Institution of Parallel and Distributed System, Shanghai Jiao Tong University # ServerlessBench is licensed under the Mulan PSL v1. # You can use this software according to the terms and conditions of the Mulan PSL v1. # You may obtain a copy of Mulan PSL v1 at: # http://license.coscl.org.cn/M...
common.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 ...
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...
server.py
from re import S import select import socket import queue import threading import sys import pickle import base64 import os from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives.ciphers.aead import AESGCM from cryptography.hazmat.primitives.serialization import load_ssh_public_key...
Main.py
import RethinkDB_Queries as r import CSV_Download as d import CSV_Read as csv import json from math import cos, asin, sqrt, pi import rethinkdb as rdb from flask import Flask, g, render_template, make_response, request, redirect, url_for, jsonify from flask_socketio import SocketIO, send, emit from threading import Th...
cli.py
#!/usr/bin/env python3 # coding: utf-8 # @Author: ArthurBernard # @Email: arthur.bernard.92@gmail.com # @Date: 2020-03-17 12:23:25 # @Last modified by: ArthurBernard # @Last modified time: 2020-08-21 11:07:53 """ A (very) light Command Line Interface. """ # Built-in packages import logging import select import sys fr...
stockcollector.py
import json import threading import datetime from QAPUBSUB.consumer import subscriber_routing from QAPUBSUB.producer import publisher, publisher_routing from QARealtimeCollector.setting import eventmq_ip from QUANTAXIS.QAARP.QAUser import QA_User from QUANTAXIS.QAEngine.QAThreadEngine import QA_Thread from QUANTAXIS.Q...
test_server.py
"""Tests for the HTTP server.""" # -*- coding: utf-8 -*- # vim: set fileencoding=utf-8 : import os import socket import tempfile import threading import time import pytest from .._compat import bton from ..server import Gateway, HTTPServer from ..testing import ( ANY_INTERFACE_IPV4, ANY_INTERFACE_IPV6, E...
multi_tello_test.py
# -*- coding: utf-8 -*- import sys import time from tello_manager import * import Queue import time import os import binascii reload(sys) sys.setdefaultencoding('utf-8') def create_execution_pools(num): pools = [] for x in range(num): execution_pool = Queue.Queue() pools.append(execution_pool) ...
main.py
import argparse from datetime import datetime import logging from modules.targetAcquisition.taxi.TaxiWorker import taxi_worker import os import multiprocessing as mp import json from modules.targetAcquisition.targetAcquisitionWorker import targetAcquisitionWorker from modules.decklinksrc.decklinkSrcWorker import deckli...
utilities.py
#!/bin/env python # -*coding: UTF-8 -*- # # Disclaimer: # Functions get_sys_info, netcdf_and_hdf5_versions and show_versions are from: # xarray/util/print_versions.py # import os import sys import warnings import urllib import json import collections import copy from functools import reduce from packaging import ver...
Snapshots.py
import logging import difflib import Bcfg2.Server.Plugin import Bcfg2.Server.Snapshots import Bcfg2.Logger from Bcfg2.Server.Snapshots.model import Snapshot import sys import time import threading # Compatibility import from Bcfg2.Bcfg2Py3k import Queue, u_str, b64decode logger = logging.getLogger('Snapshots') ftype...
my_tweepy.py
# Tweepy # Copyright 2009-2010 Joshua Roesslein # See LICENSE for details. # Appengine users: https://developers.google.com/appengine/docs/python/sockets/#making_httplib_use_sockets from __future__ import absolute_import, print_function import logging import re import requests import sys from requests.exceptions imp...
wait_group_process.py
from multiprocessing import Condition, Value, Process import time # note this is the equivalent of a waitgroup for a process instead of a thread class WaitGroupProcess: def __init__(self, cv, wait_count): self.cv = cv self.wait_count = wait_count def add(self, count): self.cv.acquire...
UdpComms.py
# Created by Youssef Elashry to allow two-way communication between Python3 and Unity to send and receive strings # Feel free to use this in your individual or commercial projects BUT make sure to reference me as: Two-way communication between Python 3 and Unity (C#) - Y. T. Elashry # It would be appreciated if you se...
server.py
import json import logging import random import socket import threading from typing import Dict, Union, Any import sha3 from data_processing import DataProcessing from server_validator import port_validation, check_port_open END_MESSAGE_FLAG = "CRLF" DEFAULT_PORT = 9090 # Настройки логирования logging.basicConfig( ...
app.py
# import app from flask import Flask, render_template, make_response, send_file from flask_cors import CORS # import custom helpers from maplib import generate_embed import loyaltylib as ll app = Flask(__name__) CORS(app) # import declared routes import frontenddata @app.route('/ll') def llfn(): ll.create_loya...
populate_to_pairs.py
from StringIO import StringIO from sets import Set import glob import timeit import gc import gzip from random import randint import random import networkx as nx from util_class import * from multiprocessing import Process import os # use EventPair and candidate class def get_context_surrounding(sentence, dependenci...
main.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- """Trains a convolutional neural network on the MNIST dataset, then attacks it with the FGSM attack.""" from __future__ import absolute_import, division, print_function, unicode_literals from keras.models import Sequential from keras.layers import Dense, Flatten, Conv2D, MaxP...
submithost.py
""" This file is part of PUQ Copyright (c) 2013 PUQ Authors See LICENSE file for terms. """ import os, time, sys from monitor import TextMonitor from subprocess import Popen, PIPE import numpy as np from logging import debug from hosts import Host from shutil import rmtree from stat import S_ISDIR from glob import glo...
Midi_Analyzer.py
from src import Scale import time import threading import mido from mido import MidiFile, MidiTrack # https://mido.readthedocs.io/en/latest/midi_files.html # http://support.ircam.fr/docs/om/om6-manual/co/MIDI-Concepts.html tracks = [] def print_ports(): # for potential sound generation... # nonfunctional ...
app.py
#!/usr/bin/python3 from flask import Flask from datetime import datetime, timedelta from threading import Thread from os import system from random import randint last_load = datetime.now() def grim_reaper(): ''' If site not loaded for 10s reboot host reboot can be prevented by calling life_line() ''' ...
test_synchronized.py
# -*- coding: utf-8 -*- ''' Copyright 2014, 2015 Yoshida Shin 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...
entity.py
import contextlib import requests import warnings import json import asyncio import aiohttp from time import time import threading requests.packages.urllib3.disable_warnings() from sys import platform class Entity(object): """ The entity object represents any of the IoT entities registered with the RBCCPS IoT Dat...
server.py
import socket import sys import threading import selectors MAXBYTES = 1 MOTD = "Wazzup yoooooo" namedict = {} #Dict with name as key sockdict = {} #Dict with socket as key serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) serversocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) loc = "0.0.0.0" ...
kb_variationServer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import datetime import json import os import random as _random import sys import traceback from getopt import getopt, GetoptError from multiprocessing import Process from os import environ from wsgiref.simple_server import make_server import requests as _requests from json...
test_apis.py
import hetu as ht import time import os import sys import yaml import multiprocessing from multiprocessing.sharedctypes import RawArray as rarr import argparse import signal import numpy as np from scipy.stats import truncnorm import ctypes import matplotlib.pyplot as plt nitem = 2000 item_len = 1000 indx1 = 30 indx2...
test_dataloader.py
# Owner(s): ["module: dataloader"] import math import sys import errno import multiprocessing import os import ctypes import faulthandler import torch import gc import time import signal import unittest import itertools import warnings import tempfile from torch import multiprocessing as mp from torch.utils.data impor...
simutils.py
# # Software distrubuted under MIT License (MIT) # # Copyright (c) 2020 Flexpool # # 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 # ...
pi_control_worker.py
import time import datetime import json import redis import threading import sys sys.path.append('..') from controls.pi.button_control import (ButtonControl) import variables #r = redis.Redis(host='127.0.0.1', port=6379) # def clamp(n, smallest, largest): return max(smallest, min(n, largest)) class PiControlWorker()...
test_api.py
""" mbed SDK Copyright (c) 2011-2014 ARM Limited 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 wr...
applications_test.py
import pytest import random import six import numpy as np import keras_applications from keras.applications import densenet from keras.applications import inception_resnet_v2 from keras.applications import inception_v3 from keras.applications import mobilenet try: from keras.applications import mobilenet_v2 except...
web_monitor.py
""" Creates the logger, processes and threads, initializes everything """ import asyncio import logging import time from multiprocessing import Process import aiohttp import async_timeout from src.web_monitor.server import server from src.web_monitor.utils.custom_errors import ConnectionProblem async def fetch(sess...
tests.py
from __future__ import unicode_literals import sys import time import unittest from django.conf import settings from django.db import transaction, connection from django.db.utils import ConnectionHandler, DEFAULT_DB_ALIAS, DatabaseError from django.test import (TransactionTestCase, skipIfDBFeature, skipUnlessDBFe...
tunerScriptDeletion.py
#!/usr/bin/env python # Software License Agreement (BSD License) # # Copyright (c) 2015, Fabian Girrbach, Social Robotics Lab, University of Freiburg # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions ar...
detection._po.py
import sys import os sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtCore import * from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtWidgets import QFileDialog, QMes...
meta_scenario.py
"""I offer a function that is run in a Thread to orchestrate the nodes""" import codecs import threading from threading import Thread from binascii import b2a_hex from os import urandom from queue import Queue from time import sleep # pylint: disable=broad-except # pylint: disable=global-statement from .project_log...
multicast.py
import socket from socket import error as socket_error import struct import threading import time import app_ui as ui global host_name, verbose_mode, multicast_group_ip, multicast_port, timeout_in_seconds, multicast_group, num_times, no_keys, msg_delay global responses, background_threads responses = {} background_th...
FileServer.py
from SimpleHTTPServer import SimpleHTTPRequestHandler from os.path import join from SocketServer import TCPServer, ThreadingMixIn import threading HTTP_PORT = 14563 class CustomHandler(SimpleHTTPRequestHandler): def log_message(self, format, *args): pass def translate_path(self, target): tar...
controller.py
import queue import socket import threading import time from manta_lab.tuning.internal.integrations import ( BayesianController, ChocolateController, HyperbandController, HyperOptController, OptunaController, RayController, SkOptController, ) class ControllerFactory: @staticmethod ...
mlemultiprocessing.py
''' MAGeCK MLE multiprocessing ''' from __future__ import print_function import re import sys import logging import multiprocessing import copy import numpy as np from mageck.mleem import iteratenbem # debug try: from IPython.core.debugger import Tracer except: pass def thread_p_func(dinst,args,iteratenbemargs,...
test_urllib.py
"""Regression tests for urllib""" import collections import urllib import httplib import io import unittest import os import sys import mimetools import tempfile from test import test_support from base64 import b64encode def hexescape(char): """Escape char as RFC 2396 specifies""" hex_repr = hex(ord(char))[...
smtclient.py
# Copyright 2017,2020 IBM Corp. # # 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 agr...
ship.py
import tkinter as tk from utils.fonts import _getFont from game.panel import Switch, BinaryButton, ButtonGroup, VerticalSlider, HorizontalSlider from time import sleep from threading import Thread Y_OFFSET = 220 PANEL_HEIGHT = 127 PANEL_WIDTH = 140 class Ship(tk.Canvas): def __init__(self, root): tk.Canvas.__...
build_metrics_reporter.py
# # All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or # its licensors. # # For complete copyright and license terms please see the LICENSE at the root of this # distribution (the "License"). All use of this software is governed by the License, # or, if provided, by the license below or th...
serve.py
# -*- coding: utf-8 -*- from __future__ import print_function import abc import argparse import json import logging import os import platform import signal import socket import sys import threading import time import traceback from six.moves import urllib import uuid from collections import defaultdict, OrderedDict f...
statreload.py
import multiprocessing import os import signal import time from pathlib import Path HANDLED_SIGNALS = ( signal.SIGINT, # Unix signal 2. Sent by Ctrl+C. signal.SIGTERM, # Unix signal 15. Sent by `kill <pid>`. ) class StatReload: def __init__(self, config): self.config = config self.shoul...
test_memalloc.py
# -*- encoding: utf-8 -*- import gc import os import threading import pytest try: from ddtrace.profiling.collector import _memalloc except ImportError: pytestmark = pytest.mark.skip("_memalloc not available") from ddtrace.profiling import _nogevent from ddtrace.profiling import _periodic from ddtrace.profil...
main.py
import discord from itertools import cycle from discord.ext import tasks, commands from datetime import date from flask import Flask from threading import Thread app = Flask('') today = date.today() # Quote Library quote_library = {} @app.route('/') def main(): return "Your Bot Is Ready" ...
same_class_with_lock.py
#!/usr/bin/env python # coding: utf-8 import threading import time class Controller(threading.Thread): def __init__(self,p1): self.p1 = p1 self.lock = threading.Lock() def run(self): print('run') t1 = threading.Thread(target=self.new_thread) t1.start() # Fir...
test_forward.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...
extract_patches.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function # Imports import numpy as np from PIL import Image from sklearn.feature_extraction import image from tqdm import tqdm import argparse import os import threading def sample_patches_2d(img, shape, num_patches, ...
bpytop.py
#!/usr/bin/env python3 # pylint: disable=not-callable, no-member # indent = tab # tab-size = 4 # Copyright 2020 Aristocratos (jakob@qvantnet.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...
test_communicator.py
import sys import unittest import threading import time from websocket import create_connection try: from aceinna.framework.communicators import SerialPort except: # pylint: disable=bare-except sys.path.append('./src') from aceinna.framework.communicators import SerialPort # pylint: disable=missing-clas...