source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
__main__.py | #
# Copyright (c) 2014, 2016, 2018, 2020 LexisNexis Risk Data Management Inc.
#
# This file is part of the RadSSH software package.
#
# RadSSH is free software, released under the Revised BSD License.
# You are permitted to use, modify, and redsitribute this software
# according to the Revised BSD License, a copy of wh... |
local_server.py | from onshape_client.compatible_imports import HTTPServer, HTTPHandler, sendable
def start_server(authorization_callback, open_grant_authorization_page_callback):
"""
:param authorization_callback: The function to call once with the authorization URL response
:param open_grant_authorization_page_callback: ... |
websocket.py | import json
import logging
import threading
from pathlib import Path
from pajbot.managers.db import DBManager
from pajbot.models.web_sockets import WebSocket
log = logging.getLogger("pajbot")
class WebSocketServer:
clients = []
def __init__(self, manager, port, secure=False, key_path=None, crt_path=None, u... |
TFLite_detection_webcam.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... |
server.py | import asyncio
import os
import traceback
from functools import partial
from inspect import isawaitable
from multiprocessing import Process
from signal import (
SIGTERM, SIGINT, SIG_IGN,
signal as signal_func,
Signals
)
from socket import (
socket,
SOL_SOCKET,
SO_REUSEADDR,
)
from time import ti... |
thr_1.py | import threading
import time
def thread_job():
print('T1 start\n')
for i in range(10):
time.sleep(0.2)
print('T1 end\n')
def thread_job2():
print('T2 start\n')
print('T2 end\n')
def main():
added_thread1 = threading.Thread(target=thread_job,name='T1')
added_thread2 ... |
process.py | from functools import wraps
import logging
from multiprocessing import Process, Queue
import os
import subprocess
import sys
import traceback
from utils_core.func import timeout as func_timeout
log = logging.getLogger(__name__)
class RunError(Exception):
pass
def is_running(pid):
""" Returns True if the g... |
ncf_main.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
test_utilities.py | #!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
Tests the utility module
:author: Thomas Calmant
"""
# Same version as the tested bundle
__version__ = (0, 5, 6)
# Documentation strings format
__docformat__ = "restructuredtext en"
# --------------------------------------------------------------------------... |
TFSparkNode.py | # Copyright 2017 Yahoo Inc.
# Licensed under the terms of the Apache 2.0 license.
# Please see LICENSE file in the project root for terms.
"""This module provides low-level functions for managing the TensorFlowOnSpark cluster."""
from __future__ import absolute_import
from __future__ import division
from __future__ im... |
displacy.py | # coding: utf8
import plac
import threading
import time
import webbrowser
import spacy
from spacy import displacy
from sudachipy.tokenizer import Tokenizer as OriginalTokenizer
from ginza.japanese_corrector import JapaneseCorrector
from .bccwj_ud_corpus import convert_files
from .corpus import *
from ginza.japanese_cor... |
generate_events.py | import time
import random
import threading
import requests
endpoints = ('one', 'two', 'three', 'four', 'error')
def run():
while True:
try:
target = random.choice(endpoints)
requests.get("http://app:5000/%s" % target, timeout=1)
except:
pass
if __name__ == ... |
test_client.py | import pytest
import time
import sys
import logging
import threading
import ray.util.client.server.server as ray_client_server
from ray.util.client.common import ClientObjectRef
from ray.util.client.ray_client_helpers import ray_start_client_server
@pytest.mark.skipif(sys.platform == "win32", reason="Failing on Wind... |
udp.py | import collections
from typing import Dict, Tuple
import threading
import socket
import struct
import binascii
from time import time
import enum
import attr
PROTOCOL_VERSION = 1001
_battery_table = {
# CHARGING 1-11
# dying
(True, 1): 0x01,
(True, 2): 0x01,
# low
(True, 3): 0x02,
(True, ... |
test_bed_adapter_consumer_kafka_timer.py | import unittest
import sys
import threading
import time
import logging
import json
sys.path.append("..")
import datetime
from test_bed_adapter.options.test_bed_options import TestBedOptions
from test_bed_adapter import TestBedAdapter
logging.basicConfig(level=logging.INFO)
class TestConsumerWithAdapter(unittest.TestCa... |
integration_test.py | #!/usr/bin/python2.4
#
# Copyright 2008 Google 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... |
dynamic_web_server.py | import re
import sys
from multiprocessing import Process
from tcp_server_single_process import TcpServer
HTML_ROOT_DIR = "./html"
class WebServerStatic(TcpServer):
def __init__(self):
pass
# make it as a multi-processing server
def listen_loop(self, main_socket):
try:
while Tr... |
log.py | import functools
import logging
import multiprocessing as mp
import sys
import threading
import time
import traceback
from typing import Callable, List, Optional
from termcolor import colored
from typing_extensions import Literal
from .types import PathType
__all__ = [
"get_worker_id",
"get_logging_levels",
... |
sensor.py | from imagePro import videoFeed
from imagePro import imageDetection
from common import dateTime
from messenger import notify
from threading import Thread
import common.var as var
import sys
import select
class sensor(object):
def __init__(self):
self.debug = False
self.cam = videoFeed()
sel... |
translate_spider.py | from selenium import webdriver
import threading
from queue import Queue
from tqdm import tqdm
import warnings
import time
warnings.filterwarnings('ignore')
span = '/html/body/div[2]/div[2]/div[1]/div[2]/div[1]/div[1]/div[2]/div[3]/div[1]/div[2]/div/span[1]/span'
base_url = 'https://translate.google.com/#'
class Tra... |
greatfet_uart.py | #!/usr/bin/env python3
#
# This file is part of GreatFET.
#
from __future__ import print_function, absolute_import
import os
import sys
import time
import queue
import select
import threading
import greatfet
from greatfet import GreatFET
from greatfet.utils import from_eng_notation, GreatFETArgumentParser
from grea... |
VOCDataset.py | # ----------------------------------------
# Written by Yude Wang
# ----------------------------------------
from __future__ import print_function, division
import os
import pandas as pd
import cv2
import multiprocessing
from PIL import Image
import numpy as np
from lib.datasets.transform import *
from lib.utils.imuti... |
test_connection.py | # Copyright DataStax, 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 to in writing, softwa... |
test_util.py | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
scripts.py | # -*- coding: utf-8 -*-
'''
This module contains the function calls to execute command line scripts
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import os
import sys
import time
import signal
import logging
import functools
import threading
import traceback
import s... |
InstagramAnalyzer.py | """
Autor: Giorgetti Valentín
Licencia: MIT License
Módulo principal del programa.
"""
import instaloader, os, shutil, PySimpleGUI as sg
from sys import exit
from webbrowser import open as abrir_web
from os.path import join, isdir, isfile
from threading import Thread
parametros_ventana = {"element_j... |
blurImageApp.py | #!/usr/bin/env python3
import blurImage
import os
try:
import tkinter as tk
from tkinter import filedialog
from tkinter import ttk
except ImportError:
import Tkinter as tk
import ttk
import Filedialog as filedialog
from PIL import ImageTk, Image
import threading
from queue import Queue
FILETYP... |
sdkhttpserver.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
#
# Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved.
# Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries.
# Other trademarks may be trademarks of their respective owners.
#
# Licensed under the Apache License, Ver... |
hotword_factory.py | # Copyright 2017 Mycroft AI 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 to in writin... |
test_patch.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
from .cmdline_tmpl import CmdlineTmpl
import os
import shutil
import re
import sys
import unittest
from string import Template
file_spawn_tmpl = Template(... |
stubserver.py | """
Copyright 2009 Chris Tarttelin
Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer.
Redistribution... |
example2.py | from socket import socket, AF_INET, SOCK_STREAM
from threading import Thread
from queue import Queue
def echo_client(q):
'''
Handle a client connection
'''
sock, client_addr = q.get()
print('Got connection from', client_addr)
while True:
msg = sock.recv(65536)
if not msg:
... |
parallel_test.py | # pyOCD debugger
# Copyright (c) 2016-2020 Arm Limited
# 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/licenses/LICENSE-2.0... |
test_broker.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... |
lock_unittest.py | # Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import multiprocessing
import os
import tempfil... |
runscriptstep.py |
import os
import sys
import copy
#import fcntl
import pty
import threading
import subprocess
from lxml import etree
try:
# py2.x
from urllib import pathname2url
from urllib import url2pathname
from urllib import quote
pass
except ImportError:
# py3.x
from urllib.request import pathname2ur... |
algorithms.py | """
Copyright (c) 2012 Bas Stottelaar, Jeroen Senden
See the file LICENSE for copying permission.
"""
from utils import intertial_axis, max_xy, min_xy, find_peak_start, find_peak_stop
from scipy.ndimage import filters, interpolation
from scipy.interpolate import griddata
from scipy import stats, signal, optimize, int... |
email.py | from threading import Thread
from config import MAIL_DEFAULT_SENDER
from flask import render_template, current_app
from flask_mail import Message
from website.app import mail
def send_async_email(app, msg):
"""异步发送"""
with app.app_context():
mail.send(msg)
def send_email(to, subject, template, **kw... |
worker.py | import queue
import threading
import websocket
import json
import time
from django.utils import timezone
from datetime import timedelta
def _run_worker():
while True:
_, fn, args = _work_queue.get()
try:
fn(*args)
except:
pass
_work_queue = queue.PriorityQueue()
_wo... |
msfs_flightmapper.py | from flask import Flask, render_template, jsonify, request
from SimConnectCust import *
from threading import Thread
import math
import sys
import time
simconnect_dict = {}
def flask_thread_func(threadname):
global simconnect_dict
if getattr(sys, 'frozen', False):
template_folder = os.path.j... |
viewers.py | # coding: utf-8
from __future__ import print_function
from os import path
import sys
from tempfile import mkdtemp
from time import sleep
from threading import Thread
class Event(object):
def __init__(self, name, description):
self.name = name
self.description = description
def __str__(self)... |
mouse_input.py | #!/usr/bin/env python
import time, threading, logging
from py2030.base_component import BaseComponent
deps = {}
def loadDeps():
global deps
if deps:
return deps
deps = {}
try:
import pynput.mouse as mouse
deps['mouse'] = mouse
except ImportError as err:
logging.getL... |
main.py |
from PyQt5.QtGui import * #check_import
from PyQt5.QtWidgets import * #check_import
from PyQt5.QtCore import pyqtSignal, QObject #check_import
import time #check_import
import threading #check_import
import logging #check_import
class DgpuPowerstateMonitor(QObject):
hide_signal = pyqtSignal()
show_signal = p... |
EWSO365.py | from typing import Dict
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
import sys
import traceback
import json
import os
import hashlib
from datetime import timedelta
from io import StringIO
import logging
import warnings
import email
from requests.exceptions impor... |
test.py | # Copyright 2019 Barefoot Networks, 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 to in... |
snippet.py | # Copyright 2021 Clivern
#
# 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, soft... |
test_index.py | import logging
import time
import pdb
import threading
from multiprocessing import Pool, Process
import numpy
import pytest
import sklearn.preprocessing
from utils import *
nb = 6000
dim = 128
index_file_size = 10
BUILD_TIMEOUT = 300
nprobe = 1
top_k = 5
tag = "1970-01-01"
NLIST = 4046
INVALID_NLIST = 100000000
field_... |
test_scale.py | import os
import time
import multiprocessing
from functools import partial
import pytest
from jina import Flow, Executor, Document, DocumentArray, requests, Client
cur_dir = os.path.dirname(os.path.abspath(__file__))
IMG_NAME = 'jina/scale-executor'
NUM_CONCURRENT_CLIENTS = 20
NUM_DOCS_SENT_BY_CLIENTS = 50
exposed_... |
session_test.py | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
test_client.py | import os
import pytest
import time
import sys
import logging
import queue
import threading
import _thread
from unittest.mock import patch
import numpy as np
import ray.util.client.server.server as ray_client_server
from ray.tests.client_test_utils import create_remote_signal_actor
from ray.tests.client_test_utils imp... |
plotter.py | import atexit
from collections import namedtuple
from enum import Enum
import platform
from queue import Queue
from threading import Thread
import numpy as np
import tensorflow as tf
from garage.sampler.utils import rollout as default_rollout
__all__ = ['Plotter']
class Op(Enum):
STOP = 0
UPDATE = 1
DE... |
tello_client.py | #!/usr/bin/python3
import socket
import threading
import time
class TelloClient(object):
"""
This class communicates with a drone via commands. It also receives the responses
"""
def __init__(self, client_ip, tello_ip, logger=print, setup=[]):
"""
constructor of the TelloClient
... |
test_pdb.py | # A test suite for pdb; not very comprehensive at the moment.
import doctest
import os
import pdb
import sys
import types
import codecs
import unittest
import subprocess
import textwrap
from contextlib import ExitStack
from io import StringIO
from test import support
# This little helper class is essential for testin... |
views.py | from django.shortcuts import redirect, render
from .models import SensorData, UserSensor
from .forms import UserMapForm
from django.db.models import Q
from django.views.decorators.csrf import csrf_exempt
from django.http import HttpResponseRedirect
from firstpage.models import UserGroup
from django.contrib.auth.models ... |
requestCollect.py | import requests
import urllib.request
import threading
import os
def download(data, number, fileName):
print(f"Downloading image number: {number}")
r = requests.get(data['webformatURL'])
with open(f'imageSets/{fileName}/{number}.jpeg', 'wb') as f:
f.write(r.content)
fileNames = ['human', 'dog',... |
conftest.py | import pytest
import time
from context import HGECtx, HGECtxError, EvtsWebhookServer, HGECtxGQLServer, GQLWsClient
import threading
import random
from datetime import datetime
import sys
import os
def pytest_addoption(parser):
parser.addoption(
"--hge-urls",
metavar="HGE_URLS",
help="csv li... |
test_logging.py | # Copyright 2001-2014 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permissio... |
test_bio_membuf.py | #!/usr/bin/env python
"""Unit tests for M2Crypto.BIO.MemoryBuffer.
Copyright (c) 2000 Ng Pheng Siong. All rights reserved."""
import os
import multiprocessing
from platform import system
from sys import version_info
from M2Crypto import six
from M2Crypto.BIO import MemoryBuffer
from tests import unittest
class Ti... |
runner.py | from __future__ import print_function
__true_print = print
import argparse
import datetime
import docker
import json
import multiprocessing
import numpy
import os
import psutil
import requests
import sys
import threading
import time
def print(*args, **kwargs):
__true_print(*args, **kwargs)
sys.stdout.flush()
... |
example_test.py | import re
import os
import socket
import BaseHTTPServer
import SimpleHTTPServer
from threading import Thread
import ssl
from tiny_test_fw import DUT
import ttfw_idf
server_cert = "-----BEGIN CERTIFICATE-----\n" \
"MIIDXTCCAkWgAwIBAgIJAP4LF7E72HakMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\n"\
"BAYTAk... |
test_conn.py | import queue
import sqlite3
import threading
from unittest.mock import Mock
import pytest
from .. import (
Database,
conn,
connect,
exc,
)
from . import util
def get_cursor_mock(exception):
def cursor():
m = Mock()
m.execute = Mock()
m.execute.side_effect = exception
... |
network.py | # Electrum - Lightweight Bitcoin Client
# Copyright (c) 2011-2016 Thomas Voegtlin
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rig... |
stress_test.py | import json
import requests
from threading import Thread
url = "http://devnet.sophiatx.com:9193"
threads_num = 30
requests_num = 10000
def call_info():
r = requests.post(url, data=json.dumps({"jsonrpc": "2.0", "method": "alexandria_api.info", "params": {}, "id": 0}))
return str(json.loads(r.text)["result"])
def ... |
status_api_demo.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... |
bot.py | import os
import threading
import requests
import bs4
import re
import datetime
# Author : Alex Nguetcha <nguetchaalex@gmail.com>
class ImageDownloaderBot:
def __init__(self, maxDownloads=10, maxDownloadSize=500*1024, verbose=True, logout=True):
"""
download many image from google by keywords ... |
test_wire.py | # This file is part of remsh
# Copyright 2009, 2010 Dustin J. Mitchell
# See COPYING for license information
import unittest
import threading
import os
import time
from remsh.xport.local import LocalXport
from remsh.wire import Wire
class TestWireReading(unittest.TestCase):
"""
test reading packets from th... |
keep_alive.py | from flask import Flask
from threading import Thread
app = Flask('')
@app.route('/')
def home():
return "I'm alive!"
def run():
app.run(host='0.0.0.0',port=8080)
def keep_alive():
t = Thread(target=run)
t.start() |
chatclient.py | #A SecCLIChat client
from basechat import SecCLIChatBase
from socket import socket, AF_INET, SOCK_STREAM, error as SocketError
from pushbuffer import PushBuffer
from threading import Thread, Event
class SecCLIChatClient(SecCLIChatBase):
def printMessages(self):
from datetime import datetime
sorte... |
test_seleniumrequests.py | import json
import socket
import threading
from seleniumrequests import Firefox, Chrome, Ie, Opera, Safari, PhantomJS
from seleniumrequests.request import get_unused_port
from six.moves import BaseHTTPServer, http_cookies
import pytest
import requests
import six
WEBDRIVER_CLASSES = Firefox, Chrome, Ie, Opera, Safari... |
lammerbait.py | #-*-coding: utf-8-*-
from socket import *
import threading
from smtplib import SMTP
import os
from getpass import getpass
def getdfile(name):
dic = ""
while True:
os.system("cls")
dicp = input("Please write the path of the {} dictionary file: ".format(name))
try:
dfile = open(dicp, "r")
except:
continu... |
test_util_test.py | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
utils.py | # -*- coding:utf-8 -*-
"""
Author:
Weichen Shen,weichenswc@163.com
"""
import json
import logging
from threading import Thread
import requests
try:
from packaging.version import parse
except ImportError:
from pip._vendor.packaging.version import parse
def check_version(version):
"""Return version o... |
installer_gui_prank.py | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'installer_gui_prank.ui',
# licensing of 'installer_gui_prank.ui' applies.
#
# Created: Thu Nov 22 17:47:44 2018
# by: pyside2-uic running on PySide2 5.11.2
#
# WARNING! All changes made in this file will be lost!
from PySide... |
hackc.py | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import itertools
import multiprocessing
import os
import signal
import subprocess
import sys
import threading
import time
hh_sing... |
domp.py | #!/usr/bin/env python
import codecs
from bs4 import BeautifulSoup
import sys, os, fnmatch
#from pygments import highlight
#from pygments.lexers import *
#from pygments.formatters import HtmlFormatter
from string import *
import multiprocessing
files_list = []
def findReplace(directory, find, replace, filePattern):
... |
test_wrapt_timeout_decorator.py | """Timeout decorator tests."""
# STDLIB
import inspect
import sys
import threading
from threading import Thread
import time
from typing import Any
# EXT
from dill import PicklingError # type: ignore
import pytest # type: ignore
# OWN
from wrapt_timeout_decorator import *
from wrapt_timeout_decorator.wrap_helper imp... |
bus.py | """
Terminal Runner class
"""
__author__ = "Bruno Chianca Ferreira"
__license__ = "MIT"
__version__ = "0.5"
__maintainer__ = "Bruno Chianca Ferreira"
__email__ = "brunobcf@gmail.com"
import traceback, os, logging, time, subprocess, threading, socket, pickle, struct
class Bus():
def __init__(self):
'Initial... |
spatialquerytests.py | import logger
import time
import unittest
import threading
from threading import Thread
from membase.helper.rebalance_helper import RebalanceHelper
from couchbase_helper.cluster import Cluster
from basetestcase import BaseTestCase
from remote.remote_util import RemoteMachineShellConnection
import json
import sys
from ... |
234.py | """
234. Web Crawler
https://www.lintcode.com/problem/web-crawler/description
hmm.. terrible code :(
"""
"""
class HtmlHelper:
# @param (string)
# @return (list)
@classmethod
def parseUrls(url):
# Get all urls from a webpage of given url.
"""
from collections import deque
import re
import thread... |
Chapter15_ProcessThread07_Lock.py | # -*- coding: utf-8 -*-
import threading
count = 0
lock = threading.Lock() # threading.Lock()创建一个锁
def change_it(n): # 先存后取,结果count应该为0
global count
count = count + n
count = count - n
# def run_thread(n):
# for i in range(100000):
# change_it(n)
def run_thread(n):
... |
models.py | # -*- coding: UTF-8 -*-
import uuid
import os
import datetime
import time
import logging
import sys
import types
import pprint
import threading
try:
from cStringIO import StringIO # Python 2
except ImportError:
from io import StringIO
import django.utils.timezone
from django.db import models
from django.ut... |
common.py | """Test the helper method for writing tests."""
import asyncio
from datetime import timedelta
import functools as ft
import os
import sys
from unittest.mock import patch, MagicMock, Mock
from io import StringIO
import logging
import threading
from contextlib import contextmanager
from homeassistant import auth, core a... |
data_util.py | import time
import numpy as np
import threading
import multiprocessing
try:
import queue
except ImportError:
import Queue as queue
class GeneratorEnqueuer():
def __init__(self, generator,
use_multiprocessing=True,
wait_time=0.05,
random_seed=None):
... |
test.py | import logging
import time
import os
import pytest
from helpers.cluster import ClickHouseCluster, get_instances_dir
from helpers.utility import generate_values, replace_config, SafeThread
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
CONFIG_PATH = os.path.join(
SCRIPT_DIR,
"./{}/node/configs/confi... |
queue.py | #####################################################################
# #
# /queue.py #
# #
# Copyright 2013, Monash University ... |
webstreaming.py |
from imutils.video import VideoStream
from flask import Flask, render_template, Response
from edgetpu.detection.engine import DetectionEngine
from edgetpu.utils import dataset_utils
import threading
import imutils
import time
import cv2
from PIL import Image
box_color = (0, 0, 255)
label_text_color = (255, 255, 255... |
async.py | import asyncio
import test_request
from threading import Thread
def send_notification(url, name, loop):
"""Generate and send the notification email"""
print("Send Notification")
print("URL : ", url)
print("Name : ",name)
# Do some work to get payload body
# Connect package
response = tes... |
__init__.py | import threading
from i3pystatus import SettingsBase, Module, formatp
from i3pystatus.core.util import internet, require
class Backend(SettingsBase):
settings = ()
updates = 0
class Updates(Module):
"""
Generic update checker.
To use select appropriate backend(s) for your system.
For list o... |
server.py | import logging
from multiprocessing import Process
from flask import Flask, jsonify, request
from flask.views import MethodView
from networkx.readwrite import json_graph
from utils.general import CurrentEncoder
log = logging.getLogger('werkzeug')
log.setLevel(logging.ERROR)
class NetworkAPI(MethodView):
def g... |
session_test.py | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
cmd.py | # -*- Coding:utf-8 -*-
# !/usr/bin/env python3
"""
################################################################################
Command will be execute
################################################################################
"""
import os
import sys
import re
import threading
from contextlib ... |
test_thread_local.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 u... |
portable_runner.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... |
message.py | #!usr/bin/env python
#-*-coding:utf-8-*-
#author:lim time:2018/4/30
from packet import *
import socket
from threading import Thread
import sys
'''
程序的底层消息发送采用Python 然后将接受到的消息发送给上层的UI
本程序主要分成两个部分,responseMsg负责监听底层的消息 然后转发给UI
ipcSend则负责监听UI的消息,然后发送给Python底层进行通信
'''
#上线和下线广播地址和端口
broadcastAddr = ("<broadcast>", 36258)
... |
wallpaper.py | # coding: utf-8
"""
Contains code for handling wallpapers
"""
from gi.repository import Gtk, Gdk, GdkPixbuf, GLib, GObject
import math
import os
import threading
import traceback
import time
import uuid
from aspinwall.utils.dimmable import Dimmable
from aspinwall.launcher.config import config
def color_to_pixel(color... |
wsclient.py | #!/usr/bin/env python
# encoding: utf-8
#
# Copyright SAS Institute
#
# 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 b... |
camera.py | import cv2
import threading
import time
class Camera:
def __init__(self, src=0,shape=[480,320]):
self.src = src
self.stream = cv2.VideoCapture(src)
# self.stream.set(cv2.CAP_PROP_FRAME_WIDTH, shape[0])
# self.stream.set(cv2.CAP_PROP_FRAME_HEIGHT, shape[1])
self.stream.set(cv... |
zayante.py | #!/usr/bin/env python
"""Run signal-to-reference alignments
"""
from __future__ import print_function
import pandas as pd
import glob
from signalAlignLib import *
from alignmentAnalysisLib import CallMethylation
from variantCallingLib import get_alignments_labels_and_mask
from multiprocessing import Process, Queue, cur... |
swivel.py | #!/usr/bin/env python3
#
# Copyright 2016 Google Inc. All Rights Reserved.
# Copyright 2017 Sourced Technologies S. L.
#
# 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.apach... |
videoin.py | #! /usr/bin/env python
"""
Copyright (c) 2019 - 2022 Jolle Jolles <j.w.jolles@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 a copy of the License at:
http://www.apache.org/licenses/LICENSE-2.0
Unless required... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.