source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
emails.py | # -*- coding: utf-8 -*-
from builtins import str
from flask import render_template,g
from flask_mail import Message
from cineapp import mail, db
from cineapp.models import User
from threading import Thread
from cineapp import app
import html2text, time, json, traceback
# Send mail into a dedicated thread in order to ... |
client.py | #!/usr/bin/env python3
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COP... |
zhihu_login.py | # -*- coding: utf-8 -*-
import threading
__author__ = 'zkqiang'
__zhihu__ = 'https://www.zhihu.com/people/z-kqiang'
__github__ = 'https://github.com/zkqiang/Zhihu-Login'
import base64
import hashlib
import hmac
import json
import re
import time
from http import cookiejar
from urllib.parse import urlencode
import exe... |
test.py | #!/usr/bin/env python3
from hydrus import QtPorting as QP
from qtpy import QtWidgets as QW
from qtpy import QtCore as QC
import locale
try: locale.setlocale( locale.LC_ALL, '' )
except: pass
from hydrus import HydrusConstants as HC
from hydrus import HydrusData
from hydrus import HydrusGlobals as HG
from hydrus impo... |
telegram_controller.py | """텔래그램 챗봇을 활용한 시스템 운영 인터페이스
Operator를 사용해서 시스템을 컨트롤하는 모듈
"""
import os
import signal
import time
import threading
import json
from urllib import parse
import requests
from dotenv import load_dotenv
from . import (
LogManager,
Analyzer,
UpbitTrader,
UpbitDataProvider,
BithumbTrader,
BithumbData... |
kite_wbsk_mom.py | import datetime
import time
import json
from multiprocessing import Process, Queue
from queuemap import QueueMap
from threading import Thread
import pytz
import requests
from dotenv import load_dotenv, find_dotenv
from kiteconnect import KiteTicker
from kiteconnect import KiteConnect
from config import EnvConfig
from... |
run_experiments.py | #!/usr/bin/env python3
#
# Copyright (C) 2022 Intel Corporation.
#
# This software and the related documents are Intel copyrighted materials, and your use of them is governed by the express license under which they were provided to you ("License"). Unless the License provides otherwise, you may not use, modify, co... |
autoIndex.py | #!/usr/bin/env python3
import json
import logging
from multiprocessing import Manager, Process, cpu_count, current_process
from queue import Empty
from urllib.parse import urlparse
import boto3
import click
import datacube
from botocore import UNSIGNED
from botocore.config import Config
from ls_public_bucket import (... |
safe_t.py | from binascii import hexlify, unhexlify
import traceback
import sys
from typing import NamedTuple, Any, Optional, Dict, Union, List, Tuple, TYPE_CHECKING
from electrum.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException
from electrum.bip32 import BIP32Node
from electrum import constants
from electr... |
tello.py | import socket
import threading
import time
import cv2
from easytello.stats import Stats
class Tello:
def __init__(self, tello_ip: str='192.168.10.1', debug: bool=True):
# Opening local UDP port on 8889 for Tello communication
self.local_ip = ''
self.local_port = 8889
self... |
world.py | from terrain import *
from player import *
from core.renderer import *
import threading
import random
def execute_with_delay(func, delay):
threading.Timer(delay, func).start()
class ThreadedChunkGenerator:
def __init__(self, parent):
self.parent = parent
self.thread = threading.Thread... |
datasets.py | import glob
import math
import os
import random
import shutil
import time
from pathlib import Path
from threading import Thread
import cv2
import numpy as np
import torch
from PIL import Image, ExifTags
from torch.utils.data import Dataset
from tqdm import tqdm
from utils.utils import xyxy2xywh, xywh2xyxy
help_url =... |
37-3.py | # encoding=utf-8
import select
from threading import Thread
from time import time
def slow_system_call():
select.select([],[],[],0.1)
start = time()
threads = []
for _ in range(5):
thread = Thread(target=slow_system_call)
thread.start()
threads.append(thread)
end = time()
def compute_helicopter_location():
... |
RobotTracker.py | # -*- coding: utf-8 -*-
from teachablerobots.src.Communicate import SocketComm
from teachablerobots.src.GridSpace import *
import math
from time import sleep
#import threading
import ast
from multiprocessing import Process, Queue, Event, Value, Lock, Manager
from ctypes import c_char_p
class Robot(object):
''' ... |
common.py | """Test the helper method for writing tests."""
from __future__ import annotations
import asyncio
import collections
from collections import OrderedDict
from collections.abc import Awaitable, Collection
from contextlib import contextmanager
from datetime import datetime, timedelta
import functools as ft
from io import... |
create_and_run_compiler_gym_service.py | #! /usr/bin/env python3
#
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""An example CompilerGym service in python."""
import os
import sys
from concurrent import futures
from multiproces... |
logger.py | import collections, threading, traceback
import paho.mqtt.client as mqtt
try:
# Transitional fix for breaking change in LTR559
from ltr559 import LTR559
ltr559 = LTR559()
except ImportError:
import ltr559
from bme280 import BME280
from pms5003 import PMS5003
from enviroplus import gas
class EnvLogg... |
test_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... |
utilbuild.py |
def output_reader(pipe, queue):
try:
with pipe:
for l in iter(pipe.readline, b''):
queue.put(l)
finally:
queue.put(None)
def cargo_run(args, logging, cwd = None, faketime = None):
import subprocess
import shutil
from threading import Thread
from queu... |
yt_downloader_with_GUI_new.py | import glob
import os
import re
import sys
import urllib
from tkinter import (BOTH, CENTER, RIGHT, YES, HORIZONTAL, Button, Entry, Label, Listbox, Menu,
Scrollbar, StringVar, Tk, Toplevel, Y, font)
from tkinter import messagebox as m_box
from tkinter.ttk import Progressbar
from numpy import insert
... |
Dark-Mod.py | #!/usr/bin/python
# coding=utf-8
# (BHV) RedDemons
# Source : Python2 Gerak"
# DARK-FB version1.7
#Import module
import os,sys,time,datetime,random,hashlib,re,threading,json,getpass,urllib,cookielib
from multiprocessing.pool import ThreadPool
try:
import mechanize
except ImportError:
os.system("pip2 install mecha... |
Simulation.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... |
node.py | #!/usr/bin/env python2
"""
WARNING! This file is auto updated from the node manager. Any changes will
be lost when the client disconnects and reconnects.
This file is compatible with python2 and python3.
Theory of operation
1. Read the config file getting
- Server and port to connect too
- What arrays are ava... |
test_rand.py | from itertools import chain
import multiprocessing as mp
try:
from multiprocessing import SimpleQueue as MPQueue
except ImportError:
from multiprocessing.queues import SimpleQueue as MPQueue
import os
import threading
from ddtrace import Span
from ddtrace import tracer
from ddtrace.internal import _rand
fro... |
cloud.py | """
Object Store plugin for Cloud storage.
"""
import logging
import multiprocessing
import os
import os.path
import shutil
import subprocess
import threading
import time
from datetime import datetime
from galaxy.exceptions import ObjectInvalid, ObjectNotFound
from galaxy.util import (
directory_hash_id,
safe... |
weerplaza_eg.py | # -*- coding: utf-8 -*-
''' File contains examples for how to use the function from the anim library
for downloading images from weerplaza.nl'''
__author__ = 'Mark Zwaving'
__email__ = 'markzwaving@gmail.com'
__copyright__ = 'Copyright (C) Mark Zwaving. All rights reserved.'
__license__ = 'MIT Lice... |
test_io.py | """Unit tests for the io module."""
# Tests of io are scattered over the test suite:
# * test_bufio - tests file buffering
# * test_memoryio - tests BytesIO and StringIO
# * test_fileio - tests FileIO
# * test_file - tests the file interface
# * test_io - tests everything else in the io module
# * test_univnewlines - ... |
test_wrappers.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import os
from .common_test_data import *
from reusables import (
unique,
lock_it,
time_it,
queue_it,
setup_logger,
log_exception,
remove_file_handlers,
retry_it,
catch_it,
ReusablesError,
)
@unique(exception=OSError, ... |
main.py | # author: Bartlomiej "furas" Burek (https://blog.furas.pl)
# date: 2022.05.10
# [python - OpenCV (-215:Assertion failed) !_src.empty() in function 'cvtColor - Stack Overflow](https://stackoverflow.com/questions/60551469/opencv-215assertion-failed-src-empty-in-function-cvtcolor/60551714)
# Google Colab: https://colab.r... |
button.py | import datetime
import threading
from typing import Callable
import usb
from py_dream_cheeky import DreamCheekyThread, EventType, DreamCheekyEvent
BUTTON_VENDOR_ID = 0x1d34
BUTTON_PRODUCT_ID = 0x000d
def find_button_devices():
return list(usb.core.find(find_all=True, idVendor=BUTTON_VENDOR_ID, idProduct=BUTTON... |
DearPyGuiWrapper.py | from threading import Thread
import dearpygui.dearpygui as dpg
class DearPyGuiWrapper:
""" Wrapper for dearpygui window """
def __init__(self, title):
""" inicializacja """
self._ready = False
self._viewport_size = [1280, 720]
self._title = title
self.dpg = dpg
... |
runner.py | # library imports
from multiprocessing import Pool, cpu_count, Process
from copy import deepcopy
from typing import Dict, List, Tuple
import json
from os import makedirs, getcwd
import os
import traceback
import shutil
from uncertainties import ufloat, ufloat_fromstr
import time
# scientific imports
import numpy as np
... |
trainer.py | # coding=utf-8
# Copyright 2021 Zilliz. 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 applicab... |
consume-mail.py | #!/usr/bin/env python3
# Consume mail received from PowerMTA
# command-line params may also be present, as per PMTA Users Guide "3.3.12 Pipe Delivery Directives"
#
# Author: Steve Tuck. (c) 2018 SparkPost
#
# Pre-requisites:
# pip3 install requests, dnspython
#
import os, email, time, glob, requests, dns.resolver, s... |
main.py | # -*- coding: utf-8 -*-
"""
@Author : Fang Yao
@Time : 2021/3/24 9:28 上午
@FileName: main.py
@desc: 主程序入口文件
"""
import re
import os
import random
from collections import Counter
import unicodedata
from threading import Thread
import cv2
from Levenshtein import ratio
from PIL import Image
from numpy import average,... |
core.py | # -*- coding: utf-8 -*-
#
# 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, software
... |
multiprocessing_sharedctypes.py | """
「マルチプロセス」の節で登場するサンプルコード
sharedctypesサブモジュールを使ってプロセス間でデータを共有する方法
"""
from multiprocessing import Process, Value, Array
def f(n, a):
n.value = 3.1415927
for i in range(len(a)):
a[i] = -a[i]
if __name__ == '__main__':
num = Value('d', 0.0)
arr = Array('i', range(10))
p = Process(target... |
bot.py | try:
import unicorn_binance_rest_api
except ImportError:
print("Please install `unicorn-binance-rest-api`! https://pypi.org/project/unicorn-binance-rest-api/")
sys.exit(1)
binance_com_api_key = ...
binance_com_api_secret = ...
from unicorn_binance_websocket_api.unicorn_binance_websocket_api_manager import... |
trezor.py | from binascii import hexlify, unhexlify
import traceback
import sys
from electrum_btcc.util import bfh, bh2u, versiontuple, UserCancelled
from electrum_btcc.bitcoin import (b58_address_to_hash160, xpub_from_pubkey, deserialize_xpub,
TYPE_ADDRESS, TYPE_SCRIPT, is_address)
from electrum... |
simple-share.py | import seamless
from seamless.core import macro_mode_on
from seamless.core import context, cell, transformer, unilink, macro
from seamless.shareserver import shareserver
from seamless.core.share import sharemanager
from functools import partial
import websockets
import requests
import asyncio
import json
import time
... |
multiprocessing.py |
import time
import traceback
import pickle
import inspect
import collections.abc
from itertools import islice
from threading import Thread
from multiprocessing import current_process, Process, Queue
from typing import Iterable, Any, List, Optional, Dict
from coba.exceptions import CobaException
... |
cli.py | #!/usr/bin/env python
'''
brozzler/cli.py - brozzler command line executables
Copyright (C) 2014-2019 Internet Archive
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/lic... |
test_process_utils.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... |
onnxruntime_test_python.py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# -*- coding: UTF-8 -*-
import unittest
import os
import numpy as np
import onnxruntime as onnxrt
import threading
import sys
from helper import get_name
class TestInferenceSession(unittest.TestCase):
def run_model(self... |
test_retry.py | from datetime import datetime
from threading import Thread
from time import sleep
import pytest
import retry
exception_message = 'testing exceptions'
def foo(bar):
if bar < 0:
raise ArithmeticError(exception_message)
return bar
def test_success_criteria():
"""Success criteria successfully rai... |
rasprest.py | import os
from threading import Thread
import time
from subprocess import run
from flask import Flask, request
app = Flask(__name__)
passwd = open(os.path.expanduser('~/.passwd.txt')).readlines()[0].strip()
class Command:
'''
Given a command argument list, run command after seconds delay.
'''
def __i... |
wikicrawl.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 31 15:32:00 2017
@author: dataquanty
"""
import wikipedia
from csv import reader
import time
import threading
import sys
import warnings
def getWikipediaStats(page):
pagelmt = page.rsplit('_',3)
try:
wikipedia.set_lang(pagelm... |
multitester.py | """
Certbot Integration Test Tool
- Launches EC2 instances with a given list of AMIs for different distros
- Copies certbot repo and puts it on the instances
- Runs certbot tests (bash scripts) on all of these
- Logs execution and success/fail for debugging
Notes:
- Some AWS images, e.g. official CentOS and FreeBSD... |
main.py | # -*- coding: utf-8 -*-
"""
-------------------------------------------------
File Name: main.py
Description : 运行主函数
Author : JHao
date: 2017/4/1
-------------------------------------------------
Change Activity:
2017/4/1:
----------------------------------------... |
obupdater.py | import telegram
import queue
import html
import logging
from obupdater import long_poll, webhooks
import urllib.parse
import settings
import threading
import traceback
import sentry_support
class OBUpdater:
def __init__(self, bot, modloader):
self.logger = logging.getLogger("OBUpdater")
self.upd... |
state.py | import logging
import time
from threading import RLock
from typing import Optional
from fastapi import HTTPException, status
from minesweeper.game import Minesweeper, Status
from .models import Move, Square, Start
def _iter_game(game: Minesweeper):
from dataclasses import asdict
separator = ','.encode('utf-... |
decode.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2017 Tomoki Hayashi (Nagoya University)
# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
import argparse
import logging
import math
import os
import sys
import numpy as np
import soundfile as sf
import torch
import torch.multiprocessing as mp
from... |
import_logs.py | #!/usr/bin/python
# vim: et sw=4 ts=4:
# -*- coding: utf-8 -*-
#
# Piwik - free/libre analytics platform
#
# @link http://piwik.org
# @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
# @version $Id$
#
# For more info see: http://piwik.org/log-analytics/ and http://piwik.org/docs/log-analytics-tool-how-... |
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... |
functions0.py | #The MIT License (MIT)
#
#Copyright (c) 2017 Jordan Connor
#
#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, m... |
shutdown.py | import signal
from .Device import listOfDevices
from twisted.internet import reactor
from threading import Thread
import time
def GracefullShutdown(sig, form):
for device in listOfDevices:
device.stop()
t = Thread(target=server_shutdown)
t.start()
def server_shutdown():
time.sleep(0.3)
... |
Gui.py | from threading import Thread, Lock, Event
import time
import serial
import sys
import wx
import sys
import glob
import os
import struct
from csv import writer
import numpy as np
from collections import deque
import serial.tools.list_ports
import numpy as np
import matplotlib as mtp
mtp.use('WxAgg')
from matplotlib.... |
Application.py | ################################################################################
# Main application
################################################################################
import queue
import threading
from os.path import abspath, dirname, join
import tkinter as tk
from PIL import Image, ImageTk, ImageOps, Uni... |
localPathFinderInterface.py | import errno
import os
from threading import Thread
import time
from engine.interface import fileUtils
from engine.pathFinder import PathFinder
from engine.pathFinderManager import PathFinderManager
import gui
from gui.pathFinder.pathFinderInterface import PathFinderInterface
MAX_FILE_DUMPS = 1000
class LocalPathFi... |
MutiProcessProgramming.py |
print('MultiProcessProgramming')
# Unix 多进程创建 fork
#
# import os
#
# print('Process (%s) start...' % os.getpid())
#
# pid = os.fork()
#
# if pid == 0:
# print('I am child process(%s) and parent is %s' % (os.getpid(),os.getppid()))
# else:
# print('I (%s) just created a child process (%s)' % (os.getpid(), pid)... |
FS1Server.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# (wg-python-fix-pdbrc)
### HEREHEREHERE
from __future__ import annotations
import os
import optparse
import sys
import re
import socket
import threading
#############################################################################
# git FlexSpec1/Code/FlexSpec/Client... |
firmware_update.py | # Copyright 2020 AVSystem <avsystem@avsystem.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 a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
application.py |
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import QPoint
import sys
import setupsys
import systimatic
from ub import TW
import time
import threading
class Ui_Form(object):
def setupUi(self... |
data_collect_haar.py | #!/usr/bin/env python3
# coding=utf-8
import cv2
import numpy as np
import csv
import time
from multiprocessing import Process
# 在中断后重新识别人脸会导致突然的速度变化,因为是和之前的有图速度进行运算
# 两边判断现在基本不起作用
class DataCollect(object):
def __init__(self, cam_id, video_name):
self.cam_id = cam_id
self.video_name = video_name... |
pycozmobot.py | import pycozmo
from pycozmo import Client, LiftPosition
from pycozmo.util import Pose, Vector3, Angle, Distance, Speed #, Rotation
import time
import threading
import math
from pycozmo.expressions import Amazement, Excitement, Happiness, Sadness, Anger, Boredom, Surprise
import quaternion
import io
import json
animat... |
installwizard.py |
import sys
import threading
import os
import traceback
from typing import Tuple, List
from PyQt5.QtCore import *
from electrum.wallet import Wallet, Abstract_Wallet
from electrum.storage import WalletStorage
from electrum.util import UserCancelled, InvalidPassword, WalletFileException
from electrum.base_wizard impor... |
people_detector.py | ######## Webcam Object Detection Using Tensorflow-trained Classifier #########
#
# Author: Evan Juras
# Date: 10/27/19
# Description:
# This program uses a TensorFlow Lite model to perform object detection on a live webcam
# feed. It draws boxes and scores around the objects of interest in each frame from the
# webcam.... |
parellel_test_20191203.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Problem: certain sub-processes are not completing
Created on 2019-12-03 at 17:38
@author: cook
"""
import time
from multiprocessing import Process, Manager, Event
import numpy as np
import warnings
import os
import sys
import string
# --------------------------------... |
helpers.py | import multiprocessing
import time
import socket
import logging
import re
from contextlib import contextmanager
from playhouse.test_utils import assert_query_count, _QueryLogHandler
from data.database import LogEntryKind, LogEntry3
class assert_action_logged(object):
"""
Specialized assertion for ensuring ... |
hr_RealAppNavQ.py | # USAGE (for real case application):
#
# python human_recog.py --mode 2 --target cpu
# python human_recog.py -m 2 -t cpu
# import the necessary packages
from imutils.video import FPS
import argparse
import imagezmq
import socket
import signal
import time
import sys
import cv2
import dlib
from multiprocessing impor... |
processify.py | import inspect
import os
import sys
import traceback
from functools import wraps
from multiprocessing import Process, Queue
class Sentinel:
pass
# https://gist.github.com/schlamar/2311116 & https://gist.github.com/stuaxo/889db016e51264581b50
def processify(func):
'''Decorator to run a function as a process.
B... |
train_ug_pretrain.py | import tensorflow as tf
import numpy as np
import time
import datetime
import os
import network_pretrain as network_pre#pretraining for random division.
import json
from sklearn.metrics import average_precision_score
import sys
import ctypes
import threading
from kg_dataset_transe import KnowledgeGraph
export_path = "... |
app.py | import threading
from zipfile import ZipFile
from flask import Flask, request
import uuid
import sys
import subprocess
import settings as s
import utils as u
import boto3
import os.path
logger = u.init_logger(__name__)
app = Flask(__name__)
@app.route('/', methods=['POST'])
def index():
file_name = None
sc... |
program.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... |
spaceapi.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=C0111,R0903
"""Displays the state of a Space API endpoint
Space API is an API for hackspaces based on JSON. See spaceapi.io for
an example.
Requires the following libraries:
* requests
* regex
Parameters:
* spaceapi.url: String representati... |
crawler.py | from bs4 import BeautifulSoup
import warnings; warnings.filterwarnings("ignore")
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from IPython.display import clear_output
import re, os, time, pickle, errno
import pandas as pd
import numpy as np
import threading
class BigwingCrawler(... |
sessions.py | import os
import uuid
import time
from datetime import datetime
from threading import Thread, Lock
from contextlib import contextmanager
from sentry_sdk._types import MYPY
from sentry_sdk.utils import format_timestamp
if MYPY:
import sentry_sdk
from typing import Optional
from typing import Union
fro... |
day3homework_1.py | import requests
import re
import threading
def spider(listadd):
for j in listadd:
response = requests.get(j)
response.encoding = 'utf-8'
title = re.findall('<h1>\n(.*)</h1>', response.text, re.S)
content = re.findall('  (.*?)<br /><br />', response.text)
temp=... |
AsynchronousThreading.py | """
"""
import threading
from src.utils.Prints import pt
import traceback
import json
def object_to_json(object, attributes_to_delete=None):
"""
Convert class to json with properties method.
:param attributes_to_delete: String set with all attributes' names to delete from properties method
:return: s... |
smbrelayx.py | #!/opt/impacket-impacket_0_9_20/bin/python3
# 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:
# ... |
webgui.py | import os
from datetime import datetime
import logging
import tempfile
import subprocess as sps
from threading import Lock, Thread
from scan_system.wsgi import application
logging.basicConfig(
level=logging.INFO, format="flaskwebgui - [%(levelname)s] - %(message)s"
)
def find_chrome_win():
... |
test_decorators.py | from threading import Thread
import cProfile, pstats, io, os, errno, signal, time
from functools import wraps
from contextlib import contextmanager
from utilmy.debug import log
def test_all():
"""function test_all
Args:
Returns:
"""
test_decorators()
test_decorators2()
def test_dec... |
sequencer.py | import copy
import threading
import webbrowser
import statistics
from operator import attrgetter, methodcaller
from PySide2.QtGui import *
from PySide2.QtCore import *
from PySide2.QtWidgets import *
from leaguedirector.widgets import *
PRECISION = 10000.0
SNAPPING = 4
OVERLAP = 4
ADJACENT = 0.05
class SequenceKeyfr... |
terrain_interface.py | import random
import shapely
from sqlalchemy import create_engine, and_
from psycopg2.pool import ThreadedConnectionPool
import psycopg2
from sqlalchemy.orm import sessionmaker
from geoalchemy2.functions import GenericFunction
from geoalchemy2 import Geometry
from geoalchemy2.shape import to_shape, from_shape
from shap... |
add_recording_bookmark.py | import sys
sys.path.append('../')
sys.path.append('../TensorFlow-2.x-YOLOv3')
sys.path.append('../mmfashion')
import os
import cv2
import numpy as np
import tensorflow as tf
import torch
from yolov3.utils import load_yolo_weights, image_preprocess, postprocess_boxes, nms, draw_bbox, read_class_names
from deep_sort imp... |
douban.py | #coding:utf-8
#多一个线程时不时序列化
#{
# visited
# n
#}
#载入时自动使viited.pop()作为最新的url
#n = num
#提供一些爬取豆瓣的api
import requests
from bs4 import BeautifulSoup
from queue import Queue
import threading
import re
import time
import os.path
import json
import random
HEADER={
"Host": "movie.douban.com",
"scheme":"https",
"version":"HT... |
ms.py | """
merge sort parallelization
"""
import math
import os, sys, time
import math, random
from multiprocessing import Process, Manager
def mergeSort(a):
len_a = len(a)
if len_a <= 1:
return a
m = int(math.floor(len_a) / 2)
left = a[0:m]
right = a[m:]
left = mergeSort(left)
right =... |
allsettings.py | # Copyright (c) 2011-2020 Eric Froemling
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish,... |
checker_server.py | import getopt
import socket
import sys
from threading import Thread
from gpiozero import RotaryEncoder, OutputDevice, Motor, DigitalInputDevice
from time import sleep
from config import Config
from logger import Logger
def convert_steps(steps):
return f'{steps:04}'
def when_rotated(rotary_encoder):
Logger... |
workers_manager.py | import importlib
import inspect
import threading
from functools import partial
from apscheduler.schedulers.background import BackgroundScheduler
from interruptingcow import timeout
from pytz import utc
from const import DEFAULT_COMMAND_TIMEOUT, DEFAULT_COMMAND_RETRIES, DEFAULT_UPDATE_RETRIES
from exceptions import Wo... |
controller.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import RPi.GPIO as GPIO # Import Raspberry Pi GPIO library
import time,threading
import os
import sys
import Adafruit_DHT
import syslog
from mikezlcd import *
lcd = lcd_module(2004, 25, 24, 22, 18, 17,23)
lcd.disp(0,0,"Booting...")
import psycopg2
try:
f = open("/etc/db... |
train_hybrid.py | #!/usr/bin/env python
"""
Main training workflow
"""
from __future__ import division
import argparse
import glob
import os
import random
import signal
import time
import torch
import distributed
from pytorch_transformers import BertTokenizer
from models import data_loader, model_builder
from models.data_loader imp... |
run_temporal_averaging.py | import pyvista
import os, sys, glob
import subprocess
import math
from natsort import natsorted
import multiprocessing
def write_pvd(base_name, dt, nsteps, extension, nprocs_sim=1):
prefix = '''<?xml version="1.0"?>
<VTKFile type="Collection" version="0.1"
byte_order="LittleEndian"
... |
OrderLogic.py | from threading import Thread, Lock
from settings import Settings
from asyncblink import signal
from random import uniform
from helpers import Logger
curId = "OrderLogic"
class ChainRiftData(object):
balances = {}
openOrders = {}
for ticker, orderTypes in Settings.chainRiftPairPlacement.items():
... |
iostream.py | """Wrappers for forwarding stdout/stderr over zmq"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import atexit
from binascii import b2a_hex
from collections import deque
from imp import lock_held as import_lock_held
import os
import sys
import threading
import ... |
test.py | from easytello import tello
import threading
import time
import socket
from tkinter import *
import tkinter as tk
from PIL import Image,ImageTk
import tkinter.messagebox
import cv2
import PIL.Image
from gaze_tracking import GazeTracking
root = tk.Tk()
root.title('湧泉相報系統')
root.geometry('1024x600')
root.configure(... |
smartbms.py | #!/usr/bin/env python3
import argparse
import os
import serial
import serial.tools.list_ports
import struct
import sys
import threading
import time
from collections import deque
from datetime import datetime
from dbus.mainloop.glib import DBusGMainLoop
from gi.repository import GLib
# Victron packages
sys.path.insert(... |
P2PUDPSocket.py | import sys
import socket as sk
import urllib.parse
import urllib.request
import time
import threading
try:
import stun
except:
print('Install stun with')
print('pip install pystun3')
sys.exit(1)
# PUBLIC stun host can be found by googling ... or similar words.
# https://gist.github.com/sagivo/3a4b2f2c... |
host_manager.py | import random
import os
import json
import time
import threading
import simple_http_client
from front_base.host_manager import HostManagerBase
class HostManager(HostManagerBase):
def __init__(self, config, logger, default_fn, fn, front):
self.config = config
self.logger = logger
self.def... |
benchmark_averaging.py | import math
import time
import threading
import argparse
import torch
import hivemind
from hivemind.utils import LOCALHOST, increase_file_limit, get_logger
from hivemind.proto import runtime_pb2
logger = get_logger(__name__)
def sample_tensors(hid_size, num_layers):
tensors = []
for i in range(num_layers)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.