source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
plugin.py | import base64
import re
import threading
from binascii import hexlify, unhexlify
from functools import partial
from electrum_arg.bitcoin import (bc_address_to_hash_160, xpub_from_pubkey,
public_key_to_p2pkh, EncodeBase58Check,
TYPE_ADDRESS, TYPE_SCRIPT,
... |
scheduler.py | #!/usr/bin/env python
import os
import cPickle as pickle
import sys
import time
import socket
import random
from optparse import OptionParser
from threading import Thread
import subprocess
from operator import itemgetter
import logging
import signal
import zmq
import mesos
import mesos_pb2
ctx = zmq.Context()
class ... |
git_common.py | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Monkeypatch IMapIterator so that Ctrl-C can kill everything properly.
# Derived from https://gist.github.com/aljungberg/626518
import multiprocessing.pool
... |
notifications.py | import threading
import time
from signal import SIGINT, SIGTERM, signal
from agents import Agent, Message
class NotificationBroker(Agent):
def setup(self, name=None, pub_address=None, sub_address=None):
self.create_notification_broker(pub_address, sub_address)
class Sender(Agent):
def setup(self, n... |
p2db_server.py | import threading
import time
import io
import serial
import queue
from . import p2info
from . import p2tools
import logging
log = logging.getLogger('main')
class CogState:
DISCONNECTED = 0 # this cog has not been seen and we can't talk to it
IDLE = 1 # this cog is idle and ready to accept data
... |
ConsoleUtils.py | import io
import logging
import shutil
import sys
import threading
import time
from enum import Enum
from typing import Callable, Iterable, Union, Sized, Optional
from .LoggerUtils import temp_log
__all__ = ['Progress', 'GetInput', 'count_ordinal', 'TerminalStyle']
# noinspection SpellCheckingInspection
class Termi... |
cleanup_stale_fieldtrial_configs.py | # Copyright 2021 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.
"""Simple script for cleaning up stale configs from fieldtrial_testing_config.
Methodology:
Scan for all study names that appear in fieldtrial config file,... |
car.py | '''
MIT License
Copyright (c) 2021 ImPurpl3
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, publi... |
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... |
data_utils.py | # 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 required by applica... |
copyutil.py | # cython: profile=True
# 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
# "... |
bruteforcer.py | #!/usr/bin/env python3
'''
Original Author --> https://rastating.github.io/bludit-brute-force-mitigation-bypass/
This is just the fixed version of the above script so i am not taking
any credit for the orginal CVE of this vulnerability. Thank you.
'''
import re, sys
import requests, threading
if len(sys.argv) < 2:
... |
sender.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import time
from threading import Thread
from requests import Request, Session
from .. import DEFER_METHOD_THREADED, DEFER_METHOD_CELERY
from ..exceptions import SenderException
from . import COLLECT_PATH, DEBUG_PATH, HTTP_URL, SSL_URL, GET_SIZE_LIMIT, ... |
custom.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
http_flood.py | import socket, threading, time
__THREAD_NUMBER__ = 1200
def http_flood(ip: str, port: str, timeout: str):
def flood(ip: str, port: int, timeout: int):
start_time = int(time.time())
while int(time.time()) - start_time < timeout:
try:
sock = socket.socket(socket.AF_INET,... |
lockbench.py |
from threading import Thread
from threading import RLock
from fastrlock.rlock import FastRLock as FLock
def lock_unlock(l):
l.acquire()
l.release()
l.acquire()
l.release()
l.acquire()
l.release()
l.acquire()
l.release()
l.acquire()
l.release()
def reentrant_lock_unlock(l):
... |
benchmark_send_get_multiprocess_test.py | # stdlib
import socket
import time
from typing import Any
from typing import List
# syft absolute
from syft.lib.python import List as SyList
from syft.lib.python.string import String
# syft relative
from ...syft.grid.duet.process_test import SyftTestProcess
PORT = 21211
def do_send(data: Any) -> None:
# syft a... |
ros_connector.py | import os
import signal
from base_connector import SlackConnector
import rospy
from std_msgs.msg import String
from rostopic import get_topic_class
from rosservice import get_service_class_by_name
from rosservice import get_service_list
from threading import Thread
from roslib.message import strify_message
import argpa... |
__init__.py | """Interact with Taskwarrior."""
import datetime
import os
import re
import threading
import traceback
from abc import ABCMeta, abstractmethod
from pathlib import Path
from shutil import which
from subprocess import PIPE, Popen
from typing import List, Optional, Tuple, Union
import albert as v0 # type: ignore
import... |
dhcp_relay_test.py | import ast
import struct
import ipaddress
import binascii
# Packet Test Framework imports
import ptf
import ptf.packet as scapy
import ptf.testutils as testutils
from ptf import config
from ptf.base_tests import BaseTest
from ptf.mask import Mask
import scapy.all as scapy2
from threading import Thread
# Helper funct... |
spinorf_multicore.py | # -*- coding: utf-8 -*-
"""
Created on Fri Jun 5 14:24:21 2015
This is the python version of spinorf with multicore processing
@author: zag
"""
import time as timemod
import numpy as np
import math
try:
import numba
from .chebyshev_functions_numba import setup_scaled_H, moments, find_norm
except ImportError:
... |
main_window.py | import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
import asyncio
from typing import TYPE_CHECKING, Optional, Union, Callable, Sequence
from electrum.storage import WalletStorage, StorageReadWriteError
from electrum.wallet_db import WalletDB
from el... |
workflow.py | import os
import sys
from subprocess import Popen, PIPE
import gzip
import errno
import pipes
import re
import threading
try:
import Queue as queue # Python 2
except ImportError:
import queue # Python 3
import time
try:
import cPickle as pickle # Python 2
except ImportError:
import pickle # Python 3... |
test_kernel.py | # coding: utf-8
"""test the IPython Kernel"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import io
import os.path
import sys
import nose.tools as nt
from IPython.testing import decorators as dec, tools as tt
from IPython.utils import py3compat
from IPython.u... |
qt_and_tornado.py | __author__ = 'breddels'
"""
Demonstrates combining Qt and tornado, both which want to have their own event loop.
The solution is to run tornado in a thread, the issue is that callbacks will then also be executed in this thread, and Qt doesn't like that.
To fix this, I show how to use execute the callback in the main th... |
server.py | from waitress import serve
import logging
import asyncio
import threading
from services.streaming.backend import app
# Local
from services.streaming.lib import StreamingAnalytics
from services.streaming.config import collect_env_vars
logger = logging.getLogger('waitress')
logger.setLevel(logging.INFO)
def start_an... |
lock_files.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Encrypt and decrypt files using AES encryption and a common
password. You can use it lock files before they are uploaded to
storage services like DropBox or Google Drive.
The password can be stored in a safe file, specified on the command
line or it can be manually ent... |
rest_api.py | # --depends-on commands
# --depends-on config
# --depends-on permissions
import binascii
import http.server
import json
import os
import socket
import threading
import urllib.parse
from src import ModuleManager, utils
from src.Logging import Logger as log
DEFAULT_PORT = 5001
DEFAULT_PUBLIC_PORT = 5000
class Respon... |
detection_custom.py | # ================================================================
#
# File name : detection_custom.py
# Author : PyLessons
# Created date: 2020-09-17
# Website : https://pylessons.com/
# GitHub : https://github.com/pythonlessons/TensorFlow-2.x-YOLOv3
# Description : object detection image a... |
test_buffered_pipe.py | # Copyright (C) 2006-2007 Robey Pointer <robeypointer@gmail.com>
#
# This file is part of paramiko.
#
# Paramiko is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (a... |
test.py | #!/usr/bin/env python
import urllib2
from threading import Thread
URL = 'http://localhost:8001'
class SiteRequest:
def __init__(self, x=10, suffixName='', tables=[]):
self.__x = x
self.__tables = tables
self.__suffixName = suffixName
def hit(self, hitCount):
for i in range(hi... |
test_semlock.py | from _multiprocessing import SemLock
from threading import Thread
import thread
import time
def test_notify_all():
"""A low-level variation on test_notify_all() in lib-python's
test_multiprocessing.py
"""
N_THREADS = 1000
lock = SemLock(0, 1, 1)
results = []
def f(n):
if lock.acqu... |
test_debug.py | import importlib
import inspect
import os
import re
import sys
import tempfile
import threading
from io import StringIO
from pathlib import Path
from django.core import mail
from django.core.files.uploadedfile import SimpleUploadedFile
from django.db import DatabaseError, connection
from django.shortcuts import render... |
openvino_tiny-yolov3_MultiStick_test.py | import sys, os, cv2, time, heapq, argparse
import numpy as np, math
from openvino.inference_engine import IENetwork, IEPlugin
import multiprocessing as mp
from time import sleep
import threading
yolo_scale_13 = 13
yolo_scale_26 = 26
yolo_scale_52 = 52
classes = 80
coords = 4
num = 3
anchors = [10,14, 23,27, 37,58, 81... |
test_local.py | import os
import socket
import time
import contextlib
from threading import Thread
from threading import Event
from threading import Lock
import json
import subprocess
from contextlib import contextmanager
import pytest
import mock
import requests
from urllib3.util.retry import Retry
from requests.adapters import HTTP... |
old_ssh.py | import logging
import os
import socket
import sys
import time
import traceback
try:
from queue import Queue
except ImportError: # Python 2.7 fix
from Queue import Queue
from threading import Thread
from tlz import merge
from tornado import gen
logger = logging.getLogger(__name__)
# These are handy for cr... |
app.py | import boto3
import io
import os
import requests
from subprocess import run, PIPE
from flask import Flask
from flask_restful import Resource, Api, reqparse
from threading import Thread
from uuid import uuid4
from tempfile import mkdtemp
# Never put credentials in your code!
from dotenv import load_dotenv
load_dotenv()... |
tftp_stress_test.py | import datetime
import os
import sys
import time
import logger
from optparse import OptionParser
from multiprocessing import Process,JoinableQueue, Queue
import queue
import tftpy
from random import randint
my_logger = logger.getLogger("TftpStress")
download_file_names = [
"BOOT",
"boot_emmc-boot.scr",
"... |
http.py | """
This module provides WSGI application to serve the Home Assistant API.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/http/
"""
import hmac
import json
import logging
import mimetypes
import threading
import re
import ssl
import voluptuous as vol
... |
miner.py | from __future__ import print_function
import sys
import os
import math
import argparse
import time
import uuid
import hashlib
import copy
import base64
import threading
# import urllib.request
import secrets
import tornado.web
import tornado.websocket
import tornado.ioloop
import tornado.httpclient
import tornado.gen... |
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... |
web.py | #!/usr/bin/env python
"""web.py: makes web apps (http://webpy.org)"""
__version__ = "0.1381"
__revision__ = "$Rev: 72 $"
__license__ = "public domain"
__author__ = "Aaron Swartz <me@aaronsw.com>"
__contributors__ = "see http://webpy.org/changes"
from __future__ import generators
# long term todo:
# - new form syste... |
__main__.py | from kubemon.log import create_logger
from .exceptions.platform_exception import NotLinuxException
from .cli import *
from .merge import merge
from .collector.commands import COMMANDS
from multiprocessing import Process
import sys
import logging
def start(instance):
instance.start()
if __name__ == "__main__":
... |
example2_test_white_percentage.py | #
# For this is how God loved the world:<br/>
# he gave his only Son, so that everyone<br/>
# who believes in him may not perish<br/>
# but may have eternal life.
#
# John 3:16
#
from aRibeiro.tools import SensorVis;
import time
from threading import Thread
from multiprocessing import Value
import random
WINDOW_WIDTH... |
onethreadnode.py | # Copyright © 2018 CNRS
# All rights reserved.
# @author Christophe Reymann
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this l... |
tradestream_110720.py | import datetime
import json
import os
import threading
import traceback
import time
import loghandler
from pymongo import MongoClient
import websocket
import subprocess
# from pprint import pprint
from google.cloud import translate_v2
import six
from dotenv import load_dotenv
load_dotenv(os.path.join(os.getcwd(), ... |
datd.py | """2ch like dat interface
"""
#
# Copyright (c) 2014,2015 shinGETsu Project.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#... |
main.py | import pythoncom
import pyHook
import pyautogui
import win32ui
import threading
import time
import win32gui
import win32com.client
import sys
# pyHook must be manually added!
# https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyhook
# Download the file corresponding to the python version being used (I'm using 3.6.6)
# pip ... |
_connection.py | import json
import sys
from threading import Thread
from signalr.events import EventHook
from signalr.hubs import Hub
from signalr.transports import AutoTransport
class Connection:
protocol_version = '1.5'
def __init__(self, url, session):
self.url = url
self.__hubs = {}
self.qs = {}
... |
halo.py | # -*- coding: utf-8 -*-
# pylint: disable=unsubscriptable-object
"""Beautiful terminal spinners in Python.
"""
from __future__ import unicode_literals, absolute_import
import sys
import threading
import time
import functools
import atexit
import cursor
from spinners.spinners import Spinners
from log_symbols.symbols i... |
kitti_input.py | import matplotlib
import itertools
import os
import random
from PIL import Image, ImageEnhance
import numpy as np
import matplotlib.pyplot as plt
import imageio
import tensorflow as tf
from include.utils.data_utils import (annotation_to_h5)
from include.utils.annolist import AnnotationLib as AnnoLib
import threading
fr... |
test_runner.py | from threading import Thread
import contextlib
import os
import unittest
import sublime
import sublime_plugin
class __vi_tests_write_buffer(sublime_plugin.TextCommand):
"""Replaces the buffer's content with the specified `text`.
`text`: Text to be written to the buffer.
"""
def run(self, edit, te... |
__init__.py | #### PATTERN | WEB #################################################################################
# Copyright (c) 2010 University of Antwerp, Belgium
# Author: Tom De Smedt <tom@organisms.be>
# License: BSD (see LICENSE.txt for details).
# http://www.clips.ua.ac.be/pages/pattern
####################################... |
__init__.py | import multiprocessing as mp
import signal
import sys
from functools import wraps
import erdos.internal as _internal
from erdos.streams import (ReadStream, WriteStream, LoopStream, IngestStream,
ExtractStream)
from erdos.operator import Operator, OperatorConfig
from erdos.profile import Pro... |
script.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2020 Alibaba Group Holding Limited.
#
# 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... |
volume-count.py | #!/usr/bin/env python
from docker import Client
import BaseHTTPServer
import SocketServer
import datetime
import errno
import json
import os
import signal
import socket
import threading
import time
import urllib2
PLUGIN_ID="volume-count"
PLUGIN_UNIX_SOCK="/var/run/scope/plugins/" + PLUGIN_ID + ".sock"
DOCKER_SOCK="un... |
app.py | import os
import threading
import shutil
from datetime import timedelta, datetime
from flask import Flask, render_template, request, session, jsonify, url_for, redirect
from haystack.document_store.elasticsearch import *
from haystack.preprocessor.utils import convert_files_to_dicts
from haystack.preprocessor.cleaning ... |
main.py | import torch
from src.data import DataManager
from src.policies import PolicyManagerNew, DeterministicPolicy, GreedyPolicy, AdvSwitchPolicy, RandomPolicy
from src.train import SamplingBuffer, Trainer
from src.envs.breakout import BreakoutWrapper
from src.utils import OptWrapper
import sys
import torch.multiprocessing a... |
__init__.py | from wsgiref.simple_server import WSGIRequestHandler
from wsgiref.simple_server import WSGIServer
import os
import plone.testing
import threading
import wsgiref.handlers
class LogWSGIRequestHandler(WSGIRequestHandler):
def log_request(self, *args):
if 'GOCEPT_HTTP_VERBOSE_LOGGING' in os.environ:
... |
led8x8controller.py | #!/usr/bin/python3
""" Control the display of an Adafruit 8x8 LED backpack """
# MIT License
#
# Copyright (c) 2019 Dave Wilson
#
# 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 res... |
bartender.py | import gaugette.ssd1306
import gaugette.platform
import gaugette.gpio
import time
import sys
import RPi.GPIO as GPIO
import json
import threading
import traceback
from dotstar import Adafruit_DotStar
from menu import MenuItem, Menu, Back, MenuContext, MenuDelegate
from drinks import drink_list, drink_options
GPIO.set... |
Vision.py | from threading import Thread, Event
import cv2
#import time
import datetime
import uuid
import os
#This class is used to approximate the processing frames per second
#This class has no functional purpose per se, strictly for information
class FPS:
def __init__(self):
self._start = None
self._end = ... |
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.
import argparse
import json
import multiprocessing
imp... |
xmpp.py | import datetime
import logging
import threading
import tzlocal
# See:
# * http://sleekxmpp.com/getting_started/muc.html
# * http://sleekxmpp.com/getting_started/echobot.html
# * https://github.com/fritzy/SleekXMPP/wiki/Stanzas:-Message
from sleekxmpp import ClientXMPP
from chatty.exceptions import OperationNot... |
test_podmodel_installer.py | """test_podmodel_installer.py - tests the podmodel_installer module
Chris R. Coughlin (TRI/Austin, Inc.)
"""
__author__ = 'Chris R. Coughlin'
from controllers import pathfinder
from models.tests import test_plugin_installer
import models.podmodel_installer as podmodel_installer
import models.zipper as zipper
import ... |
Spider_bak.py | import requests
import bs4
import Queue
import re
import threading
class Spider():
def __init__(self):
self.url = None
self._WebRootPage = None
self.UrlList = []
self._ParmList = {}
self._DuplicateUrlList = []
self.Threads = 10
self._Counter = 0
self... |
test_prf.py | from PyQt5.QtTest import QTest
from PyQt5.QtCore import Qt
from qttasks.prf import PrettyWidget
from time import sleep
from serial import serial_for_url, SerialException
from pathlib import Path
from struct import unpack
import threading
class SerialThreading(object):
def __init__(self):
self.triggers_lo... |
es.py | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-BASE 蓝鲸基础平台 is licensed under the MIT License.
License for BK-BASE 蓝鲸基础平台:
------------------------------------------... |
plot_builder.py | #
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
#
# self.py: functions to help produce plots of metrics from runs
import math
import time
import numpy as np
import pandas as pd
from xtlib import qfe
from xtlib import utils
from xtlib import errors
from xtlib import console
from xtlib import ... |
EpisodeManager.py | #!/usr/bin/env python3
#
# This file includes mainly a class "EpisodeManager" and some utility function called get_ip
# Author: Michele
# Project: SmartLoader - Innovation
#
# For now, hard coded:
# sim_host="192.168.100.21"
# sim_port= 22
# scenario_file="/home/sload/InitialScene.json"
# oururl... |
main.py | #!/usr/bin/env python3
#
# https://docs.python.org/3/library/threading.html
#
import threading
import time
# --- classes ---
class ExampleThread(threading.Thread):
def __init__(self, name, counter=10, sleep=0.5):
threading.Thread.__init__(self)
self.name = name
self.counter = counter
... |
dns_server.py | #!/usr/bin/env python
# coding=utf-8
from mn_rand_ips import MNRandIPs
import argparse
import datetime
import sys
import time
import threading
import traceback
import SocketServer
import struct
import logging
try:
from dnslib import *
except ImportError:
logging.error("Missing dependency dnslib: <https://pypi... |
test_mp.py | import numpy as np
import torch
import torch.multiprocessing as mp
mp.set_start_method('spawn', force=True)
import time
import uuid
import queue
import logging
import cv2
def test_input_output(idx, qin, qout):
print(f'{idx} start')
duration = 0
count = 0
while True:
start = time.time()
... |
PuppetExecutor.py | #!/usr/bin/env python2.6
'''
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
"Licens... |
hasource.py | import os.path
from .snapshots import HASnapshot, Snapshot, AbstractSnapshot
from .config import Config
from .time import Time
from .model import SnapshotSource, CreateOptions
from typing import Optional, List, Dict
from threading import Lock, Thread
from .harequests import HaRequests
from .exceptions import LogicError... |
queued.py | import os
import multiprocessing
from six.moves import queue
import threading
import traceback
from pulsar.managers.unqueued import Manager
from logging import getLogger
log = getLogger(__name__)
STOP_SIGNAL = object()
RUN = object()
# Number of concurrent jobs used by default for
# QueueManager.
DEFAULT_NUM_CONCURR... |
marketHack.py | import urllib2
import time
import getopt
import sys
import json
import csv
import os
from multiprocessing import Process, Queue
from db import Database
API_KEY = '114e933ff74d41b9f4bddeeb74c81ccd&symbol'
ITERATIONS = 5
CHUNK_SIZE = 100
SAMPLES = 98
def get_data(url, finished, counter):
try:
finished.put(... |
test_lock.py | import os
import threading
import time
import unittest
try:
import queue
except ImportError:
import Queue as queue
import django
from django.db import connection, DatabaseError
from django.test import skipUnlessDBFeature, TransactionTestCase
from viewflow import flow, lock
from viewflow.base import Flow, thi... |
util.py | # Electrum - lightweight Bitcoin client
# Copyright (C) 2011 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... |
fuzzer.py | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... |
_algorithm.py | '''
Copyright (c) 2018 by Tobias Houska
This file is part of Statistical Parameter Optimization Tool for Python(SPOTPY).
:author: Tobias Houska
This file holds the standards for every algorithm.
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __fut... |
distribution_daemon.py | # -*- coding: utf-8 -*-
# Copyright 2017-2021 CERN
#
# 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... |
test_util.py | # Copyright 2015 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... |
ProportionalExecutionStrategy.py | # -*- coding: utf-8 -*-
import random
import datetime
import threading
from ..config.MeasurementType import MeasurementType
from ..config.ConfigurationManager import ConfigurationManager
from ..results.ResultsManager import ResultsManager
from .ExecutionContext import ExecutionContext
from ..benchmarks.BenchmarkInsta... |
legacy.py | from typing import (
Any,
cast,
Dict,
IO,
Iterable,
Iterator,
List,
Optional,
Set,
Tuple,
Union,
)
import io
import os
import sys
import copy
import json
import time
import threading
import contextlib
import collections
from io import BytesIO
import requests
import pandas as ... |
keep_alive.py | #------------------------------------------------------------------------#
#---------------------- TO keep the bot running ------------------------#
#------------------------------------------------------------------------#
from flask import Flask
from threading import Thread
app = Flask('')
@app.route('/')
def home... |
blockchain_processor.py | #!/usr/bin/env python
# Copyright(C) 2011-2016 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 to use, copy, ... |
upnp.py | import logging
import threading
from queue import Queue
from typing import Optional
try:
import miniupnpc
except ImportError:
pass
log = logging.getLogger(__name__)
class UPnP:
thread: Optional[threading.Thread] = None
queue: Queue = Queue()
def __init__(self):
def run():
t... |
sleep_sort.py | import time
import threading
# 你需要排序的序列(可以包含负数)
num = [-5, 3, 9, 11, -1, 3, 12, 0, 8, -3, 23, 5, 19]
# 睡眠的方法
def doSleep(func):
co = 0.02 # 添加系数让睡眠时间短一些
time.sleep(co * pow(1.1, float(func))) # 使用幂函数就不怕负数排序了
print(func)
# 将多个线程存在一个数组中
thread_list = []
for i in range(len(num)):
temp = threading.Th... |
server.py | import logging
import math
import os
from threading import Thread
from typing import List
from urllib.request import Request
import json
import boto3
import redis
import cache
import time
import requests
import uvicorn as uvicorn
from fastapi import FastAPI, Header, HTTPException
from fastapi.exceptions import RequestV... |
content_bot.py | import datetime as dt
import os
import sqlite3
import threading
from time import sleep
import requests
import telebot
from dotenv import load_dotenv
from loguru import logger
from telebot import types
load_dotenv()
logger.add(
"bot_debug.log",
format="{time} {level} {message}",
level="DEBUG",
rotation... |
msg_entity.py | """
MIT License
Copyright (c) 2018 AlessioNetti
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, ... |
diskover_socket_server.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""diskover - Elasticsearch file system crawler
diskover is a file system crawler that index's
your file metadata into Elasticsearch.
See README.md or https://github.com/shirosaidev/diskover
for more information.
Copyright (C) Chris Park 2017-2018
diskover is released unde... |
wait_blocking.py | #!usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Test module to implement wait blocking to address race condition, using
threading.Condition and threading.Event.
"""
__author__ = 'Ziang Lu'
import time
from threading import Condition, Event, Thread, current_thread
# Condition
product = None # 商品
condition = Cond... |
api-server.py | #!/usr/bin/env python3
"""
This api server runs one or both of the json-rpc and rest api. Uses
neo.api.JSONRPC.JsonRpcApi and neo.api.REST.NotificationRestApi
See also:
* Tutorial on setting up an api server: https://gist.github.com/metachris/2be27cdff9503ebe7db1c27bfc60e435
* Example systemd service config: https://... |
csclient.py | """
NCOS communication module for SDK applications.
Copyright (c) 2018 Cradlepoint, Inc. <www.cradlepoint.com>. All rights reserved.
This file contains confidential information of CradlePoint, Inc. and your use of
this file is subject to the CradlePoint Software License Agreement distributed with
this file. Unauthor... |
multiprocessing_terminate.py | #!/usr/bin/env python3
# encoding: utf-8
#
# Copyright (c) 2009 Doug Hellmann All rights reserved.
#
"""
"""
#end_pymotw_header
import multiprocessing
import time
def slow_worker():
print('Starting worker')
time.sleep(0.1)
print('Finished worker')
if __name__ == '__main__':
p = multiprocessing.Proc... |
app.py | from flask import Flask, request
from math import factorial
from threading import Thread
import signal
import time
# This class generates load by running math.factorial() over a period of time
class Load:
should_stop = False
def stop(self):
should_stop = True
def run(self, cpu_usage: float, secon... |
Sclient_py.py | import os
import socket
import base64
import pickle
import threading
import multiprocessing
import hashlib
import random
import yaml
import datetime
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
from cryptography.hazmat.primitives.asymmetric impo... |
yodelEnvironment.py | #from yodel.errors import YodelError
from asyncio.exceptions import CancelledError
from json.decoder import JSONDecodeError
from types import FunctionType, LambdaType
from typing import Any, Callable, NoReturn, Dict
from websockets import exceptions
from websockets.exceptions import WebSocketException
from websockets.s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.