source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
mutual_exclusion.py | '''
El propósito de este snipet es demostrar el uso de
mutual exlusion protegido , es decir con los metodos de adquitur y liberar.
Con estos puede solatr el lapiz.
'''
#!/usr/bin/env python3
""" Two shoppers adding items to a shared notepad """
import threading
import time
garlic_count = 0
pencil = threading.Lo... |
ssm_tunnel_cli.py | #!/usr/bin/env python3
# Set up IP tunnel through SSM-enabled instance.
#
# See https://aws.nz/aws-utils/ssm-tunnel for more info.
#
# Author: Michael Ludvig (https://aws.nz)
import os
import sys
import time
import copy
import errno
import threading
import random
import struct
import select
import fcntl
import argpar... |
wake.py | """Wake word support."""
import json
import os
import re
import shutil
import struct
import subprocess
import threading
import time
from pathlib import Path
from typing import Any, Dict, Iterable, List, Optional, Type
from rhasspy.actor import RhasspyActor
from rhasspy.events import (
AudioData,
ListenForWakeW... |
mocker.py | # Copyright (C) 2019 by eHealth Africa : http://www.eHealthAfrica.org
#
# See the NOTICE file distributed with this work for additional information
# regarding copyright ownership.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with
# the License. Y... |
affected_genomic_model_etl.py | """Affected Genomic Model ETL."""
import logging
import multiprocessing
from etl import ETL
from etl.helpers import TextProcessingHelper, ETLHelper
from files import JSONFile
from transactors import CSVTransactor, Neo4jTransactor
class AffectedGenomicModelETL(ETL):
"""ETL for adding Affected Genomic Model."""
... |
mirage.py | #!/usr/bin/env python
import argh
import shutil
import os
import posixpath
import http.server
import socketserver
import threading
import time
import uglipyjs
import urllib.request, urllib.parse, urllib.error
import webbrowser
import yaml
from csscompressor import compress
from libcloud.storage.types import Provider,... |
util.py | # Copyright (c) 2014-2018 Barnstormer Softworks, Ltd.
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import, print_function
import d... |
main.py | # coding=utf-8
# main script for training and testing mask rcnn on MSCOCO dataset
# multi gpu version
import sys, os, argparse
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # so here won't have poll allocator info
# solve the issue of a bug in while loop, when you import the graph in multi-gpu, prefix is not added in while... |
item_38.py | #!/usr/bin/env python3
# Copyright 2014 Brett Slatkin, Pearson Education 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 re... |
consumers.py | import json
import threading
from alexa_client import AlexaClient
from channels.generic.websocket import WebsocketConsumer
from requests.exceptions import HTTPError
from django.conf import settings
from alexa_browser_client import constants, helpers
class AuthenticationError(IOError):
pass
class MissingRefre... |
Prefetcher.py | import threading
import Queue
import time
import random
import os.path as osp
import numpy as np
from PIL import Image
from ..utils.dataset_utils import parse_im_name
#ospj = osp.join
ospeu = osp.expanduser
# from TrainSet import Trainset.pre_process_im
class Counter(object):
"""A thread safe counter."""
def ... |
process01.py | """
进程模块使用,基础示例
"""
# 不能选带横线的
import multiprocessing
from time import sleep
a = 1
# 进程执行函数
def fun():
print("开始运行第一个进程")
sleep(2)
global a
print(a)
a = 100 # 打印子进程a
print("第一个进程结束")
# 实例化进程对象
p = multiprocessing.Process(target=fun)
# 启动进程 此刻才会产生进程,运行fun函数
p.start()
print("第二个进程开始运行")
slee... |
server.py | from functools import partial
from io import StringIO
import multiprocess as mp
import cytoolz as toolz
import os.path as op
import platform
import logging
import logging.handlers
import socket
import tempfile
import json
import time
import os
from flask import Flask
from flask import request, jsonify
# from flask_re... |
gfs_retrieve_latest.py | #!/usr/bin/env python
from __future__ import print_function
from datetime import datetime, timedelta
from os import makedirs, path
from posixpath import basename
from shutil import copyfileobj
from sys import argv
from tempfile import gettempdir
from threading import Thread
from urllib2 import urlopen
from urlparse i... |
test_client.py | import os
import pytest
import time
import sys
import logging
import queue
import threading
import _thread
from unittest.mock import patch
import numpy as np
from ray.util.client.common import OBJECT_TRANSFER_CHUNK_SIZE
import ray.util.client.server.server as ray_client_server
from ray.tests.client_test_utils import c... |
smbrelayx.py | #!/usr/bin/env python
# SECUREAUTH LABS. Copyright 2018 SecureAuth Corporation. All rights reserved.
#
# This software is provided under under a slightly modified version
# of the Apache Software License. See the accompanying LICENSE file
# for more information.
#
# SMB Relay Module
#
# Author:
# Alberto Solino (@agso... |
oplog_manager.py | # Copyright 2013-2014 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
httpsever.py | # coding:utf-8
########
# 参考:https://www.cnblogs.com/xinyangsdut/p/9099623.html
########
import socket
import re
import psutil
import json
import os
import time
from threading import Thread
from queue import Queue
# 设置静态文件根目录
HTML_ROOT_DIR = "./html"
os.chdir(os.path.dirname(__file__))
class HTTPServer(object):
... |
SharedMemoryRunner.py | # Copyright 2017 Battelle Energy Alliance, 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... |
_debugger_case_check_tracer.py | import threading, atexit, sys
from collections import namedtuple
import os.path
if sys.version_info[0] >= 3:
from _thread import start_new_thread
else:
from thread import start_new_thread
FrameInfo = namedtuple('FrameInfo', 'filename, name, f_trace')
def _atexit():
sys.stderr.flush()
sys.stdout.flus... |
test_setup.py | """Test component/platform setup."""
# pylint: disable=protected-access
import asyncio
import os
from unittest import mock
import threading
import logging
import voluptuous as vol
from homeassistant.core import callback
from homeassistant.const import (
EVENT_HOMEASSISTANT_START, EVENT_COMPONENT_LOADED)
import ho... |
dbt_integration_test.py | #
# MIT License
#
# Copyright (c) 2020 Airbyte
#
# 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, pu... |
receiver.py | import hmac
import logging
import time
import traceback
import websocket
import json
import os
from threading import Thread
from pydantic import BaseModel
from ..core.playbooks.playbooks_event_handler import PlaybooksEventHandler
from ..core.model.env_vars import INCOMING_REQUEST_TIME_WINDOW_SECONDS, RUNNER_VERSION
fr... |
mock_server.py | # Copyright 2018 Cable Television Laboratories, 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... |
federated_learning_keras_consensus_FL_threads_CIFAR100_gradients_exchange.py | from DataSets import CIFARData
from DataSets_task import CIFARData_task
from consensus.consensus_v4 import CFA_process
from consensus.parameter_server_v2 import Parameter_Server
# use only for consensus , PS only for energy efficiency
# from ReplayMemory import ReplayMemory
import numpy as np
import os
import tensorflo... |
tracker.py | """
Tracker script for DMLC
Implements the tracker control protocol
- start dmlc jobs
- start ps scheduler and rabit tracker
- help nodes to establish links with each other
Tianqi Chen
"""
# pylint: disable=invalid-name, missing-docstring, too-many-arguments, too-many-locals
# pylint: disable=too-many-branches, too... |
camera.py | """camera.py
This code implements the Camera class, which encapsulates code to
handle IP CAM, USB webcam or the Jetson onboard camera. In
addition, this Camera class is further extended to take a video
file or an image file as input.
"""
import logging
import threading
import subprocess
import numpy as np
import c... |
main.py | from collections import defaultdict
from getpass import getuser
from fastapi import FastAPI, WebSocket
from pyparsing import And
import uvicorn
import poseEstimation
import mediapipe as mp
import calculator as calc
import time, threading, queue
import datetime as dt
import json
app = FastAPI(title='ESMA API')
mpPose ... |
server_launcher.py | #!/usr/bin/python
from conans.server.service.authorize import BasicAuthorizer, BasicAuthenticator
import os
from conans.server.conf import get_file_manager
from conans.server.rest.server import ConanServer
from conans.server.crypto.jwt.jwt_credentials_manager import JWTCredentialsManager
from conans.server.crypto.jwt.j... |
set_proxy.py | from PyQt5.QtWidgets import QDialog, QApplication
from PyQt5.uic import loadUi
from PyQt5.QtCore import pyqtSlot, Qt, pyqtSignal
import sys
import urllib.request
import urllib.error
import urllib.parse
import threading
class SetProxies(QDialog):
signal_update = pyqtSignal(str)
proxy_selected = pyqtSignal(str... |
main.py | from datetime import datetime
from http.server import BaseHTTPRequestHandler
from http.server import HTTPServer
from threading import Event
from threading import Thread
from time import sleep
from analysis import Analysis
from logs import Logs
from trading import Trading
from twitter import Twitter
# Whether to send ... |
iCopy.py | import time, logging, re, chardet
from telegram.ext import (
Updater,
CommandHandler,
MessageHandler,
Filters,
CallbackQueryHandler,
ConversationHandler,
)
from telegram.ext.dispatcher import run_async
import utils
from utils import (
folder_name,
sendmsg,
restricted,
menu_keyboa... |
compare_Wchain_sgd_5layers.py | import qiskit
import numpy as np
import sys
sys.path.insert(1, '../')
import qtm.base, qtm.constant, qtm.ansatz, qtm.fubini_study, qtm.encoding
import importlib
import multiprocessing
importlib.reload(qtm.base)
importlib.reload(qtm.constant)
importlib.reload(qtm.ansatz)
importlib.reload(qtm.fubini_study)
def run_wcha... |
certs.py | #!/usr/bin/env python
#
# Generic script to get the days left to expire for https certs
#
import argparse
import datetime
import json
import subprocess
import sys
from threading import Thread
#------------------------------------------------------------------------------
# Group
group = 'HTTPS check'
# Description... |
pod.py | """
Pod related functionalities and context info
Each pod in the openshift cluster will have a corresponding pod object
"""
import logging
import os
import re
import yaml
import tempfile
import time
import calendar
from threading import Thread
import base64
from ocs_ci.ocs.ocp import OCP, verify_images_upgraded
from ... |
_time_summary.py | # mypy: ignore-errors
import atexit
from contextlib import contextmanager
import os
import time
from typing import Callable, Dict, Generator, Optional, Tuple
import threading
import queue
import multiprocessing as mp
import torch
import weakref
from pytorch_pfn_extras.reporting import DictSummary
Events = Tuple[tor... |
train_dppo2_mlp.py | import os
import sys
import time
from datetime import datetime
import gym
import gym_gazebo2
import tensorflow as tf
import multiprocessing
import threading
from importlib import import_module
from baselines import bench, logger
from baselines.ppo2 import ppo2
from baselines.common.vec_env.dummy_vec_env import DummyV... |
ROMEOavery.py | import requests
import os
import sys
import threading
import time
import json
import asyncio
import discord
import aiohttp
from pypresence import Presence
from discord import Webhook, AsyncWebhookAdapter
from discord.ext import commands
os.system(f'cls & mode 85,20 & title [Avery Nuker] - Configuration')
token = inp... |
detector_utils.py | # Utilities for object detector.
import numpy as np
import sys
import tensorflow as tf
import os
from threading import Thread
from datetime import datetime
import cv2
from utils import label_map_util
from collections import defaultdict
detection_graph = tf.Graph()
sys.path.append("..")
# score threshold for showing... |
ppequeue.py | from concurrent import futures
import queue
import threading
import time
class JobManager(object):
def __init__(self,jobs):
self.jobs=jobs
self.result=queue.Queue()
self.threads=[]
self.process_task_done=False
self.init_threads()
def init_threads(self):
t=thread... |
verify.py | from sec2j import sec2j
from multiprocessing import Process, Queue
import os
import time
import numpy as np
import h5py
import sys
import random
def write_h5file(q):
# print 'Here'
fname = '/home/adaszews/mnt/mouse_brain/scratch/test.h5'
if os.path.exists(fname):
os.unlink(fname)
if os.path.exists(fname + '.jou... |
test_elasticsearch.py | # Copyright The OpenTelemetry 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 applicable law or agreed to in ... |
webserve.py | import sys
import os
import base64
import threading
import ssl
import socketserver
#import BaseHTTPServer
#from SimpleHTTPServer import SimpleHTTPRequestHandler
from http.server import SimpleHTTPRequestHandler
from importlib import reload
WEB_PORT=5000
class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserv... |
test_data_join_worker.py | # Copyright 2020 The FedLearner 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... |
local.py | from TradzQAI.core import Local_Worker, Local_env
from TradzQAI.core.environnement.base import dataLoader
from TradzQAI.tools import Saver, Logger, red
import time, os
from threading import Thread
class Local_session(Thread):
def __init__(self, mode="train", contract_type="classic", config='config/', db=None, a... |
platform_utils.py | # -*- coding:utf-8 -*-
#
# Copyright (C) 2016 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... |
main.py | # Copyright (c) 2015 Gregory Gaston
# License: https://opensource.org/licenses/MIT
# This file contains the main() function for the TauNet system as
# well as many of the basic functions involved with sending messages
# recieving messages, and the program interface.
# Built in libraries
import socket, threading, time,... |
_server_adaptations.py | # Copyright 2016 gRPC 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 applicable law or agreed to in... |
__init__.py | # Copyright 2017-2021 John Snow Labs
#
# 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... |
system.py | from flask import request, jsonify, session
from tqdm import tqdm
import traceback, json, time, os, datetime, threading, pywfom
import numpy as np
from . import api
from .. import models
from ...devices.arduino import Arduino
from ...devices.camera import Camera
DEFAULT_FILE = {
"directory":os.environ['PYWFOM_DI... |
correlation.py | import math
import logging
import pandas as pd
from datetime import datetime, timedelta
import time
import sched
import threading
import pytz
from scipy.stats.stats import pearsonr
import pickle
import inspect
import sys
from mt5_correlation.mt5 import MT5
class CorrelationStatus:
"""
The status of the monit... |
06-1-share-child-base.py | #!/usr/bin/env python
"""Test parent and child processes sharing a run.
Compare to a run in a single process, base usage of `run.log`"""
import multiprocessing as mp
import wandb
import yea
def process_parent():
run = wandb.init()
assert run == wandb.run
run.config.c1 = 11
run.log({"s1": 11})
re... |
multi_client.py | # Copyright 2020 MobiledgeX, Inc. All rights and licenses reserved.
# MobiledgeX, Inc. 156 2nd Street #408, San Francisco, CA 94105
#
# 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
#
# htt... |
broadcast_client.py | import socket
import time
import threading
from threading import Thread
class udpclient():
def __init__(self):
self.AMOUNT_BYTES = 1024
self.BROADCAST_PORT_SEND = 9000
BROADCAST_PORT_RECV = 9001
BROADCAST_LISTEN = ''
self.BROADCAST_SEND = '<broadcast>'
#SOCKET TO RECEIVE MSG
self.bsock = socket.socket(... |
document_entity.py | """
Name: arXiv Intelligence NER Web Service
Authors: Jonathan CASSAING
Web service specialized in Named Entity Recognition (NER), in Natural Language Processing (NLP)
"""
import json
import sys
from datetime import datetime
from multiprocessing import Process
from pathlib import Path
from sqlalchemy import Column, In... |
synth.py | import wave
import threading
from pathlib import Path
from importlib import import_module
from functools import lru_cache, partial
from contextlib import contextmanager
import numpy as np
import soundcard as sc
SAMPLERATE = 44100 # default sample rate
def sine_wave(duration, frequency, ampl=1.0, samplerate=SAMPL... |
workflow.py | """Implementation of the workflow for demultiplexing sequencing directories."""
import collections
import csv
import glob
import gzip
import itertools
import json
import logging
import os
import shutil
import subprocess
import sys
from threading import Thread, Lock
import tempfile
import xml.etree.ElementTree as ET
f... |
launch.py | """Launching tool for DGL distributed training"""
import os
import stat
import sys
import subprocess
import argparse
import signal
import logging
import time
import json
import multiprocessing
import re
from functools import partial
from threading import Thread
from typing import Optional
DEFAULT_PORT = 30050
def cle... |
test_browser.py | # coding=utf-8
# Copyright 2013 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.
from __future__ import print_function
import argparse
... |
htcpcp-alexa.py | import threading
import requests
import pyalexa
import flask
import json
BASE_RESPONSE = {
"version": "1",
"response": {}
}
with open(".keys") as f:
keys = json.load(f)
APP_ID = keys["app_id"]
api = flask.Flask(__name__)
skill = pyalexa.Skill(app_id=APP_ID)
my_drink_id = -1
def do_brew(drink, creams=... |
add_code_to_python_process.py | r'''
Copyright: Brainwy Software Ltda.
License: EPL.
=============
Works for Windows relying on a fork of winappdbg which works in py2/3 (at least for the part we're interested in).
See: https://github.com/fabioz/winappdbg (py3 branch).
Note that the official branch for winappdbg is: https://github.com/MarioVilas/wi... |
ws.py | import threading
import websocket
class WSClient:
def __init__(self, url: str, on_message=None, on_open=None, on_close=None, on_error=None):
self.ws = websocket.WebSocketApp(
url,
on_open=self._default_on_open,
on_close=self._default_on_close,
on_error=self.... |
urls.py | import os
import threading
from django.contrib import admin
from django.urls import path, include
from django.views.generic.base import TemplateView
from django.contrib.auth.decorators import login_required
from orchestrator.monitoring import file_trigger_monitor, schedule_trigger_monitor, email_imap_trigger_monitor, e... |
status.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020 by Murray Altheim. All rights reserved. This file is part of
# the Robot OS project and is released under the "Apache Licence, Version 2.0".
# Please see the LICENSE file included as part of this package.
#
# author: Murray Altheim
# created: 2020-01-... |
processes.py | # -*- coding: utf-8 -*-
import atexit
import heapq
import sys
import time
from threading import Thread
from plumbum.lib import IS_WIN32, six
if sys.version_info >= (3,):
from io import StringIO
from queue import Empty as QueueEmpty
from queue import Queue
else:
from cStringIO import StringIO
from ... |
core.py | # Copyright (c) 2019-2021, Andrey "Limych" Khrolenok <andrey@khrolenok.ru>
# Creative Commons BY-NC-SA 4.0 International Public License
# (see LICENSE.md or https://creativecommons.org/licenses/by-nc-sa/4.0/)
"""Beward devices controller core."""
import logging
import socket
import threading
from datetime import da... |
conjur.py | from .plugin import CredentialPlugin
import base64
import os
import stat
import tempfile
import threading
from urllib.parse import urljoin, quote_plus
from django.utils.translation import ugettext_lazy as _
import requests
conjur_inputs = {
'fields': [{
'id': 'url',
'label': _('Conjur URL'),
... |
face2rec2.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... |
IEngine.py | import typing
from abc import ABC, abstractmethod
from threading import Thread
from typing import Callable
if typing.TYPE_CHECKING:
from fishy.gui import GUI
class IEngine(ABC):
def __init__(self, config, gui_ref: 'Callable[[], GUI]'):
self.get_gui = gui_ref
self.start = False
self.w... |
serverlib_fallback.py | # This file duplicates the implementation of ot2serverlib. Remove once all
# robots have new update endpoints
import os
import json
import asyncio
import logging
from time import sleep
from aiohttp import web
from threading import Thread
log = logging.getLogger(__name__)
PATH = os.path.abspath(os.path.dirname(__file__... |
Ghost.py | #!/usr/bin/python
# -*- coding: UTF-8 -*-
"""
MIT License
Copyright (c) 2022 Ben Tettmar
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... |
hashcracker.py | import json
import hashlib
import os
import sys
import time
import threading
import multiprocessing
md, sh1, sh256 = [], [], []
unknown_hashtypes = []
with open("config.json") as c:
config = json.load(c)
wlpath = config["wordlistpath"]
hashpath = config["hashlistpath"]
if not os.path.... |
test_stdout.py | from __future__ import print_function
import os
import random
import string
import sys
import time
import pytest
from dagster import (
DagsterEventType,
ExecutionTargetHandle,
InputDefinition,
ModeDefinition,
execute_pipeline,
pipeline,
resource,
solid,
)
from dagster.core.execution.c... |
ffmpeg.py | import queue
import threading
import os
import compute
vids_path = './videos'
out = './processed'
def main():
q = queue.Queue()
directory = os.listdir(vids_path)
for file in directory:
q.put(vids_path+"/"+file)
for i in range(3):
worker = threading.Thread(target=compute.process, args=(q,vids_path))
worker.st... |
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... |
pipeline_ops_test.py | # Copyright 2020 Google LLC. 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 a... |
mp_benchmarks.py | #
# Simple benchmarks for the multiprocessing package
#
# Copyright (c) 2006-2008, R Oudkerk
# All rights reserved.
#
import time, sys, multiprocessing, threading, Queue, gc
if sys.platform == 'win32':
_timer = time.clock
else:
_timer = time.time
delta = 1
#### TEST_QUEUESPEED
def queuespeed_func(q, c, it... |
SICS.py | from threading import Thread
from time import sleep
import requests
from core.data.command import Command
from core.device.manager import DeviceManager
from core.task.abstract import BaseTask
class MeasureWeight(BaseTask):
def __init__(self, config):
self.__dict__.update(config)
required = ['sl... |
modulo_serializar.py | # License: Released under MIT License
# Notice: Copyright (c) 2020 TytusDB Team
# Developer: Andree Avalos
import pickle
import threading
path = 'data/dict/'
def commit(objeto, nombre):
try:
file = open(path+nombre+".bin","wb+")
file.write(pickle.dumps(objeto))
file.close()
... |
core.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
OONI Fastpath
See README.adoc
"""
# Compatible with Python3.6 and 3.7 - linted with Black
# debdeps: python3-setuptools
from argparse import ArgumentParser, Namespace
from base64 import b64decode
from configparser import ConfigParser
from datetime import datetime... |
sanitylib.py | #!/usr/bin/env python3
# vim: set syntax=python ts=4 :
#
# Copyright (c) 2018 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import contextlib
import string
import mmap
import sys
import re
import subprocess
import select
import shutil
import shlex
import signal
import threading
import concurrent.fu... |
safe_t.py | from binascii import hexlify, unhexlify
import traceback
import sys
from electrum_mona.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException
from electrum_mona.bitcoin import TYPE_ADDRESS, TYPE_SCRIPT
from electrum_mona.bip32 import BIP32Node
from electrum_mona import constants
from electrum_... |
xla_client_test.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... |
test_tracker.py | # Copyright 2019 Kakao Brain
#
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.
from queue import Queue
import threading
import pytest
import torch
from torch import nn
... |
agent.py | #!/usr/bin/env python3
""" HIAS TassAI Facial Recognition Agent.
HIAS TassAI Facial Recognition Agent processes streams from local
or remote cameras to identify known and unknown humans.
MIT License
Copyright (c) 2021 Asociación de Investigacion en Inteligencia Artificial
Para la Leucemia Peter Moss
Permission is h... |
https_injector.py | from mitmproxy.options import Options
from mitmproxy.proxy.config import ProxyConfig
from mitmproxy.proxy.server import ProxyServer
from mitmproxy.tools.dump import DumpMaster
from mitmproxy.net.http.http1.assemble import assemble_request
from bs4 import BeautifulSoup
import threading,asyncio,time,Levenshtein,pandas,sq... |
okta.py | """
Copyright 2016-present Nike, 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, softw... |
pyterm.py | #!/home/pi/repos/gateway_pi/virtual/bin/python
"""Simple Python serial terminal
"""
# Copyright (c) 2010-2020, Emmanuel Blot <emmanuel.blot@free.fr>
# Copyright (c) 2016, Emmanuel Bouaziz <ebouaziz@free.fr>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, a... |
download.py | import os
import requests
import threading
import psutil
# Todo: Create a better stoppable thread class.
class StoppableThread(threading.Thread):
"""Thread class with a stop() method. The thread itself has to check
regularly for the stopped() condition."""
def __init__(self):
super(StoppableThread... |
prophet_model.py | from pandas import DataFrame, Series
from fbprophet import Prophet
import random
import numpy as np
from itertools import product
import pandas as pd
import threading
from multiprocessing import cpu_count
from functions import *
from utils import *
from logger import LoggerProcess
def get_anomaly(fact, yhat_upper, y... |
kbdeleonContigFilterServer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import json
import os
import random as _random
import sys
import traceback
from getopt import getopt, GetoptError
from multiprocessing import Process
from os import environ
from wsgiref.simple_server import make_server
import requests as _requests
from json... |
DHCP_FULL.py | #!/usr/bin/python3.4
# -*- coding=utf-8 -*-
#本脚由亁颐堂现任明教教主编写,用于乾颐盾Python课程!
#教主QQ:605658506
#亁颐堂官网www.qytang.com
#乾颐盾是由亁颐堂现任明教教主开发的综合性安全课程
#包括传统网络安全(防火墙,IPS...)与Python语言和黑客渗透课程!
import sys
sys.path.append('/usr/local/lib/python3.4/dist-packages/PyQYT/ExtentionPackages')
sys.path.append('/usr/lib/python3.4/site-packages/... |
MultiprocessingWithException.py | import multiprocessing as mp
import traceback
from typing import Optional, Tuple
class ProcessWithException(mp.Process):
"""
to be treated same as usual multiprocessing process, with
p = Process(target=target, args=args)
p.start()
p.join()
p.print_and_raise_if_has_exception()
extended fro... |
main.py | import asyncio
import math
import sys
import time
import pdb
from multiprocessing import Process, Queue
import numpy as np
import serial
import adafruit_mlx90640
import board
import busio
import main
from file_utils import create_folder_if_absent, save_npy
from visualizer import init_heatmap, update_he... |
event_client.py | import traceback
import duml_cmdset
import duss_event_msg
import rm_define
import rm_log
import socket
import sys
import threading
import time
import tools
import user_script_ctrl
logger = rm_log.dji_scratch_logger_get()
default_target_address = '\0/duss/mb/0x900'
DUSS_EVENT_MSG_HEADER_LEN = 4
class EventAckIdent... |
server.py | # based on https://www.youtube.com/watch?v=3QiPPX-KeSc
import socket
import threading
HEADER = 64
PORT = 5050
# local IP address
SERVER = socket.gethostbyname(socket.gethostname())
print("Local IP address: ",SERVER)
print("host name: ",socket.gethostname())
ADDR = (SERVER, PORT)
FORMAT = 'utf-8'
DISCONNECT_MESSAGE = ... |
test_restart_services.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... |
test_multiprocessing.py | import pytest
import multiprocessing
import contextlib
import redis
from rediscluster.connection import ClusterConnection, ClusterConnectionPool
from redis.exceptions import ConnectionError
from .conftest import _get_client
@contextlib.contextmanager
def exit_callback(callback, *args):
try:
yield
fi... |
menextun.py | #!/usr/bin/python3
#Coded by ViRu
#########################################
# Just a little change #
# -- ViRu #
#########################################
import requests
import socket
import socks
import time
import random
import threading
import sys
import ssl
import dat... |
server.py | from http.server import BaseHTTPRequestHandler, HTTPServer
import multiprocessing, urllib, json, threading
import tensorflow as tf
class SessionServer(HTTPServer):
def __init__(self, tensors, session, address="127.0.0.1", port=8084, assign_ops=None, placeholders=None):
"""
Session Server allows Tensor value... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.