source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
test_index.py | """
For testing index operations, including `create_index`, `describe_index` and `drop_index` interfaces
"""
import logging
import pytest
import time
import pdb
import threading
from multiprocessing import Pool, Process
import numpy
import sklearn.preprocessing
from milvus import IndexType, MetricType
from utils imp... |
run.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
fMRI preprocessing workflow
=====
"""
import os
import os.path as op
from pathlib import Path
import logging
import sys
import gc
import uuid
import warnings
from argparse import ArgumentParser
from argparse import RawTextHelpFormatter
from multiprocessing import cpu_... |
MultiClampTelegraph.py | # -*- coding: utf-8 -*-
from __future__ import print_function
import sys
from acq4.util.clibrary import winDefs, CParser, CLibrary
sys.path.append('C:\\cygwin\\home\\Experimenters\\luke\\acq4\\lib\\util')
import ctypes
import os, threading, time
DEBUG = False
if DEBUG:
print("MultiClampTelegraph Debug:", DEBUG)... |
wsgi_server.py | #!/usr/bin/env python
#
# Copyright 2007 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 o... |
boeing.py | #!/usr/bin/python
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
import signal
import random
import mcp3008
def MakeHandlerClass(mcp):
class CustomHandler(BaseHTTPRequestHandler, object):
_mcp = None
def __init__(self, *args, **kwargs):
self._mcp = mcp
sup... |
common.py | # Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved.
# Python
import json
import yaml
import logging
import os
import re
import stat
import urllib.parse
import threading
import contextlib
import tempfile
import psutil
from functools import reduce, wraps
from decimal import Decimal
# Django
from django.core.exce... |
network.py | # Copyright 2019 Uber Technologies, 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 applica... |
benchmark_utils.py | # This file is adapted from the AllenNLP library at https://github.com/allenai/allennlp
# Copyright 2020 The HuggingFace Team and the AllenNLP 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 o... |
test_angles.py | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Test initalization and other aspects of Angle and subclasses"""
import pytest
import numpy as np
from numpy.testing import assert_allclose, assert_array_equal
import threading
from astropy.coordinates.angles import Longitude, L... |
log.py | from threading import Thread
from docker import Client
import localstore
import connection
def threaded_function(logs_steam, logs, container_name):
with open(logs, 'ab') as f:
for log_line in logs_steam:
f.write("[%s]"%container_name+log_line)
def consolidate_logs(cluster_name, logs):
# C... |
extract_detection_feature.py | import sys
import os
import numpy as np
import six.moves.urllib as urllib
import tarfile
from object_detection.builders import model_builder
from object_detection.protos import pipeline_pb2
from google.protobuf import text_format
import tensorflow as tf
import h5py
from PIL import Image
import re, tqdm, random
impo... |
test_generator_mt19937.py | import sys
import hashlib
import pytest
import numpy as np
from numpy.linalg import LinAlgError
from numpy.testing import (
assert_, assert_raises, assert_equal, assert_allclose,
assert_warns, assert_no_warnings, assert_array_equal,
assert_array_almost_equal, suppress_warnings)
from numpy.ran... |
aliens_game.py | from sys import stderr
from typing import List, Tuple, Callable, Iterable
from enum import IntEnum, unique
from random import random
from threading import Thread
import pygame
import ecs
RESOLUTION = 640, 480
SCREEN_CAPTION = "The Illustrious Aliens Game"
IMAGES_FORMAT = ".gif"
SOUND_FORMAT = ".wav"
FRAMES_PER_SECOND... |
openNeuroService.py | """
A command-line service to be run where the where OpenNeuro data is downloaded and cached.
This service instantiates a BidsInterface object for serving the data back to the client
running in the cloud. It connects to the remote projectServer.
Once a connection is established it waits for requets and invokes the Bids... |
test_state.py | import glob
import logging
import os
import shutil
import threading
import time
import pytest
from tests.support.case import SSHCase
from tests.support.pytest.helpers import temp_state_file
from tests.support.runtests import RUNTIME_VARS
SSH_SLS = "ssh_state_tests"
SSH_SLS_FILE = "/tmp/salt_test_file"
log = logging.... |
asyncfin-v2.py | """
Correct tasks finalization. Variant 2. Send signal by AioPipe message.
"""
import aiopg
import aioprocessing
import asyncio
import multiprocessing
import random
import signal
import time
class Client(object):
def __init__(self):
self.running = True
@asyncio.coroutine
async def test(self, i... |
favicon.py | import sys
import socket
from planet import config, feedparser
from planet.spider import filename
from urllib2 import urlopen
from urlparse import urljoin
from html5lib import html5parser, treebuilders
from ConfigParser import ConfigParser
# load config files (default: config.ini)
for arg in sys.argv[1:]:
config.l... |
test_maybe.py | from threading import Thread
from wraptor.context import maybe
def test_basic():
with maybe(lambda: False) as result:
assert result == False
check = False
with maybe(lambda: True):
check = True
assert check
def test_threads():
def worker(arr, index):
for i in range(5):
... |
processing_1.py | __author__ = "JJ.sven"
import multiprocessing
import threading
import time
import os
'''进程 多进程解决python实际在操作系统上实际为单线程处理任务,资源利用率低的问题
1. 至少包含一个线程
2. 每个子进程都由父进程启动
'''
def thread_run():
print('thread_run: ', threading.get_ident())
def run(n):
print(n, '--run---进程ID:%s--父进程ID:%s️' % (os.getpid(), os.getppid()))
... |
test_integration.py | import argparse
import psutil
import signal
import subprocess
import threading
import time
import uuid
import tempfile
import shutil
import pytest
import os
from rebus.agent import Agent, AgentRegistry
from rebus.bus import BusRegistry, DEFAULT_DOMAIN
import rebus.agents
import rebus.buses
rebus.agents.import_all()
r... |
multitester.py | """
Certbot Integration Test Tool
- Configures (canned) boulder server
- Launches EC2 instances with a given list of AMIs for different distros
- Copies certbot repo and puts it on the instances
- Runs certbot tests (bash scripts) on all of these
- Logs execution and success/fail for debugging
Notes:
- Some AWS ima... |
poll.py | #!/usr/bin/env python
####################
# Required Modules #
####################
# Generic/Built-in
import logging
import multiprocessing as mp
import os
import time
from threading import Thread
from typing import Dict
# Libs
from flask import request
from flask_restx import Namespace, Resource, fields
# Custom... |
email1.py | from threading import Thread
from flask_mail import Message
from . import mail
from flask import current_app
from flask import render_template
def send_async_email(app, msg):
with app.app_context():
mail.send(msg)
def send_email(to, subject, template, **kwargs):
app = current_app._get_current_object... |
bridge.py | """ LimitlessLED Bridge. """
import queue
import socket
import select
import time
import threading
from datetime import datetime, timedelta
from limitlessled import MIN_WAIT, REPS
from limitlessled.group.rgbw import RgbwGroup, RGBW, BRIDGE_LED
from limitlessled.group.wrgb import WrgbGroup, WRGB
from limitlessled.grou... |
executor.py | import sys, traceback, os
from signal import pause
from time import sleep, monotonic
from threading import Timer, Thread
from gpiozero import Button
from enum import Enum
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from tagit.bus import MessageInputStream, MessageOutputStream
from t... |
display_Run.py | import cv2
import _thread
import time
import socket
import base64
import numpy
import multiprocessing as mp
from luma.core.interface.serial import i2c
from luma.core.render import canvas
from luma.oled.device import ssd1306, ssd1325, ssd1331, sh1106
from time import sleep
from PIL import Image
"""full_Data = b''
TCP_I... |
run_manager.py | # -*- encoding: utf-8 -*-
import errno
import json
import logging
import os
import re
import signal
import socket
import stat
import subprocess
import sys
import time
from tempfile import NamedTemporaryFile
import threading
import yaml
import numbers
import inspect
import glob
import platform
import fnmatch
import cl... |
httpserver.py | import logging
import http.server
import socketserver
import os
import threading
import time
import requests
import lttngust
def http_request_worker(port):
while True:
requests.get(url="http://localhost:{}".format(port))
time.sleep(0.50)
class LoggingHTTPRequestHandler(http.server.SimpleHTTPReques... |
thread10.py | # Python Program To Show Dead Lock Of Threads Due To Locks On Objects
'''
Function Name : Show Dead Lock Of Threads Due To Locks On Objects
Function Date : 5 Oct 2020
Function Author : Prasad Dangare
Input : String
Output : String
'''
from threading import*
# Take Two L... |
test_streamming.py | # Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma de
# Barcelona (UAB).
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
from . import SmokeTest
import time
import threading
import carla
class TestStreamming(SmokeTest)... |
testcases.py | import json
import multiprocessing
import socket
import time
import unittest
import requests
import vocalsalad.server
def find_free_ports(how_many=1):
"""Return a list of n free port numbers on localhost"""
results = []
sockets = []
for x in range(how_many):
s = socket.socket(socket.AF_INET,... |
DCMv2.py | #Imports
import tkinter as tk
import serial
from serial import Serial
import numpy
from tkinter import ttk
from tkinter import messagebox
import sqlite3
import sys
import time
import usb.core
from threading import Thread
import struct
#Serial Details
portName = "COM6" #Change to our port
status = ''
#Creating sqlit... |
alpaca_paper_trade_multicrypto.py | # /*
#
# MIT License
#
# Copyright (c) 2021 AI4Finance
#
# Author: Berend Gort
#
# Year: 2021
#
# GitHub_link_author: https://github.com/Burntt
#
# 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 Softwa... |
client.py | #!/usr/bin/env python
#
# Copyright 2014 Huawei Technologies Co. Ltd
#
# 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 ... |
debug_events_writer_test.py | # Copyright 2019 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... |
run_benchmark.py | # Helper class to run tasks in multiple processes
import os
import subprocess
import shutil
import random
import argparse
import sys
from threading import Thread
from queue import Queue
# Simple task queue
class ShellTaskQueue(Queue):
def __init__(self, nWorkers=1, timeout=99999999999):
Queue.__init__(... |
perf.py | #!/usr/bin/env python3
import argparse
import clickhouse_driver
import itertools
import functools
import math
import os
import pprint
import random
import re
import statistics
import string
import sys
import time
import traceback
import logging
import xml.etree.ElementTree as et
from threading import Thread
from scipy... |
custom.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
test_shared_mem_store.py | """ NOTE(zihao) The unittest on shared memory store is temporally disabled because we
have not fixed the bug described in https://github.com/dmlc/dgl/issues/755 yet.
The bug causes CI failures occasionally but does not affect other parts of DGL.
As a result, we decide to disable this test until we fixed the bug.
"""
i... |
test_ssl.py | # Test the support for SSL and sockets
import sys
import unittest
from test import support
import socket
import select
import time
import datetime
import gc
import os
import errno
import pprint
import urllib.request
import threading
import traceback
import asyncore
import weakref
import platform
import sysconfig
try:
... |
test_operator.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... |
services.py | import importlib
import json
import logging
import os
import re
import uuid
from concurrent import futures
from dataclasses import dataclass, field
from glob import glob
from threading import Thread, Lock
from time import time, sleep
from typing import Dict, Callable, Any, Type, Optional
import grpc
from google.protob... |
test_connection_pool.py | import os
import mock
import pytest
import re
import redis
import time
from threading import Thread
from redis.connection import ssl_available, to_bool
from .conftest import skip_if_server_version_lt, _get_client
from .test_pubsub import wait_for_message
class DummyConnection(object):
description_format = "Dummy... |
speak.py | import threading
import pygame
import pygame_gui
from pygame_gui.elements import UILabel
from pygame_gui.elements import UITextEntryLine
import pyttsx3
class SpeakSpell(pygame_gui.elements.UIWindow):
speakthrd = None
def __init__(self, pos, manager):
super().__init__(
pygame.Rect(pos, ... |
go_tool.py | from __future__ import absolute_import
import argparse
import copy
import json
import os
import re
import shutil
import subprocess
import sys
import tarfile
import tempfile
import threading
import six
from functools import reduce
import process_command_files as pcf
import process_whole_archive_option as pwa
arc_proje... |
tk2thread-broken.py | import queue
import threading
import time
import tkinter
from tkinter import ttk
the_queue = queue.Queue()
def thread_target():
while True:
message = the_queue.get()
print("thread_target: doing something with", message, "...")
time.sleep(1)
print("thread_target: ready for another ... |
pyroxide.py | from threading import Thread
import requests
import math
import socket
import logging
from struct import pack
class Pyroxide:
def __init__(self, timeout=3, logger=None):
self.timeout = timeout
self.logger = logger or logging.getLogger(__name__)
self.good_list = []
@stati... |
dumping_callback_test.py | # Copyright 2019 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... |
multiprocessing_pipe.py | # coding: utf-8
import os
import random
from multiprocessing import Pipe, Process
def producer_task(conn):
value = random.randint(1, 10)
conn.send(value)
print('Value [%d] sent by PID [%d]' % (value, os.getpid()))
conn.close()
# Never forget to always call the `close()` method of a `Pipe` connection
... |
ex8_ntmko_sh_ver_proc_queue.py | #!/usr/bin/env python
"""
8. Optional bonus question -- use a queue to get the output data back from
the child processes in question #7. Print this output data to the screen
in the main process.
"""
from netmiko import ConnectHandler
from datetime import datetime
from net_system.models import NetworkDevice, Credenti... |
subproc_vec_env.py | import multiprocessing as mp
import numpy as np
import multiagent
from baselines.common.vec_env.vec_env import VecEnv, CloudpickleWrapper, clear_mpi_env_vars
def worker(remote, parent_remote, env_fn_wrapper):
parent_remote.close()
env = env_fn_wrapper.x()
try:
while True:
cmd, data = ... |
custom.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
cluster.py | # Future
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from time import sleep
# external
import arrow
import ast
# Standard
import importlib
import signal
import socket
import traceback
# Django
from django import d... |
tivocontroller.py | import logging
import re
import socket
import threading
import time
import zeroconf
logger = logging.getLogger('cmdserver.tivocontroller')
# Mapping of commands to remote codes
CODES = {
# teleport
'Home': 'TIVO',
'My Shows': 'NOWSHOWING',
'LiveTV': 'LIVETV',
'Info': 'INFO',
'Guide': 'GUIDE',... |
wsdump.py | #!/home/ian/下载/wukong-starter/env/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 = getat... |
producer.py | #!/usr/bin/env python 3
import sys
import pika
import random
import traceback
from uuid import uuid1
from vnpy.amqp.base import base_broker
from threading import Thread
import json
######### 模式1:发送者 #########
class sender(base_broker):
def __init__(self, host='localhost', port=5672, user='admin', password='admin'... |
tunnel_util.py | import uuid
import re
import time
import threading
import Queue
import logging
import sys
import getpass
import os
import socket
import select
try:
import SocketServer
except ImportError:
import socketserver as SocketServer
import paramiko
from .shell_util import check_connection
from ..configuration import c... |
wis.py | #!/usr/bin/python
# Copyright 2015 Neuhold Markus and Kleinsasser Mario
#
# 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 ... |
meta_info.py | # -*- coding:utf-8 -*-
import bimpy
from PIL import Image
from geopy.geocoders import Nominatim
from multiprocessing import Process
from Modules.i18n import LANG_EN as LANG
from Modules.conf import conf
from Modules.exif_reader import exif_reader
class meta_info:
def __init__(self):
pass
class meta_i... |
test_params.py | from common.params import Params, UnknownKeyName
import threading
import time
import tempfile
import shutil
import unittest
class TestParams(unittest.TestCase):
def setUp(self):
self.tmpdir = tempfile.mkdtemp()
print("using", self.tmpdir)
self.params = Params(self.tmpdir)
def tearDown(self):
shut... |
Render 3D.py | import collections
import json
from Player import Player, Weapon
import pygame
import FasterMap
import structures
import pg_structures
import numpy as np
from threading import Thread
from Sprites3D import BillboardSprite, Sprites
from numba.typed import Dict
from numba import types
class Player3D(Player):
def _... |
complex_action_server.py | #! /usr/bin/env python
# Copyright (c) 2009, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# no... |
eval_composition.py | import os
import sys
import numpy as np
import json
import multiprocessing as mp
import constants
import util_feature_IO
import util
import util_meta
import util_geometry
import util_version
import util_batch
def evalCubeStatsPost(networkDir, outfolder, ids, neurons, gridDescriptor):
data = {}
k = 0
for ... |
main.py | import pathlib
import threading
import dearpygui.dearpygui as im
from tkinter import *
from tkinter import filedialog
from Downloader.GwDownloader import SkillDownloader
def init_imgui():
im.create_context()
def exit_imgui():
im.destroy_context()
class ImWindow:
def __init__(self, title: str, width... |
keylime_agent.py | #!/usr/bin/python3
'''
SPDX-License-Identifier: Apache-2.0
Copyright 2017 Massachusetts Institute of Technology.
'''
import asyncio
import http.server
from http.server import HTTPServer, BaseHTTPRequestHandler
from socketserver import ThreadingMixIn
import threading
import base64
import configparser
import uuid
impor... |
renderfarmnode.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
################################################################################
# Copyright 1998-2018 by authors (see AUTHORS.txt)
#
# This file is part of LuxCoreRender.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except i... |
arduino_flasher.py | import platform
from .base_flasher import BaseFlasher
import zipfile
import re
import os
import shutil
from threading import Thread
from datetime import datetime
import serial
import flask
from flask_babel import gettext
import pyduinocli
import intelhex
import requests
import tarfile
import io
class ArduinoFlasher(... |
longpulling.py | import datetime
import time
import logging
import dan63047VKbot
import config
import vk_api
import threading
dan63047VKbot.log(False, "Script started")
def bots():
dan63047VKbot.log(False, "Started listening longpull server")
dan63047VKbot.debug_array['start_time'] = time.time()
for event in dan63047VKbot... |
threading_study.py | # import time, threading
#
# balance = 0
# lock = threading.Lock()
#
# def change_it(n):
# global balance
# balance = balance + n
# balance = balance - n
# print balance
#
# def run_thread(n):
# for i in range(n):
# lock.acquire()
# try:
# change_it(n)
# finally:
... |
run.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""ASL preprocessing workflow."""
from .. import config
def main():
"""Entry point."""
from os import EX_SOFTWARE
from pathlib import Path
import sys
import gc
from multiprocessing import Process, Manager
from .parser import parse_args
from... |
face_recognition.py | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# author:cheney<XZCheney@gmail.com>
# 人脸识别
import os
import sys
import cv2
import dlib
import queue
import logging
import logging.config
import threading
import numpy as np
import pandas as pd
from datetime import datetime
from PyQt5.QtCore import QTimer, pyqtSignal, Qt... |
launch_cross_validate.py | #
# Copyright John Reid 2009
#
"""
Code to launch the single gap algorithm on the cross-validation of several fragments concurrently.
"""
import os, subprocess, logging, sys, Queue, threading
from optparse import OptionParser
def get_code_dir():
logging.info('Locating code directory.')
candidate_dirs = [
... |
test_imperative_thread_local_has_grad.py | # Copyright (c) 2021 PaddlePaddle 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 ap... |
dataloader_iter.py | # Copyright (c) 2020 PaddlePaddle 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 appli... |
PC_Miner.py | #!/usr/bin/env python3
##########################################
# Duino-Coin PC Miner (v1.6)
# https://github.com/revoxhere/duino-coin
# Distributed under MIT license
# © Duino-Coin Community 2020
##########################################
import socket, statistics, threading, time, random, re, subprocess, h... |
federated_learning_keras_low_power_PS_CIFAR100.py | from DataSets import CIFARData
from consensus.consensus_v3 import CFA_process
from consensus.parameter_server_v2 import Parameter_Server
# use only for consensus , PS only for energy efficiency
# from ReplayMemory import ReplayMemory
import numpy as np
import os
import tensorflow as tf
from tensorflow import keras
from... |
redis_sub_throughput.py | import os
from os.path import dirname
import sys
sys.path.append((dirname(sys.path[0])))
from arguments import argparser
import time
import redis
import datetime
from multiprocessing import Process
def pub(myredis,n_seconds):
start = time.time_ns()
cnt = 0
n_ns = n_seconds * 1000000000
while True:
... |
main.py | import discord, emoji, math, textwrap
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont, ImageOps, ImageFilter, ImageColor, ImageSequence, ImageEnhance
from PIL.ImageColor import getcolor, getrgb
from PIL.ImageOps import grayscale
from io import BytesIO
import asyncio, pickle, aiofiles
from conc... |
worker.py | from urllib2 import urlopen
from HTMLParser import HTMLParser
from queue import SpiderQueue
from bloomset import BloomSet
from threading import Thread
from storage import Storage
import utilities
import datetime
#Class for Crawling URL's
class SpiderWorker(HTMLParser):
date= datetime.datetime.now()
#initialize mem... |
test_system.py | # Copyright 2016 Google LLC 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 ag... |
webserver.py | # Copyright 2013 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.
import BaseHTTPServer
import os
import threading
import sys
class Responder(object):
"""Sends a HTTP response. Used with TestWebServer."""
def __init_... |
train.py | # Author: Bichen Wu (bichen@berkeley.edu) 08/25/2016
"""Train"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cv2
from datetime import datetime
import os.path
import sys
import time
import numpy as np
from six.moves import xrange
import tensorfl... |
test_containers.py | """toil_container containers tests."""
from os.path import join
from multiprocessing import Process
import os
import docker
import pytest
from toil_container import __version__
from toil_container import exceptions
from toil_container.containers import docker_call
from toil_container.containers import singularity_ca... |
UI.py | #!/bin/python3
import gi
#from resize import resize1
#from resize import resize2
#from resize import resizeNewImages
#from resize import headerSize
from screeninfo import get_monitors
import os
from inputListener import listener
import threading
import re
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk
... |
test_http.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
import multiprocessing
import socket
import time
import pytest
import thriftpy
thriftpy.install_import_hook() # noqa
from thriftpy.http import make_server, client_context
addressbook = thriftpy.load(os.path.join(os.path.dirname(__file__),
... |
email.py | from threading import Thread
from flask import current_app
from flask_mail import Message
from app import mail
def sendAsyncEmail(app, msg):
with app.app_context():
mail.send(msg)
def sendEmail(subject, sender, recipients, text_body, html_body):
msg = Message(subject, sender=sender, recipients=recip... |
command_centre.py | # usage: python command_centre.py
import email_listener
import config
from models import StreamConnection
import logging
from datetime import datetime, timedelta
from database import Session
import json
import threading
import re
from pyngrok import ngrok
from twilio.rest import Client
from time import sleep
def get... |
main.py |
import tensorflow as tf
from tensorflow.keras.models import load_model
from tensorflow.keras.applications.mobilenet_v2 import preprocess_input
from tensorflow.keras.preprocessing.image import img_to_array,load_img
import numpy as np
import cv2
import requests
import time
from PIL import Image,ImageOps
import pyscreens... |
utils.py | import time
import functools
import math
import logging
import itertools
from datetime import datetime
from subprocess import Popen, PIPE
import json
import pprint
import queue
import multiprocessing as mp
from pathos.pools import ProcessPool, ParallelPool
import copy
def factorization(x):
if x == 0:
raise... |
test6.py | import time
import threading
import queue
q = queue.Queue(10)
def productor(i):
while True:
q.put("厨师 %s 做的包子!" % i)
time.sleep(2)
def custom(j):
while True:
print("顾客 %s 吃了一个 %s" % (j, q.get()))
time.sleep(1)
for i in range(3):
t = threading.Thread(target=productor, a... |
zeromq.py | # -*- coding: utf-8 -*-
'''
Zeromq transport classes
'''
# Import Python Libs
from __future__ import absolute_import
import os
import sys
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.uti... |
build.py | # Copyright 2014 The Oppia 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 applicable ... |
sr-video.py | import sys
import time
import ffmpeg
import logging
import subprocess
import numpy as np
import tensorflow as tf
import DCSCN
import cv2
from helper import args
from helper import utilty as util
from threading import Thread
from queue import Queue, Empty
ON_POSIX = 'posix' in sys.builtin_module_names
logger = logging... |
test_flush.py | import time
import pdb
import threading
import logging
from multiprocessing import Pool, Process
import pytest
from utils import *
from constants import *
DELETE_TIMEOUT = 60
default_single_query = {
"bool": {
"must": [
{"vector": {default_float_vec_field_name: {"topk": 10, "query": gen_vectors... |
diag.py | import sys
import os
import os.path
import platform
import futu
import multiprocessing as mp
if futu.IS_PY2:
import Queue as queue
else:
import queue
def print_sys_info(opend_ip=None, opend_port=None):
if futu.IS_PY2:
mp.freeze_support()
opend_version = get_opend_version(opend... |
test_get_collection_info.py | import pdb
import pytest
import logging
import itertools
from time import sleep
import threading
from multiprocessing import Process
from utils import *
nb = 1000
collection_id = "info"
default_fields = gen_default_fields()
segment_row_count = 5000
field_name = "float_vector"
class TestInfoBase:
@pytest.fixtur... |
crawl_urls.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
import time
import requests
import multiprocessing
import argparse
from lxml import html
from urllib.parse import urljoin
from urllib.parse import urlparse
from fake_useragent import UserAgent
from lxml.etree import ParserError
from lxml.etree import XMLSyntaxE... |
P2_1_TCP_Server.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# @Time : 2020/9/30 11:22
# @Author : Newport
# @Site :
# @File : P2_2_UDP_Server.py
# @Software: PyCharm
import socket
import threading
bind_ip="0.0.0.0"
bind_port=9999
server=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
server.bind((bind_ip,bind_port))
server.listen(5)... |
det.py | import os
import random
import queue
import threading
import hashlib
import argparse
import sys
import string
import time
import json
import struct
import tempfile
from random import randint
from os import listdir
from os.path import isfile, join, dirname
from Crypto.Cipher import AES
from zlib import compress, decompr... |
_kit2fiff_gui.py | """Mayavi/traits GUI for converting data from KIT systems."""
# Authors: Christian Brodbeck <christianbrodbeck@nyu.edu>
#
# License: BSD-3-Clause
from collections import Counter
import os
import queue
import sys
from threading import Thread
import numpy as np
from mayavi.core.ui.mayavi_scene import MayaviScene
from... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.