source
stringlengths
3
86
python
stringlengths
75
1.04M
rl_scheduler.py
import os import json import time import pickle import logging import threading import multiprocessing as mp from collections import OrderedDict import mxnet as mx from .resource import DistributedResource from ..utils import (save, load, mkdir, try_import_mxboard, tqdm) from ..core import Task from ..core.decorator ...
api_chess.py
from multiprocessing import connection, Pipe import time from threading import Thread import numpy as np from blackqueen.config import Config class ChessModelAPI: # noinspection PyUnusedLocal def __init__(self, config: Config, agent_model): # ChessModel self.agent_model = agent_model self.p...
alpaca.py
# # Copyright 2018 Alpaca # # 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, sof...
env.py
""" @author: Viet Nguyen <nhviet1009@gmail.com> """ import gym_super_mario_bros from gym.spaces import Box from gym import Wrapper from nes_py.wrappers import JoypadSpace from gym_super_mario_bros.actions import SIMPLE_MOVEMENT, COMPLEX_MOVEMENT, RIGHT_ONLY import cv2 import numpy as np import subprocess as sp import ...
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...
artifacts.py
import json import yaml import mimetypes import os import pickle from six.moves.urllib.parse import quote from copy import deepcopy from datetime import datetime from multiprocessing import RLock, Event from multiprocessing.pool import ThreadPool from tempfile import mkdtemp, mkstemp from threading import Thread from t...
worker.py
from multiprocessing import Process from multiprocessing import Pipe from planet import take_snapshot from config import PLANET_INIT from config import PLANET_ANGLE from config import NUMBER_OF_WORKERS from config import IMAGE_SIZE # # This function is executed by the worker thread of the script. # # conn: The endp...
pyrep.py
import numpy as np from pyrep.backend import sim, utils from pyrep.objects.object import Object from pyrep.objects.shape import Shape from pyrep.textures.texture import Texture from pyrep.errors import PyRepError import os import sys import time import threading from threading import Lock from typing import Tuple, List...
gigapixel.py
# Gigapixel controller # This must run as root (sudo python gigapixel.py) due to framebuffer, etc. # # http://www.adafruit.com/products/998 (Raspberry Pi Model B) # http://www.adafruit.com/products/1601 (PiTFT Mini Kit) # # Prerequisite tutorials: aside from the basic Raspbian setup and PiTFT setup # http://learn.ada...
__main__.py
""" Multi-threaded match-making game server """ import os import random from datetime import datetime import threading from collections import defaultdict from referee.log import StarLog from referee.game import play, IllegalActionException, COLOURS, NUM_PLAYERS from battleground.protocol import DisconnectException, ...
mainwindow.py
# -*- coding: utf-8 -*- # # Copyright © Spyder Project Contributors # Licensed under the terms of the MIT License # (see spyder/__init__.py for details) """ Spyder, the Scientific Python Development Environment ===================================================== Developped and maintained by the Spyder Pro...
put.py
from __future__ import division from future.utils import listitems, listvalues from builtins import str from builtins import object import argparse import arvados import arvados.collection import base64 import copy import datetime import errno import fcntl import hashlib import json import logging import os import pwd ...
auto_posting_thread.py
from app import app, helpers from app.scheduledb import ScheduleDB from app.scheduleCreator import create_schedule_text from app import vkapi from datetime import datetime, timedelta import threading from time import sleep def auto_posting(current_time): today = datetime.now() week_type = (today.isocalendar(...
client_back.py
#!/usr/bin/env python3 """ RSM Client """ __author__ = "Bruno Chianca Ferreira" __license__ = "MIT" __version__ = "0.1" __maintainer__ = "Bruno Chianca Ferreira" __email__ = "brunobcf@gmail.com" import socket, random, sys, json, traceback, zlib, fcntl, time, threading, pickle, argparse, os, statistics, datetime from...
test_api.py
import mock import re import socket import threading import time import warnings from unittest import TestCase import pytest from tests.test_tracer import get_dummy_tracer from ddtrace.api import API, Response from ddtrace.compat import iteritems, httplib, PY3 from ddtrace.internal.runtime.container import CGroupInf...
SVM-Process.py
import multiprocessing as mp import time import numpy as np from sklearn import svm def cvkfold(X, y, tuning_params, partitions, k): n_tuning_params = tuning_params.shape[0] partition = partitions[k] Train = np.delete(np.arange(0, X.shape[0]), partition) Test = partition X_train = X[Train, :] ...
mid_personxxx.py
#-------------------------------------# # 调用摄像头或者视频进行检测 # 调用摄像头直接运行即可 # 调用视频可以将cv2.VideoCapture()指定路径 # 视频的保存并不难,可以百度一下看看 #-------------------------------------# import threading import rospy from sensor_msgs.msg import CameraInfo, CompressedImage from cv_bridge import CvBridge, CvBridgeError from std_msgs.msg ...
rotate_data.py
import numpy as np from scipy.spatial import cKDTree from multiprocessing import Process, cpu_count, Queue, freeze_support, Array # , current_process, Array import ctypes import os, psutil, sys def memlog(msg): process = psutil.Process(os.getpid()) print('%s, RAM=%.4g GB'%(msg,process.memory_info()[0]/2.**30))...
cronus.py
from .db import DB import sqlalchemy from sqlalchemy import Integer, Text import threading import base64 from tldextract import extract import urllib.parse from bs4 import BeautifulSoup import requests import logging import os import re logging.basicConfig(format='[%(levelname)s] : [%(asctime)s] : %(messa...
PythonExecutor.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 "License")...
_image_feature_extractor.py
# -*- coding: utf-8 -*- # Copyright © 2017 Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can # be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause from __future__ import print_function as _ from __future__ import division as _ from...
test.py
Skip to content Features Business Explore Marketplace Pricing Search Sign in or Sign up 1 0 0 ryrizo/AIND-Isolation Code Issues 0 Pull requests 0 Projects 0 Insights Join GitHub today GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software togeth...
fileStore.py
# Copyright (C) 2015-2016 Regents of the University of California # # 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 app...
request.py
import base64 import enum import json import threading import time import urllib.parse as parse from dataclasses import dataclass from typing import List, Tuple, Union from urllib.parse import urlparse import requests from author.models import Author from backend.settings import NETLOC from comment.models import Comme...
acamar.py
#!/usr/bin/env python import sys, requests, json, os, threading from bs4 import BeautifulSoup as bs def enterRes(e): e = e.split('/', 1)[0] if e not in result: result.append(e) def enumHackertarget(): print('[!] Enumerating hackertarget.com') r = requests.get('https://api.hackertarget.com/ho...
sensorReporter.py
#!/usr/bin/python """ Copyright 2016 Richard Koshak 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 ...
response_recorder.py
# =============================================================================== # Copyright 2014 Jake Ross # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licens...
simple.py
#!/usr/bin/env python3 # # Copyright (C) 2019 Jayson # import time import threading def say_hello(name): for i in range(10): print("hello {}".format(name)) thread1 = threading.Thread(target=say_hello, args=('small red',)) thread2 = threading.Thread(target=say_hello, args=('small light',)) ...
watcher_plugin.py
import multiprocessing import cv2 from Plugins import base from FacialRecognition.model import FacialRecognitionModel from utils import parallelization class WatcherPlugin(base.Plugin): def __init__(self): self.name = 'WatcherPlugin' super().__init__(name=self.name, command_hooks={}, modifiers={...
populations.py
import torch import torch.multiprocessing as mp class Population: def __init__(self): self.swarms = [] def add(self, swarm) -> None: self.swarms.append(swarm) def run(self, data: torch.Tensor, episodes: int, ) -> None: # cpus = mp.cpu_count() -...
xdcrbasetests.py
import sys import time import datetime import unittest import logger import logging import copy import string import random from threading import Thread from membase.api.rest_client import RestConnection, Bucket from couchbase_helper.cluster import Cluster from couchbase_helper.document import View from TestInput impo...
sdk_worker_main.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...
Local.py
# Copyright 2007 by Tiago Antao <tiagoantao@gmail.com>. All rights reserved. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. ''' Asynchronous local execution. Supports multicore architectures. ''' ...
PyNmapScanner.py
import nmap, argparse from threading import Thread def nmapScan(tgtHost, tgtPort): nScan = nmap.PortScanner() nScan.scan(tgtHost,tgtPort) state=nScan[tgtHost]['tcp'][int(tgtPort)]['state'] print " [*] " + tgtHost + " tcp/"+tgtPort +" "+state def main(): parser = argparse.ArgumentParser(description="A simple Pyth...
autotaskbackdealer.py
"""task feedback data dealer""" # -*- coding:utf-8 -*- import math import queue import threading import time import traceback from commonbaby.helpers import helper_time from datacontract import (DataMatcher, DataSeg, ECommandStatus, InputData, AutomatedTask, AutotaskBack, AutotaskBatchBack...
inb4404.py
#!/usr/bin/python import urllib2, argparse, logging import os, re, time import httplib import fileinput from multiprocessing import Process log = logging.getLogger('inb4404') workpath = os.path.dirname(os.path.realpath(__file__)) args = None def load(url): req = urllib2.Request(url, headers={'User-Agent': '4chan...
crossref.py
# ============================================================================= # # EZID :: crossref.py # # Interface to Crossref <http://www.crossref.org/>. # # Author: # Greg Janee <gjanee@ucop.edu> # # License: # Copyright (c) 2014, Regents of the University of California # http://creativecommons.org/licenses/...
arearesilience.py
#!/usr/bin/env python3 """ RESOURCE MANAGEMENT - POLICIES MODULE Area Resilience - Keep always a Leader in the area! """ import threading import requests import socket from time import sleep from random import randrange from common.logs import LOG from common.common import CPARAMS, URLS from policies.leader...
base.py
""" Module containing base classes that represent object entities that can accept configuration, start/stop/run/abort, create results and have some state. """ import os import sys import time import signal import threading import traceback from collections import deque, OrderedDict import psutil from schema import Or...
engineer.py
import os import numpy as np import pandas as pd from scipy.stats import skew, kurtosis, mode # from constant import Constant from meta_feature_utils import sample_num_strategy # sample strategy import random import re import easyocr # pip install easyocr from mtcnn import MTCNN # pip install mtcnn # python -m pi...
test_base.py
import asyncio import fcntl import logging import os import random import sys import threading import time import uvloop import unittest import weakref from unittest import mock from uvloop._testbase import UVTestCase, AIOTestCase class _TestBase: def test_close(self): self.assertFalse(self.loop._closed...
detect_cup.py
import cv2 import time #from espeak import espeak from subprocess import call import random import numpy as np import threading import requests cap = cv2.VideoCapture(0) cap.set(cv2.CAP_PROP_FRAME_WIDTH, 640) cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 480) roi = (275, 309, 39 + 275, 53 + 309) # hsv values green_thresh_low =...
audible.py
# Python imports import threading import xlsxwriter import json, time import pandas as pd from numpy import nan import openpyxl as op from bs4 import BeautifulSoup from selenium import webdriver book_prefix = { 'Australia':'https://www.amazon.com.au', 'Brazil':'https://www.amazon.com.br', 'Canada':'ht...
start_sploit.py
#!/usr/bin/env python3 import argparse import binascii import itertools import json import logging import os import random import re import stat import subprocess import sys import time import threading from concurrent.futures import ThreadPoolExecutor from enum import Enum from math import ceil from urllib.parse impo...
utils.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...
dbdlnolang.py
''' Encoding image analyzing errors: Add the numbers below to 8 to encode all types of errors (so status=9...23 is reserved to describe the errors) - general exception: 1 - bad format: 2 - image too big: 4 - image too small: 8 - any combination of above ''' import gc import os import ssl import sys import time imp...
fabfile.py
from fabric import api as fab from functools import wraps import os, re ######################################################################################################### # Init / Settings # Set the working directory to the build/ directory. This is necessary if you # run "fab ..." in a subdirectory or with "...
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...
client.py
from contextlib import ExitStack import threading from typing import List from ibapi import client from ibapi import account_summary_tags from ibapi import contract from ibapi import order from rx import operators as _ from rx.subject import ReplaySubject from ibrx.mess import message_wrapper from ibrx.mess.message i...
glsvgoverlaysink.py
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
ArduinoSerial_PyQt_Demo_AllOne.py
# -*- coding: utf-8 -*- """ This recipe opens a simple window in PyQt to poll the serial port for data and print it out. Uses threads and a queue. This recipe depends on Python3.5,PyQt4 and pySerial. Tested on Qt4.7 / Win 10 / Arduino Uno PS: This code is meant to demonstrate a concept only, not for actual us...
faster_parser_model_apply_inputs.py
# -*- coding: utf-8 -*- """ @author: mesar """ import pandas as pd import json from datetime import datetime import numpy as np import csv from pathlib import Path from progressbar import progressbar as pbar import time import sys def parallel_parsing(i, key, number_of_clients, vehicle_capacity, package_data_list,...
SMTPListener.py
import logging import sys import os import threading import SocketServer import ssl import socket from . import * class SMTPListener(object): def taste(self, data, dport): # Once the TCP connection has been established, the server initiates # the conversation with '220' mes...
run_squad_ColabTCPTrans_Quick.py
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
rlock_management.py
import threading import time class Box(object): lock = threading.RLock() def __init__(self): self.total_items = 0 def execute(self,n): Box.lock.acquire() self.total_items += n Box.lock.release() def add(self): Box.lock.acquire() self.execute(1) Bo...
hypothesis_test.py
import numpy as np import copy import time from functools import partial, reduce from future.utils import viewitems, viewkeys from hypothesis import assume, given, settings, HealthCheck import hypothesis.strategies as st import unittest import threading from caffe2.python import core, workspace, tt_core, dyn...
ut_launch.py
import socket import random import os import pathlib from datetime import datetime from billiard import Process from ament_index_python.packages import get_package_prefix from launch import LaunchService, LaunchDescription from launch.actions.execute_process import ExecuteProcess from launch_ros.actions import Node ...
runner.py
#!/usr/bin/env python2 # 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 ...
test_engine_py3k.py
import asyncio from sqlalchemy import Column from sqlalchemy import create_engine from sqlalchemy import delete from sqlalchemy import event from sqlalchemy import exc from sqlalchemy import func from sqlalchemy import Integer from sqlalchemy import select from sqlalchemy import String from sqlalchemy import Table fro...
rl-sim.py
# -*- coding:utf8 -*- # File : rl-sim.py # Author : Jiayuan Mao # Email : maojiayuan@gmail.com # Date : 4/22/17 # # This file is part of TensorArtist. import argparse import pickle import time import threading import os.path as osp from tartist import image from tartist.app.rl.simulator import Controller, Pack,...
views.py
import hashlib import hmac import json import logging import shlex import subprocess import threading from django.http import JsonResponse from django.utils import timezone from django.views.decorators.csrf import csrf_exempt from core import models logger = logging.getLogger(__name__) def _verify_signature(clien...
train.py
#!/usr/bin/env python import os import json import torch import numpy as np import queue import pprint import random import argparse import importlib import threading import traceback import torch.distributed as dist import torch.multiprocessing as mp from tqdm import tqdm from torch.multiprocessing import Process, Q...
test_telnetlib.py
import socket import selectors import telnetlib import time import contextlib from test import support import unittest threading = support.import_module('threading') HOST = support.HOST def server(evt, serv): serv.listen() evt.set() try: conn, addr = serv.accept() conn.close() except ...
zip_streaming.py
#!/usr/bin/python3.9 # SPDX-License-Identifier: MIT # # Streaming zip files via http with naive block cache. # __author__ = "Amir Heinisch <mail@amir-heinisch.de>" import os, re from urllib.request import Request, urlopen class URLCache: # Cache block size. CBLKSIZE = 10 * 1024 * 1024 def __init__(s...
moto_services.py
# Copyright 2019-2022 Darren Weber # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
conftest.py
import multiprocessing import platform import pytest def dummy_func(): pass @pytest.fixture(scope='session', autouse=True) def scope_session(): if int(platform.python_version_tuple()[0]) >= 3: multiprocessing.set_start_method('forkserver') p = multiprocessing.Process(target=dummy_func) ...
test_retry_eintr.py
# -*- coding: utf8 -*- # Copyright (C) PyZMQ Developers # Distributed under the terms of the Modified BSD License. import signal import time from threading import Thread from pytest import mark import zmq from zmq.tests import BaseZMQTestCase, SkipTest, skip_pypy from zmq.utils.strtypes import b # Partially based ...
base.py
"""Worker pool executor base classes.""" import abc import inspect import logging import numbers import os import psutil import threading import time from schema import Or, And import six from testplan.common.config import ConfigOption, validate_func from testplan.common import entity from testplan.common.utils.thr...
net.py
""" About: ComNetsEmu Network Module. """ import http.server import json import os import os.path import shutil import threading from functools import partial from time import sleep import docker from comnetsemu.cli import spawnXtermDocker from comnetsemu.node import APPContainer, DockerHost from mininet.log import ...
views.py
from datetime import datetime from threading import Thread import requests from django.core.exceptions import PermissionDenied from django.shortcuts import render, reverse, redirect from random import randint from django.conf import settings from os import path, listdir from account.permissions import is_admin_or_ro...
base.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import tools import time import re import db import threading class Source (object) : def __init__ (self): self.T = tools.Tools() self.now = int(time.time() * 1000) def getSource (self) : urlList = [] url = 'https://www.jianshu.c...
thread_objects_02.py
import threading from time import sleep from tqdm import tqdm def target_function(name: str = 'someone') -> None: print(f'hello, {name}!') print(f'you are in the thread {threading.current_thread().name}') for i in tqdm(range(5)): sleep(1) thread_01 = threading.Thread(name='t1', target=target_function, ar...
ServiceMLFlask.py
#!flask/bin/python import sys import logging from threading import Thread import requests from flask import Flask from flask import jsonify from flask import request sys.path.append('./vgg19') from Persistancy import Persistancy from ModelVgg19 import ModelVgg19 app = Flask(__name__, static_folder='./html/') # @a...
main.py
from trade_client import * from store_order import * from load_config import * from collections import defaultdict from datetime import datetime, time import time import threading import json import os.path # loads local configuration config = load_config('config.yml') def get_all_coins(): """ Returns all...
fuwuduan-udp.py
import socket import threading import time s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.bind(('127.0.0.1', 9999)) print('Bind UDP on 9999...') def tcplink(data,addr): print('Received from %s:%s.' % addr) s.sendto(b'Hello, %s!' % data, addr) while True: data, addr = s.recvfrom(1024) t = thread...
server.py
import socket import threading import struct IP = '127.0.0.1' PORT = 1613 # 定义数据长度 # 一个数据包的数据为 1024 bytes # 再加上 24 bytes 的序列号,确认号,文件结束标志 _BUFFER_SIZE = 1024 + 24 # 传送包的结构定义 # 使用 python 的 struct 定义 # 包括 序列号,确认号,文件结束标志,1024B的数据 # pkt_value = (int seq, int ack, int end_flag 1024B的byte类型 data) pkt_struct = struct.Struc...
dropbox.py
#!/usr/bin/python # # Copyright (c) Dropbox, Inc. # # dropbox # Dropbox frontend script # This file is part of nautilus-dropbox 2015.02.12. # # nautilus-dropbox is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, ...
test_csv.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...
scdlbot.py
# -*- coding: utf-8 -*- """Main module.""" import configparser import gc import pathlib import random import shelve import shutil from datetime import datetime from multiprocessing import Process, Queue from queue import Empty from subprocess import PIPE, TimeoutExpired from urllib.parse import urljoin from uuid impo...
trezor.py
import traceback import sys from typing import NamedTuple, Any from electrum.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException from electrum.bitcoin import TYPE_ADDRESS, TYPE_SCRIPT from electrum.bip32 import BIP32Node, convert_bip32_path_to_list_of_uint32 as parse_path from electrum import const...
vnet.py
# # CORE # Copyright (c)2010-2012 the Boeing Company. # See the LICENSE file included in this distribution. # # authors: Tom Goff <thomas.goff@boeing.com> # Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com> # ''' vnet.py: PyCoreNet and LxBrNet classes that implement virtual networks using Linux Ethernet bridging...
revocation_notifier.py
''' DISTRIBUTION STATEMENT A. Approved for public release: distribution unlimited. This material is based upon work supported by the Assistant Secretary of Defense for Research and Engineering under Air Force Contract No. FA8721-05-C-0002 and/or FA8702-15-D-0001. Any opinions, findings, conclusions or recommendations ...
tunnel.py
"""Basic ssh tunnel utilities, and convenience functions for tunneling zeromq connections. """ # Copyright (C) 2010-2011 IPython Development Team # Copyright (C) 2011- PyZMQ Developers # # Redistributed from IPython under the terms of the BSD License. from __future__ import print_function import atexit import os i...
views.py
import json import logging import re from datetime import timedelta from threading import Thread import shortuuid from django.contrib import messages from django.core.exceptions import PermissionDenied from django.db import IntegrityError, transaction from django.http import JsonResponse from django.shortcuts import H...
highlights.py
"""Highlights API handler.""" import os import sys sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'lib')) import json import time from time import sleep import requests import threading try: from gateway_addon import APIHandler, APIResponse, Adapter, Device, Property, Database #prin...
peer.py
# ###################################### # TODO : SOROOSH NOORZAD - 99205372 # ###################################### # ###################################### # TODO : Import libraries # ###################################### import os import sys import time import json import base64 import socket im...
__init__.py
import importlib from fastapi import FastAPI, Request from fastapi.responses import Response import json import base64 from multiprocessing import Process import uvicorn app = FastAPI() def start_webserver(): def _start_webserver(): uvicorn.run(app, host="127.0.0.1", port=8080, log_level="debug") p ...
tests.py
import sys import threading import time from unittest import skipIf, skipUnless from django.db import ( DatabaseError, Error, IntegrityError, OperationalError, connection, transaction, ) from django.test import ( TransactionTestCase, skipIfDBFeature, skipUnlessDBFeature, ) from .models import Reporter @...
clang_format.py
#! /usr/bin/env python """ A script that provides: 1. Ability to grab binaries where possible from LLVM. 2. Ability to download binaries from MongoDB cache for clang-format. 3. Validates clang-format is the right version. 4. Has support for checking which files are to be checked. 5. Supports validating and updating a s...
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 ...
trace_event_unittest.py
#!/usr/bin/env python # Copyright 2014 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. import contextlib import json import logging import math import multiprocessing import os import tempfile import time import unittest f...
google_nest_controller.py
import time import threading import requests from googlecontroller import GoogleAssistant as _GA_ import librosa class GoogleNestDevice(_GA_): def __init__(self, ip, default_volume=18): self.ip = ip _GA_.__init__(self, ip) self.nest_device = _GA_(host=self.ip) if not default_volume...
caching_test.py
# -*- coding: utf-8 -*- # Copyright 2018-2019 Streamlit 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 applicabl...
ringbuffer.py
# ---------------------------------------------------------------------------- # Copyright (c) 2017 Massachusetts Institute of Technology (MIT) # All rights reserved. # # Distributed under the terms of the BSD 3-clause license. # # The full license is in the LICENSE file, distributed with this software. # -------------...
messaging.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See LICENSE in the project root # for license information. from __future__ import absolute_import, division, print_function, unicode_literals """An implementation of the session and presentation layers as used in the D...
assembler.py
import importlib import inspect import multiprocessing as mp import os import sys from copy import copy import baseTasks import muparse import progress from errors import * class Assembler(object): taskFolder = 'tasks/' tasks_serial = {} tasks_reducer = {} tasks_parallel = {} def __init__(self, altPath=N...
learner.py
# Lint as: python3 # Copyright 2020 DeepMind Technologies Limited. 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 # # ...
picro.py
#!/bin/python import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk, Gdk, Gio, GLib, GdkPixbuf, GObject import os import sys import subprocess import signal from threading import Thread # Needed to remove stdout FNULL = open(os.devnull, 'w') # Blacklist some file types BLACKLIST = ['vnd.fpx'] #...
managers.py
# # Module providing the `SyncManager` class for dealing # with shared objects # # multiprocessing/managers.py # # Copyright (c) 2006-2008, R Oudkerk # Licensed to PSF under a Contributor Agreement. # __all__ = [ 'BaseManager', 'SyncManager', 'BaseProxy', 'Token' ] # # Imports # import sys import threading import ar...
simple_xchain_transfer_test.py
import sys import time from multiprocessing import Process, Value from typing import Dict from xrpl.models import XRP, IssuedCurrency, Payment, TrustSet from xrpl.utils import xrp_to_drops from slk.chain.chain import Chain from slk.chain.mainchain import Mainchain from slk.chain.xchain_transfer import main_to_side_tr...