source
stringlengths
3
86
python
stringlengths
75
1.04M
netvm.py
# coding: UTF-8 # Copyright 2020 Hideto Manjo. # # Licensed under the MIT License """Network virtual memory module.""" import threading import socket from margaret.core.memory import VirtualMemory from margaret.core.formats import NumpyRawFormat class NetVM(VirtualMemory): """NetVM. Network virtual memory i...
tests.py
""" Unit tests for reverse URL lookups. """ import sys import threading from admin_scripts.tests import AdminScriptTestCase from django.conf import settings from django.conf.urls import include, url from django.contrib.auth.models import User from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist f...
BayesianDesigner.py
from functools import partial from threading import Thread,Condition import copy import pandas as pd import numpy as np from sklearn.preprocessing import StandardScaler, MinMaxScaler from scipy.stats import norm as scipynorm from matplotlib import pyplot as plt from .PawsPlugin import PawsPlugin class BayesianDesign...
httpclient_test.py
#!/usr/bin/env python from __future__ import absolute_import, division, print_function, with_statement import base64 import binascii from contextlib import closing import functools import sys import threading import datetime from io import BytesIO from tornado.escape import utf8 from tornado.httpclient import HTTPRe...
pivideostream.py
# import the necessary packages from picamera.array import PiRGBArray from picamera import PiCamera from threading import Thread import cv2 import time class PiVideoStream: def __init__(self, resolution=(320, 240), framerate=32, **kwargs): # initialize the camera self.camera = PiCamera() # set camera parameter...
BlockCompressor.py
from os import remove from nsz.nut import Print from time import sleep from pathlib import Path from traceback import format_exc from zstandard import ZstdCompressor from nsz.ThreadSafeCounter import Counter from nsz.SectionFs import isNcaPacked, sortedFs from multiprocessing import Process, Manager from nsz.Fs import ...
3_5_example.py
# -*- coding: utf-8 -*- """ This recipe describes how to handle asynchronous I/O in an environment where you are running Tkinter as the graphical user interface. Tkinter is safe to use as long as all the graphics commands are handled in a single thread. Since it is more efficient to make I/O channels to block and wait ...
framework.py
#!/usr/bin/env python from __future__ import print_function import gc import sys import os import select import unittest import tempfile import time import faulthandler import random import copy from collections import deque from threading import Thread, Event from inspect import getdoc, isclass from traceback import ...
task.py
import atexit import json import os import shutil import signal import sys import threading import time from argparse import ArgumentParser from logging import getLogger from operator import attrgetter from tempfile import mkstemp, mkdtemp from zipfile import ZipFile, ZIP_DEFLATED try: # noinspection PyCompatibili...
cifar10_main.py
import argparse import datetime import getpass import logging import os import shutil import threading import time from urllib import parse import tensorflow as tf import tensorflow.keras.backend as ktf from tensorflow.python.estimator.run_config import RunConfig from tensorflow.python.estimator.training import TrainS...
bucketcapture.py
# -*- coding: utf-8 -*- """ Created on Tue Jan 24 20:46:25 2017 @author: mtkes """ ## NOTE: OpenCV interface to camera controls is sketchy ## use v4l2-ctl directly for explicit control ## example for dark picture: v4l2-ctl -c exposure_auto=1 -c exposure_absolute=10 # import the necessary packages import cv2 from su...
testMP.py
#!/usr/bin/env python # # Simple example which uses a pool of workers to carry out some tasks. # # Notice that the results will probably not come out of the output # queue in the same in the same order as the corresponding tasks were # put on the input queue. If it is important to get the results back # in the origina...
Saltadder.py
import os import sys import argparse import threading pasr=argparse.ArgumentParser(description="Salt Adder in PasswordList",epilog='''Usage Instruction : ./saltadder -s salt -p passwordlist -t threads -l 0 -o Out...
serve_normalize.py
""" sentry.management.commands.serve_normalize ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2018 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import, print_function import SocketServer import base64 import os import...
run_cmd.py
import argparse from threading import Thread from scrabble.engine import ClientEngine, ReplayEngine, ServerEngine def init_parser(): parser = argparse.ArgumentParser(description='Scrabble game', prog='scrabble') subparsers = parser.add_subparsers(required=True) server = subparsers.add_parser('host', hel...
utils.py
from bitcoin.core import COIN # type: ignore from bitcoin.rpc import RawProxy as BitcoinProxy # type: ignore from bitcoin.rpc import JSONRPCError from contextlib import contextmanager from pathlib import Path from pyln.client import RpcError from pyln.testing.btcproxy import BitcoinRpcProxy from collections import Or...
mp_process05.py
from multiprocessing import Process, Pipe def func(conn): conn.send([42, None, 'hello']) conn.close() if __name__ == '__main__': parent_conn, child_conn = Pipe() p = Process(target=func, args=(child_conn,)) p.start() print(parent_conn.recv()) # prints "[42, None, 'hello']" p.join()
animation.py
from threading import Thread import time import pygame from pygame_widgets import Button class AnimationBase: def __init__(self, widget, timeout, allowMultiple=False, **kwargs): """Base for animations :param widget: The widget that the animation targets :param time: The time of the anima...
quick_chats.py
import flatbuffers import multiprocessing import queue from threading import Thread from rlbot.messages.flat import QuickChat from rlbot.messages.flat import QuickChatSelection from rlbot.utils.logging_utils import get_logger def get_quick_chats(): """ Look for quick chats from here: https://github.com/R...
Main.py
# -*- coding: UTF-8 -*- import os from multiprocessing import Process from wx.lib.agw import ultimatelistctrl as ULC from webserver import PythonWebServer from images import images as image from presenter.presenter import * from task.task import Task import lang.lang as LANG import tool.tools as tool USE_GENERIC = 0...
OptimalThresholdSVM.py
# This script computes the best SVM threshold value that maximises the F1 score. # Please set the validation_set_path variable to the current location of the validation samples before running the script. import numpy as np import glob, os import matplotlib.pyplot as plt from math import copysign from sklearn.metrics.c...
test_sockets.py
from __future__ import print_function import os, multiprocessing, subprocess, socket, time from runner import BrowserCore, path_from_root from tools.shared import * node_ws_module_installed = False try: NPM = os.path.join(os.path.dirname(NODE_JS[0]), 'npm.cmd' if WINDOWS else 'npm') except: pass def clean_process...
api.py
""" API ====== """ import zipfile try: import queue except ImportError: import Queue as queue import threading import datetime import math import requests import mimetypes import os try: from urllib.parse import urlunparse, urlencode, urlparse, parse_qs except ImportError: from urllib import urlencode ...
main.py
import threading NUM_THREAD = 10 printed = False def print_text(): print ("printed once") threads = [] for i in range (NUM_THREAD): t = threading.Thread (target=print_text) threads.append(t) t.start() for i in range (NUM_THREAD): threads[i].join()
context.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...
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...
main.py
import pickle from json import dumps from time import sleep import os from watchdog.events import FileSystemEventHandler from watchdog.observers import Observer from threading import Thread import logging import sys import socket import errno from kivy import Logger from _thread import interrupt_main # --------Binary ...
test_hdfs3.py
from __future__ import unicode_literals import io import multiprocessing import os import posixpath import tempfile import sys from random import randint try: from queue import Queue except ImportError: from Queue import Queue from threading import Thread import traceback import pytest from hdfs3 import HDFi...
lisp-itr.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...
softmax_mpi.py
#!/usr/bin/env python """ DMLC submission script, MPI version """ import argparse import sys import os import subprocess import tracker from threading import Thread parser = argparse.ArgumentParser(description='DMLC script to submit dmlc job using MPI') parser.add_argument('-n', '--nworker', required=True, type=int, ...
wallet.py
# Electrum - lightweight Bitcoin client # Copyright (C) 2015 Thomas Voegtlin # # 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 t...
pool.py
# Copyright 2017 Red Hat, 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, ...
test_operator_gpu.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...
upload_wpt_results_test.py
# Copyright 2018 The WPT Dashboard Project. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import BaseHTTPServer import cgi import json import os import shutil import subprocess import tempfile import threading import unittest import zlib her...
trainer.py
# Lint as: python3 # Copyright 2018 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 ...
authorization_code.py
#!/usr/bin/python3 # coding: utf-8 from local_server import runHTTPServer, acode import threading import requests from pprint import pprint import json #from manager import uuid authority_url = 'http://127.0.0.1:5000/oauth/authorize' token_url = 'http://127.0.0.1:5000/oauth/token' api_port=5000 auth_url='http://127.0...
tasks.py
import os from threading import Thread from invoke import run, task from time import sleep @task def dropdb(context): from palaverapi.models import database, Device, Token Token.drop_table(True) Device.drop_table(True) @task def syncdb(context): from palaverapi.models import database, Device, Token...
snapshotter.py
#!/usr/bin/env python # # VM Backup extension # # Copyright 2014 Microsoft 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 # # U...
build.py
## @file # build a platform or a module # # Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR> # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR> # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD Li...
cclient2.py
import socket import threading conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM) conn.connect(("127.0.0.1", 14900)) # Задание №4 # КЛИЕНТ def outgoing(): while True: message = input() conn.send(b"Client 2: " + message.encode("utf-8")) def incoming(): while True: a = conn.rec...
process.py
# -*- coding: utf-8 -*- # Import python libs from __future__ import absolute_import import os import sys import time import types import signal import subprocess import logging import multiprocessing import multiprocessing.util import threading # Import salt libs import salt.defaults.exitcodes import salt.utils impo...
_test_multiprocessing.py
# # Unit tests for the multiprocessing package # import unittest import queue as pyqueue import contextlib import time import io import itertools import sys import os import gc import errno import signal import array import socket import random import logging import struct import operator import weakref import test.su...
test_stub.py
''' Create an unified test_stub to share test operations @author: Youyk ''' import os import subprocess import sys import time import threading import zstacklib.utils.ssh as ssh import zstackwoodpecker.test_lib as test_lib import zstackwoodpecker.test_util as test_util import zstackwoodpecker.zstack...
train.py
#!/usr/bin/env python import os import json import torch import numpy as np import queue import pprint import random import shutil import time import argparse import importlib import threading import traceback import torch.distributed as dist import torch.multiprocessing as mp from tqdm import tqdm from py3nvml.py3nvm...
EIH_Attenuation_Sim_Main.py
from os import getpid from multiprocessing import Pool, Queue, cpu_count, get_context from queue import Empty import time from ErgodicHarvestingLib.EIH_API_Sim_Entropy import EIH_Sim from ErgodicHarvestingLib.utils import print_color def QueueWorker(mp_queue): while True: try: arg...
__init__.py
import os import struct import numpy as np import pandas as pd from abc import ABC, abstractmethod class Dataset(ABC): """ Abstract data interface class. """ @abstractmethod def __init__(self): """ Must define: self.X -- numpy array of data samples; sel...
__init__.py
import logging import os import subprocess import sys import threading from typing import Optional, List, Tuple import requests from orangeshare import Config from orangeshare.temp_dir import temp_dir from orangeshare.updater.UpdatePopup import UpdatePopup class Updater: _instance = None @staticmethod ...
LocalDispatcher.py
########################################################################## # # Copyright (c) 2013-2014, 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: # # * Redi...
NetworkClientGUI.py
import re import time import netifaces as netifaces from PyQt5 import QtWidgets from PyQt5.uic.properties import QtGui from RigParams import RigParams from OmniRigQTControls import OmniRigQTControls __author__ = '@sldmk' import random from PyQt5.QtGui import QPalette, QColor import sys from PyQt5.QtCore import Qt f...
process_name_1.py
from multiprocessing import Process, current_process import time import os def fun(val): process = os.getpid() parent_process = os.getppid() name = current_process().name print('==='*15 + ' < ' + f'{name}' + ' > ' + '==='*15) print(f'starting fun Process={process} VAL={val}') print(f'Parent ID...
utils.py
import aioboto3 import boto3 import random import yaml import multiprocessing as mp from runners.helpers import db from runners.helpers.dbconfig import ROLE as SA_ROLE def updated(d=None, *ds, **kwargs): """Shallow merges dictionaries together, mutating + returning first arg""" if d is None: d = {} ...
tvhProxy.py
from gevent import monkey monkey.patch_all() import json from dotenv import load_dotenv from ssdp import SSDPServer from flask import Flask, Response, request, jsonify, abort, render_template from gevent.pywsgi import WSGIServer import xml.etree.ElementTree as ElementTree from datetime import timedelta, datetime, time ...
fb2twilio.py
import creds import threading from fbchat import Client from fbchat.models import * from twilio.rest import Client as TwilioClient def forwardMsg(msg): tclient.messages.create( to=creds.twilio['phone'], from_=creds.twilio['twilio_phone'], body=str(msg) ) class CustomClient(Client): ...
windows.py
import collections import ctypes import ctypes.wintypes import os import socket import struct import threading import time import argparse import pydivert import pydivert.consts import pickle import socketserver PROXY_API_PORT = 8085 class Resolver: def __init__(self): self.socket = None self.l...
HVAC_Controller.py
""" Hi Welcome to the HVAC controller of the.... ______ ______ _ _ _ _____ _ | ___ \ | ___ \ (_) | | | / ___| | | | |_/ / __ _ ___ ___ | |_/ /_ _ _| | __| | \ `--. _ _ ___| |_ ___ _ __ ___ | ___ \/ _` / __|/ _ ...
parasol.py
# Copyright (C) 2015-2021 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...
pydoc.py
#!/usr/bin/env python # -*- coding: latin-1 -*- """Generate Python documentation in HTML or text for interactive use. In the Python interpreter, do "from pydoc import help" to provide online help. Calling help(thing) on a Python object documents the object. Or, at the shell command line outside of Python: Run "pydo...
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...
loadable_elf_example_test.py
import os import pexpect import serial import sys import threading import time try: import IDF except ImportError: test_fw_path = os.getenv('TEST_FW_PATH') if test_fw_path and test_fw_path not in sys.path: sys.path.insert(0, test_fw_path) import IDF import Utility class CustomProcess(object)...
bench-encoding.py
from turbojpeg import TurboJPEG from nvjpeg import NvJpeg import cv2 import time from functools import partial from threading import Thread from queue import Queue import gc import argparse class Timer: def __enter__(self): self.start = time.time() return self def __exit__(self, *args...
httpclient_test.py
#!/usr/bin/env python from __future__ import absolute_import, division, print_function, with_statement import base64 import binascii from contextlib import closing import functools import sys import threading from tornado.escape import utf8 from tornado.httpclient import HTTPRequest, HTTPResponse, _RequestProxy, HTT...
harvest.py
from multiprocessing import Process, Manager import time import os import sys import harvester # Set Global Variables URL_SOURCE = 'URI.txt' if len(sys.argv) > 1: URL_SOURCE = sys.argv[1] AUTO_PROCESS_OVERFLOW = True DATABASE_FILE = 'data/ld-database.db' DATABASE_TEMPLATE = 'database/create_database.sql' WORK_QUEU...
main.py
import socket import utils import threading HOST = '127.0.0.1' # IP do servidor SERVER_PORT = 5000 # Porta onde o servidor está escutando STREAM_HOST = '127.0.0.1' # IP do servidor de streaming STREAM_PORT = 5555 # Porta do servidor com o streaming # def init_logs(): # global logged_users # logged_users...
test_radius.py
# RADIUS tests # Copyright (c) 2013-2016, Jouni Malinen <j@w1.fi> # # This software may be distributed under the terms of the BSD license. # See README for more details. import binascii import hashlib import hmac import logging logger = logging.getLogger() import os import select import struct import subprocess import...
qt.py
#!/usr/bin/env python # # Electrum - Lightweight Bitcoin Client # Copyright (C) 2015 Thomas Voegtlin # # 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...
rabbit_sub_throughput.py
import os from os.path import dirname import sys sys.path.append((dirname(sys.path[0]))) from arguments import argparser import time import datetime import pika from multiprocessing import Process def pub(n_sec, topic): start = time.time_ns() cnt = 0 connection = pika.BlockingConnection(pika.ConnectionPara...
scrape_polo_feather.py
# core import os import sys import time from datetime import datetime, timedelta from threading import Thread import traceback # installed # if running from the code/ folder, this will try to import # a module Poloniex from the folder. Better to run from within the # poloniex folder as a result from poloniex import P...
tpu_estimator.py
# Copyright 2017 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...
site_list.py
#! /usr/bin/env python3 """Snoop: скрипт для обновления БД списка сайтов """ import json import sys import requests import threading import xml.etree.ElementTree as ET from datetime import datetime from argparse import ArgumentParser, RawDescriptionHelpFormatter pool = list() pool1 = list() def get_rank(domain_to_q...
io.py
# # Copyright (c) 2020, 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 ...
build_incremental_dexmanifest.py
# Copyright 2015 The Bazel 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 applicable la...
maker.py
#!/usr/bin/env python import requests, logging from threading import Thread, Event logging.basicConfig(format='%(asctime)s - %(levelname)s: %(message)s') _logger = logging.getLogger(__name__) _logger.setLevel(logging.INFO) class Maker(): _maker_key = 'nmr2BnBoPJPDkNvfz3bk0' def send(self, event, params=None)...
train_hybrid1.py
#!/usr/bin/env python """ Main training workflow """ from __future__ import division import argparse import glob import os import random import signal import time import torch from pytorch_transformers import BertTokenizer import distributed from models import data_loader, model_builder from models.data_loader i...
github.py
import copy import json import re import threading import time from urllib.request import urlopen from i3pystatus import IntervalModule, formatp from i3pystatus.core import ConfigError from i3pystatus.core.desktop import DesktopNotification from i3pystatus.core.util import user_open, internet, require try: import...
health_manager.py
from template_finder import TemplateFinder from ui_manager import UiManager from belt_manager import BeltManager from pather import Location import cv2 import time import keyboard from utils.custom_mouse import mouse from utils.misc import cut_roi, color_filter, wait from logger import Logger from screen import Screen ...
select_ticket_info.py
# -*- coding=utf-8 -*- import datetime import random import os import socket import sys import threading import time import TickerConfig import wrapcache from agency.cdn_utils import CDNProxy from config import urlConf, configCommon from config.TicketEnmu import ticket from config.configCommon import seat_conf_2, seat_...
keepkey.py
from binascii import hexlify, unhexlify import traceback import sys from electrum.util import bfh, bh2u, 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 electrum.transac...
conftest.py
# Copyright (c) 2019 SUSE LINUX GmbH # # 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 w...
threadpool.py
#!/usr/bin/env python # -- Content-Encoding: UTF-8 -- """ Cached thread pool, inspired from Pelix/iPOPO Thread Pool :author: Thomas Calmant :copyright: Copyright 2019, Thomas Calmant :license: Apache License 2.0 :version: 0.4.0 .. Copyright 2019 Thomas Calmant Licensed under the Apache License, Version 2.0 ...
coach.py
# # Copyright (c) 2017 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
installwizard.py
import sys import threading import os import traceback from typing import Tuple, List from PyQt5.QtCore import * from qtum_electrum.wallet import Wallet, Abstract_Wallet from qtum_electrum.storage import WalletStorage from qtum_electrum.util import UserCancelled, InvalidPassword, WalletFileException from qtum_electr...
feature_shutdown.py
#!/usr/bin/env python3 # Copyright (c) 2018 The Bitcoin Core developers # Copyright (c) 2017-2020 The Sheet Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test sheetd shutdown.""" from threading import Thread ...
favorites.py
import datetime import logging import re import threading from telegram import ForceReply from telegram import InlineKeyboardButton from telegram import InlineKeyboardMarkup, ReplyKeyboardMarkup from telegram.ext import ConversationHandler import captions import mdformat import const import settings import util from ...
process_control.py
# TODO more comprehensive tests from __future__ import division from __future__ import absolute_import # XXX is this necessary? from wx.lib.agw import pyprogress import wx from libtbx import thread_utils from libtbx import runtime_utils from libtbx import easy_pickle from libtbx import easy_run from libtbx.utils impo...
code.py
# Copyright (c) 2011-2020 Eric Froemling # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish,...
bot.py
import telebot; from telebot import types; import threading; from aitextgen import aitextgen; from functions import *; from config import TOKEN; import psutil; import os; pid = os.getpid() py = psutil.Process(pid) queue = [] ai = aitextgen(model_folder="model") bot = telebot.TeleBot(TOKEN) @bot.message_handler(com...
data_reader.py
import threading import Queue import operator import os import sys class MapReduce: ''' MapReduce - to use, subclass by defining these functions, then call self.map_reduce(): parse_fn(self, k, v) => [(k, v), ...] map_fn(self, k, v) => [(k, v1), (k, v2), ...] reduce_fn(se...
engine.py
# -*- coding: utf-8 -*- """The multi-process processing engine.""" from __future__ import unicode_literals import abc import ctypes import logging import os import signal import sys import threading import time from plaso.engine import engine from plaso.engine import process_info from plaso.lib import definitions fr...
run.py
# -*- coding: UTF-8 -*- from gevent import monkey monkey.patch_all() import multiprocessing import config import spider import availability import persistence import web # 进程间队列 # 爬取的代理 queue_verification = multiprocessing.Queue(config.COROUTINE_NUM) # 待持久化的代理 queue_persistence = multiprocessing.Queue() # 多进程列表 wor...
rest.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...
parallel_cp.py
#!/usr/bin/env python3 # vim: tabstop=4:shiftwidth=4:smarttab:noexpandtab # parallel_cp.py # Copy a file (presumably from a network-mounted filesystem) # in multiple parts simultaneously to minimize the slowing effects # of latency or a shared connection (at the expense of increased disk IO). # # You can accomplish t...
gcsio_test.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
cursor_wrapper.py
import logging from threading import Thread from time import time from django.db.backends.utils import CursorWrapper from .log_object import SqlLogObject, settings log = logging.getLogger('dl_logger') class CursorLogWrapper(CursorWrapper): def execute(self, sql, params=None): return self.log_query(super(...
BaseSpider.py
import datetime from src.threadPool.ImageThreadPool import ImageThreadPool from src.util import util from copy import deepcopy import json from src.util.constant import BASE_DIR, EXPIRE_TIME_IN_SECONDS, BASE_PATH, QR_CODE_MAP_KEY import re import logging from src.web.entity.UserInfo import UserInfo from src.web.web_ut...
test_order.py
import pytest import grpc import threading from stub.test_pb2 import EchoRequest, Empty from order_stub.order_pb2 import OrderCreateReq @pytest.fixture(scope='module') def grpc_add_to_server(): from stub.test_pb2_grpc import add_EchoServiceServicer_to_server from order_stub.order_service_pb2_grpc import add_...
ri_vmware.py
import requests import json import os import subprocess as sp from threading import Thread import socket # https://www.youtube.com/watch?v=AsOm56jGNCE&ab_channel=ThePacketThrower # openssl req -x509 -sha256 -nodes -newkey rsa:4096 -keyout vmware-key.pem -out vmware-crt.pem -days 365 class VmWare: def __init__(se...
conftest.py
import pytest import time from context import HGECtx, HGECtxError, ActionsWebhookServer, EvtsWebhookServer, HGECtxGQLServer, GQLWsClient, PytestConf import threading import random from datetime import datetime import sys import os from collections import OrderedDict def pytest_addoption(parser): parser.addoption( ...
relay_integration.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...
xapp_frame.py
# ================================================================================== # Copyright (c) 2020 Nokia # Copyright (c) 2020 AT&T Intellectual Property. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You ...
classification.py
from multiprocessing import Process import matplotlib.pyplot as plt import show_slices as sl import tensorflow as tf import nibabel as nib import numpy as np import math import cv2 tf.compat.v1.disable_eager_execution() def calc(): img_px = math.ceil(50/4) slice_ct = math.ceil(30/4) return img_px * img_...