source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
main.py | # Copyright 2016 Google 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 required by applicable law or a... |
counts2shuf.py | import argparse
from scipy.sparse import dok_matrix, csr_matrix
import numpy as np
import random
from sys import getsizeof
import sys
import os
from multiprocessing import Process, Queue
from Queue import Empty
def worker(proc_num, queue, counts_dir, memory_size):
while True:
try:
year = queue... |
run.py | #!/usr/bin/env python
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
#
# Copyright 2021 The NiPreps Developers <nipreps@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with ... |
main.py | import argparse
import logging
import sys
from networking import Networking
from strategy.executor import Executor
from strategy.code import Strategy
from chain import Chain
from bitcoin import core
import threading
import cliserver
from threading import Lock
def check_positive(value):
integer_value = int(value)
... |
midi_setup.py | import os
import subprocess
import imp
import sys
import time
import threading
#vars
midiIn = 0
midiOut = 1
midiInGate = 1
midiOutGate = 1
midiDeviceIdx = 0
midiDevices = [ ]
midiDevice = '28:0'
# usb or sd card
user_dir = os.getenv("USER_DIR", "/usbdrive")
# imports
current_dir = os.path.dirname(os.path.abspath(__f... |
create_caches2.py | #!/usr/bin/env python3
'''Takes a bunch of types training files. First argument is what index the receptor starts on
(ligands are assumed to be right after). Reads in the gninatypes files specified in these types
files and writes out two monolithic receptor and ligand cache files in version 2 format.
Version 2 is o... |
sanitylib.py | #!/usr/bin/env python3
# vim: set syntax=python ts=4 :
#
# Copyright (c) 2018 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import contextlib
import string
import mmap
import sys
import re
import subprocess
import select
import shutil
import shlex
import signal
import threading
import concurrent.fu... |
usecase_loopback.py | from netmiko import ConnectHandler
from threading import Thread
from pysnmp.entity.rfc3413.oneliner import cmdgen
cmdGen = cmdgen.CommandGenerator()
threads = []
def pushconfig(ip,interface):
print ("\nConfiguring router %s now..." % (ip))
device = ConnectHandler(device_type='cisco_ios', ip=ip, usern... |
window_capture.py | import os
from threading import Thread
import pathlib
import audio_capture , video_capture
import settings
from window import Window
dir = pathlib.Path(__file__).parent.resolve()
window_list = Window.fromTitle(settings.target_search)
if window_list:
window = window_list[0]#TODO: make user selection if more than... |
backend.py | import logging
import threading
from seleniumwire.server import MitmProxy
log = logging.getLogger(__name__)
DEFAULT_BACKEND = 'default'
def create(addr='127.0.0.1', port=0, options=None):
"""Create a new proxy backend.
The type of backend created depends on the 'backend' option. Supported types
are 'd... |
thread.py | import asyncio
import concurrent.futures
import logging
import threading
from .base import BaseSubscriptionConsumer, BaseSubscriptionProducer, SubscriptionClosed
from .events import threadedEventHandler
class ThreadedSubscriptionProducer(BaseSubscriptionProducer, threadedEventHandler):
def __init__(
self... |
y2m_gui.py | import os
import Tkinter as tk
import ttk
import re
import threading
import logging
import ConfigParser
import tkMessageBox
from tkFileDialog import askdirectory
import pafy
from settings import YtSettings
import converter
logging.basicConfig(level=logging.DEBUG,
filename='y2m.log',
... |
slaver.py | #!/usr/bin/env python
# coding=utf-8
from __future__ import print_function, unicode_literals, division, absolute_import
import random
import ssl
import os
from redis import Redis
from common_func import *
__author__ = "Aploium <i@z.codes> et al"
__website__ = "https://github.com/rettier/shootback"
r = Redis(
... |
start_modules.py | import os
import multiprocessing
import threading
from data.config import Constants
from utils.logger import logger
import platform
def execute_module(module_name: str, cmd: str, retry: int = 0) -> bool:
res = os.system(cmd)
if res != 0:
if retry < Constants.MODULES_RUN_RETRY:
logger.warni... |
vnhuobi.py | # encoding: utf-8
import urllib.request, urllib.parse, urllib.error
import hashlib
import json
import requests
from time import time, sleep
from queue import Queue, Empty
from threading import Thread
# 常量定义
COINTYPE_BTC = 1
COINTYPE_LTC = 2
ACCOUNTTYPE_CNY = 1
ACCOUNTTYPE_USD = 2
LOANTYPE_CNY = 1
LOANTYPE_BTC = 2... |
progress.py | from __future__ import absolute_import, division, print_function
import sys
import threading
import time
from timeit import default_timer
from ..callbacks import Callback
from ..utils import ignoring
def format_time(t):
"""Format seconds into a human readable form.
>>> format_time(10.4)
'10.4s'
>>>... |
payday_farm.py | from pokeAPI import *
import time
from threading import Thread
from prompt_toolkit import HTML, print_formatted_text
from prompt_toolkit.styles import Style
import sys
import os
try:
driver = pokeAPI().register_window(name="РokеММO")
wx, wy = driver.get_window_rect()[:2]
ROUND_COUNT = 0
print = print_... |
simplewebserver.py | from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
from SocketServer import ThreadingMixIn
import threading
import argparse
import re
import cgi
class LocalData(object):
records = {}
class HTTPRequestHandler(BaseHTTPRequestHandler):
def do_POST(self):
if None != re.search('/api/v1/addrecord/*', self... |
registrar_common.py | '''
SPDX-License-Identifier: BSD-2-Clause
Copyright 2017 Massachusetts Institute of Technology.
'''
import os
import threading
import sys
import signal
import time
import hashlib
import http.server
try:
import simplejson as json
except ImportError:
raise("Simplejson is mandatory, please install")
from http.se... |
PygameDisplay_2.py | # -*- coding: utf-8 -*-
"""
Created on Sat Feb 26 12:14:08 2022
@author: nuria
#todo
- change so that it does not pop up two times if I am already away (maybe sleep for 1sec? lets try)
"""
from __future__ import print_function
from threading import Thread
import pygame
import datetime
import time
... |
hypothesis_test.py | # Copyright (c) 2016-present, Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
test_cached_property.py | # -*- coding: utf-8 -*-
import time
import unittest
from threading import Lock, Thread
from freezegun import freeze_time
import cached_property
def CheckFactory(cached_property_decorator, threadsafe=False):
"""
Create dynamically a Check class whose add_cached method is decorated by
the cached_property_... |
moduleinspect.py | """Basic introspection of modules."""
from typing import List, Optional, Union
from types import ModuleType
from multiprocessing import Process, Queue
import importlib
import inspect
import os
import pkgutil
import queue
import sys
class ModuleProperties:
def __init__(self,
name: str,
... |
views.py | from django.shortcuts import render_to_response,render
from django.http import HttpResponseRedirect,HttpResponse
# from django.contrib import auth
# from django.core.context_processors import csrf, request
from django import forms
from django.db import models
# from django.core.urlresolvers import reverse
from django.... |
color_cycler.py | #
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# These materials are licensed under the Amazon Software License in connection with the Alexa Gadgets Program.
# The Agreement is available at https://aws.amazon.com/asl/.
# See the Agreement for the specific terms and conditions of the Agreem... |
trustedcoin.py | #!/usr/bin/env python
#
# Electrum - Lightweight Bitcoin Client
# Copyright (C) 2015 Thomas Voegtlin
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without... |
log_printer.py | import _thread as thread
import sys
from collections import namedtuple
from itertools import cycle
from operator import attrgetter
from queue import Empty
from queue import Queue
from threading import Thread
from docker.errors import APIError
from . import colors
from compose.cli.signals import ShutdownException
from... |
threading_oldway.py | import time
import threading
def calc_square(numbers):
print("calculate square of numbers")
for n in numbers:
time.sleep(0.2)
print("square:", n * n)
def calc_cube(numbers):
print("calculate cube of numbers")
for n in numbers:
time.sleep(0.2)
print("cube: ", n * n * n... |
main.py | """the interface to interact with wakeword model"""
import pyaudio
import threading
import time
import argparse
import wave
import torchaudio
import torch
import numpy as np
from neuralnet.dataset import get_featurizer
from threading import Event
import os
import subprocess
import random
from os.path import join, real... |
utils.py | #!/usr/bin/env python
"""This file contains various utility classes used by GRR."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import array
import base64
import collections
import errno
import functools
import ge... |
test_threading.py | """
Tests for the threading module.
"""
import test.support
from test.support import (verbose, import_module, cpython_only,
requires_type_collecting)
from test.support.script_helper import assert_python_ok, assert_python_failure
import random
import sys
_thread = import_module('_thread')
thr... |
parallel.py | from __future__ import absolute_import
from __future__ import unicode_literals
import logging
import operator
import sys
from threading import Thread
from docker.errors import APIError
from six.moves import _thread as thread
from six.moves.queue import Empty
from six.moves.queue import Queue
from compose.cli.signals... |
pythess.py | # Copyright 2012 James McCauley
#
# 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 writi... |
test_multiprocess.py | # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/gaogaotiantian/viztracer/blob/master/NOTICE.txt
import os
import sys
import multiprocessing
import signal
import tempfile
import unittest
from unittest.case import skipIf
from .cmdline_tmpl import CmdlineT... |
InstaMachine.py | from PyQt5 import QtCore, QtGui, QtWidgets
import datetime
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import sqlite3
import requests
import time
import re
import pickle
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webd... |
conftest.py | import os
import json
from multiprocessing import Process
from indexd import default_settings, get_app as get_indexd_app
from indexclient.client import IndexClient
import pytest
import requests
import requests_mock
from mock import patch
from flask.testing import make_test_environ_builder
from fence.jwt.token import g... |
auto_update_git.py | #!/usr/bin/env python3
assert __name__ == '__main__'
import logging
import subprocess
import sys
import threading
import time
# -
CHECK_INTERVAL = 60.0
PRETEND_UPDATE = False
LOG = logging.getLogger()
args = sys.argv[1:]
while True:
cur = args.pop(0)
if cur == '--pretend':
PRETEND_UPDATE = True
... |
plugin.py | from contextlib import contextmanager
import multiprocessing
import collections
from _pytest import main
import psutil
import pytest
def pytest_addoption(parser):
group = parser.getgroup('pytest-mp')
mp_help = 'Distribute test groups via multiprocessing.'
group.addoption('--mp', '--multiprocessing', act... |
test_ginga.py | # -*- coding: utf-8 -*-
import datetime
import time
from threading import Thread
from gcp import Client
def do(i):
c = Client(token='test_token_1', host='0.0.0.0', port=1903, nonce="ssss")
while 1:
try:
c.lock()
print datetime.datetime.now(), i
time.sleep(1)
... |
listener.py | import sys
sys.path.append("../main/")
import queue
from functools import partial
import soundfile
from array import array
from sys import byteorder
import threading
import asyncio
import time
import struct
import numpy as np
import pyaudio
import wave
import webrtcvad
import params
_uint16 = 2 ** 15
filename = ... |
data_source_implements.py | # Copyright 2017,2018,2019,2020,2021 Sony Corporation.
# Copyright 2021 Sony Group Corporation.
#
# 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-... |
TwitchLinkUi.py | import os
import threading
import time
import gc
from PyQt5.QtCore import Qt, QRegExp, QUrl, QThread, pyqtSignal
from PyQt5.QtGui import QIcon, QPixmap, QDesktopServices
from PyQt5.QtWidgets import QMainWindow, QWidget, QDialog, QDialogButtonBox, QLabel, QTextBrowser
from TwitchLinkConfig import Config
from Services... |
WtMonSvr.py | from flask import Flask, session, redirect, request, make_response
import json
import datetime
import os
import hashlib
import sys
import base64
import chardet
from .WtLogger import WtLogger
from .DataMgr import DataMgr, backup_file
from .PushSvr import PushServer
from .WatchDog import WatchDog, WatcherSin... |
fusefs.py | from __future__ import print_function
import fuse
import stat
import errno
import os
import sys
from wellpapp import Client, Tag, raw_exts
import re
from time import time, sleep
from hashlib import md5
from struct import pack, unpack
from zlib import crc32
from xml.sax.saxutils import escape as xmlescape
from os.path ... |
smuggler.py | #!/usr/bin/python3.5
# I don't believe in license.
# You can do whatever you want with this program.
# Based on the awesome James Kettle research
# https://twitter.com/albinowax
# https://portswigger.net/web-security/request-smuggling
# https://portswigger.net/research/http-desync-attacks-request-smuggling-reborn
im... |
test_execute.py | # coding: utf-8
from __future__ import print_function
import json
import sys
import tempfile
import os.path
import platform
import threading
import psutil
import pytest
import time
import subprocess
from simpleflow import execute
from simpleflow.exceptions import ExecutionError, ExecutionTimeoutError
@execute.pro... |
ResultFrame.py | from tkinter import *
from tkinter import ttk
from main.gui.Frames.ClassificationResultsFrame import ClassificationAlgorithmResultsFrame
from main.gui.Frames.RegressionResultsFrame import RegressionAlgorithmResultsFrame
from main.gui.Frames.ClusteringResultsFrame import ClusteringAlgorithmResultsFrame
from main.gu... |
test_html.py | from functools import partial
from importlib import reload
from io import BytesIO, StringIO
import os
from pathlib import Path
import re
import threading
from urllib.error import URLError
import numpy as np
import pytest
from pandas.compat import is_platform_windows
from pandas.errors import ParserError
... |
test_browser.py | import BaseHTTPServer, multiprocessing, os, shutil, subprocess, unittest, zlib, webbrowser, time, shlex
from runner import BrowserCore, path_from_root
from tools.shared import *
# User can specify an environment variable EMSCRIPTEN_BROWSER to force the browser test suite to
# run using another browser command line tha... |
oase_apply.py | # Copyright 2019 NEC Corporation
#
# 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 writi... |
client.py | import socket
from time import sleep
from threading import Thread
# server config --------------------
FORMAT = 'utf-8'
IP, PORT = input('Enter server address like: 192.168.1.36:8000 \n').split(':')
SERVER_ADDRESS = (IP, int(PORT))
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
... |
RetrieveAccountData.py | # Copyright (C) 2021 LYNX B.V. All rights reserved.
# Import ibapi deps
from ibapi.client import EClient
from ibapi.wrapper import EWrapper
from ibapi.account_summary_tags import *
import threading
import time
import pandas as pd
class App(EWrapper, EClient):
def __init__(self, ipaddress, portid, clientid):
... |
_instruments.py | # coding: utf-8
# codeskyblue 2020/06
"""
instruments连接建立之后,传输的消息为 DTXMessage
DTXMessage = (DTXMessageHeader + DTXPayload)
- DTXMessageHeader 主要用来对数据进行封包传输,以及说明是否需要应答
DTXPayload = (DTXPayloadHeader + DTXPayloadBody)
- DTXPayloadHeader 中的flags字段规定了 DTXPayloadBody 的数据类型
- DTXPayloadBody 可以是任何数据类型 (None, (None, None),... |
sleeptest.py | import threading
import pybind11_playground
import time
def f(i):
print('sleep start')
if i == 0:
time.sleep(3)
else:
pybind11_playground.toyclass().sleep(3)
print('sleep end')
for i in range(2):
thread = threading.Thread(target=f, args=(i,))
thread.start()
print('hello')
... |
honeypot.py | #!/usr/bin/env python3
"""
SSH Honeypot Server that will ban all IP's via fail2ban
"""
from paramiko.py3compat import b, u, encodebytes, decodebytes
from binascii import hexlify
import sys
import os
import re
import time
from socket import socket, AF_INET, SOCK_STREAM, SOL_SOCKET, SO_REUSEADDR
from threading import ... |
lisp-rtr.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... |
test_local_api_service.py | """
Function test for Local API service
"""
import os
import shutil
import random
import threading
import requests
import time
import logging
from samcli.commands.local.lib import provider
from samcli.commands.local.lib.local_lambda import LocalLambdaRunner
from samcli.local.lambdafn.runtime import LambdaRuntime
from... |
8_rms_wait_die_Speak.py | # Author Emeka Ugwuanyi Emmanuel
from functools import reduce
from sys import *
import numpy as np
import random as r
import ping_code as pc
import socket
import struct
import subprocess as sp
from threading import Thread
import threading
import ast
import time
import os
import psutil
import datetime as dt
import getp... |
msgclient.py | #!/usr/bin/env python3
import threading
import select
import eventfd
import time
from cobs import cobs
class Client:
def __init__(self, name, ffi, lib, serial):
self.name = name
self.ffi = ffi
self.lib = lib
self.channelTypes = {
fieldName[:-4]: field.type.item
... |
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... |
websocket_client.py |
#!/usr/local/bin/python
import websocket
import threading
from base64 import b64encode
import logging
import time
import xml.etree.ElementTree as ET
from .websocket_event import Websocket_Event
logger = logging.getLogger(__name__)
class Websocket_Client(object):
def __init__(self,controller,address,port,use... |
service.py | # -*- coding:utf-8 -*-
__author__ = 'q00222219@huawei'
import commonutils
import exception
import time
import threading
import constant
import awscloud
import fscloud
import install.aws_access_cloud_installer as cascaded_installer
#import fs_gateway_register
from vpn import VPN
from commonutils import *
from environm... |
col_det_screen_view.py | from asyncio.windows_events import NULL
from email import message
import cv2
import urllib.request
import numpy as np
# to send color detection to arduino
import socket
from threading import Thread
# to delay the sending of messages
import timeit
#function to open socket and connection
def socket_connectio... |
object_detection_multithreading.py | import os
import cv2
import time
import argparse
import numpy as np
import tensorflow as tf
import zmq
from queue import Queue
from threading import Thread
from multiprocessing import Process, Queue, Pool
from utils.app_utils import FPS, WebcamVideoStream, draw_boxes_and_labels
from object_detection.utils import label... |
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... |
orchestrate.py | # Copyright 2018 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, ... |
train_eqa.py | # 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 h5py
import time
import argparse
import numpy as np
import os, sys, json
from tqdm import tqdm
import pdb
... |
emails.py | # -*- coding: utf-8 -*-
"""
:author: Grey Li (李辉)
:url: http://greyli.com
:copyright: © 2018 Grey Li <withlihui@gmail.com>
:license: MIT, see LICENSE for more details.
"""
from threading import Thread
from flask import url_for, current_app
from flask_mail import Message
from blog_server.extensions imp... |
main_window.py | import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
import asyncio
from typing import TYPE_CHECKING, Optional, Union, Callable, Sequence
from electrum.storage import WalletStorage, StorageReadWriteError
from electrum.wallet_db import WalletDB
from el... |
thread_monitor.py | # -*- coding: ascii -*-
"""
Thread monitor - Check the state of all threads.
Just call activate_hook() as early as possible in program execution.
Then you can trigger the output of tracebacks of all threads
by calling trigger_dump().
Usage of Python 2.5 is recommended because it allows for a much ... |
wsdump.py | #!/home/samir/Documents/zobot/benv/bin/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 = geta... |
main.py | #panda3d is needed to run this script
#get it from pip:
#python -m pip install panda3d
#or download from panda3d.org
#by default a simpler version of opticalmaterialspy is used (see mat_spy.py)
#but the original can be used if needed, but that version requires both numpy and scipy
#try:
# import opticalmaterialspy ... |
zeromq.py | # -*- coding: utf-8 -*-
'''
Zeromq transport classes
'''
# Import Python Libs
from __future__ import absolute_import
import os
import copy
import errno
import signal
import hashlib
import logging
import weakref
from random import randint
# Import Salt Libs
import salt.auth
import salt.crypt
import salt.utils
import s... |
make_masks.py | #
# demo.py
#
import argparse
import os
import numpy as np
from modeling.deeplab import *
from dataloaders import custom_transforms as tr
from PIL import Image
from torchvision import transforms
from dataloaders.utils import *
from torchvision.utils import make_grid, save_image
from tqdm import tqdm
from multiprocessi... |
_test_multiprocessing.py | #
# Unit tests for the multiprocessing package
#
import unittest
import unittest.mock
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 subprocess
import struct
import operator
import p... |
smokeTestRelease.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 use ... |
runner.py | import asyncio
import threading
import click.testing
from kopf import cli
class KopfRunner:
"""
A context manager to run a Kopf-based operator in parallel with the tests.
Usage::
from kopf.testing import KopfRunner
with KopfRunner(['run', '--verbose', 'examples/01-minimal/example.py']... |
test_dist_graph_store.py | import os
os.environ['OMP_NUM_THREADS'] = '1'
import dgl
import sys
import numpy as np
import time
import socket
from scipy import sparse as spsp
from numpy.testing import assert_array_equal
from multiprocessing import Process, Manager, Condition, Value
import multiprocessing as mp
from dgl.heterograph_index import cre... |
tests.py | import threading
from datetime import datetime, timedelta
from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist
from django.db import DEFAULT_DB_ALIAS, DatabaseError, connections, models
from django.db.models.manager import BaseManager
from django.db.models.query import MAX_GET_RESULTS, EmptyQ... |
mainwindow.py | # -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""
Spyder, the Scientific Python Development Environment
=====================================================
Developed and maintained by the Spyder Proj... |
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... |
button_tests.py | import telegram as tl
from telegram.ext import *
import logging
def main():
def stop_and_restart():
import os, sys
updater.stop()
os.execl(sys.executable, sys.executable, *sys.argv)
def restart(update, context):
from threading import Thread
update.message.reply_tex... |
LitDriver.py | #!/usr/bin/python3
import LitMimic as lm
import ServiceLib as sv
import os
import sys
import glob
import multiprocessing
import shlex
import shutil
import subprocess as sp
import progressbar
import smtplib
import RandomGenerator as RG
from random import shuffle
import re
import time
import psutil
import signal
class L... |
BrowserCamera.py | from flask import Flask, render_template, redirect, request
from flask_socketio import SocketIO
import cv2
import numpy as np;
import base64
import io
from imageio import imread
import threading
import os
DIR_PATH = os.path.dirname(os.path.realpath(__file__))
class BrowserCamera:
def __init__(self):
self._properti... |
game.py | import chess
import subprocess
import threading
TIMEOUT = 1 # seconds
class Command(object):
def __init__(self, cmd):
self.cmd = cmd
self.process = None
def run(self, input_string, timeout):
""" Run command with timeout."""
self.output = ""
def target():
self.process = subprocess.Popen(self.cmd, stder... |
parameter_server.py | """
Utility functions to retrieve information about available services and setting up security for the Hops platform.
These utils facilitates development by hiding complexity for programs interacting with Hops services.
"""
import os
from hops import devices, tensorboard, hdfs
from hops.experiment_impl.util import ex... |
main.py | import sys
import boto3
import click
import click_spinner
import threading
import queue
from botocore.exceptions import ProfileNotFound, NoRegionError, ClientError
version = '0.0.4'
PAGE_SIZE = 100
@click.command()
@click.version_option(version=version, message=version)
@click.argument('name', required=False)
@cli... |
service.py | """"""
import typing as t # noqa
from common import PROJECT_NAME, APP_NAME, LOGGER, ServiceBase # noqa
import os
import signal
import time
import psutil
import threading
from nameko.constants import NON_PERSISTENT
from nameko.events import EventDispatcher, event_handler, BROADCAST
from nameko.rpc import rpc
import ... |
tasks.py | import inspect
import six
import sys
import textwrap
from fabric import state
from fabric.utils import abort, warn, error
from fabric.network import to_dict, disconnect_all
from fabric.context_managers import settings
from fabric.job_queue import JobQueue
from fabric.task_utils import crawl, merge, parse_kwargs
from f... |
sqlite_web.py | #!/usr/bin/env python
import datetime
import hashlib
import math
import operator
import optparse
import os
import re
import sys
import threading
import time
import webbrowser
from collections import namedtuple, OrderedDict
from functools import wraps
from getpass import getpass
from io import TextIOWrapper
# Py2k com... |
test_debug.py | import importlib
import inspect
import os
import re
import sys
import tempfile
import threading
from io import StringIO
from pathlib import Path
from unittest import mock
from django.core import mail
from django.core.files.uploadedfile import SimpleUploadedFile
from django.db import DatabaseError, connection
from djan... |
spinner.py | import sys
import time
import threading
from pyspin import spin
class Spinner:
def __init__(self, message, spinning=False, frames=spin.Default, done=''):
self.message = message
self.spinning = spinning
self.done_message = done
self._spinner = spin.Spinner(frames)
self._thr... |
RepeatedTimer.py | import time
from threading import Event, Thread
class RepeatedTimer:
"""Repeat `function` every `interval` seconds."""
def __init__(self, interval, function, *args, **kwargs):
self.interval = interval
self.function = function
self.args = args
self.kwargs = kwargs
self... |
ui.py |
import os, sys
import multiprocessing as mp
from simulation import *
# Version Check
if sys.version_info[0] == 3: # Python 3
from tkinter import *
from tkinter.ttk import Notebook
import tkinter.filedialog as tkf
else:
# Python 2
from Tkinter import *
from ttk import Notebook
import tkFile... |
installwizard.py |
from functools import partial
import threading
from kivy.app import App
from kivy.clock import Clock
from kivy.lang import Builder
from kivy.properties import ObjectProperty, StringProperty, OptionProperty
from kivy.core.window import Window
from kivy.uix.button import Button
from kivy.utils import platform
from kivy... |
test_basic.py | # -*- coding: utf-8 -*-
"""
tests.basic
~~~~~~~~~~~~~~~~~~~~~
The basic functionality.
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import pickle
import re
import time
import uuid
from datetime import datetime
from threading import Thread
import pytest... |
test_rollbar.py | import base64
import copy
import json
import mock
import socket
import threading
import uuid
import sys
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
import unittest
import rollbar
from rollbar.lib import python_major_version, string_types
from rollbar.test import BaseTest
... |
多线程爬取糗事百科.py | import threading
from queue import Queue
import requests
from lxml import etree
import time
class qiushi(object):
def __init__(self):
self.url = "https://www.qiushibaike.com/8hr/page/{}/" # 获取url
self.url_queue = Queue() # 创建url队列
self.html_queue = Queue() # 创建html队列容器
self.da... |
py.py | import re
import os
import six
import sys
import yaml
import types
import inspect
import logging
import threading
import traceback
from six.moves.queue import Queue
from collections import defaultdict
from functools import reduce, partial
from syn.globals import test_logger
#-------------------------------------------... |
client.py | # @package name - asyncSocket
# @os - independent
# @auther - Shikhar Yadav | yshikharfzd10@gmail.com
__all__ = ["client"]
#import
from typing import Any
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
from cryptography.hazmat.primitives.asymmetr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.