source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
common.py | """Test the helper method for writing tests."""
import asyncio
from collections import OrderedDict
from datetime import timedelta
import functools as ft
import json
import os
import sys
from unittest.mock import patch, MagicMock, Mock
from io import StringIO
import logging
import threading
from contextlib import contex... |
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... |
wrappers.py | # Copyright 2017 The TensorFlow Agents Authors.
#
# 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... |
n1ql_upgrade.py | import threading
from .tuq import QueryTests
from upgrade.newupgradebasetest import NewUpgradeBaseTest
from remote.remote_util import RemoteMachineShellConnection
from membase.api.rest_client import RestConnection
from couchbase.cluster import Cluster
from couchbase.cluster import PasswordAuthenticator
import couchbase... |
interceptor.py | from django.utils.deprecation import MiddlewareMixin
import requests
import json
import threading
from hudou.services.houseservices import HouseService
class GeneralInvterceptor(MiddlewareMixin):
def process_request(self,request):
reqPath = request.path
if (reqPath == '/'):
t = threadi... |
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... |
process_info_tracker.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... |
word2vec.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This OhmNet code is adapted from:
# Copyright (C) 2013 Radim Rehurek <me@radimrehurek.com>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
from __future__ import division
import logging
import os
import heapq
from timeit import default_timer... |
main_window.py | import os
import traceback
from threading import Thread
from typing import io
from datetime import datetime
from PyQt5.QtCore import Qt, QDir, QUrl
from PyQt5.QtGui import QCursor
from PyQt5.QtWidgets import (
QWidget, QPushButton, QProgressBar, QLabel, QSizePolicy, QGridLayout, QGroupBox, QVBoxLayout, QFileDialo... |
test_dota_base_sota.py | # -*- coding:utf-8 -*-
# Author: Xue Yang <yangxue-2019-sjtu@sjtu.edu.cn>
#
# License: Apache-2.0 license
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import math
import os
from multiprocessing import Queue, Process
import cv2
import num... |
tests.py | """
Unit tests for reverse URL lookups.
"""
import sys
import threading
from admin_scripts.tests import AdminScriptTestCase
from django.conf import settings
from django.conf.urls import include, url
from django.contrib.auth.models import User
from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist
f... |
__init__.py | #!/usr/bin/python3
# @todo logging
# @todo extra options for url like , verify=False etc.
# @todo enable https://urllib3.readthedocs.io/en/latest/user-guide.html#ssl as option?
# @todo option for interval day/6 hour/etc
# @todo on change detected, config for calling some API
# @todo fetch title into json
# https://di... |
main_ui_multitask.py | #!/usr/bin/env python
# coding:utf-8
import sys
# print(sys.path)
try:
# Python2
import Tkinter as tk
from Tkinter import Menu
import tkMessageBox as messagebox
import tkFileDialog as filedialog
except ImportError:
# Python3
import tkinter as tk
from tkinter import *
import tkinter.m... |
engine.py | '''
Created on Nov 23, 2016
@author: arnon
'''
import logging
from acrilib import Sequence, MergedChainedDict
from acrilog import SSHLogger as Logger
from acris import virtual_resource_pool as vrp
import multiprocessing as mp
from threading import Thread
from collections import namedtuple
import inspect
from enum imp... |
comments.py | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from time import sleep, time, asctime
from random import random
import pandas as pd
from threading import Thread
# choose a driver
wd = webdriver.Chrome()
# specify the the wait time for a new page to be fully loaded
wait_time_for_loading ... |
virtualHostUtilities.py | #!/usr/local/CyberCP/bin/python
import os
import os.path
import sys
import django
#PACKAGE_PARENT = '..'
#SCRIPT_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))))
#sys.path.append(os.path.normpath(os.path.join(SCRIPT_DIR, PACKAGE_PARENT)))
sys.path.append('/usr/local/Cybe... |
test_wsgiref.py | from unittest import mock
from test import support
from test.test_httpservers import NoLogRequestHandler
from unittest import TestCase
from wsgiref.util import setup_testing_defaults
from wsgiref.headers import Headers
from wsgiref.handlers import BaseHandler, BaseCGIHandler, SimpleHandler
from wsgiref import util
from... |
multithreads5.py | # 创建一个“队列”对象
# import Queue
# q = Queue.Queue(maxsize = 10)
# Queue.Queue #类即是一个队列的同步实现。队列长度可为无限或者有限。可通过Queue的构造函数的可选参数maxsize来设定队列长度。如果maxsize小于1就表示队列长度无限。
# 将一个值放入队列中
# q.put(10)
# 调用队列对象的put()方法在队尾插入一个项目。put()有两个参数,第一个item为必需的,为插入项目的值;第二个block为可选参数,默认为
# 1。如果队列当前为空且block为1,put()方法就使调用线程暂停,直到空出一个数据单元。如果block为0,put方法... |
test_events.py | """Tests for events.py."""
import functools
import gc
import io
import os
import platform
import re
import signal
import socket
try:
import ssl
except ImportError:
ssl = None
import subprocess
import sys
import threading
import time
import errno
import unittest
from unittest import mock
import weakref
if sys.... |
0-bridgeMQTTcsv.py | import re
import json
from typing import NamedTuple
from datetime import datetime, timedelta
import threading
import time
import os
import argparse
import paho.mqtt.client as mqtt
# escritorio/local/iddispositivo
# {"tipo": "d2c", "temperatura": 23.5, "umidade": 38.4, "luminosidade": 830}
MQTTIP = '52.225.223.230'
to... |
newswrapper.py | #!/usr/bin/python3 -OO
# Copyright 2007-2021 The SABnzbd-Team <team@sabnzbd.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any late... |
test_rwlock.py | # Copyright (c) 2015 VMware, Inc. All Rights Reserved.
import threading
import unittest
from hamcrest import * # noqa
from matchers import * # noqa
from common.rwlock import RWLock
class TestRWLock(unittest.TestCase):
def test_read_lock(self):
rwlock = RWLock()
threads = []
def run()... |
utility.py | import os
import math
import time
import datetime
from multiprocessing import Process
from multiprocessing import Queue
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import imageio
import torch
import torch.optim as optim
import torch.optim.lr_scheduler as lrs
class time... |
run.py | #!/usr/bin/env python3
"""
Dependencies:
tensorflow
gym
gym_OptClang
"""
import tensorflow as tf
import numpy as np
import matplotlib
# do not use x-server
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import gym, gym_OptClang
import random, threading, queue, operator, os, sys, re
from operator import itemgette... |
asyncorereactor.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... |
swarming_count_tasks.py | #!/usr/bin/env python
# Copyright 2015 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Calculate statistics about tasks.
Saves the data fetched from the server into a json file to enable reprocessing
the dat... |
AddContition.py | # Copyright (C) 2021 LYNX B.V. All rights reserved.
# Import ibapi deps
from ibapi.client import EClient
from ibapi.wrapper import EWrapper
from ibapi.contract import *
from ibapi.order import *
from ibapi.order_condition import *
import threading
import time
class App(EWrapper, EClient):
def __init__(self, ipad... |
commentdelete.py | import requests
import json
import hashlib
import threading
from bs4 import BeautifulSoup
from time import sleep
from datetime import datetime
def getUserid(user_id,user_pw):
_url = "https://dcid.dcinside.com/join/mobile_app_login.php"
_hd = {
"User-agent" : "dcinside.app",
"Referer" : "http://www.dc... |
test_initialize.py | import multiprocessing as mp
import dask.array as da
from dask_cuda.initialize import initialize
from distributed import Client
from distributed.deploy.local import LocalCluster
import numpy
import psutil
import pytest
mp = mp.get_context("spawn")
ucp = pytest.importorskip("ucp")
# Notice, all of the following test... |
test_sys.py | import unittest, test.support
from test.support.script_helper import assert_python_ok, assert_python_failure
import sys, io, os
import struct
import subprocess
import textwrap
import warnings
import operator
import codecs
import gc
import sysconfig
import locale
# count the number of test runs, used to create unique
#... |
test_mainwindow.py | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright © Spyder Project Contributors
#
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
# -----------------------------------------------------------------------------
"""
Te... |
test_logging.py | # Copyright 2001-2022 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_fwd.py | import unittest
import signal
import os
import time
import asyncio
import multiprocessing
import sys
import requests
from tinap.tests.support import coserver
from tinap import main
class FakeArgs:
port_mapping = "localhost:8887/localhost:8888"
rtt = 0.0
inkbps = 0.0
outkbps = 0.0
desthost = None... |
core.py | # -*- coding: utf-8 -*-
#
# 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
#... |
mqlproton.py |
# python-mqlight - high-level API by which you can interact with MQ Light
#
# Copyright 2015-2017 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licens... |
wss_app.py | #!-*-coding:utf-8 -*-
import logging
import math
import time
from collections import defaultdict
from threading import Thread
from . import config
import numpy as np
import talib
from .WSS.fcoin_client import fcoin_client
from .balance import balance
from fcoin import Fcoin
class wss_app():
def __init__(self):
... |
single_vs_multi_coutdown.py | import threading
import time
def countdown(n):
while n > 0:
time.sleep(0.02)
n -= 1
count = 10
# single-thread processing:
tsingle = time.time()
countdown(count)
countdown(count)
print("single-thread time:",time.time() - tsingle,"\n")
# multithreaded processing:
tmulti = time.time()
tr1 = threading.Thread... |
Scan.py | import datetime
import sys
import time
import os
import numpy as np
import threading
import warnings
import stage
import joystick
import EOSwindowControl
import monoDetecting
warnings.filterwarnings("error")
class Scan():
def __init__(self):
print("\n\n=============== Initializin... |
__init__.py | import RPi.GPIO as GPIO
import time
import datetime
import enum
import threading
class light_mode(enum.Enum):
off = 1
solid = 2
blink_1sec = 3
doubleblink_1sec = 4
class runninglightmanager:
__mypin__ = 0
__currentmode__ = light_mode.off
__kill__ = False
def __init__(self, pin):
... |
GravityServerHelper.py | #!/usr/bin/env python
'''
**********************************************************
Gravity Server Helper
This is a helper class that you can use in the event that
you need to run Gravity as a separate thread within a bigger application.
This should be used to create a thread from a main program.
Note: Currently i... |
independent.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import random
import math
import json
import threading
import numpy as np
import tensorflow as tf
import util
import coref_ops
import conll
import metrics
import optimization
from bert import tokeniz... |
GenericWebsocket.py | """
Module used as a interfeace to describe a generick websocket client
"""
import asyncio
import websockets
import socket
import json
import time
from threading import Thread
from pyee import EventEmitter
from ..utils.CustomLogger import CustomLogger
# websocket exceptions
from websockets.exceptions ... |
main.py | import os
import time
import sys
import psutil
import argparse
from timeit import default_timer
import yaml
import hashlib
import socket
import subprocess as sp
import skimage.io
from network import frame_utils, flo_viz
def get_gpu_memory():
_output_to_list = lambda x: x.decode('ascii').split('\n')[:-1]
ACCEPTABL... |
spawn.py | import multiprocessing as mp
import os
import time
import queue
def worker(q, results):
worker_id = os.getpid()
print('worker {} starts working'.format(worker_id))
timer_1 = time.time()
counter = 0
while True:
try:
val = q.get(block=False)
print('worker {} processes ... |
init.py | # Copyright 2019 Katteli Inc.
# TestFlows.com Open-Source Software Testing Framework (http://testflows.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/lice... |
yolo_socket_final3.py | #!python3
'''
##############################
### Receive Video stream #####
### from Android client #######
### Use yolo to do detect ####
## (Display camera frames) ##
##############################
'''
from ctypes import *
import math
import random
import os
import socket
import time
import cv2
import numpy as np
fr... |
test_algorithm.py | # encoding=utf8
"""Algorithm test case module."""
import logging
from queue import Queue
from threading import Thread
from unittest import TestCase
import numpy as np
from numpy import random as rnd
from WeOptPy.util import objects2array
from WeOptPy.task.interfaces import (
Task,
UtilityFunction
)
from WeOptPy.t... |
speedtest.py | ################################################################################
# Copyright (C) 2019 drinfernoo #
# #
# This Program is free software; you can redistribute it and/or modify ... |
kubernetes.py | import os
import threading
import time
from traitlets import Int, Float, Dict, Unicode, Instance, default
from traitlets.config import SingletonConfigurable
try:
import kubernetes
except ImportError:
raise ImportError(
"'%s.KubeClusterManager' requires 'kubernetes' as a dependency. "
"To insta... |
test_request_safety.py | """
Ensure that if the ``AsyncioTracer`` is not properly configured,
bad traces are produced but the ``Context`` object will not
leak memory.
"""
import asyncio
import threading
from urllib import request
from ddtrace.provider import DefaultContextProvider
from tests.utils import assert_is_measured
async def test_fu... |
droidmaster.py | # This file contains the main class of droidbot
# It can be used after AVD was started, app was installed, and adb had been set up properly
# By configuring and creating a droidbot instance,
# droidbot will start interacting with Android in AVD like a human
import logging
import os
import shutil
import subprocess
impor... |
context.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... |
simulation.py | import arcade
from threading import *
import numpy as np
import random
import scipy, scipy.ndimage
import math
import time
from matplotlib import pyplot as plt
import collections
import os
import timeit
import requests
from fps_test_modules import FPSCounter
import time as timeclock
import datetime
impor... |
wsdump.py | #!/Users/harsh/code/git/cloud-desktop/server/bin/python3
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():
enco... |
doom_gym.py | import copy
import os
import random
import re
import time
from os.path import join
from threading import Thread
import cv2
import gym
import numpy as np
from filelock import FileLock, Timeout
from gym.utils import seeding
from vizdoom.vizdoom import ScreenResolution, DoomGame, Mode, AutomapMode
from sample_factory.al... |
server.py | # -*- coding: utf-8 -*-
"""
livereload.server
~~~~~~~~~~~~~~~~~
WSGI app server for livereload.
:copyright: (c) 2013 by Hsiaoming Yang
"""
import os
import logging
from subprocess import Popen, PIPE
import time
import threading
import webbrowser
from tornado import escape
from tornado.wsgi import WS... |
scavenger.py | #!/usr/bin/env python3
# Copyright (C) 2018 Philip (haxrbyte) Pieterse
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use... |
comfoairq.py | import time
import logging
from datetime import datetime
from pycomfoconnect import *
logger = logging.getLogger(__name__)
class ComfoAirQ(object):
comfoconnect_settings = {}
comfoconnect_bridge = None
comfoconnect = None
callback_sensor = None
connection_event = None
registered_sensors = {... |
tokenizer.py | import os
import click
from tinydb import TinyDB, Query
from pathlib import Path
import os.path
from bs4 import BeautifulSoup
from bs4.element import Comment
from nltk.tokenize import word_tokenize
import re
import textract
import json
import multiprocessing as mp
URL_DB_LOCATION = "/src/url.json"
URL_TEXT_LOCATION = ... |
module.py |
import io
import sys
import time
import socket
import signal
import random
import logging
import resource
import threading
import multiprocessing
import multiprocessing.connection
def cached_with_timeout(timeout, allow_none=False):
def decorator(func):
timestamp, value = 0, None
def wrapper(*ar... |
subprocess.py | """
Some light wrappers around Python's multiprocessing, to deal with cleanly
starting child processes.
"""
import multiprocessing
import os
import sys
multiprocessing.allow_connection_pickling()
spawn = multiprocessing.get_context("spawn")
def get_subprocess(config, target, sockets):
"""
Called in the paren... |
pyrebase.py | import requests
from requests import Session
from requests.exceptions import HTTPError
try:
from urllib.parse import urlencode, quote
except:
from urllib import urlencode, quote
import json
import math
from random import uniform
import time
from collections import OrderedDict
from app.pyrebase.sseclient import... |
simpleserver.py | """
Simple socket server, designed for unit testing
"""
import logging
import socketserver
import threading
__author__ = 'Stephen Brown (Little Fish Solutions LTD)'
log = logging.getLogger(__name__)
def simple_tcp_handler(simple_server):
class SimpleTcpHandler(socketserver.BaseRequestHandler):
def hand... |
testrunner.py | #!/usr/bin/env python
# coding: utf-8
from datetime import datetime
startTime = datetime.now()
import itertools
import json
import multiprocessing as mp
import os
import sys
import time
try:
import pandas as pd
import papermill
from tabulate import tabulate
except ImportError:
sys.exit("""Some librarie... |
fsfreezer.py | #!/usr/bin/env python
#
# VM Backup extension
#
# Copyright 2014 Microsoft 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
#
# U... |
custom.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
ovn_driver.py | # Copyright 2018 Red Hat, 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 b... |
multiprocessing_value_array.py | import multiprocessing
def calc_square(numbers, result, v):
v.value = 5.67
for idx, n in enumerate(numbers):
result[idx] = n*n
if __name__ == "__main__":
numbers = [2,3,5]
result = multiprocessing.Array('i',3)
v = multiprocessing.Value('d', 0.0)
p = multiprocessing.Process(target=calc_... |
utilNotify.py | from . import fmPopup
from . import wgmultiline
from . import fmPopup
import curses
import textwrap
import threading
class ConfirmCancelPopup(fmPopup.ActionPopup):
def on_ok(self):
self.value = True
def on_cancel(self):
self.value = False
class YesNoPopup(ConfirmCancelPopup):
OK_BUTTON_TEX... |
subproc_vec_env.py | import multiprocessing
from collections import OrderedDict
import gym
import numpy as np
from stable_baselines.common.vec_env import VecEnv, CloudpickleWrapper
from stable_baselines.common.tile_images import tile_images
def _worker(remote, parent_remote, env_fn_wrapper):
parent_remote.close()
env = env_fn_w... |
httpclient_test.py | #!/usr/bin/env python
from __future__ import absolute_import, division, print_function, with_statement
import base64
import binascii
from contextlib import closing
import functools
import sys
import threading
import datetime
from io import BytesIO
from tornado.escape import utf8
from tornado.httpclient import HTTPRe... |
mic.py | # Silvius microphone client based on Tanel's client.py
__author__ = 'dwk'
import argparse
from ws4py.client.threadedclient import WebSocketClient
import threading
import sys
import urllib
import json
import time
import Adafruit_GPIO.SPI as SPI
import Adafruit_SSD1306
from PIL import Image
from PIL import ImageDraw... |
aucontrolservice.py | #!/usr/bin/env python3
'''A library and a command line tool to interact with the LOCKSS daemon AU control
service via its Web Services API.'''
__copyright__ = '''\
Copyright (c) 2000-2021, Board of Trustees of Leland Stanford Jr. University
All rights reserved.
'''
__license__ = '''\
Redistribution and use in source... |
__main__.py | # Copyright 2014 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.
"""Sets up and starts a Swarming slave."""
import argparse
import re
import sys
import threading
# pylint: disable=F0401
from infra.tools.bot_setup.start ... |
watchdog.py | # -*- coding: utf-8 -*-
from kazoo.client import KazooClient
import os
import sys
import logging
import time
import signal
from multiprocessing import Process
main_dir = "/root/V3/project"
signal_dir = '/signal/cnblog'
task_type = "cnblog"
def run_proc():
os.chdir(main_dir +"cnblog/cnblog/spiders")
#arg = ["HE... |
main.py | import bot.app
from threading import Thread
Thread(target=bot.app).start() |
ICOM_P_simple.py | #!/usr/bin/python
# -*- coding= utf-8 -*-
import multiprocessing
import os
import sys
from datetime import datetime
from multiprocessing.queues import Queue
from threading import current_thread
import time
from multiprocessing.dummy import Process as dummyProcess
from multiprocessing.dummy import Lock as dummyLock
f... |
discover.py | import threading
from System.Core.Global import *
from System.Core.Colors import *
from System.Core import Modbus
import ipcalc
class Module:
info = {
'Name': 'Modbus Discover',
'Author': ['@enddo'],
'Description': ("Check Modbus Protocols"),
}
options = {
'RHOSTS' :['' ,True ,'The target addres... |
methods.py | # Copyright 2018 gRPC authors.
#
# 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... |
TelegramConnection.py | from cmath import exp
import json
import requests
import threading
import time
import traceback
from queue import Queue
class TelegramConnection:
_send_queue = Queue()
_recv_queue = Queue()
_running = False
_lastUpdate = 0
def __init__(self, api, authToken, chatId):
self._api = api + "bo... |
pyswitchlib_ns_daemon.py | import os
import sys
import time
import threading
import Pyro4
import Pyro4.naming
from pyswitchlib.util.configFile import ConfigFileUtil
from pyswitchlib.util.config import ConfigUtil
from daemon.runner import (DaemonRunner, DaemonRunnerStopFailureError)
from lockfile import LockTimeout
pyswitchlib_conf_file = os.pat... |
badserver.py | from sanic import Sanic
from sanic import response
from sanic.response import stream
import asyncio
from multiprocessing import Process
import click
DEFAULT_CERT = {"cert": "certs/host.cert", "key": "certs/host.key"}
class BadServer:
app_http = Sanic()
app_https = Sanic()
https_process = None
http_... |
worm.py | ####################################
# File name: worm.py #
# Author: Filip Komárek (pylyf) #
# Status: Development #
# Date created: 7/6/2018 #
####################################
import nmap
import paramiko
import os
import socket
from urllib.request import urlopen
... |
automaton.py | # This file is part of Scapy
# See http://www.secdev.org/projects/scapy for more information
# Copyright (C) Philippe Biondi <phil@secdev.org>
# Copyright (C) Gabriel Potter <gabriel@potter.fr>
# This program is published under a GPLv2 license
"""
Automata with states, transitions and actions.
"""
from __future__ imp... |
work_queue.py | # -*- python -*-
# Mark Charney
#BEGIN_LEGAL
#
#Copyright (c) 2017 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
#
... |
base.py | from collections import OrderedDict as dict
import threading
import numpy as np
import pandas as pd
import uuid
from .utils import *
__all__ = ['Base',
'Defaults',
'DBase',
'Datasheet',
'Thread']
class Base(object):
""" This is the default Base Object.
Base ob... |
autoreload.py | import functools
import itertools
import logging
import os
import signal
import subprocess
import sys
import threading
import time
import traceback
import weakref
from collections import defaultdict
from pathlib import Path
from types import ModuleType
from zipimport import zipimporter
from django.apps import apps
fro... |
build_dictionary.py |
import threading
import subprocess
import glob
import re
import operator
import pickle
from audio import spec2wav, wav2spec, read_wav, write_wav
import matplotlib.pyplot as plt
import numpy as np
sr = 22050
n_fft = 512
win_length = 400
hop_length = 80
duration = 2 # sec
# moving all data to one dir cd ~/Downloads/a... |
cli3.py | """
cli.py
Sample CLI Clubhouse Client
RTC: For voice communication
"""
import os
import sys
import threading
import configparser
import keyboard
import sys
import time
import colorama
from colorama import Fore, Style
from rich.table import Table
from rich.console import Console
from clubhouse.clubhouse import Clubh... |
decorators.py | from functools import wraps
from threading import Thread
from flask import flash, redirect, url_for, abort
from flask_login import current_user
def async(f):
@wraps(f)
def wrapper(*args, **kwargs):
thread = Thread(target=f, args=args, kwargs=kwargs)
thread.start()
return wrapper
def check... |
TestPuppetExecutor.py | #!/usr/bin/env python2.6
'''
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
"Licens... |
ss.py | #!/usr/bin/env python3
"""
AUTHORS: CHRIS KORTBAOUI, ALEXIS RODRIGUEZ
START DATE: 2020-04-06
END DATE: 2020-04-13
MODULE NAME: ss.py
"""
try:
import socket # Import socket for creating TCP connection.
from time import sleep # Import sleep from time to halt execution of program when necessary.
import os # Import os... |
env.py | # Microsoft Azure Linux Agent
#
# Copyright 2018 Microsoft 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 b... |
plot.py | #!/usr/bin/env python
#from https://thepoorengineer.com/en/arduino-python-plot/
from threading import Thread
import serial
import time
import collections
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import struct
import copy
import pandas as pd
import numpy as np
class se... |
server.py | import errno
import http.server
import os
import socket
from socketserver import ThreadingMixIn
import ssl
import sys
import threading
import time
import traceback
import uuid
from collections import OrderedDict
from queue import Empty, Queue
from h2.config import H2Configuration
from h2.connection import H2Connection... |
gsicrawler_pipeline.py | import luigi
from luigi import configuration
from luigi.s3 import S3Target, S3PathTask
import threading
from time import sleep
import os
import json
import imp
import random
import datetime
import uuid
from bottle import route, run, template, static_file, response, request, install
import luigi
import urllib2
pendin... |
respi_car_0801.py | #coding:utf8
import RPi.GPIO as GPIO
import time
from random import random,choice
from threading import Thread
from copy import copy
import logging
class MyCarLog(object):
"""docstring for MyCarLog"""
def __init__(self):
pass
# 创建Logger
self.logger = logging.getLogg... |
camera.py | """camera.py
This code implements the Camera class, which encapsulates code to
handle IP CAM, USB webcam or the Jetson onboard camera. In
addition, this Camera class is further extended to take a video
file or an image file as input.
"""
import logging
import threading
import subprocess
import numpy as np
import c... |
dispatcher.py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""GRPC client.
Implements loading and execution of Python workers.
"""
import asyncio
import concurrent.futures
import logging
import os
import queue
import sys
import threading
from asyncio import BaseEventLoop
from loggin... |
main.py | import sys
import time
from cv2 import cv2
import numpy as np
import mss
from pynput.mouse import Button, Controller
import os
from bot import Fisher
import threading
# Some images we will use to dynamically find catch bar
# dirname = os.path.dirname(__file__)
path = os.path.dirname(os.path.dirname(__file__))
img_path... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.