source
stringlengths
3
86
python
stringlengths
75
1.04M
git_tools.py
#!/usr/bin/python # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import cStringIO import os import re import subprocess import sys import threading try: import git_cache except ImportError: for p...
server.py
from flask import Flask, request as flaskRequest, jsonify, render_template import requests import json import time from datetime import datetime, timedelta import sqlite3 import sys import ccxt import os from threading import Thread from pathlib import Path #Config Settings allowedFields = ["keepWeeks", "exchanges",...
app.py
from tkinter import * from PIL import Image import tkinter.messagebox from PIL import ImageTk from PIL import * from tkinter import filedialog import threading from tkinter.ttk import Combobox from PIL import ImageFilter class Img_filter: def __init__(self,root): self.root=root self.root.title(...
pool_in_threads.py
import multiprocessing import os import threading import traceback def t(): try: with multiprocessing.Pool(1): pass except Exception: traceback.print_exc() os._exit(1) def main(): threads = [] for i in range(20): threads.append(threading....
__main__.py
'''Kirale tool for serial interfacing KiNOS devices''' from __future__ import print_function import argparse import codecs import os import platform import subprocess import sys from threading import Thread from time import sleep import colorama from kitools import kidfu, kifwu, kiserial, kisniffer, __ve...
threads.py
import logging import queue import threading from concurrent.futures import ThreadPoolExecutor # from utils.config import MAX_THREAD_COUNT # 任务:事件 def func_a(a, b): return a + b def func_b(a, b): return a * b def func_c(a, b, c): return a * b - c # 回调函数 def handle_result1(resu...
calculate_distance_mean.py
import utility as utl import csv import threading import numpy as np def convert_to_float(string_vector): vector = [] for item in string_vector: vector.append(float(item)) return vector def fill_data_set(csv_file): with open(csv_file) as f: data_set_count = sum(1 for line in f) - 1 ...
test_httplib.py
import errno from http import client import io import itertools import os import array import re import socket import threading import unittest TestCase = unittest.TestCase from test import support here = os.path.dirname(__file__) # Self-signed cert file for 'localhost' CERT_localhost = os.path.join(here, 'keycert.p...
multiThread_check_cdn_design_files.py
#!/usr/bin/python # -*- coding:utf-8 -*- ''' @Author: xiaodong @Email: fuxd@jidongnet.com @DateTime: 2016-01-19 17:25:13 @Description: 根据本地目录结构遍历下载CDN上的文件,和本地进行比对. 主要通过上线流程自动触发下载进行检测,检验文件上传完毕后的下载文件,是否和本地一致. @version : 1.0.0 ''' import requests import os import time import sys from ...
pio_terminal.py
# !/usr/bin/env python # -*- coding: utf-8 -*- import os import sublime import sublime_plugin from threading import Thread from time import sleep from ..libraries import tools from ..libraries.messages import Messages from ..platformio.command import Command from ..libraries.thread_progress import ThreadProgress from...
unit_tests.py
# -*- coding: utf-8 -*- """ Created on Sat Apr 2 09:31:14 2016 @author: Parag Guruji, paragguruji@gmail.com """ from multiprocessing import Process from test.context import api, core, elasticsearch_util import requests import unittest import os import json import time from elasticsearch.exceptions import ConnectionE...
mona_uds_client.py
# ---------------------------------------------------------------------------- # Copyright 2021 MonaLabs.io # # 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.ap...
__init__.py
# Copyright 2019 Atalaya Tech, 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,...
environment.py
# Copyright 2018 Tensorforce Team. 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 applicable la...
timeout_confirm.py
import os import sys from threading import Thread d = os.path.dirname(os.getcwd()) sys.path.append(d) from pychron.core.ui import set_toolkit set_toolkit('qt4') from pychron.core.ui.dialogs import myConfirmationDialog from traits.api import HasTraits, Button from traitsui.api import View class A(HasTraits): ...
fake.py
# This code run compatibly under Python 2 and 3.x for x >= 2. # Preserve this property! # # This file is Copyright 2010 by the GPSD project # SPDX-License-Identifier: BSD-2-Clause """ gpsfake.py -- classes for creating a controlled test environment around gpsd. The gpsfake(1) regression tester shipped with GPSD is a t...
QrGenerator.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import qrcode import tkinter, tkinter.messagebox from PIL import Image, ImageTk import configparser import threading import time # get filename name = os.path.split(__file__)[-1] name = name[:name.rfind('.')] # del log if os.path.exists(name+'log.txt'): os.r...
run_experiments_v2.py
#!/usr/bin/python import subprocess import threading import multiprocessing import os conf_str_incastN = '''init_cwnd: 2 max_cwnd: 30 retx_timeout: 450 queue_size: 524288 propagation_delay: 0.0000002 bandwidth: 100000000000.0 queue_type: 6 flow_type: 6 num_flow: {0} num_hosts: {5} flow_trace: ./CDF_{1}.txt cut_throug...
dataloader_iter.py
# Copyright (c) 2020 PaddlePaddle 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...
main.py
import threading from pkg.RIPServer.server import RIPAdvertise from pkg.RIPClient.client import RIPQueryRoutesTable from multiprocessing import Process,Manager, Pool from pkg.Status.status import remoteHosts,routesTable if __name__ == '__main__': print("[main] remoteHosts: ", remoteHosts, flush=True) thre...
mp01.py
# coding: utf-8 # # This file is part of the IKPdb Debugger # Copyright (c) 2017 by Cyril MORISSE # Licence: MIT. See LICENCE at repository root # import sys import os import time import multiprocessing import ikpdb class Worker(object): def __init__(self): self._running = True def terminate(sel...
USDSceneTest.py
########################################################################## # # Copyright (c) 2017, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistribu...
client.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- # Author: i2cy(i2cy@outlook.com) # Project: I2cylib # Filename: client # Created on: 2021/9/29 import threading import time import socket from i2cylib.network.I2TCP_protocol.I2TCP_client import I2TCPclient from i2cylib.utils.logger import Logger class Client(I2TCPclient): ...
seg.py
# coding:utf-8 # 2019-3-17 # import matplotlib.pyplot as plt import numpy as np import os import cv2 import datetime import logging import pickle from threading import Thread, Lock from tool import util from tool import model as models from tool import api # 日志设置 LOGGER_PATH = r".\log" logger = util.get_logger(LOGGE...
console.py
from __future__ import absolute_import from __future__ import print_function from __future__ import division from __future__ import unicode_literals import threading, code, logging, Queue as queue from contextlib import contextmanager log = logging.getLogger(__name__) import muz from muz.util import forever from .f...
test10.py
import time import zmq from zmq.devices.monitoredqueuedevice import MonitoredQueue from zmq.utils.strtypes import asbytes from multiprocessing import Process from threading import Thread import random frontend_port = 5559 backend_port = 5560 monitor_port = 5562 number_of_workers = 1 def get_local_ip() -> str: f...
portscan.py
# py2 import socket import threading from Queue import Queue memes = int(input("Amount of threads to use: ")) target = raw_input("IP address: ") minRange = int(input("min port to scan: ")) maxRange = int(input("max port to scan: ")) maxRange += 1 print_lock = threading.Lock() q = Queue() def portscan(port): ...
mpd_player.py
############################################################################################## # FIXME List: # CC27 - Consider Change 27 # Заменить реализацию на _alternative_get_title # CC28 - Consider Change 28 # Пересмотреть ВЕСЬ модуль. И отрефакторить при необходимости. Сейчас (28.02.17) на # продолжение воз...
conftest.py
from tempfile import TemporaryFile import threading import pytest from jeepney import ( DBusAddress, HeaderFields, message_bus, MessageType, new_error, new_method_return, ) from jeepney.io.threading import open_dbus_connection, DBusRouter, Proxy @pytest.fixture() def respond_with_fd(): name = "io.gitlab...
base.py
# Copyright 2014 ETH Zurich # # 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...
thread_write_file.py
#!/usr/bin/python # -*- coding: utf-8 -*- # python version 2.7.6 import threading,sys,fcntl mutex = threading.Lock() def writeWarnLog(file): with mutex: count=0; while count<100: file.write('2012-11-28 22:51:01|zookeeper|WARN|m1|172.17.1.15\n') count+=1 print 'write warn log finished' def writeE...
interface.py
#!/usr/bin/python -OO # Copyright 2007-2019 The SABnzbd-Team <team@sabnzbd.org> # # This program 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; either version 2 # of the License, or (at your option) any later...
gleam_url_fetcher.py
import json import threading from queue import Queue import argparse import sys import re from enum import Enum from collections import defaultdict import random from configparser import ConfigParser import socket import http.client import time from urllib.error import URLError import praw import requests from request...
wsgi.py
from __init__ import app, socketio, db, csrf from helper import tasks, helper from include import filters, views, websocket from helper.generators import generate_demo from threading import Thread from classes.logging import logger from classes.site_settings import site def start_threads(): logger.create_log(...
WebSocketService.py
# coding: utf-8 from socket import * import json, time, threading config = { 'HOST': '192.168.31.145', 'PORT': 1024, 'LISTEN_CLIENT': 50, 'KEY': '391f10fadc339e9ec5fa15af60030ac1', 'SIZE': 2048, 'TIME_OUT': 1000, 'HEART_TIME': 5, 'MAGIC_STRING': '258EAFA5-E914-47DA-95CA-C5AB0DC85B11',...
parser.py
# -*- coding: utf-8 -*- # # awsdbrparser/parser.py # # Copyright 2015 Amazon.com, Inc. or its affiliates. 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://w...
mouse_to_active_win.py
#-------------------------------------------------------------------------- # The MIT License (MIT) # # Copyright (c) 2014 Shahzeb Ihsan # # 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 Softwa...
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 #...
vwsfriend_base.py
import os import sys import re import argparse from datetime import datetime, timedelta, timezone import logging import time import tempfile import netrc import getpass import threading from pyhap.accessory_driver import AccessoryDriver from weconnect import weconnect from weconnect.__version import __version__ as _...
main.py
#!/usr/bin/python3 import os, sys, re, json, threading, queue from multiprocessing import Value from mcpi import minecraft from importlib import import_module print("Welcome to Minecraft Pi Forge.") root=os.path.dirname(os.path.abspath(__file__)) conf_path=os.path.join(root,"conf","main.json") if not os.path.isfile(c...
test_fcntl.py
"""Test program for the fcntl C module. """ import platform import os import struct import sys import unittest from multiprocessing import Process from test.support import verbose, cpython_only from test.support.import_helper import import_module from test.support.os_helper import TESTFN, unlink # Skip test if no fcn...
event_processor.py
""" Implementation details of the analytics event delivery component. """ # currently excluded from documentation - see docs/README.md from calendar import timegm from collections import namedtuple from email.utils import parsedate import errno import json from threading import Event, Lock, Thread import time import u...
loop.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # filename: loop.py # modified: 2019-09-11 __all__ = ["main"] import time import random from queue import Queue, Empty from collections import deque from threading import Thread, Lock, current_thread from requests.compat import json from requests.exceptions import Reques...
controller.py
# Copyright (c) 2021, NVIDIA 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...
app.py
from flask import Flask, jsonify, request, make_response from flask_cors import CORS from humps import camelize import json import threading from definitions.passenger import Passenger from definitions.patient import Patient import iris app = Flask(__name__) CORS(app) # ----------------------------------------------...
dell_storagecenter_blockdevice.py
# Copyright 2015 Dell 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 agree...
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...
GameClient.py
import Network from time import sleep from threading import Thread CALL_ROOMLIST = 0 CALL_WEAPLIST = 1 CALL_PLAYERLIST = 2 CALL_NEWPLAYER = 3 CALL_PLAYERLEFT = 4 CALL_CHAT = 5 CALL_PLAYERDAT = 6 CALL_ROOMSTAT = 7 CALL_LEAVEROOM = 8 CALL_SHOOT = 9 CALL_SCORE = 10 class GameClient(Network.Client): CONNECTING = 0 ...
intercept_handler.py
import errno import importlib import json import os import pdb import re import tempfile import time import threading from mitmproxy import http from urllib.parse import urlparse import lib from lib.agent_api import AgentApi from lib.hashed_request_decorator import HashedRequestDecorator from lib.joined_request impo...
dirbustEVERYTHING.py
#!/usr/bin/python import sys import os import subprocess import errno import multiprocessing from multiprocessing import Process import time import argparse #makedir function from https://stackoverflow.com/questions/600268/mkdir-p-functionality-in-python #Compatible with Python >2.5, but there is a more advanced func...
regrtest.py
#! /usr/bin/env python """ Usage: python -m test.regrtest [options] [test_name1 [test_name2 ...]] python path/to/Lib/test/regrtest.py [options] [test_name1 [test_name2 ...]] If no arguments or options are provided, finds all files matching the pattern "test_*" in the Lib/test subdirectory and runs them i...
racunalnik.py
""" .. module:: reversi.racunalnik .. moduleauthor:: Luka Lodrant <luka.lodrant@gmail.com, Lenart Treven <lenart.treven44@gmail.com> Interface racunalniskega igralca """ import random import time import threading from mislec import Mislec class Racunalnik: """ Interface racunalniskega igralca """ ...
process_manager.py
#!/usr/bin/env python3 # -*- coding:utf-8 -*- ''' 进程之间通过Manager 实现数据共享 ''' from multiprocessing import Process, Manager import os def test(dicts, lists): dicts['pid'] = os.getpid() lists.append(os.getpid()) if __name__ == '__main__': with Manager() as manager: # 生成一个可在多进程之间传递和共享信息的字典 m_d...
lisp.py
# ----------------------------------------------------------------------------- # # Copyright 2013-2019 lispers.net - Dino Farinacci <farinacci@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...
vrouterTest.py
# Copyright 2017-present Open Networking Foundation # # 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...
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...
image_face_detection.py
import cv2 import os import dlib import face_recognition from multiprocessing import Process, Manager import datetime import time import sys import argparse def recognize_face(cropped_image, face_location, return_dict, images): height, width = cropped_image.shape[:2] start = time.time() face_matched = Fals...
th_cap.py
import threading import queue import cv2 class ThreadingVideoCapture: def __init__(self, src, max_queue_size=256): self.video = cv2.VideoCapture(src) self.q = queue.Queue(maxsize=max_queue_size) self.stopped = False def start(self): thread = threading.Thread(target=self.updat...
cometa.py
""" Author: Emile Camus """ __license__ = """ Copyright 2015 Visible Energy 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 app...
transformasi2d.py
# Tim : MI6 # Anggota : # 1. Ferdian Ifkarsyah/13517024 # 2. Paulus Siahaan/13517 # 3. Renita Napitulu/13517 import OpenGL import OpenGL.GLU from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * from copy import copy, deepcopy import time import math import sys import threading exit = False d...
app.py
# Copyright 2014 OpenStack Foundation # Copyright 2014 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENS...
mem.py
"Utility functions for memory management" from ..imports.torch import * from ..core import * from ..script import * from ..utils.env import * import pynvml, functools, traceback, threading, time from collections import namedtuple import platform IS_IN_IPYTHON = is_in_ipython() use_gpu = torch.cuda.is_available() GP...
decorators.py
from threading import Thread def async(f): def wrapper(*args, **kwargs): thr = Thread(target = f, args = args, kwargs = kwargs) thr.start() return wrapper
dataloader.py
import os import torch from torch.autograd import Variable import torch.utils.data as data import torchvision.transforms as transforms from PIL import Image, ImageDraw from SPPE.src.utils.img import load_image, cropBox, im_to_torch from opt import opt from yolo.preprocess import prep_image, prep_frame, inp_to_i...
plugin_scheduler.py
# code for cores isolation was inspired by Tuna implementation # perf code was borrowed from kernel/tools/perf/python/twatch.py # thanks to Arnaldo Carvalho de Melo <acme@redhat.com> from . import base from .decorators import * import tuned.logs import re from subprocess import * import threading import perf import se...
x.py
import argparse import asyncio import importlib.util import logging import os import signal import traceback from multiprocessing import get_context from typing import List, Text, Optional, Tuple, Iterable import aiohttp import ruamel.yaml as yaml import rasa.cli.utils as cli_utils import rasa.utils.io as io_utils fr...
player.py
#coding:utf8 import pyglet #AVbin10 is needed from threading import Thread import time FWDREWNDTIME = 20 class Player(): parent = None paused = False stopped = False current_time = 0 vol = 0.0 def play_media(self): try: self.myplayer = pyglet.media.Player() ...
awb_client.py
import abc import amidi from collections.abc import Iterable from copy import copy from heapq import merge from importlib import import_module import jack import mawb_pb2 from midi import Event import modes import os import pickle from threading import Lock, Thread from typing import Any, Callable, Generator, IO, List...
extract_frames_main.py
# -*- coding: utf-8 -*- # Author: Haoran Chen # Date: 2019-3-12 import os import subprocess import multiprocessing as mp import time Path_Train = '/home/chenhaoran/kinetics-400-video/train' Path_Val = '/home/chenhaoran/kinetics-400-video/val' Path_Test = '/home/chenhaoran/kinetics-400-video/test' Path_Train_Out =...
XMLRPCPlugin.py
""" XML-RPC plugin for SpamBayes core server. This plugin opens an XML-RPC server in a separate thread listening to the given host and port (default localhost:5001). In Python 2.5 and later it also enforces a path (default /sbrpc). SECURITY NOTE: The XML-RPC plugin provide *NO SECURITY*. It would be unwise to list...
pdb2pqr_runner.py
import os, sys, time import glob import requests from multiprocessing import Process from legacy.src.pdb import readPDB from legacy.src.aconf import (STYLESHEET, WEBSITE, PDB2PQR_OPAL_URL, HAVE_PDB2PQR_OPAL, INSTALLDIR, ...
frontend.py
import logging import os import threading import time import pykka import requests from mopidy import core import netifaces from . import Extension from .brainz import Brainz logger = logging.getLogger(__name__) class OLEDConfig: def __init__(self, config=None): self.size = 128 class OLEDFrontend(pyk...
threaded_runner.py
# Copyright 2017 reinforce.io. 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 applicable law or...
proxy.py
# # Copyright Cloudlab URV 2020 # # 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 writin...
RdfFileHandler.py
import gzip import logging import os from multiprocessing import Process, Queue from datetime import datetime import osmutils from utils import format_date from RdfHandler import RdfHandler log = logging.getLogger('osm2rdf') def writer_thread(worker_id, queue, options): while True: ts, file_id, data, l...
solariot.py
#!/usr/bin/env python # Copyright (c) 2017 Dennis Mellican # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modi...
06_sifter_digitizer_bruker_integral_wurst.py
import sys import signal import datetime import numpy as np import atomize.math_modules.fft as fft_module import atomize.general_modules.general_functions as general import atomize.general_modules.return_thread as returnThread import atomize.device_modules.PB_ESR_500_pro as pb_pro import atomize.device_modules.Spectrum...
common_utils.py
r"""Importing this file must **not** initialize CUDA context. test_distributed relies on this assumption to properly run. This means that when this is imported no CUDA calls shall be made, including torch.cuda.device_count(), etc. torch.testing._internal.common_cuda.py can freely initialize CUDA context when imported....
batch_loader.py
import asyncio from logging import getLogger from threading import Thread from time import time from typing import Any, Callable, Dict, Iterable from kivy.clock import mainthread, Clock from kivy.event import EventDispatcher from kivy.uix.widget import Widget from tesseractXplore.app import get_app from tesseractXplo...
start.py
#!/usr/bin/env python import logging from concurrent.futures import ThreadPoolExecutor, as_completed from contextlib import suppress from itertools import cycle from json import load from math import log2, trunc from multiprocessing import RawValue from os import urandom as randbytes from pathlib import Path from secr...
global.py
from multiprocessing import Process, Queue def foo(q): q.put('hello') if __name__ == '__main__': q = Queue() for i in range(10): p = Process(target=foo, args=(q,)) p.start() while True: print(q.get())
task.py
############################################################################## # # Copyright (c) 2001, 2002 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # TH...
engine.py
""" """ import logging import smtplib import os from abc import ABC from datetime import datetime from email.message import EmailMessage from queue import Empty, Queue from threading import Thread from typing import Any, Sequence, Type from vnpy.event import Event, EventEngine from .app import BaseApp from .event imp...
crawler.py
from __future__ import absolute_import, unicode_literals import datetime import main.scraper.settings from main.scraper.models import ProductRecord from main.scraper.helpers import make_request, log, format_url, enqueue_url, dequeue_url from main.scraper.extractors import get_title, get_url, get_price, get_primary_img,...
util.py
import os import re import sys import time import json import requests from datetime import datetime from subprocess import run, PIPE, DEVNULL from multiprocessing import Process from urllib.parse import quote from config import ( IS_TTY, OUTPUT_PERMISSIONS, REPO_DIR, SOURCES_DIR, OUTPUT_DIR, ...
telloMain.py
from telloFunctions import * from pynput.keyboard import Key, Listener import time import cv2 import threading import numpy as np # VARIABLES # ---------------------------------------- # Control panel listener = None # To check wether listener thread is created keyPressed = None # Value of pressed keys trackOn = Fal...
update_repository.py
import abc import dataclasses import functools import hashlib import io import logging import re import sys import threading import zipfile from pathlib import Path from typing import Any, BinaryIO, Callable, Dict, IO, List, Optional, Tuple, Type, TypeVar, Union, cast from xml.etree import ElementTree as ET import kon...
indexer.py
# -*- coding: utf-8 -*- import multiprocessing import threading import unicodedata from django.db.utils import IntegrityError from .parser import Parser from django.db import transaction from collections import Counter from .models import * from nltk.tokenize import RegexpTokenizer from nltk.stem.snowball import Englis...
a3c.py
"""Asynchronous Advantage Actor-Critic (A3C) algorithm for reinforcement learning.""" from deepchem.models import TensorGraph from deepchem.models.tensorgraph.optimizers import Adam from deepchem.models.tensorgraph.layers import Feature, Weights, Label, Layer import numpy as np import tensorflow as tf import collectio...
steel.py
#!/usr/bin/env python # Copyright (c) 2019 Riverbed Technology, Inc. # # This software is licensed under the terms and conditions of the MIT License # accompanying the software ("License"). This software is distributed "AS IS" # as set forth in the License. import re import os import sys import time import glob imp...
parallel.py
# Copyright 2016 Google Inc. 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 applicable law or ag...
test_decimal.py
# Copyright (c) 2004 Python Software Foundation. # All rights reserved. # Written by Eric Price <eprice at tjhsst.edu> # and Facundo Batista <facundo at taniquetil.com.ar> # and Raymond Hettinger <python at rcn.com> # and Aahz (aahz at pobox.com) # and Tim Peters """ These are the test cases for the Decim...
sensors.py
import io import queue import struct import sys from math import ceil, floor from os import path from typing import List import numpy as np from bresenham import bresenham DIRECTORY = path.dirname(path.abspath(__file__)) sys.path.append(path.dirname(DIRECTORY)) # workaround for autopep8 moving imports to the top. if...
tsl2561.py
#!/usr/bin/python # -*- coding: utf-8 -*- import smbus import time import datetime import threading address = 0x39 # 0100101(7bit,0x39) READ_INT = 2 # [sec], each reading interval is to be grater than 2 sec LOG_INT = 600 # [sec] DEBUG = False # Dislpay a given message with the date def print_date_msg(msg): d ...
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...
whereBlindFunctionJSONStringifyInjection.py
import copy; import difflib; from util.output import verbose; from util.output import success; from util.output import failure; from util.output import question; from util.output import info; from util.output import bold; import threading; from itertools import combinations; class WhereBlindFunctionJSONStringifyInjec...
DPPO.py
""" A simple version of OpenAI's Proximal Policy Optimization (PPO). [https://arxiv.org/abs/1707.06347] Distributing workers in parallel to collect data, then stop worker's roll-out and train PPO on collected data. Restart workers once PPO is updated. The global PPO updating rule is adopted from DeepMind's paper (DPP...
mapping.py
import numpy as np from queue import Queue from threading import Thread, Lock, Condition import time from itertools import chain from collections import defaultdict from .optimization import LocalBA from .components import Measurement class Mapping(object): def __init__(self, graph, params): self.grap...
crs3_shared_memory.py
import random as rn import time import numpy as np import helpers as hp import functions as f import multiprocessing def get_G(x): return (np.sum(np.array(x), axis=0)/len(x)).tolist() def get_P(centroid, w): doubled_G = [2*x for x in centroid] return [doubled_G[i] - w[i] for i in range(len(centroid))] ...
web.py
from SimpleHTTPServer import SimpleHTTPRequestHandler import SocketServer from multiprocessing import Process, Queue from threading import Thread import os class Web(object): def __init__(self, initial_cwd): self.web_dir = initial_cwd + "/web" self.started = False self.filename = None ...