source
stringlengths
3
86
python
stringlengths
75
1.04M
local_server.py
import logging import threading from contextlib import contextmanager import string import six from six.moves import queue from six.moves.urllib.parse import parse_qsl, urlparse, urlunparse try: from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler except ImportError: from http.server import HTTPServer...
main.py
import glob import json import datetime import numpy as np import pandas as pd import multiprocessing import matplotlib import os import matplotlib.pyplot as plt import concurrent.futures from obspy import Stream, Trace, read, UTCDateTime from models.sds_index import SdsIndex from multiprocessing import Pool matplotli...
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...
test_asyncore.py
import asyncore import unittest import select import os import socket import threading import sys import time import errno from test import support from test.support import TESTFN, run_unittest, unlink from io import BytesIO from io import StringIO HOST = support.HOST class dummysocket: def __init__(self): ...
vm_util_test.py
# Copyright 2018 PerfKitBenchmarker 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 appli...
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()
utils.py
import threading from logging import Logger from time import time from typing import Callable from django.core.management.base import BaseCommand import metrics def run_threaded(job_func: Callable[[], None], **kwargs): job_thread = threading.Thread(target=job_func, kwargs=kwargs) job_thread.start() def jo...
master.py
import os import threading import time import math import pdb import copy import logging import numpy as np from hpbandster.core.dispatcher import Dispatcher from hpbandster.core.result import Result from hpbandster.core.base_iteration import WarmStartIteration class Master(object): def __init__( se...
extcap_ot.py
#!/usr/bin/env python3 # # Copyright (c) 2019, The OpenThread 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-...
test_GUI_threading.py
from MultiVehicleEnv.GUI import GUI import argparse import time import threading parser = argparse.ArgumentParser(description="GUI for Multi-VehicleEnv") parser.add_argument('--gui-port',type=str,default='/dev/shm/gui_port') parser.add_argument('--fps',type=int,default=24) args = parser.parse_args() GUI_ins...
xrproxy.py
# Copyright (c) 2019-2020 The Blocknet developers # Distributed under the MIT software license, see the accompanying # file LICENSE or http://www.opensource.org/licenses/mit-license.php. #!/usr/bin/env python3 import bitcoin.core import bitcoin.signmessage import bitcoin.wallet import json import requests import thre...
main.py
""" OVERVIEW:\n Making a trial program for assigning the red lights of the\n according to the inputs made by the ML division. \n\n THEORY: assign green light to the one which has the greatest time in\n the array inputted\n \n INPUT:\n a numpy array from ML file that contains the time required to\n clean the intersect...
auto_pilot_frontend_client.py
import base64 import os import time from concurrent import futures import threading import argparse import sys import datetime from multiprocessing import Process, Queue, Lock from google.protobuf.timestamp_pb2 import Timestamp import grpc #from hams_admin.grpcclient import grpc_client from hams_admin.rpc import ...
teslaWatch.py
#!/usr/bin/env python3 ''' ################################################################################ # # Script to watch for Tesla state changes # # This is to run in the cloud and there will be an Android front-end to # manage the fences and this will issue notifications to the mobile device. # # N.B. # * Val...
manager.py
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright 2015 clowwindy # # 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 b...
batch_env.py
import multiprocessing as mp from typing import Tuple, List, Dict import numpy as np from textworld.core import Environment def _list_of_dicts_to_dict_of_lists(list_: List[Dict]) -> Dict[str, List]: # Convert List[Dict] to Dict[List] keys = set(key for dict_ in list_ for key in dict_) return {key: [dic...
data_playground.py
import pandas as pd import numpy as np import esp_connection as esp import multiprocessing as mp import time import matplotlib # have to do this to set backend of matplotlib. otherwise no graph is displayed matplotlib.use("TKAgg") import matplotlib.pyplot as plt class DataPlayground: def __init__(self): ...
pubsub_example.py
# # pubsub_example.py # # This source file is part of the FoundationDB open source project # # Copyright 2013-2018 Apple Inc. and the FoundationDB project 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 cop...
sample-1.py
import asyncio import collections import concurrent.futures import multiprocessing import multiprocessing.pool import queue import sys import threading import time import types from .arguments import Arguments __all__ = ["Pool"] class Queue(object): def __init__(self, values): self.__reference = values self._v...
tests.py
# -*- coding: utf-8 -*- # Unit tests for cache framework # Uses whatever cache backend is set in the test settings file. from __future__ import unicode_literals import os import re import shutil import tempfile import threading import time import unittest import warnings from django.conf import settings from django....
request_connector.py
# Copyright 2020. ThingsBoard # # 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 applicabl...
spinner.py
# From: https://stackoverflow.com/a/39504463 # License: Creative Commons Attribution-Share Alike # Copyright: Victor Moyseenko import sys import threading import time class Spinner: running = False busy = False delay = 0.1 @staticmethod def spinning_cursor(): while 1: for cur...
gui.py
#!/usr/bin/env python # _*_ coding:utf-8 _*_ # @Author : lusheng import os from tkinter import * from tkinter import messagebox import sqlite3 from datetime import datetime, date, timedelta import time import requests import re import json from email.utils import parseaddr, formataddr import smtplib from email.mime.te...
utils_test.py
import asyncio import collections from contextlib import contextmanager import copy from datetime import timedelta import functools from glob import glob import io import itertools import logging import logging.config import os import queue import re import shutil import signal import socket import subprocess import sy...
__init__.py
import threading import numpy as np import imageio import os import paramiko from paramiko import SSHClient from scp import SCPClient class HoloeyeSLM (SSHClient): class Commands: PWD = 'pwd' GO_HOME = "cd ~" SET_LIBRARY = "export LD_LIBRARY_PATH=/mnt" DISABLE_HDMI = "/mnt/ControlE...
benchmark.py
from __future__ import print_function import threading from pymol.wizard import Wizard from pymol import cmd import pymol import types import time class Benchmark(Wizard): def bench_fn(self,action): time.sleep(0.5) self.cmd.do("_ wizard benchmark,%s"%action) def report(self,name,value):...
terminal.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import os import re import sys import time import shlex import codecs import curses import logging import threading import webbrowser import subprocess import curses.ascii from curses import textpad from multiprocessing import Process from contextlib impo...
concepts_and_terms.py
""" Time stuff """ # import time # # t1 = time.perf_counter_ns() # # do things # t2 = time.perf_counter_ns() # print(t2 - t1) """ Idempotence f(f(x)) = f(x) Whenever you do something over and over again, you get the same result. GET PUT POST DELETE Are always Idempotent POST is NOT Idempotent (The response can ch...
detector.py
""" The detector.py file is used to determine whether a person is wearing a mask or not. It uses detect_and_predict_mask function that takes in a single frame from the live stream, a face_net used to determine faces in the frame and mask_net used to determine whether the faces detected are wearing masks or not. mask_ne...
test_buffered_pipe.py
# Copyright (C) 2006-2007 Robey Pointer <robeypointer@gmail.com> # # This file is part of paramiko. # # Paramiko is free software; you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation; either version 2.1 of the License, or (a...
test_transaction.py
# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license import time import pytest import dns.name import dns.rdataclass import dns.rdatatype import dns.rdataset import dns.rrset import dns.transaction import dns.versioned import dns.zone class DB(dns.transaction.TransactionManager): def __i...
sync_daemon.py
#!/usr/bin/env python3 import json import logging import sys import threading import time import urllib.parse import guessit import os import requests import mpv import trakt_key_holder import trakt_v2_oauth log = logging.getLogger('mpvTraktSync') TRAKT_ID_CACHE_JSON = 'trakt_ids.json' config = None last_is_pause...
wsdump.py
#!/home/chuck/Desktop/Projects/Kube-Automate/venv/bin/python import argparse import code import sys import threading import time import ssl import gzip import zlib import six from six.moves.urllib.parse import urlparse import websocket try: import readline except ImportError: pass def get_encoding(): ...
redecanais.py
# -*- coding: utf-8 -*- # import re import time import shutil import webbrowser import http.server import socketserver import threading import requests from bs4 import BeautifulSoup BASE_URL = 'https://redecanais.rocks' class SimpleServerHttp: handler = http.server.SimpleHTTPRequestHandler def __init__(self...
onnxruntime_test_python.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # -*- coding: UTF-8 -*- import unittest import os import numpy as np import onnxruntime as onnxrt import threading import sys from helper import get_name class TestInferenceSession(unittest.TestCase): def run_model(self...
cyberteamscript.py
#!/usr/bin/python3 #Coded by Vesah ######################################### # Fist Version private script # # Vesah lover # # ######################################### import requests import socket import socks import time import ran...
custom_threadpool_executor.py
""" 可自动实时调节线程数量的线程池。 比官方ThreadpoolExecutor的改进是 1.有界队列 2.实时调节线程数量,指的是当任务很少时候会去关闭很多线程。官方ThreadpoolExecurot只能做到忙时候开启很多线程,但不忙时候线程没有关闭线程。 linux系统能承受的线程总数有限,一般不到2万。 """ import atexit import queue import sys import threading import time import weakref from function_scheduling_distributed_framework.utils import LoggerMixin,...
tasks.py
# -*- coding: utf-8 -*- # Copyright (c) 2015 Ansible, Inc. # All Rights Reserved. # Python from collections import OrderedDict, namedtuple import errno import functools import importlib import json import logging import os import shutil import stat import tempfile import time import traceback from distutils.dir_util ...
app.py
import threading import requests from flask import * from algorithm import evolutionary_algorithm app = Flask(__name__) def format_timetable(timetable, timetable_data, days): course_codes = {} for i in timetable_data["courses"]: course_codes[i["code"]] = i["name"] new_timetable_data = [] for ...
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...
test.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 # "L...
mock_vthttpserver.py
import socket import re try: #Python 3 from http.server import SimpleHTTPRequestHandler from socketserver import TCPServer import urllib.parse as urlparse except ImportError: #Python 2.7 from SimpleHTTPServer import SimpleHTTPRequestHandler from SocketServer import TCPServer import urlparse ...
runner.py
from ctypes import * from ctypes.wintypes import * from multiprocessing import Process, Array, Queue import time import realTimeDisplay import ReadWriteMem import PlayHelper import array import AlwaysTowardsBallAgent OpenProcess = windll.kernel32.OpenProcess CloseHandle = windll.kernel32.CloseHandle ph = PlayHelper....
listener.py
from time import time from threading import Thread from flask import current_app from gi.repository import GLib, Gio from . import db, error from .device import update_rssi, sensordata from .timeutil import get_timedelta def init(app): with app.app_context(): try: bus = Gio.bus_get_sync(Gio.Bu...
AtomicCounter.py
"""An atomic, thread-safe incrementing counter.""" import threading class AtomicCounter: """An atomic, thread-safe incrementing counter. >>> counter = AtomicCounter() >>> counter.increment() 1 >>> counter.increment(4) 5 >>> counter = AtomicCounter(42.5) >>> counter.value 42.5 ...
handler.py
from threading import Thread from sdk import * from .queries.processor import process_text import logging from utils.text import restrict_len from utils.mongo import Mongo from utils.config import Config import time class Handler: def __init__(self, config, facebook): self.facebook = facebook self...
imapclient.py
#!/usr/bin/env python3 # Standard libraries. import asyncio import collections.abc import datetime import enum import imaplib import logging import pathlib import select import socket import typing # External dependencies. import imapclient import keyring # Internal modules. import phile.asyncio.pubsub import phile....
main.py
# main.py # author: Playinf # email: playinf@stu.xmu.edu.cn import os import ops import sys, pdb import copy import argparse import numpy as np import tensorflow as tf import multiprocessing from utils import parallel_model from utils.validation import validate from data.record_reader import get_input_fn from data.pl...
views.py
from django.shortcuts import render from news.models import Universidad, Noticia from bs4 import BeautifulSoup from django.conf import settings import feedparser, unicodedata, urllib.request, time, re, datetime, time, threading import ssl import dateutil.parser import logging import unidecode import json result = [] ...
load.py
import threading import datetime kid = [] n = 10 delay_s = 10 launcher = KernelLauncher('lresende-elyra:8888') def start_kernel(): try: id = launcher.launch('spark_python_yarn_cluster') print('Kernel {} started'.format(id)) kid.append(id) except RuntimeError as re: print('Fa...
main.py
#!/usr/bin/sudo python3 import threading from db.processed_signals_db import * from db.signals_db import * from db.timer import Timer from db.video_data_db import * from device_tracking.mouse_tracker import MouseTracker from device_tracking.keyboard_tracker import KeyboardTracker from device_tracking.pythonic_video_t...
_run.py
from profil3r.app.core.colors import Colors import threading def run(self): self.load_config() self.print_logo() # Get arguments from the command line self.parse_arguments() self.menu() self.get_permutations() # Number of permutations to test per service print(Colors.BOLD + "[+]" + Co...
build_openwebtext_pretraining_dataset.py
# coding=utf-8 """Preprocessess the Open WebText corpus for pre-training.""" import argparse import multiprocessing import os import random import tarfile import time import tensorflow.compat.v1 as tf import build_pretraining_dataset from util import utils def write_examples(job_id, args): """A single process cr...
ServerWorker.py
from random import randint import sys, traceback, threading, socket from VideoStream import VideoStream from RtpPacket import RtpPacket class ServerWorker: SETUP = 'SETUP' PLAY = 'PLAY' PAUSE = 'PAUSE' TEARDOWN = 'TEARDOWN' INIT = 0 READY = 1 PLAYING = 2 state = INIT OK_200 = 0 FILE_NOT...
binary.py
import json import os import random import signal import socket import sys import tempfile import threading import time import urllib.parse from http.server import BaseHTTPRequestHandler from http.server import HTTPServer from typing import Dict from typing import List from typing import Optional import pynvim import ...
wspbus.py
r"""An implementation of the Web Site Process Bus. This module is completely standalone, depending only on the stdlib. Web Site Process Bus -------------------- A Bus object is used to contain and manage site-wide behavior: daemonization, HTTP server start/stop, process reload, signal handling, drop privileges, PID ...
complicated.py
#!/usr/bin/env python3 '''A lengthy example that shows some more complex uses of finplot: - control panel in PyQt - varying indicators, intervals and layout - toggle dark mode - price line - real-time updates via websocket This example includes dipping in to the internals of finplot and the u...
common.py
from ..common import * # NOQA import inspect import json import os import random import subprocess import ssl import time import requests import ast import paramiko import rancher import pytest from urllib.parse import urlparse from rancher import ApiError from lib.aws import AmazonWebServices from copy import deepcop...
microsimserver.py
#!/usr/local/bin/python3 import sys import os import socket import time import random import string import re import json import threading import urllib.parse from socketserver import ThreadingMixIn from statsd import StatsClient from http.server import BaseHTTPRequestHandler, HTTPServer def str2bool(val): if val ...
job.py
# Copyright 2017 Spotify AB # # 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, softw...
wsgi.py
import datetime import functools import gc import hashlib import sys import time import threading def blah(func): @functools.wraps(func) def inner(*args, **kwargs): print("work it") return func(*args, **kwargs) return inner import wsgo @wsgo.cron(-2, -1, -1, -1, -1) @blah def every_two_min...
test_jobs.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 #...
pool.py
# -*- coding: utf-8 -*- # # Module providing the `Pool` class for managing a process pool # # multiprocessing/pool.py # # Copyright (c) 2006-2008, R Oudkerk # Licensed to PSF under a Contributor Agreement. # from __future__ import absolute_import # # Imports # import errno import itertools import os import platform i...
bot.py
import sys, io import traceback from amanobot.loop import MessageLoop from contextlib import redirect_stdout from colorama import Fore import config import time import threading from amanobot.exception import TooManyRequestsError, NotEnoughRightsError from urllib3.exceptions import ReadTimeoutError import db_handler as...
context.py
from . import SpeechRecognitionComponent, ObjectDetectionComponent, FaceRecognitionComponent, TextToSpeechComponent from ..sensor import Context, UtteranceHypothesis from ..abstract import AbstractComponent, Led from pepper.language import Utterance from pepper import config from collections import deque from threadi...
portscanner.py
#-*- coding:utf-8 -*- x import optparse from socket import * from threading import * screenLock = Semaphore(value=1) def connScan(tgtHost,tgtPort): try: connSkt = socket(AF_INET,SOCK_STREAM) connSkt.connect((tgtHost,tgtPort)) connSkt.send('ViolentPython\r\n') results = connSkt.recv...
tests.py
############################################################################### # Imports import sys # Exit function import os # OS functions import argparse # Argument parser import pprint # Pretty printing dicts # Shell commands import subprocess from subprocess import Popen,PIPE import shlex # Shell command parsin...
http_server.py
# This code is part of Qiskit. # # (C) Copyright IBM 2020. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
index.py
#!/usr/local/bin/python3 # coding: utf-8 import hug import time import threading from core.database import database from core.templates import get_template user,passwd = open('etc/leakManager.conf').read().split(':') admin_area = hug.http(requires=hug.authentication.basic(hug.authentication.verify(user.strip(), passw...
main.py
from transformers import AutoTokenizer, AutoModelForQuestionAnswering from flask import Flask, request, jsonify, render_template import torch import torch.nn.functional as F from queue import Queue, Empty from threading import Thread import time app = Flask(__name__) print("model loading...") # Model & Tokenizer loa...
test_events.py
"""Tests for events.py.""" import collections.abc import concurrent.futures import functools import gc import io import os import platform import re import signal import socket try: import ssl except ImportError: ssl = None import subprocess import sys import threading import time import errno import unittest ...
client.pyw
""" 这里是客户端文件,负责创建聊天室窗口 """ from threading import Thread from address import * from plugins.lib.root import * s.connect((host, port)) # 与服务器建立连接 root.title("SimpleChat") # 标题 message_frame.grid(row=0, column=0, padx=3, pady=6) # 消息窗口,第1行,第0列 text_frame.grid(row=1, column=0, padx=3, pady=6) # 输入窗口,第2行,...
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...
bulk_write_test.py
#!/usr/bin/env python3 import time import threading from panda import Panda # The TX buffers on pandas is 0x100 in length. NUM_MESSAGES_PER_BUS = 10000 def flood_tx(panda): print('Sending!') msg = b"\xaa"*4 packet = [[0xaa, None, msg, 0], [0xaa, None, msg, 1], [0xaa, None, msg, 2]] * NUM_MESSAGES_PER_BUS pan...
htcondor_utils.py
#=== Imports =================================================== import re import time import threading import random import multiprocessing import tempfile import functools import traceback import xml.etree.ElementTree as ET try: import subprocess32 as subprocess except Exception: import subprocess try: ...
plugin.py
from binascii import hexlify, unhexlify from electrum_dash.util import bfh, bh2u from electrum_dash.bitcoin import (b58_address_to_hash160, xpub_from_pubkey, TYPE_ADDRESS, TYPE_SCRIPT) from electrum_dash import constants from electrum_dash.i18n import _ from electrum_dash.plugins imp...
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...
__init__.py
import sys import os import traceback, linecache import re import objc import time import random from Foundation import * from AppKit import * from threading import Thread from nodebox.gui.mac.ValueLadder import MAGICVAR from nodebox.gui.mac import PyDETextView from nodebox.gui.mac.util import errorAlert from nodebox ...
main-edge-sm.py
import time, queue, threading, sys, os import torch, argparse, logging from pvaccess import Channel from pvaccess import PvObject import pvaccess as pva import numpy as np import tensorrt as trt sys.path.insert(1, '/home/nvidia-agx/Inference/') import PtychoNN from framePreProcess import * from tensorrtcode_batc...
_a4c_start.py
from cloudify import ctx from cloudify.exceptions import NonRecoverableError from cloudify.state import ctx_parameters as inputs import subprocess import os import re import sys import time import threading import platform from StringIO import StringIO from cloudify_rest_client import CloudifyClient from cloudify im...
Tensortrade_Behavior_Cloning.py
# To add a new cell, type '# %%' # To add a new markdown cell, type '# %% [markdown]' # %% from IPython import get_ipython # %% [markdown] # # Install Stable-baselines/ TensorTrade - Colab # %% #install stable-baselines get_ipython().system('sudo apt-get update && sudo apt-get install cmake libopenmpi-dev zlib1g-dev...
doom.py
import threading import multiprocessing import numpy as np import matplotlib.pyplot as plt import tensorflow as tf import tensorflow.contrib.slim as slim import scipy.signal from helper import * from vizdoom import * from random import choice from time import sleep from time import time # Copies one set of variables...
Serveur.py
import socket import threading import errno # Connection Data host = '192.168.1.62.' port = 55500 # Starting Server server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.bind((host, port)) server.listen() # Lists For Clients and Their Nicknames clients = [] nicknames = [] def close(): server.close(...
get_functions.py
import logging, re, json, requests from utils import ( load, messages as _msg, restricted as _r, get_set as _set, task_box as _box, task_payload as _payload, ) from workflow import copy_workflow as _copy from utils.load import _lang, _text from telegram.ext import ConversationHandler from drive....
config_veos.py
#!/usr/bin/env python3 # scripts/config_veos.py # # Import/Export script for vEOS. # # @author Andrea Dainese <andrea.dainese@gmail.com> # @copyright 2014-2016 Andrea Dainese # @license BSD-3-Clause https://github.com/dainok/unetlab/blob/master/LICENSE # @link http://www.unetlab.com/ # @version 20160719 import getopt...
callbacks_test.py
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
params.py
#!/usr/bin/env python3 """ROS has a parameter server, we have files. The parameter store is a persistent key value store, implemented as a directory with a writer lock. On Android, we store params under params_dir = /data/params. The writer lock is a file "<params_dir>/.lock" taken using flock(), and data is stored in...
service.py
import queue import sys import threading import traceback from mushicoin import tools from mushicoin.ntwrk.message import Order class NoExceptionQueue(queue.Queue): """ In some cases, queue overflow is ignored. Necessary try, except blocks make the code less readable. This is a special queue class that ...
lvq.py
# LVQ for the Ionosphere Dataset from random import seed from random import randrange from random import shuffle from csv import reader from math import sqrt import numpy as np import os import sys import time import threading import itertools class LVQ: codebooks = list() n_codebooks = 0 data_train = l...
test_partition.py
import time import random import pdb import threading import logging from multiprocessing import Pool, Process import pytest from utils.utils import * from common.constants import * from common.common_type import CaseLabel TIMEOUT = 120 class TestCreateBase: """ **********************************************...
safe_t.py
from binascii import hexlify, unhexlify import traceback import sys from electrum.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException from electrum.bitcoin import TYPE_ADDRESS, TYPE_SCRIPT from electrum.bip32 import deserialize_xpub from electrum import constants from electrum.i18n import _ from el...
mock_server.py
import logging import os from threading import Thread from uuid import uuid4 from typing import List from flask import Flask, jsonify, Response, request import requests LOGGER = logging.getLogger(__name__) # based on https://gist.github.com/eruvanos/f6f62edb368a20aaa880e12976620db8 class MockServer: def __init...
TFSparkNode.py
# Copyright 2017 Yahoo Inc. # Licensed under the terms of the Apache 2.0 license. # Please see LICENSE file in the project root for terms. """This module provides low-level functions for managing the TensorFlowOnSpark cluster.""" from __future__ import absolute_import from __future__ import division from __future__ im...
14_mmw.py
# # Copyright (c) 2018, Manfred Constapel # This file is licensed under the terms of the MIT license. # # # TI IWR1443 ES2.0 EVM @ mmWave SDK demo of SDK 1.2.0.5 # TI IWR1443 ES3.0 EVM @ mmWave SDK demo of SDK 2.1.0.4 # import sys import json import serial import threading from lib.shell import * from lib.helper imp...
fc_2015_04_25.py
#!/usr/bin/env python3 # imports go here import multiprocessing import time # # Free Coding session for 2015-04-25 # Written by Matt Warren # def wait_for_event(e): print("waiting") e.wait() print("got event") def wait_for_event_timeout(e, t): print("wait for timeout") e.wait(t) print("event...
engine.py
#!/usr/bin/env python # -*- 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, ...
notebookapp.py
# coding: utf-8 """A tornado based IPython notebook server. Authors: * Brian Granger """ from __future__ import print_function #----------------------------------------------------------------------------- # Copyright (C) 2013 The IPython Development Team # # Distributed under the terms of the BSD License. The fu...
test_worker.py
import socket import sys from datetime import datetime, timedelta from Queue import Empty from kombu.transport.base import Message from kombu.connection import BrokerConnection from celery.utils.timer2 import Timer from celery import current_app from celery.concurrency.base import BasePool from celery.exceptions imp...
similarity.py
import os from queue import Queue from threading import Thread import pandas as pd import tensorflow as tf import collections import args import tokenization import modeling import optimization # os.environ['CUDA_VISIBLE_DEVICES'] = '1' class InputExample(object): """A single training/test example for simple s...
profile_tac_consumer.py
#!/usr/bin/env python import argparse import asyncio from functools import partial from multiprocessing import Process import sys from pathlib import Path import yappi # type: ignore sys.path.append(str(Path(".").parent.absolute().joinpath("tacview_client"))) sys.path.append(str(Path(".").parent.absolute().joinpath(...