source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
output_devices.py | # GPIO Zero: a library for controlling the Raspberry Pi's GPIO pins
# Copyright (c) 2016-2019 Andrew Scheller <github@loowis.durge.org>
# Copyright (c) 2015-2019 Dave Jones <dave@waveform.org.uk>
# Copyright (c) 2015-2019 Ben Nuttall <ben@bennuttall.com>
# Copyright (c) 2019 tuftii <3215045+tuftii@users.noreply.github.... |
rhcnode_network.py | #!/usr/bin/env python3
# Copyright (c) 2019, The Personal Robotics Lab, The MuSHR Team, The Contributors of MuSHR
# License: BSD 3-Clause. See LICENSE.md file in root directory.
import sys
import os
import signal
import threading
import random
import numpy as np
from queue import Queue
import time
import rospy
from ... |
main.py | """迁移当前目录下的所有MP3到指定目录"""
import os
import threading
from gevent import monkey
monkey.patch_all()
def open_and_write(mp3_name):
# 迁移ing
global path
with open('./' + mp3_name, 'rb') as f:
data = f.read()
with open(path + mp3_name, 'wb') as f:
f.write(data)
def handler(mp3_name):
#... |
nifty.py | """@package geometric.nifty Nifty functions, originally intended to be imported by any module within ForceBalance.
This file was copied over from ForceBalance to geomeTRIC in order to lighten the dependencies of the latter.
Table of Contents:
- I/O formatting
- Math: Variable manipulation, linear algebra, least square... |
susi_loop.py | """
Processing logic of kasper_linux
"""
import time
import os
import re
import logging
import queue
from threading import Thread, Timer, current_thread
from datetime import datetime
from urllib.parse import urljoin
import speech_recognition as sr
import requests
import json_config
import json
import speech_recognition... |
main.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
import logging
import threading
import sys
from pathlib import Path
from flask import Flask, request, redirect
ROOT = Path(__file__).resolve().parent.parent.parent
sys.path.append(str(ROOT / 'winapi__windows__ctypes/windows__toast_balloontip_n... |
twisterlib.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 math
import sys
import re
import subprocess
import select
import shutil
import shlex
import signal
import hashlib
import thre... |
eval_multiprocess.py | # Copyright 2018 Google. 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 agree... |
paralleljobhandler.py | import multiprocessing
from multiprocessing.connection import Connection
import time
import signal
import mlprocessors as mlpr
from .jobhandler import JobHandler
from .mountainjobresult import MountainJobResult
from typing import List
from .mountainjob import MountainJob
class ParallelJobHandler(JobHandler):
def ... |
cluster_log_manager.py | import multiprocessing
from types import TracebackType
from typing import Any, Callable, Optional
class ClusterLogManager:
def __init__(self, logs_func: Callable[..., Any]) -> None:
self._logs_process: Optional[multiprocessing.Process] = None
self.logs_func = logs_func
def __enter__(self) -> ... |
AP.py | import sys
import pygame
import socket
import threading
import hashlib
import binascii
import MySQLdb
import random
def sim():
pygame.init()
win_size = 900, 350
black = 0, 0, 0
black = 255, 255, 255
screen = pygame.display.set_mode(win_size)
pc = pygame.image.load("prot.jpg")... |
monitor_client_tests.py | #!/usr/bin/env python3
#
# Copyright (c) 2014-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
from __future__ import absolute_import, division, print_function, unicode_literals
import unittest
from builtins import... |
visual_system.py | """A biologically-inspired model of visual perception."""
from math import exp, hypot
import logging
import numpy as np
import cv2
import cv2.cv as cv
from collections import OrderedDict, deque
from itertools import izip
#import pyNN.neuron as sim
from lumos.context import Context
from lumos.util import Enum, getNorm... |
test_search_20.py | import pytest
from time import sleep
from base.client_base import TestcaseBase
from utils.util_log import test_log as log
from common import common_func as cf
from common import common_type as ct
from common.common_type import CaseLabel, CheckTasks
from utils.utils import *
from common.constants import *
prefix = "se... |
test_content.py | from __future__ import print_function
import re
import sys
import json
import time
import urllib3
import argparse
import requests
import threading
import subprocess
import os
from time import sleep
from datetime import datetime
import demisto_client.demisto_api
from slackclient import SlackClient
from Tests.mock_serv... |
resmonitor.py | #!/usr/bin/env python -O
import argparse
import logging
import psutil
import shlex
import signal
import subprocess as sp
import sys
import tempfile
import threading
import time
from typing import Optional, Sequence, Union
def memory_t(value: Union[int, str]) -> int:
if isinstance(value, int):
return valu... |
serverTCP.py | import socket
import time
import sys
import threading
localIP = "127.0.0.1"
PORT = 12345
buffer = 1024
inetAddress = (localIP, PORT)
backlog = 5
serversock = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0)
try:
serversock.bind(inetAddress)
except:
print("[Binding Error] : Exiting...")
sys.exit(1)
serversock... |
console.py | import multiprocessing, os,RaspMain, psutil,re
from CommunicationModule import CommunicationModule
conn1, conn2 = multiprocessing.Pipe()
def welcome_message():
print("______ _ _ ___ ______ ___ ___ ___")
print("| ___ \ (_) | | / _ \ | _ \/ _ \ | \/ |")
... |
test_ssl.py | import contextlib
import sys
import threading
import time
import warnings
from functools import partialmethod
import pytest
import requests
from urllib3.exceptions import InsecureRequestWarning
from uvicorn.config import Config
from uvicorn.main import Server
@contextlib.contextmanager
def no_ssl_verification(sessi... |
q-learning.py | import gamefield
import threading
import time
import random
import numpy as np
import copy
discount = 0.99 # future influence - discount factor
actions = gamefield.actions
states = gamefield.field
specials = gamefield.specials
number_of_actions = len(actions) - 1
Q = {}
for key in states: # auslagern in gamefield ... |
SwitchBot.py | # #! /usr/bin/env python3
# # -*- coding: utf-8 -*-
#
# import threading
# import binascii
# import struct
# from bluepy.btle import Peripheral, DefaultDelegate
#
# from switchbot.abstract_bot_controller import AbstractBotController
#
# NOTIFY_CONTROLL_HANDLER = 0x0014
#
# SWITCH_CONTROLL_HANDLER = 0x0016
#
# PRESS_EVE... |
my_autofn.py | from multiprocessing import Process
import tweepy
import time
import logging
import json
import requests
from config import create_api
from follow import follow_followers
from justlk import TListener
from rply_BTC import check_mentions
#from rply_ETH import check_mention
from tagged import check_mentioning
logging.bas... |
test_gc.py | import unittest
import unittest.mock
from test.support import (verbose, refcount_test, run_unittest,
cpython_only, start_threads,
temp_dir, requires_type_collecting, TESTFN, unlink,
import_module)
from test.support.script_helper import assert... |
train.py | import cv2
import numpy
import time
from lib.utils import get_image_paths
from lib.cli import FullPaths
from plugins.PluginLoader import PluginLoader
class TrainingProcessor(object):
arguments = None
def __init__(self, subparser, command, description='default'):
self.parse_arguments(description, subp... |
sdk.py | # -*- coding: utf-8 -*
# Copyright (C) 2018 Kin Foundation
from decimal import Decimal, getcontext
from functools import partial
from stellar_base.keypair import Keypair
from .config import *
from .errors import *
from .stellar.channel_manager import ChannelManager
from .stellar.horizon import Horizon, HORIZON_LIVE... |
heat_your_system.py | # Python Script to Heat your CPU Cores in Cold Temperatures
from multiprocessing import Process, cpu_count
from sys import argv
defaultProcessCount: int = cpu_count()
processCount: int = int(argv[1]) if len(argv) > 1 else defaultProcessCount
def heat():
for i in range(1 * 10**16):
i = i ** i
for i in ... |
dijk_inner.py | import random
import time
import threading
from threading import Thread,Semaphore
globvar = 1
INT_MAX = 1000000000
N=16
DEG=16
P=2
u=0
W = [[0 for x in range(DEG)] for x in range(N)]
W_index = [[0 for x in range(DEG)] for x in range(N)]
D = [0 for x in range(N)]
Q = [0 for x in range(N)]
threads = []
class Barrier... |
base_crash_reporter.py | # Electrum - lightweight Bitcoin client
#
# 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... |
_test_multiprocessing.py | #
# Unit tests for the multiprocessing package
#
import unittest
import queue as pyqueue
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.support
import test.... |
client3.py | import socket
import threading
sckt = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sckt.connect(('localhost', 9090))
name = input('Введите ник: ')
def send_message():
try:
while True:
text = input()
sckt.sendall(bytes(name + ": " + text, "utf-8"))
if text == "X":
... |
emails.py |
from threading import Thread
from flask import current_app, render_template
from flask_mail import Message
from image_social.extensions import mail
def _send_async_mail(app, message):
with app.app_context():
mail.send(message)
def send_mail(to, subject, template, **kwargs):
message = Message(curr... |
CommitManager.py | #encoding=utf-8
import os
import json
import time
import threading
import platform
import logutil
# 记录日志对象
_logger = logutil.getLogger("commit")
# 打印info级别日志
def _info(message):
_logger.info(message)
# 用于保存需要进行处理的应用的信息
_apps_need_to_handle = []
# 启动处理线程
_handle_thread = None
_thread_lock = t... |
recorder.py | import os
import time
import json
import operator
from threading import Thread
import numpy as np
import pyaudio
import datetime
import math
try:
import tflite_runtime.interpreter as tflite
except:
from tensorflow import lite as tflite
from config import config as cfg
from utils import audio
from utils impor... |
prom_client.py | """Implement Prometheus client."""
# Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
# Copyright (C) 2015 Brad Cowie, Christopher Lorier and Joe Stringer.
# Copyright (C) 2015 Research and Education Advanced Network New Zealand Ltd.
# Copyright (C) 2015--2019 The Contributors
#
# Licensed under the Apac... |
test_base_events.py | """Tests for base_events.py"""
import concurrent.futures
import errno
import logging
import math
import os
import socket
import sys
import threading
import time
import unittest
from unittest import mock
import asyncio
from asyncio import base_events
from asyncio import constants
from asyncio import events
from test.t... |
engine.py | import math
import os
import tempfile
import traceback
import uuid
from enum import Enum
from threading import Thread
from zipfile import ZipFile
import cv2
import logging
import time
import numpy as np
import pytesseract
from fishy.engine.fullautofisher.tesseract import is_tesseract_installed, downlaoad_and_extract... |
utils.py | #############################################################################
# Copyright (c) 2018, Voilà Contributors #
# Copyright (c) 2018, QuantStack #
# #
# Distri... |
pyplaybin.py | #!/usr/bin/env python
#-*- coding: ISO-8859-1 -*-
# This software is released under the terms of the MIT license. See the LICENSE file for details.
"""
Thin wrapper around GStreamer's playbin2, using asyncio-style asynchronous methods.
"""
import gi
gi.require_version('Gst', '1.0')
gi.require_version('GstVideo', '1.... |
two-tasks.py | #!/usr/bin/env python
"""
Two progress bars that run in parallel.
"""
import threading
import time
from prompt_toolkit_dev.shortcuts import ProgressBar
def main():
with ProgressBar() as pb:
# Two parallal tasks.
def task_1():
for i in pb(range(100)):
time.sleep(.05)
... |
signer.py | from multiprocessing import Process
import os
import random
import socket
from ecdsa import ecdsa as ec
from datetime import datetime
RNG = random.Random()
import hashlib
g = ec.generator_192
N = g.order()
secret = RNG.randrange(1, N)
PUBKEY = ec.Public_key(g, g * secret)
PRIVKEY = ec.Private_key(PUBKEY,... |
test.py | import sys
import mock
import threading
import time
import atexit
sys.modules["RPi.GPIO"] = mock.Mock()
sys.modules["RPi"] = mock.Mock()
sys.path.insert(0, "../examples/")
import motephat
_running = True
def watch():
while _running:
print(motephat.pixels)
time.sleep(0.5)
def stop():
globa... |
test_disk_set.py | # -*- coding: UTF-8 -*-
"""
Copyright 2012 Andres Riancho
This file is part of w3af, http://w3af.org/ .
w3af is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation version 2 of the License.
w3af is distributed in the h... |
train_new.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 io
import json
import torch
from pytorch_pretrained_bert import BertConfig
import distributed
from models import data_loader, model_builder
fro... |
SerialClient.py | #####################################################################
# Software License Agreement (BSD License)
#
# Copyright (c) 2011, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
... |
gesture_local_app.py | #-*-coding:utf-8-*-
'''
DpCas-Light
|||| ||||| |||| || |||||||
|| || || || || || |||| || ||
|| || || || || || || || ||
|| || || || || ||====|| ||||||
|| || ||||| || || ||======|| ||
|| || || |... |
test_ssl.py | # Test the support for SSL and sockets
import sys
import unittest
import unittest.mock
from test import support
import socket
import select
import time
import datetime
import gc
import os
import errno
import pprint
import urllib.request
import threading
import traceback
import asyncore
import weakref
import platform
i... |
manager.py | """Local development server manager."""
import logging
import os
import socket
import sys
import threading
from grow.common import bulk_errors
from grow.common import colors
from grow.common import timer
from grow.documents import document
from grow.preprocessors import file_watchers
from grow.sdk import updater
from ... |
sync.py | """
Ethereum Sync
^^^^^^^^^^^^^
Using an RPC provider, fetch each block and validate it with the specification.
"""
import argparse
import base64
import json
import logging
import time
from queue import Empty, Full, Queue
from threading import Thread
from typing import Any, Dict, List, Optional, TypeVar, Union
from u... |
runtime.py | from concurrent.futures import ThreadPoolExecutor
from functools import lru_cache, partial, wraps
import inspect
import threading
import uuid
import sublime
import sublime_plugin
MYPY = False
if MYPY:
from typing import Any, Callable, Dict, Iterator, Literal, Optional, Tuple, TypeVar
T = TypeVar('T')
F =... |
RTTMeasurement.py | #!/usr/bin/env python3
# -*- encoding: utf-8 -*-
import argparse
import json
import logging
import os
import random
import shlex
import signal
import socket
import subprocess
import threading
import time
import queue
import redis
class RTTMeasurement(object):
def __init__(self, host_list=[], port=6666, bind_ip =... |
purchasingdepartment.py | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 18 20:58:22 2021
@author: mhamz
"""
from datetime import datetime
import socket
import threading
import random
import string
from Crypto.PublicKey import RSA
from Crypto import Random
from Crypto.Cipher import DES
from Crypto.Cipher import DES3
from Crypto... |
healthcheckmqtt.py | """
Created on Nov 22, 2017
@author: sgoldsmith
Copyright (c) Steven P. Goldsmith
All rights reserved.
"""
import threading, observer
class healthcheckmqtt(observer.observer):
"""Health check.
Verify the health of videoloop. External process needs to monitor MQTT topic.
Based on PR from Joao Paul... |
test_enum.py | import enum
import inspect
import pydoc
import sys
import unittest
import sys
import threading
from collections import OrderedDict
from enum import Enum, IntEnum, EnumMeta, Flag, IntFlag, unique, auto
from io import StringIO
from pickle import dumps, loads, PicklingError, HIGHEST_PROTOCOL
from test import support
from ... |
WebServer.py |
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
from SocketServer import ThreadingMixIn
import threading
import re
import cgi
class LocalData(object):
records = {}
class HTTPRequestHandler(BaseHTTPRequestHandler):
def do_POST(self):
if None != re.search('MotorController', self.path):
ct... |
detector_app.py | import io
import base64
import sys
import tempfile
import cv2
import time
import argparse
import datetime
import numpy as np
try:
import queue
except ImportError:
import Queue as queue
from threading import Thread
MODEL_BASE = '/opt/VideoDetection/models/research'
sys.path.append(MODEL_BASE)
sys.path.append(M... |
secscommunicator.py | import threading
import inspect
import secs
class SecsCommunicatorError(Exception):
def __init__(self, msg):
super(SecsCommunicatorError, self).__init__(msg)
def __str__(self):
return repr(self)
class SecsWithReferenceMessageError(SecsCommunicatorError):
def __init__(self, msg, ref_ms... |
euslime_test_case.py | import os
import pprint
import re
import socket
import time
import traceback
import unittest
from euslime.logger import get_logger
from euslime.server import EuslimeServer
from sexpdata import dumps
from sexpdata import loads
from threading import Thread
HEADER_LENGTH = 6
REGEX_ADDR = re.compile(r' #X[0-9a-f]*')
REGE... |
handshake.py | import json
from queue import Queue
import subprocess
import socket
import struct
import sys
import threading
from threading import Thread
import time
# Project Includes
import constants
from network import network_utils
from network.network_utils import NetworkUtils
class Handshake(Thread):
"""Cl... |
sstvProxy.py | #!/usr/bin/env python3
###
###Copyright (c) 2016 by Joel Kaaberg and contributors. See AUTHORS
###for more details.
###
###Some rights reserved.
###
###Redistribution and use in source and binary forms of the software as well
###as documentation, with or without modification, are permitted provided
###that the follow... |
Stream.py | from SimpleCV.base import *
_jpegstreamers = {}
class JpegStreamHandler(SimpleHTTPRequestHandler):
"""
The JpegStreamHandler handles requests to the threaded HTTP server.
Once initialized, any request to this port will receive a multipart/replace
jpeg.
"""
def do_GET(self):
global... |
website_monitor.py | #!/usr/bin/env python
import asyncio
import json
import threading
import sys
from lib.monitor import Monitor
from lib.stats_writer import StatsWriter
config = json.load(open('config.json'))
def run_monitor():
monitor = Monitor(config)
# NOTE: Ugly workaround for running asyncio on Windows
# Solution a... |
norm_detector_benchmark.py | import random
import copy
import os
import subprocess
import logging as log
from norm_detector import norm_detector
from bayesian_norm_detector import bayesian_norm_detector
from hierarchical_bayesian_norm_detector import hierarchical_bayesian_norm_detector
from oren_meneguzzi_norm_detector import threshold_norm_dete... |
feature_shutdown.py | #!/usr/bin/env python3
# Copyright (c) 2018-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test danecoind shutdown."""
from test_framework.test_framework import DanecoinTestFramework
from test_... |
pyminer.py | #!/usr/bin/python
#
# Copyright (c) 2011 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
import... |
DualSendRecvExample.py | import sys
import os
HOME = os.environ['HOME']
sys.path.insert(1, HOME + '/github/StreamingSVM')
from comms import Communication
import numpy as np
import time
from threading import Thread
from dask.distributed import Client
class SendRecvExample:
comms = Communication.Communication()
def get_data(self, ran... |
sensor.py | """Sensor to monitor incoming/outgoing phone calls on a Fritz!Box router."""
from datetime import datetime, timedelta
import logging
import queue
from threading import Event as ThreadingEvent, Thread
from time import sleep
from fritzconnection.core.fritzmonitor import FritzMonitor
import voluptuous as vol
from homeas... |
speedtest-fs.py | #!/usr/bin/env python3
import os
import sys
import stat
import time
import signal
import traceback
import threading
from queue import Queue
"""speedtest-fs: filesystem performance estimate"""
__author__ = "ed <copyparty@ocv.me>"
__copyright__ = 2020
__license__ = "MIT"
__url__ = "https://github.com/9001/copyparty/"
... |
api.py | import bisect
from http.server import HTTPServer, BaseHTTPRequestHandler, HTTPStatus
import logging
import threading
from typing import Tuple
logger = logging.getLogger(__name__)
class Handler(BaseHTTPRequestHandler):
def __init__(self, *args, **kw):
self._paths = kw.pop('__paths')
logger.debug('... |
__init__.py | # -*- coding: utf-8 -*-
# @Author : xiaohuzi
# @Time : 2022-01-25 15:31
import logging
from tkinter import HORIZONTAL
import threading
import tkinter as tk
import time
import datetime
class Application(tk.Frame):
text_pady = 2
text_padx = 10
button_ipady = 10
def __init__(self, master=None):
... |
server.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
from base64 import b64encode
import json
import datetime as DT
import secrets
import socket
import threading
import random
import uuid
# Для импорта common
import sys
sys.path.append('..')
from common import send_msg, recv_msg
from info_securit... |
app.py | #from starlette.responses import Response
#from passlib.hash import pbkdf2_sha256
#from starlette.websockets import WebSocketDisconnect
from blockchain import Blockchain, DB, NODES
import os
from fastapi import FastAPI, WebSocket
import uvicorn
import socket
#import requests as r
from pydantic import BaseModel
from fas... |
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... |
orewa.py | #python3/tcpflood
#code by XalbadorX
import random
import socket
import threading
import os,sys
os.system("clear")
ip_bos = str(input("Ip Target : "))
port_bos = int(input("Port Target : "))
paket_bos = int(input("Pakets : "))
threads_bos = int(input("Threads : "))
os.system("clear")
def bos():
bos... |
test_poplib.py | """Test script for poplib module."""
# Modified by Giampaolo Rodola' to give poplib.POP3 and poplib.POP3_SSL
# a real test suite
import poplib
import asyncore
import asynchat
import socket
import os
import errno
import threading
from unittest import TestCase, skipUnless
from test import support as test... |
test_multiprocessing.py | #
# Unit tests for the multiprocessing package
#
import unittest
import Queue
import time
import sys
import os
import gc
import signal
import array
import socket
import random
import logging
import errno
import weakref
import test.script_helper
from test import support
from StringIO import StringIO
_multiprocessing = ... |
cloudstorage.py | import logging
import multiprocessing
import os
import azure.common
from azure.storage.blob import BlockBlobService
# Todo - comment class
class CloudStorage:
"""
This class is a helper class used to upload an image file to a cloud storage account. Currently it only supports
Azure, but others could be eas... |
example_binance_futures_1s.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# File: example_binance_futures_1s.py
#
# Part of ‘UNICORN Binance WebSocket API’
# Project website: https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api
# Documentation: https://lucit-systems-and-development.github.io/unicorn-binance-websocket-... |
discrepancy_searcher.py | #!/usr/bin/env python
# Copyright (c) 2014 Cloudera, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... |
decision_loop.py | from __future__ import annotations
import asyncio
import contextvars
import datetime
import json
import socket
import uuid
import random
import logging
import threading
from asyncio import CancelledError
from asyncio.events import AbstractEventLoop
from asyncio.futures import Future
from asyncio.tasks import Task
from... |
test_subprocess.py | import unittest
from unittest import mock
from test import support
import subprocess
import sys
import platform
import signal
import io
import itertools
import os
import errno
import tempfile
import time
import selectors
import sysconfig
import select
import shutil
import threading
import gc
import textwrap
from test.s... |
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
import homeassistant.config as config_ut... |
manager.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... |
main.py | # -*- encoding:utf-8 -*-
import os
import sys
import re
import argparse
import itertools
import multiprocessing
import asyncio
import time
import glob
import numpy as np
import matplotlib.pyplot as plt
import japanize_matplotlib
from PIL import Image
##################################################
# ... |
connection.py | import re
import time
import threading
from .utils import is_windows, encode_attr
from .event import Event
from .control import Control
class Connection:
def __init__(self, conn_id):
self.conn_id = conn_id
self.lock = threading.Lock()
self.url = ""
self.web = False
self.pri... |
apache-httpd-path-traversal.py | #coding:utf-8
#Author:LSA
#Description:apache httpd path traversal cve-2021-41773 and cve-2021-42013
#Date:20211011
from urllib import request
import sys
import optparse
import threading
import datetime
import os
import queue
import ssl
#reload(sys)
#sys.setdefaultencoding('utf-8')
context = ssl._create_unverifie... |
Ph4ntom.py | import os, requests, random, threading, json, time, multiprocessing
from colorama import Fore
# Credit to Pycenter by billythegoat356 thx billy :)
# Github: https://github.com/REXOUNER
# License: https://github.com/REXOUNER
def center(var:str, space:int=None): # From Pycenter
if not space:
space ... |
mp.py | ## this is mp.py from mpwn, a single file framework which lives at:
## https://github.com/lunxbochs/mpwn
#
#########
#
# Copyright (c) 2019 Ryan Hileman
#
# 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 ... |
demoserver.py | #!/usr/bin/python
#
# Server that will accept connections from a Vim channel.
# Run this server and then in Vim you can open the channel:
# :let handle = ch_open('localhost:8765')
#
# Then Vim can send requests to the server:
# :let response = ch_sendexpr(handle, 'hello!')
#
# And you can control Vim by typing a JSON... |
parallel_map.py | """
Parellel Map snippet by Brian Refsdal
http://www.astropython.org/snippet/2010/3/Parallel-map-using-multiprocessing
"""
from __future__ import print_function
import numpy
import warnings
from astropy import log
from tqdm import tqdm
_multi=False
_ncpus=1
try:
# May raise ImportError
import multiprocessing
... |
wsdump.py | #!python
import argparse
import code
import sys
import threading
import time
import ssl
import gzip
import zlib
import six
from six.moves.urllib.parse import urlparse
import websocket
try:
import readline
except ImportError:
pass
def get_encoding():
encoding = getattr(sys.stdin, "encoding", "")
if... |
data_manager.py | from PyQt5.QtCore import QFile, QIODevice
from PyQt5.QtGui import QPixmap
from data.dicom_series import DicomSeries
from image.dicom_image import DicomImage
from PyQt5.QtWidgets import QProgressBar
import os, time, random, re, threading, pathlib
from matplotlib import pyplot
from typing import Tuple
import numpy as np
... |
my_threading.py | import threading
import time
ls = []
def func(n):
for i in range(1, n+1):
ls.append(i)
time.sleep(0.5)
def func2(n):
for i in range(1, n+1):
ls.append(i)
time.sleep(0.5)
x = threading.Thread(target=func, args=(5,))
x.start()
# Switch back to the other thread
# Which means switch for x thre... |
io.py | # coding: utf-8
# pylint: disable=invalid-name, protected-access, fixme, too-many-arguments, W0221, W0201, no-self-use
"""NDArray interface of mxnet"""
from __future__ import absolute_import
from collections import OrderedDict
import ctypes
import sys
import numpy as np
import logging
import threading
from .base impo... |
make_token_lm.py | # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
__main__.py | from multiprocessing import Process
import time
import logging
from r2d7.slack.__main__ import main as slack_main
from r2d7.discord.__main__ import main as discord_main
logger = logging.getLogger(__name__)
def auto_restarter(slack, discord):
"""
If either bot crashes, start it up again. Last line of defence... |
redis_rendezvous.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import datetime
import json
import logging
import random
import sys
import threading
impo... |
dispatcher.py | import logging
import multiprocessing
import platform
import time
import typing as T
from logging.handlers import QueueHandler, QueueListener
from threading import Thread
from rembrain_robot_framework import utils
from rembrain_robot_framework.logger.utils import setup_logging
from rembrain_robot_framework.services.wa... |
spectrogram_to_tfrecords.py | import argparse
import os
from multiprocessing import Process
import tensorflow as tf
import tensorflow_io as tfio
from tqdm import tqdm
class Converter:
"""
Converter class for scanning input directory for classes and automatic conversion to TFRecords.
The resultant TFRecord stores the spectrogram along... |
__main__.py | import argparse
import glob
from io import BytesIO
import logging
import math
from multiprocessing import Process, Queue
import os
import queue
import sys
import zipfile
import json
import numpy
import requests
from .classifier import AzureSDKTrackClassifier, Language
from .helpers import get_zip_uri_and_subpath_from... |
thing.py | import threading
import time
import Adafruit_DHT
import RPi.GPIO as GPIO
DHT_TYPE = Adafruit_DHT.AM2302
DHT_PIN = 18
LED_PIN = 23
SWITCH_PIN = 24
class PiThing(object):
"""Internet 'thing' that can control GPIO on a Raspberry Pi."""
def __init__(self):
"""Initialize the 'thing'."""
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.