source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
app.py | import requests
from flask import Flask, render_template, request, redirect, make_response
from song import Song
import json
import spotify
from Queue import Queue
import datetime
import random, string
from threading import Thread
from bosesoundhooks import play, getTime
import webbrowser
from time import sleep
access... |
test_brozzling.py | #!/usr/bin/env python
'''
test_brozzling.py - XXX explain
Copyright (C) 2016-2018 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/licenses/LICENSE-2.0
U... |
custom.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
ble_task_rpi.py | import time
import os
import json
import queue
import base64
import pexpect
from typing import Optional
from threading import Thread
from modi.task.conn_task import ConnTask
from modi.util.miscellaneous import ask_modi_device
class BleTask(ConnTask):
def __init__(self, verbose=False, uuid=None):
print(... |
matrixlock.py | #!/usr/bin/python3
from argparse import ArgumentParser
from http.server import BaseHTTPRequestHandler, HTTPServer
from os.path import dirname, join
from subprocess import run, Popen, DEVNULL
from threading import Thread, Event
from time import time
import json
def main(matrix_delay_secs, terminal, locker):
workspac... |
__init__.py | import logging
import socket
import faulthandler
from telegram.ext import Updater as tgUpdater
from qbittorrentapi import Client as qbClient
from aria2p import API as ariaAPI, Client as ariaClient
from os import remove as osremove, path as ospath, environ
from requests import get as rget
from json import loads as jsnl... |
ci.py | import json
import logging
import collections
import requests
import threading
import time
from batch.client import Job
from flask import Flask, request, jsonify, render_template
from flask_cors import CORS
from .batch_helper import try_to_cancel_job, job_ordering
from .ci_logging import log
from .constants import BU... |
pjit_test.py | # Copyright 2021 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
consolelogwriter.py | """The console log writer"""
# -*- coding:utf-8 -*-
import os
import queue
import sys
import threading
import time
import traceback
from .mslogconfig import MsConsoleLogConfig
from .msloglevel import MsLogLevels
from .mslogmsg import MsLogMessage
from .mslogwriter import MsLogWriter
__mutex = threading.RLock()
__in... |
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... |
dicom.py | # -*- coding: utf-8 -*-
"""
There are two types of AEs:
* SCP (Service Class Provider) which can be thought of as a server
* SCU (Service Class User) as a client.
CHANGELOG
=========
0.1.2 / 2021-05-19
------------------
- change debug messages
0.1.1 / 2021-04-27
------------------
- enables dicom calls via pynet... |
docker.py | # -*- encoding: utf-8 -*-
from __future__ import nested_scopes, generators, division, absolute_import, \
with_statement, print_function, unicode_literals
import logging
from subprocess import Popen, PIPE
from strings import get_random_string
import io
import threading
import subprocess
log = logging.getLogger(__... |
test_capi.py | # Run the _testcapi module tests (tests for the Python/C API): by defn,
# these are all functions _testcapi exports whose name begins with 'test_'.
from collections import OrderedDict
import os
import pickle
import random
import re
import subprocess
import sys
import textwrap
import threading
import time
import unitt... |
tests.py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
index.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
import hashlib
import logging
import os
import shutil
import subprocess
import tempfile
try:
from threading import Thread
except ImportErr... |
application_compile_and_run_test.py | # Copyright 2021 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... |
db.py | #
# clfsload/db.py
#
#-------------------------------------------------------------------------
# Copyright (c) Microsoft. 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 a... |
python_instance.py | #!/usr/bin/env python
#
# 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
# "... |
blockchain_test.py | import threading
import time
from time import sleep
from blockchain.blockchain_manager import BlockchainManager
from blockchain.block_builder import BlockBuilder
from transaction.transaction_pool import TransactionPool
# TransactionPoolの確認頻度
CHECK_INTERVAL = 10
FLAG_STOP_BLOCK_BUILD = False
def start_thread(tp, bb... |
setup_perturbed_snapshots.py | from multiprocessing import Queue, Process
from argparse import ArgumentParser
import ioutils
import copy
from scipy.stats import bernoulli
def worker(proc_num, queue, corpus, donor_list, donor_occuarances_map, receptor_list, word_freq, preplacement, out_dir, out_suffix):
while True:
if queue.empty():
... |
semaphore.py | import threading
import time
sem = threading.Semaphore()
def fun1():
while True:
sem.acquire()
print(1)
sem.release()
time.sleep(0.25)
def fun2():
while True:
sem.acquire()
print(2)
sem.release()
time.sleep(0.5)
t = threading.Thread(target = fun... |
main.py | #!/usr/bin/env python3
import operator
import sys
from queue import Queue
from threading import Thread
class Memory(list):
def __getitem__(self, index):
if index >= len(self):
self.extend([0] * (index - len(self) + 1))
return super(Memory, self).__getitem__(index)
def __setitem__... |
luck.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import time, threading
balance = 0
lock = threading.Lock()
# 新线程执行的代码:
def loop():
print('thread %s is running...' % threading.current_thread().name)
n = 0
global balance
while n < 5:
n = n + 1
lock.acquire()
balance = balance + 1... |
thinc_worker.py | """
PyTorch version: https://github.com/pytorch/examples/blob/master/mnist/main.py
TensorFlow version: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/tutorials/mnist/mnist.py
"""
# pip install thinc ml_datasets typer
import threading
from typing import Optional
import time
from thinc.types imp... |
test_client.py | import unittest
import socket
from threading import Thread
import openmath.openmath as om
from openmath.encoder import encode_bytes
from openmath.decoder import decode_bytes
from scscp.client import SCSCPClient
from scscp.server import SCSCPServerBase
from scscp import scscp
class TestClient(unittest.TestCase):
d... |
subscriber.py | from abc import ABCMeta, abstractmethod
from azure.servicebus import Rule
from speedcamera import SpeedCamera
import azurehook
import threading
import json
import math
import time
import Queue
import random
################################################################################
###############################... |
bot.py | # -*- coding: utf-8 -*-
import vk_api
import requests
import bs4
import datetime
import random
import json
import time
import os.path
import threading
from vk_api.keyboard import VkKeyboard, VkKeyboardColor
from bot_4u.checkers import *
from bot_4u.config import *
from bot_4u.keyboards import *
from bot_4u.games impor... |
app.py | from motor_controller import start_motor_controller
from web_server import start_webserver
from discovery_service import discovery
from multiprocessing import Process
if __name__ == '__main__':
mc = start_motor_controller()
p = Process(target=discovery)
p.start()
start_webserver(mc) |
map_dataset_op_test.py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
main V2 BETA 2.0 .py | import serial # For Bluetooth
from nanpy import (ArduinoApi, SerialManager) # For Arduino
import RPi.GPIO as GPIO # For Raspberry Pi
from threading import Thread
from time import sleep, time
import os
from Adafruit_CharLCD import Adafruit_CharLCD
import socket
# Bluetooth Serial Conniction
ser = serial.Serial('/dev/tt... |
vxstreamlib.py | # vim: sw=4:ts=4:et
import gzip
import hashlib
import io
import json
import logging
import os.path
import re
import shutil
import smtplib
import sys
import tempfile
import threading
import time
import traceback
import warnings
import zipfile
from subprocess import Popen, PIPE
import requests
__all__ = [
'VXSTRE... |
demo.py | # Copyright (c) 2015 SONATA-NFV, UBIWHERE, i2CAT,
# 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 require... |
utils.py | import asyncio
from collections import namedtuple
from queue import Empty, Full, Queue
from threading import Lock, Thread
from pypeln import utils as pypeln_utils
import time
LOOP = asyncio.new_event_loop()
def run_on_loop(f_coro):
if not LOOP.is_running():
def run():
LOOP.run_forever()
... |
cluster_fireball.py |
import os
import time
from multiprocessing import Pool, Process
import pychemia
from pychemia.utils.serializer import generic_serializer
__author__ = 'Guillermo Avendano-Franco'
def cluster_fb_worker(db_settings):
while True:
pcdb = pychemia.db.get_database(db_settings)
population = pychemia.pop... |
training.py | from django.shortcuts import render
from django.http import HttpResponse
from django.conf import settings
from rest_framework import permissions
from rest_framework.views import APIView
from rest_framework.response import Response
from django.views.decorators.csrf import csrf_exempt
# from rest_framework.decorators im... |
trainer_controller.py | # # Unity ML-Agents Toolkit
# ## ML-Agent Learning
"""Launches trainers for each External Brains in a Unity Environment."""
import os
import threading
from typing import Dict, Optional, Set, List
from collections import defaultdict
import numpy as np
from mlagents.tf_utils import tf
from mlagents_envs.logging_util i... |
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 - ... |
download_imgs.py | import codecs
import os
import urllib
import threading
class DownloadImgs(object):
def __init__(self, img_urls_file, thread_num=8):
self.img_urls_file = img_urls_file
self.fold_name = self.img_urls_file.split("/")[-1].split(".")[0]
self.__get_img_urls_list()
if not os.path.exists(".... |
osdlyrics.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# osdlyrics.py --- desktop lyrics for musicbox
# Copyright (c) 2015-2016 omi & Contributors
import sys
import logger
from config import Config
from multiprocessing import Process
log = logger.getLogger(__name__)
config = Config()
try:
from PyQt4 import QtGui, QtCor... |
tracker.py | """RPC Tracker, tracks and distributes the TVM RPC resources.
This folder implemements the tracker server logic.
Note
----
Tracker is a TCP based rest api with the following protocol:
- Initial handshake to the peer
- RPC_TRACKER_MAGIC
- Normal message: [size(int32), json-data]
- Each message is initiated by the cl... |
generator_data_source.py | from skmultiflow.data.source.data_source import DataSource
import threading
class GeneratorDataSource(DataSource):
""" GeneratorDataSource class.
Provides a DataSource implementation, pulling data from a generator.
Examples
--------
>>> import time
>>> from skmultiflow.data.generator.sea_gene... |
naiveA2C.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
# @Time : 2021/8/4 11:02 下午
# @Author : tinyzqh
# @Email : tinyzqh@163.com
# @File : naiveA2C.py
"""
import gym
import argparse
import torch
import numpy as np
import torch.nn as nn
import torch.optim as optim
from torch.distributions import Categorical
import ma... |
acquire_faces.py |
from picamera.array import PiRGBArray
from picamera import PiCamera
import time
import cv2
import numpy as np
import os
import multiprocessing
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
def detect_faces(image, frames_passed_in_session, output):
gray_image = cv2.cvtColor(image, c... |
function.py | import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
os.environ['CUDA_VISIBLE_DEVICES'] = ''
import nltk
nltk.data.path.append('/home/husein/nltk_data')
from rnn import *
from setting import *
from bs4 import BeautifulSoup
import requests
import re
from queue import Queue
import threading
import pickle
import numpy as np... |
torch_policy.py | import copy
import functools
import gym
import logging
import math
import numpy as np
import os
import threading
import time
import tree # pip install dm_tree
from typing import (
Any,
Callable,
Dict,
List,
Optional,
Set,
Tuple,
Type,
Union,
TYPE_CHECKING,
)
import ray
from ray... |
apmserver.py | from datetime import datetime, timedelta
import json
import os
import re
import sets
import shutil
import sys
import threading
import time
import unittest
from urlparse import urlparse
from elasticsearch import Elasticsearch, NotFoundError
from nose.tools import nottest
import requests
sys.path.append(os.path.join(os... |
paramiko_expect.py | #
# Paramiko Expect
#
# Written by Fotis Gimian
# http://github.com/fgimian
#
# This library works with a Paramiko SSH channel to provide native SSH
# expect-like handling for servers. The library may be used to interact
# with commands like 'configure' or Cisco IOS devices or with interactive
# Unix scripts or comman... |
display.py | import threading
try:
from .grab import Image
except:pass
def grab_bytes():
return Image().asbytes
def send(s,a):
s.post(b's'+grab_bytes(),a)
def show_bytes(r):
if not r.startswith('s'):return
Image(r[1:]).show()
def conf(s,a):
def _conf():
while True:
send(s,a)
threading... |
video_base.py | import time
import threading
try:
from greenlet import getcurrent as get_ident
except ImportError:
try:
from thread import get_ident
except ImportError:
from _thread import get_ident
'''
An Event-like class that signals all active clients when a new frame is available.
'''
class VideoE... |
streaming.py | # Tweepy
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
# Appengine users: https://developers.google.com/appengine/docs/python/sockets/#making_httplib_use_sockets
from __future__ import absolute_import, print_function
import logging
import requests
from requests.exceptions import Timeout
from thre... |
sfp_portscan_tcp.py | # -*- coding: utf-8 -*-
# -------------------------------------------------------------------------------
# Name: sfp_portscan_tcp
# Purpose: SpiderFoot plug-in for performing a basic TCP port scan of IP
# addresses identified.
#
# Author: Steve Micallef <steve@binarypool.com>
#
# Create... |
test_threads.py | # This file is part of h5py, a Python interface to the HDF5 library.
#
# http://www.h5py.org
#
# Copyright 2008-2013 Andrew Collette and contributors
#
# License: Standard 3-clause BSD; see "license.txt" for full license terms
# and contributor agreement.
"""
Tests the h5py.File object.
"""
from __futu... |
ydlhandler.py | import os
from queue import Queue
from threading import Thread
import subprocess
from collections import ChainMap
import io
import importlib
import youtube_dlc
import json
from time import sleep
import sys
from ydl_server.logdb import JobsDB, Job, Actions, JobType
from ydl_server import jobshandler
from ydl_server.con... |
mupen64plus_env.py | from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
import abc
import array
import inspect
import itertools
import json
import os
import subprocess
import threading
import time
from termcolor import cprint
import yaml
import gym
from gym import error, spaces, utils
from gym.utils import seeding
import nump... |
breadth.py | import sys
import threading
import time
import keyboard
TEXT = ["BREATHE IN", "HOLD", "BREATHE OUT"]
JJ = [0, 4, 11]
def my_code():
"""
The actual function to do the breathe patterns.
It rings a ``ding`` to alert user for hold breathe in and out
"""
i = 0
j = 0
while True:
prin... |
miniterm.py | #!C:\Python27\python.exe
# Very simple serial terminal
# (C)2002-2011 Chris Liechti <cliechti@gmx.net>
# Input characters are sent directly (only LF -> CR/LF/CRLF translation is
# done), received characters are displayed as is (or escaped trough pythons
# repr, useful for debug purposes)
import sys, os, s... |
facerec_with_gui.py | # -*- coding: utf-8 -*-
#######################################
__file__ = "facerec_with_gui.py"
__author__ = "Mesut Pişkin"
__version__ = "1.0"
__email__ = "mesutpiskin@outlook.com"
#######################################
from tkinter import *
import PIL.Image
import PIL.ImageTk
import tkinter.filedialog
import fac... |
memtest.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2014 Ben Kurtovic <ben.kurtovic@gmail.com>
#
# 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 ... |
mqtt_agent.py | """
Copyright (c) 2021 Software AG, Darmstadt, Germany and/or its licensors
SPDX-License-Identifier: Apache-2.0
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/licens... |
threadpool.py | #!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
Cached thread pool, inspired from Pelix/iPOPO Thread Pool
:author: Thomas Calmant
:copyright: Copyright 2017, Thomas Calmant
:license: Apache License 2.0
:version: 0.3.1
..
Copyright 2017 Thomas Calmant
Licensed under the Apache License... |
jpserve.py | r"""JPServer is a Python script executor running on the Python side.
JPServe receiving and executing the script from 3rd-part languages,
then send back the result as JSON format to the caller.
Usages:
- Start server
server = JPServe(("hostname", port))
server.start()
- Stop server
server.shutdown()
- Se... |
run_fit.py | #!/usr/bin/python
# run_fit.py - driver for running the fitting codes in parallel
# by launching multiplt (12 in this case) jobs
#
#
# Created by Michal Ben-Nun on 5/19/20.
#
import multiprocessing
from multiprocessing import Process
import os
import string
import random
import numpy as np
def info(title):
... |
views.py | from django.shortcuts import render
from stats.models import StatsLog, Day, Month, Year
from django.http import HttpResponse
#from datetime import datetime
from django.core.cache import cache
import time
import datetime
import threading
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import os
from f... |
wifi_deauth.py | #!/usr/bin/python3
import csv
from datetime import datetime
import os
import re
import shutil
import subprocess
import threading
import time
def in_sudo_mode():
"""If the user doesn't run the program with super user privileges, don't allow them to continue."""
if not 'SUDO_UID' in os.environ.keys():
... |
test_bz2.py | from test import test_support
from test.test_support import TESTFN, _4G, bigmemtest, import_module, findfile
import unittest
from cStringIO import StringIO
import os
import subprocess
import sys
try:
import threading
except ImportError:
threading = None
bz2 = import_module('bz2')
from bz2 import BZ2File, BZ2... |
envs_utils.py | import os
from abc import ABC, abstractmethod
from collections import OrderedDict
import csv
import json
from multiprocessing import Process, Pipe
import time
current_dir = os.path.dirname(os.path.realpath(__file__))
parent_dir = os.path.dirname(current_dir)
os.sys.path.append(parent_dir)
import gym
from gym import s... |
thread_test.py | import threading # python3主要的线程库 _thread是旧版本不推荐
import time
from threading import current_thread
def myTHread(arg1, arg2):
print(current_thread().getName(), 'start')
print('%s, %s' % (arg1, arg2))
time.sleep(3)
print(current_thread().getName(), 'stop')
# 循环开5个线程
for i in range(1, 6, 1):
t1 = th... |
network.py | """
Defines network nodes used within core.
"""
import logging
import math
import threading
import time
from typing import TYPE_CHECKING, Callable, Dict, List, Optional, Type
import netaddr
from core import utils
from core.emulator.data import InterfaceData, LinkData, LinkOptions
from core.emulator.enumerations impo... |
server.py | # PackedBerry Server
from flask import Flask
from threading import Thread
import logging
import time
app = Flask('')
log = logging.getLogger('werkzeug')
log.setLevel(logging.ERROR)
@app.route('/')
def home():
f = open('index.html', 'r')
d = f.read()
f.close()
html = str(d)
return html
def run():
try:
app.r... |
test_utils.py | import pickle
import threading
import time
import pytest
import boardgamegeek.utils as bggutil
from _common import *
from boardgamegeek.objects.things import Thing
def test_get_xml_subelement_attr(xml):
node = bggutil.xml_subelement_attr(None, "hello")
assert node is None
node = bggutil.xml_subelement_a... |
App.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
import threading
import time
import atexit
from modules.Blinkt import Blinkt
from modules.Config import *
from modules.Data import Data
from modules.Log import log_str
from modules.ScrollPhat import ScrollPhat
from modules.UniCorn import UniCorn
from modules.Updat... |
__init__.py | import sys
import types
import warnings
from threading import Thread
from functools import wraps
import stackprinter.formatting as fmt
from stackprinter.tracing import TracePrinter, trace
def _guess_thing(f):
""" default to the current exception or current stack frame"""
# the only reason this happens up he... |
api_connection.py | """
MindLink API samples.
For more information, visit our developer wiki @https://wiki.mindlinksoft.com/tiki-index.php?page=MindLink+API and our engineering blog @https://engineering.mindlinksoft.com/
The samples are provided "as is". Do feel free to experiment or use them as you deem fit. Have fun!
ApiConnec... |
video.py | # -*- coding: utf-8 -*-
"""Video readers for Stone Soup.
This is a collection of video readers for Stone Soup, allowing quick reading
of video data/streams.
"""
import datetime
import threading
from abc import abstractmethod
from queue import Queue
from typing import Mapping, Tuple, Sequence, Any
from urllib.parse im... |
console_dispatcher.py | import logging
import sys
import threading
from django.core.management.base import BaseCommand
from django.conf import settings
from fastapp.executors.heartbeat import update_status
from fastapp.console import PusherSenderThread
logger = logging.getLogger("fastapp.executors.console")
class Command(BaseCommand):
... |
server.py | import sys
import socket
import select
import threading
import time
# settings
class SETTINGS:
HOST = '127.0.0.1'
PORT = 54326
class TYPE:
CONSOLE = 'CONSOLE'
DEBUG = 'DEBUG'
# messages
class MESSAGE:
AMENDED = 'AMENDED'
BP_CONFIRM = 'BP_CONFIRM'
BP_RESET = 'BP_RESET'
BP_WAIT = 'BP_WA... |
benchmark_rap.py | import asyncio
import multiprocessing
import time
import uvloop
from rap.client import Client
from rap.server import Server
NUM_CALLS: int = 10000
def run_server() -> None:
async def test_sum(a: int, b: int) -> int:
await asyncio.sleep(0.01)
return a + b
loop: asyncio.AbstractEventLoop = u... |
main.py | import re
import time
import asyncio
import aiohttp
import json
import os, sys, subprocess, threading
from os import path
from PySide2.QtUiTools import QUiLoader
from PySide2.QtWidgets import *
from PySide2.QtCore import *
from PySide2.QtXml import QDomNode
import requests
from bs4 import BeautifulSoup
from MainWindo... |
ajtrace.py | #!/usr/bin/python
import argparse
import logging
import signal
import threading
import time
from ebpf_modules import ebpf_modules, Controller
from graphite import GraphiteBackend
from settings import GlobalConfig as config
controller = Controller()
def signal_handler(signum, frame):
""" Send a message to all ... |
utils.py | import threading
from django.contrib.auth.models import User
from django.core import management
from jsonrpc._json import loads, dumps
from six.moves.urllib import request as urllib_request
from six.moves.urllib import parse as urllib_parse
from jsonrpc.proxy import ServiceProxy
TEST_DEFAULTS = {
'ROOT_URLCONF'... |
image_average_tristan_node.py | #!/usr/bin/env python
from __future__ import division
import rospy
import cv2
from cv_bridge import CvBridge, CvBridgeError
from sensor_msgs.msg import CompressedImage, Image
import numpy as np
import threading
class ImageAverageNode(object):
def __init__(self):
self.node_name = "Image Average"
# ... |
safaribooks.py | #!/usr/bin/env python3
# coding: utf-8
import pathlib
import re
import os
import sys
import json
import shutil
import getpass
import logging
import argparse
import requests
import traceback
from html import escape
from random import random
from lxml import html, etree
from multiprocessing import Process, Queue, Value
f... |
agent_a3c.py | #!/usr/bin/env python
from __future__ import print_function
import numpy as np
import cv2
import tensorflow as tf
import threading
import sys
import time
import os
def MakeDir(path):
try:
os.makedirs(path)
except:
pass
lab = False
load_model = False
train = True
test_display = True
test_writ... |
wallet_multiwallet.py | #!/usr/bin/env python3
# Copyright (c) 2017-2020 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 multiwallet.
Verify that a bitcoind node can load multiple wallet files
"""
from decimal import D... |
camerasection.py | from threading import Thread
from picamera.array import PiRGBArray
from PyQt5.QtWidgets import *
from PyQt5.QtCore import pyqtSignal, pyqtSlot
from PyQt5.QtGui import QPixmap, QImage, QIcon
from src.camerasettings import SettingsWindow, CameraSettingsButton
class PreviewWindow(QLabel):
def __init__(self,... |
threads.py | from picamera.array import PiRGBArray
from picamera import PiCamera
from threading import Thread
import cv2
# To handle reading threaded frames from the Raspberry Pi camera module
class PiVideoStream:
def __init__(self, resolution=(320, 240), framerate=32):
# initialize the camera and stream
self.camera = PiCame... |
linux_driver.py | from __future__ import annotations
import asyncio
import os
from codecs import getincrementaldecoder
import selectors
import signal
import sys
import termios
import tty
from typing import Any, TYPE_CHECKING
from threading import Event, Thread
if TYPE_CHECKING:
from rich.console import Console
from .. import log
... |
message.py | # coding:utf-8
import time
import json
import base64
import re
import hmac
import hashlib
from multiprocessing import Process
import requests
import slack
from flask import Response
from settings import CHATBOT_ENDPOINT, CHATBOT_SECRET_KEY
from modules import team_manager
def handle_message(event_data):
team = tea... |
keepkey.py | from binascii import hexlify, unhexlify
import traceback
import sys
from electrum_xsh.util import bfh, bh2u, UserCancelled
from electrum_xsh.bitcoin import (b58_address_to_hash160, xpub_from_pubkey,
TYPE_ADDRESS, TYPE_SCRIPT,
is_segwit_address)
from e... |
assets.py | import binascii
import logging
import os
import shutil
import threading
from concurrent.futures import ThreadPoolExecutor, wait
from pathlib import Path
from flask import Blueprint, current_app, render_template, request
from s2_data.assets.assets import (EXTRACTED_DIR, KNOWN_ASSETS, OVERRIDES_DIR,
... |
testSampling.py | from ftw import ruleset, http, errors
"""
This script assumes that default blocking action is 403
and sampling is one. It will send a know bad request
that is expected to be blocked. If sampling is on it
will only block a certain percentage. We send 1000
requests to verify this. In order to do this we must
also turn o... |
event_writer.py | import Queue
import multiprocessing
import threading
import sys
from collections import Iterable
from .common import log
class EventWriter(object):
def __init__(self, process_safe=False):
if process_safe:
self._mgr = multiprocessing.Manager()
self._event_queue = self._mgr.Queue(10... |
vheap.py | from aiohttp import web
import threading
import asyncio
import socketio
import json
import sys
# GLOBALS #
loop = None # Thread loop
sio = None # Socket io
serving = False # To hold status of server
binsheads = {} # To hold bins heads
binschunks = {} # To hold bins chunks
v... |
main.py | from gnewsclient import gnewsclient
from urllib.request import urlopen,Request
from bs4 import BeautifulSoup
from tqdm import tqdm
import json
import pandas as pd
import threading
def search_news(lang,loc,topicc,no_of_results):
# search for news articles
client = gnewsclient.NewsClient(language=lang,
... |
test_aea.py | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI 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 ... |
test_subprocess.py | import unittest
from test.support import script_helper
from test import support
import subprocess
import sys
import signal
import io
import locale
import os
import errno
import tempfile
import time
import re
import selectors
import sysconfig
import warnings
import select
import shutil
import gc
import textwrap
try:
... |
patcher_test.py | import os
import shutil
import sys
import tempfile
import six
import tests
base_module_contents = """
import socket
import urllib
print("base {0} {1}".format(socket, urllib))
"""
patching_module_contents = """
from eventlet.green import socket
from eventlet.green import urllib
from eventlet import patcher
print('pa... |
progress_queue.py | import time
from multiprocessing import Process
from multiprocessing import Queue
def product(que):
for i in range(10):
que.put(i)
time.sleep(1)
def consume(que):
time.sleep(1)
while True:
data = que.get()
print(data)
pass
if __name__ == "__main__":
que = Queue(... |
removeVault.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
import sys
import json
import time
import os
import logging
import boto3
from multiprocessing import Process
from socket import gethostbyname, gaierror
def split_list(alist, wanted_parts=1):
length = len(alist)
return [ alist[i*length // wanted_parts: (i+1)*length // w... |
watch.py | import os
import threading
import time
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
class CustomHandler(FileSystemEventHandler):
current_event = None
def process(self, event):
if event.is_directory is not True:
self.current_event = event
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.