source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
proxy.py | import logging
import os
import time
import serial
import select
import threading
import socketserver
import util
import ip2serial
from util import ALLOWED_CLIENT_IPS
LOG = logging.getLogger(__name__)
BUFFER_SIZE=4096
# initialize the map of serial port number to TCP port; we only limit to 8 ports
# since existin... |
picker.py | #!/usr/bin/env python
# -*- coding: ascii -*-
import sys
import os
import string
import pexpect
import argparse
import re
import subprocess
import time
from multiprocessing import Process, Pipe
import signal
CONT = "(?i)are you sure you want to continue connecting"
PASSWD = "(?i)password:"
PERM = "(?i)permission deni... |
lucid_dataset_parser.py | # Copyright (c) 2020 @ FBK - Fondazione Bruno Kessler
# Author: Roberto Doriguzzi-Corin
# Project: LUCID: A Practical, Lightweight Deep Learning Solution for DDoS Attack Detection
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You... |
common.py | """Test the helper method for writing tests."""
import asyncio
import os
import sys
from datetime import timedelta
from unittest.mock import patch, MagicMock
from io import StringIO
import logging
import threading
from contextlib import contextmanager
from aiohttp import web
from homeassistant import core as ha, load... |
word2vec_optimized.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... |
parallel.py | """Handle parallelization for ``plangym.Environment`` that allows vectorized steps."""
import atexit
import multiprocessing
import sys
import traceback
from typing import Generator, Union
import numpy
from plangym.core import BaseEnvironment, VectorizedEnvironment
def split_similar_chunks(
vector: Union[list, n... |
rfc2217.py | '''
'' PyIRCIoT (PyLayerCOM class)
''
'' Copyright (c) 2019-2020 Alexey Y. Woronov
''
'' By using this file, you agree to the terms and conditions set
'' forth in the LICENSE file which can be found at the top level
'' of this package
''
'' Authors:
'' Alexey Y. Woronov <alexey@woronov.ru>
'''
# Those Global options ... |
trainValueFunc_est.py | # Set GPU
import os
import tensorflow as tf
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
tf.logging.set_verbosity(tf.logging.INFO)
print('\nRunning from GPU %s' % str(os.environ['CUDA_VISIBLE_DEVICES']))
import numpy as np
import cPickle as pickle
import time
import argparse
import shutil
import sys
sys.path.append('./... |
recover.py | import sys,os
import numpy as np
import matplotlib.pyplot as plt
import numpy.fft as fft
import pywt
import math
import scipy.misc
from scipy.stats import norm
from multiprocessing import Process, cpu_count, Manager
from mrina.gen_samples import getKspace,getVenc
from mrina.mri_utils import crop
# Import Solvers
from m... |
utils.py | #!/usr/bin/env python3
#
# Electron Cash - lightweight Bitcoin Cash client
# Copyright (C) 2012 thomasv@gitorious
#
# This file is:
# Copyright (C) 2018 Calin Culianu <calin.culianu@gmail.com>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated document... |
Get_Spotlight_Details.py | #get vulnerability details
#python imports
import requests
import logging
import sys
import datetime
from queue import Queue
from threading import Thread
from os import path
from CS_OAuth2_Base import OAuth2 as auth
import CrowdStrikeSpotlight2HumioConfig as config
class Spotlight_Details():
def get_vul_details... |
utils.py | import asyncio
import time
from contextlib import closing
from functools import wraps
from importlib import import_module
from pathlib import Path
from socket import socket
from threading import Event, Thread
from typing import Any, Callable, List, Optional, TypeVar, cast
import idom
from .proto import ServerFactory
... |
test_local_lambda_invoke.py | import threading
import shutil
import random
from mock import Mock
import time
from unittest import TestCase
import os
import requests
from samcli.local.lambda_service.local_lambda_invoke_service import LocalLambdaInvokeService
from tests.functional.function_code import nodejs_lambda, HELLO_FROM_LAMBDA, ECHO_CODE, TH... |
spinner.py | from IPython.display import display
from ipywidgets import Text
import threading
import itertools
import time
class StoppableThread(threading.Thread):
"""Thread class with a stop() method. The thread itself has to check
regularly for the stopped() condition."""
def __init__(self, *args, **kwargs):
... |
client.py | # import requests
import os
import json
from azure.storage.blob import BlockBlobService, ContentSettings
from threading import Thread
import time
import sys
# from predict import initialize, predict_image
from azure.storage.queue import QueueService, QueueMessageFormat
import base64
# from video2image import sampling
f... |
test_base_events.py | """Tests for base_events.py"""
import errno
import logging
import math
import os
import socket
import sys
import threading
import time
import unittest
from unittest import mock
import asyncio
from asyncio import base_events
from asyncio import constants
from asyncio import test_utils
try:
from test import support
e... |
analysis.py | # -*- coding: utf-8 -*-
'''
This module performs the analysis of incoming
provenance data sent by the producer. Various
types of analysers have been defined in this file.
'''
from __future__ import (absolute_import, division,
print_function, unicode_literals)
import Queue
import os
import logg... |
welcome_system.py | import datetime
import json
import os
import sys
import threading
import time
from multiprocessing import Process, Pipe
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from src.get_weather import get_weather
from src.video import face_regcon
log_file = "../log.txt"
out_mode = 0
d... |
server.py | import logging
from flask import Flask, render_template, request, redirect
from werkzeug.security import generate_password_hash, check_password_hash
from flask_cors import CORS
import threading
import json
from flask_login import (
LoginManager,
login_user,
login_required,
logout_user,
current_user... |
tests.py | import os
import shutil
import sys
import tempfile
import threading
import time
import unittest
from datetime import datetime, timedelta
from io import StringIO
from pathlib import Path
from urllib.request import urlopen
from django.core.cache import cache
from django.core.exceptions import SuspiciousFileOperation
fro... |
test.py | from Thing import Thing, on_message
import time
import threading
thing = Thing('"12345"', '"12345"',
"http://165.22.121.233:8888/api/authorization/", "165.22.121.233")
thing.on_message = on_message
thing.Start()
thr = threading.Thread(target=thing.OnConnected)
thr.start()
thing.Send("start ssss")
time.sle... |
mthread.py | #!/usr/bin/env python3
import re
import cv2
import depthai as dai
import numpy as np
from multiprocessing.pool import ThreadPool
import threading
from queue import Queue
from collections import deque
import time
# Create pipeline
pipeline = dai.Pipeline()
# Define source and output
camRgb = pipeline.createColorCamera... |
util.py | # -*- coding: utf-8 -*-
"""
工具类
Created on 03/01/2016
@author: Wen Gu
@contact: emptyset110@gmail.com
"""
import requests
import asyncio
import math
import time
from datetime import datetime
import pandas
import os
import ntplib
from pandas import DataFrame
from pymongo import MongoClient
import re
import random
import... |
bitmex_ws.py | # -*- coding: utf-8 -*-
import websocket
import threading
import traceback
from time import sleep
import json
import logging
import urllib
import math
# Naive implementation of connecting to BitMEX websocket for streaming realtime data.
# The Marketmaker still interacts with this as if it were a REST Endpoint, but no... |
object_storage_service_benchmark.py | # Copyright 2016 PerfKitBenchmarker 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... |
ifttt_sports_flask.py | #!/usr/bin/env python3
# Copyright (c) 2016 Anki, 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 in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... |
util.py | import base64
import binascii
import codecs
import colorsys
import contextlib
from datetime import date, datetime
import errno
import functools
import gzip
import hashlib
import importlib
from importlib import import_module
import json
import logging
import math
import numbers
import os
import pathlib
import platform
i... |
test_state.py | # -*- coding: utf-8 -*-
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
import glob
import logging
import os
import shutil
import threading
import time
# Import Salt Libs
from salt.ext import six
from salt.ext.six.moves import range # pylint: disable=redefined-builtin
f... |
test_process_utils.py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... |
trezor.py | import traceback
import sys
from typing import NamedTuple, Any, Optional, Dict, Union, List, Tuple, TYPE_CHECKING
from electrum_mars.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException
from electrum_mars.bip32 import BIP32Node, convert_bip32_path_to_list_of_uint32 as parse_path
from electrum_mars i... |
scale_scheduler.py | """The Scale Mesos scheduler"""
from __future__ import absolute_import
from __future__ import unicode_literals
import datetime
import logging
import threading
from django.utils.timezone import now
from django.conf import settings
from error.models import reset_error_cache
from job.execution.manager import job_exe_mg... |
logging.py | """Logging utilities."""
import asyncio
import logging
import threading
from .async import run_coroutine_threadsafe
class HideSensitiveDataFilter(logging.Filter):
"""Filter API password calls."""
def __init__(self, text):
"""Initialize sensitive data filter."""
super().__init__()
sel... |
ssh.py | #!/usr/bin/python
import getopt
import sys
from threading import Thread
from datetime import datetime
import uuid
sys.path = [".", "lib"] + sys.path
from remote.remote_util import RemoteMachineShellConnection
import TestInput
def usage(error=None):
print("""\
Syntax: ssh.py [options] [command]
Options:
-p <key=... |
main_window.py | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2012 thomasv@gitorious
#
# 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 witho... |
CAN_Logger-real.py | import threading
import queue
import can
import time
import subprocess
import signal
import pyinotify
import os
import pickle
import csv
import socket
import tornado.httpserver
import tornado.websocket
import tornado.ioloop
from tornado.ioloop import PeriodicCallback
import tornado.web
import json
#Queue for trans... |
util.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... |
graph_maker.py |
# * MakeGraphUsingTinyEKFDLL
# *
# * Copyright (C) 2022 DukiChoi
# *
# * MIT License
# -*- coding: utf-8 -*-
from calendar import c
from inspect import _void
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from mpl_toolkits.mplot3d imp... |
devent.py | '''
Cobra Distributed Event subsystem.
'''
import json
import time
import socket
import struct
import logging
import itertools
import threading
import collections
import envi.threads as e_threads
logger = logging.getLogger(__name__)
class CobraEventCore:
def __init__(self):
self._ce_chanids = itertools... |
unit_test_Cache.py | import re, os, tempfile, json
import time, datetime, random
from mock import MagicMock, patch
from nose.tools import assert_raises, assert_equal, assert_is_none
from collections import OrderedDict
from multiprocessing import Process
import synapseclient
import synapseclient.cache as cache
import synapseclient.utils as... |
Day11-00-1.py | ## 영상 처리 및 데이터 분석 툴
from tkinter import *; import os.path ;import math
from tkinter.filedialog import *
from tkinter.simpledialog import *
## 함수 선언부
def loadImage(fname) :
global window, canvas, paper, filename, inImage, outImage, inW, inH, outW, outH
fsize = os.path.getsize(fname) # 파일 크기 확인
inH = inW = ... |
simulation_1.py | '''
Created on Oct 12, 2016
@author: mwittie
'''
import math
import network_1
import link_1
import threading
from time import sleep
##configuration parameters
router_queue_size = 0 # 0 means unlimited
simulation_time = 1 # give the network sufficient time to transfer all packets before quitting
if... |
emmer_bench.py | #!/usr/bin/env python
"""
emmer_bench
Furiously nukes the TFTP server with file requests, abandoning some and being
illegal in some cases. May or may not later be extended to be more
customizable.
"""
import gflags
import os
import random
import socket
import sys
import threading
import time
sys.path.append(os.pa... |
article.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[1]/div[2]/div[1]/div[1]/div[2]/div[3]/div[1]/div[2]/div/span[1]'
base_url = 'https://translate.google.com/#'
class Translate:
... |
test_worker.py | from __future__ import absolute_import
from __future__ import with_statement
import socket
from collections import deque
from datetime import datetime, timedelta
from Queue import Empty
from billiard.exceptions import WorkerLostError
from kombu.exceptions import StdChannelError
from kombu.transport.base import Messa... |
util.py | import os
import re
import shutil
import sys
import ctypes
from pathlib import Path
from colorama import Fore, Back, Style
from .settings import *
if sys.version_info[0] < 3 or sys.version_info[1] <= 5:
print("\nPlease restart with Python 3.6+\n")
print("Current Python version:", sys.version_info)
exit(-1)... |
smsids.py | import time
import sys
import psutil
import threading
sys.path.append("../lib/")
import server as SC
import responses as RE
services = [["HTTP80", 80, RE.DLink_200],
["TR069", 7547, RE.generic],
["TOMCAT", 8080, RE.DLink_200],
["WSD", 5358, RE.generic],
["P500", 500, RE.generic]]
pidSafe = {}
p... |
process_manager.py | from enum import Enum
import logging
import os
from pathlib import Path
from threading import Condition, Lock, Thread
import time
from typing import cast, Dict, List, Tuple
from qcg.pilotjob.api.job import Jobs as QCGJobs
from qcg.pilotjob.api.manager import Manager as QCGManager
from ymmsl import Component, Configura... |
ovms_binary.py | #
# Copyright (c) 2020 Intel 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... |
coqtail.py | # -*- coding: utf8 -*-
# Author: Wolf Honore
"""Classes and functions for managing auxiliary panels and Coqtop interfaces."""
import json
import re
import socket
import threading
import time
from collections import defaultdict as ddict
from collections import deque
from concurrent import futures
from itertools import ... |
__init__.py | #### PATTERN | WEB #######################################################
# -*- coding: utf-8 -*-
# Copyright (c) 2010 University of Antwerp, Belgium
# Author: Tom De Smedt <tom@organisms.be>
# License: BSD (see LICENSE.txt for details).
# http://www.clips.ua.ac.be/pages/pattern
######################################... |
base_camera.py | import time
import threading
try:
from greenlet import getcurrent as get_ident
except ImportError:
try:
from thread import get_ident
except ImportError:
from _thread import get_ident
class CameraEvent(object):
"""An Event-like class that signals all active clients when a new frame is
... |
task.py | """
Created on Sep 14, 2017
@author: riteshagarwal
"""
import copy
import json
import json as Json
import os
import random
import socket
import threading
import time
from copy import deepcopy
import zlib
from httplib import IncompleteRead
import com.couchbase.test.transactions.SimpleTransaction as Transaction
from _t... |
main.py | from head import *
from Runalgorithm import *
from Txtcompare import *
from UI_Front import *
from UI_Result import *
# 启动线程
threads = []
threads.append(threading.Thread(target=run))
if __name__ == '__main__':
for t in threads:
t.setDaemon(True) # 守护线程
t.start()
root.mainloop()
|
main.py | import socket
import threading
import handler
import settings
from logger import Logger
# Init logger
logger = Logger(settings.LOG_TRACE_FILE, settings.LOG_REQUESTS_FILE, settings.LOG_LEVEL,
settings.LOG_FORMAT, settings.DATETIME_FORMAT)
# Init socket
server_socket = socket.socket(socket.AF_INET, ... |
compat.py | # Copyright 2016 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... |
redis.py | import redis
import os, time, multiprocess, logging, sys
import json
from compute import Config_ini
from compute.log import Log
from compute.file import get_algo_local_dir, get_population_dir
def get_logger(logger_name, log_file, level=logging.INFO):
l = logging.getLogger(logger_name)
formatter = lo... |
DDOS-MIX.py | import socket
import time
import threading
MAX_CONNECT = 200
PORT = 443
HOST = "jin-dan.site"
PAGE = "/"
buf = ("POST %s HTTP/1.1\r\n"
"Host: %s\r\n"
"Content-Length: 10000000000\r\n"
"Cookie: dklkt_dos_test\r\n"
"\r\n" % (PAGE, HOST))
buf = buf.encode()
socks = []
def conn_thread_tcp(MAX... |
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... |
pref_db.py | import collections
import copy
import gzip
import pickle
import queue
import time
import zlib
import logging
from threading import Lock, Thread
import easy_tf_log
import numpy as np
class Segment:
"""
A short recording of agent's behaviour in the environment,
consisting of a number of video frames and th... |
models.py | # -*- coding: utf-8 -*-
"""
Data models for the Deis API.
"""
from __future__ import unicode_literals
import base64
from datetime import datetime
import etcd
import importlib
import logging
import os
import re
import subprocess
import time
from threading import Thread
from django.conf import settings
from django.con... |
tm1637.py | import math
import RPi.GPIO as IO
import threading
from time import sleep, localtime
# from tqdm import tqdm
# IO.setwarnings(False)
IO.setmode(IO.BCM)
HexDigits = [0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F,
0x6F, 0x77, 0x7C, 0x39, 0x5E, 0x79, 0x71, 0x3D, 0x76,
0x06, 0x1E, 0x76, 0... |
installwizard.py | # Copyright (C) 2018 The Electrum developers
# Distributed under the MIT software license, see the accompanying
# file LICENCE or http://www.opensource.org/licenses/mit-license.php
import os
import sys
import threading
import traceback
from typing import Tuple, List, Callable, NamedTuple, Optional
from PyQt5.QtCore i... |
benchmark.py | """
**benchmark** module handles all the main logic:
- load specified framework and benchmark.
- extract the tasks and configure them.
- create jobs for each task.
- run the jobs.
- collect and save results.
"""
from copy import copy
from enum import Enum
from importlib import import_module, invalidate_caches
import l... |
avnav_worker.py | # -*- coding: utf-8 -*-
# vim: ts=2 sw=2 et ai
###############################################################################
# Copyright (c) 2012,2013 Andreas Vogel andreas@wellenvogel.net
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentatio... |
custom.py | # pylint: disable=too-many-lines
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------... |
cleanup.py | """
sentry.runner.commands.cleanup
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2015 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
import click
from datetime import timedelta
from django.utils import timezon... |
test_schedulers.py | import logging
import pickle
from datetime import datetime, timedelta
from threading import Thread
import pytest
import six
from pytz import utc
from apscheduler.events import (
EVENT_SCHEDULER_STARTED, EVENT_SCHEDULER_SHUTDOWN, EVENT_JOBSTORE_ADDED,
EVENT_JOBSTORE_REMOVED, EVENT_ALL, EVENT_ALL_JOBS_REMOVED, ... |
bodypix_gl_imx.py | # Copyright 2019 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, ... |
main.py | # Regular Imports
from pymavlink import mavutil # For pretty much everything
from threading import Thread # For pretty much everything
from threading import Event # For killing threads
from threading import Semaphore # To prevent multiple movement commands at once
from queue imp... |
helpers.py | import datetime as dt
import logging
import re
import sys
import threading
import traceback
import typing as t
from contextlib import contextmanager
from json import JSONEncoder
from flask import current_app, request
from flask_jwt_extended import create_access_token, get_jwt_identity
from flask_sqlalchemy import Base... |
video_record_manager.py | import cv2
import time
import threading
class VideoRecordManager:
VIDEO_WIDTH = 1280
VIDEO_HEIGHT = 720
VIDEO_FPS = 24.0
def __init__(self, aircraft):
self.aircraft = aircraft
self.recording = False
self.path = None
def receive_frames(self):
streaming_manager = se... |
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... |
OT2listener_websocket_template.py | import asyncio
import websockets
import json
import time
import ntplib
from threading import Thread
from opentrons import types
# import nest_asyncio
# nest_asyncio.apply()
# status enumerations
STATUS_IDLE = 0
STATUS_TASK_RECEIVED = 1
STATUS_TASK_INPROGRESS = 2
# STATUS_TASK_COMPLETE = 3
STATUS_ALL_DONE = 9
metad... |
test_process_utils.py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... |
tasks.py | import asyncio
import logging
from functools import partial, wraps
from threading import Thread
from typing import Callable, Coroutine
from tamarco.core.utils import is_awaitable
logger = logging.getLogger("tamarco.tasks")
THREAD_STOP_TIMEOUT = 3
async def observe_exceptions(coro, name):
"""Function wrapper to... |
utils.py | """
utils.py
------------------------------------------------
Contains general utilities for:
- Loading d3m dataset, writing d3m predictions
- Dealing with problem docs, protos
- Running functions with timelimit
"""
import sys
import glob
import pdb
import shutil
import json
import pandas
import numpy as np
import os
... |
redirect.py | try:
import fcntl
import pty
import tty
import termios
except ImportError: # windows
pty = tty = termios = fcntl = None # type: ignore
from collections import defaultdict
import itertools
import logging
import os
import queue
import re
import signal
import struct
import sys
import threading
impor... |
batcher.py | # Most of this file is copied form https://github.com/abisee/pointer-generator/blob/master/batcher.py
import queue
import time
from random import shuffle
from threading import Thread
import numpy as np
import tensorflow as tf
from . import data
import random
random.seed(1234)
np.random.seed(318)
class Example(ob... |
threaded_mock.py | #!/usr/bin/env python3
"""
-------------------------------
Test :mod:`phile.threaded_mock`
-------------------------------
"""
import datetime
import threading
import typing
import unittest.mock
class ThreadedMock(unittest.mock.Mock):
"""
A mock object to be called in a different thread.
Example::
... |
process_helper.py | #!/usr/bin/env python3
import queue
import time
import os
import atexit
import subprocess
import shutil
import threading
import errno
from typing import Any, Dict, List, TextIO, Optional
class Runner:
def __init__(self,
log_dir: str,
model: str,
case: str,
... |
wsdump.py | #!c:\users\hp\desktop\midas_project\scripts\python.exe
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():
encodi... |
phil-scraper.py | from threading import Thread
from bs4 import BeautifulSoup
import requests
import sys
import time
sys.dont_write_bytecode = True
import dbase
main_site = "http://philpapers.org/"
que = []
def scrape_work(url):
hasPassed = False
while not hasPassed:
try:
response = requests.get(url)
... |
main_uniform.py | from __future__ import print_function
import argparse
import os
import torch
import torch.multiprocessing as mp
import my_optim
from envs import create_picolmaze_env
from model import IntrinsicCuriosityModule2
from train_uniform import train_uniform
from test_uniform import test_uniform
import logging
from logger ... |
__init__.py | # PT-BR
# !& código usando UTF-8 !&
# !& repositório https://github.com/def-paulo/InstagramCommentBot !&
# !& obs.: se o programa não estiver carregando as imagens ou tiver algum problema com diretórios tente remover o "os.getcwd()" e especificar o caminho completo do arquivo !&
from tkinter import *
import time
from ... |
ch10_listing_source.py |
import binascii
from collections import defaultdict
from datetime import date
from decimal import Decimal
import functools
import json
from Queue import Empty, Queue
import threading
import time
import unittest
import uuid
import redis_x
CONFIGS = {}
CHECKED = {}
def get_config(conn, type, component, wait=1):
k... |
rfi_client.py | """
/*********************************************************************************
* RFI Documentation Header Block
* File: rfi_client.py
* Purpose: A client to receive and display real-time rfi data from rfi_receiver.py
* Python Version: 3.6
* Dependencies: Matplotlib, yaml, numpy, argparse
* Help: Run "python3 r... |
server.py | from socket import socket, AF_INET, SOCK_STREAM
from threading import Thread
import time
from person import Person
# GLOBAL CONSTANTS (Sabitler)
HOST = "localhost"
PORT = 5500
ADDR = (HOST, PORT)
MAX_CONNECTIONS = 10
BUFSIZE = 512 # aktarılan data'nın byte sayısı
TIME = time.ctime(t... |
download_videos.py | import time
import pytube
from .log import config_logger
from .step import Step
from pytube import YouTube
from multiprocessing import Process
from yt_concate.settings import VIDEOS_DIR
from threading import Thread
class DownloadVideos(Step):
def process(self, data, inputs, utils):
logging = config_l... |
network.py | import env
import pymongo
import subprocess, platform
import multiprocessing
import time
import datetime
import pytz
def ping(
host: str
):
'''
Returns True and latency if host responds to a ping request
'''
if platform.system().lower()=="windows":
cmd = ["ping", host, "-t"]
... |
snake.py | from abc import ABCMeta, abstractmethod
from enum import Enum, unique
from random import randrange
from threading import Thread
import pygame
class Color(object):
"""颜色"""
GRAY = (242, 242, 242)
BLACK = (0, 0, 0)
GREEN = (0, 255, 0)
PINK = (255, 20, 147)
@unique
class Directi... |
main_window.py | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2012 thomasv@gitorious
#
# 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 witho... |
benchmark.py | #! /usr/bin/env python
from SimpleHTTPServer import SimpleHTTPRequestHandler
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from threading import Thread
import os
import json
import subprocess
import sys
import signal
import argparse
from time import sleep
from format import store
from pick_safedispatch ... |
main.py | import pdb
import time
import os
import subprocess
import re
import random
import json
import numpy as np
import glob
from tensorboard.backend.event_processing.event_accumulator import EventAccumulator
import socket
import argparse
import threading
import _thread
import signal
from datetime import datetime
parser = ar... |
_asyncio.py | import asyncio
import concurrent.futures
import inspect
import math
import os
import socket
import sys
from collections import OrderedDict
from functools import partial
from threading import Thread
from typing import (
Callable, Set, Optional, Union, Tuple, cast, Coroutine, Any, Awaitable, TypeVar, Generator,
L... |
test_synchronized_number.py | import unittest
import threading
from threading_tools import SynchronizedNumber, LockAcquisitionException
NUM_TRIALS = 2500
class TestSynchronizedNumber(unittest.TestCase):
def test_increment(self):
for i in range(NUM_TRIALS):
sync_num = SynchronizedNumber(0.0)
thread1_incr_amt ... |
unlogger.py | #!/usr/bin/env python3
import argparse
import os
import sys
import zmq
import time
import signal
import multiprocessing
from uuid import uuid4
from collections import namedtuple
from collections import deque
from datetime import datetime
# strat 1: script to copy files
# strat 2: build pip packages around these
# coul... |
x.py | import argparse
import importlib.util
import logging
import signal
import sys
import os
from multiprocessing import get_context
from typing import List, Text, Optional
import ruamel.yaml as yaml
from rasa.cli.utils import get_validated_path
from rasa.cli.arguments import x as arguments
from rasa.constants import (
... |
ioloop_test.py | from __future__ import absolute_import, division, print_function
from concurrent.futures import ThreadPoolExecutor
import contextlib
import datetime
import functools
import socket
import subprocess
import sys
import threading
import time
import types
try:
from unittest import mock # type: ignore
except ImportErro... |
materialized_views_test.py | import collections
import re
import sys
import time
import traceback
from functools import partial
from multiprocessing import Process, Queue
from unittest import skip, skipIf
from cassandra import ConsistencyLevel
from cassandra.cluster import NoHostAvailable
from cassandra.concurrent import execute_concurrent_with_a... |
model.py | import os
import re
import shutil
from pathlib import Path
from typing import Callable, Dict, Tuple
import threading
from elpis.engines.common.objects.command import run
from elpis.engines.common.objects.model import Model as BaseModel
from elpis.engines.common.objects.dataset import Dataset
from elpis.engines.common.o... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.