source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
threading_daemon_join.py | #!/usr/bin/env python3
# encoding: utf-8
#
# Copyright (c) 2008 Doug Hellmann All rights reserved.
#
"""Joining daemon threads to prevent premature exit.
"""
#end_pymotw_header
import threading
import time
import logging
def daemon():
logging.debug('Starting')
time.sleep(0.2)
logging.debug('Exiting')
d... |
email.py | from threading import Thread
from flask import current_app, render_template
from flask_mail import Message
import os
from . import mail
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()
... |
test_server_basic.py | import subprocess
import requests
import time
import re
import signal
import os
import traceback
from threading import Thread
from time import sleep
__this_dir__ = os.path.join(os.path.abspath(os.path.dirname(__file__)))
class DispatcherServer(object):
def __init__(self):
pass
url=None
def foll... |
test_gateway.py | import functools
import time
from threading import Thread
import numpy as np
import pytest
from jina import Document, Client, Flow
from jina.enums import CompressAlgo
from tests import random_docs
@pytest.mark.slow
@pytest.mark.parametrize('compress_algo', list(CompressAlgo))
def test_compression(compress_algo, moc... |
directory_monitor.py | import threading
from typing import Dict
import os
import time
class DirectoryMonitor():
def __init__(self, *, directory_path: str, include_subdirectories: bool, delay_between_checks_seconds: float):
self.__directory_path = directory_path
self.__include_subdirectories = include_subdirectories
self.__delay_be... |
http.py | from __future__ import print_function
import base64
import copy
import json
import logging
import os
import random
import ssl
import string
import sys
import threading
import time
from builtins import object
from builtins import str
from flask import Flask, request, make_response, send_from_directory
from pydispatch ... |
helper.py | # -*- coding: utf-8 -*-
import os
from warnings import warn
import ctypes
import win32ui
from threading import Barrier, Thread
import contextlib
import shutil
import tempfile
#%%
def lock_until_file_is_safe(filename):
opened = False
while not opened:
try:
with open(filename):
... |
self_contained_components.py | #!/usr/bin/env python
# Lint as: python3
"""Functions to run individual GRR components during self-contained testing."""
import atexit
import collections
import os
import platform
import shutil
import signal
import subprocess
import sys
import tempfile
import threading
import time
from typing import Dict, Iterable, L... |
baddiscord.py | from PySide2.QtWidgets import QApplication, QWidget, QLabel, QVBoxLayout, QHBoxLayout,\
QPushButton, QLineEdit, QSizePolicy, QMessageBox, QStyle, QToolBar, QMenu, QWidgetAction
from PySide2.QtCore import Qt
from PySide2.QtGui import QIcon, QWindow, QPalette
from qasync import QEventLoop, QThreadExecutor
import threa... |
test_hnsw.py | import numpy
import sys
import nmslib
import time
import math
from multiprocessing import Process
def write_knn_out(out_dir,write_dist,num_inst,nbrs,batch_no,metric_space):
with open('%s/%d'%(out_dir,batch_no),'w') as fp:
fp.write('%d %d\n'%(len(nbrs),num_inst))
if write_dist == 1:
for j in range(0,... |
protocol.py | import base64
import logging
import random
import signal
import threading
import time
import traceback
from queue import Queue
from contextlib import contextmanager
from lora_multihop import ipc, serial_connection, header, variables
from lora_multihop.header import RegistrationHeader, ConnectRequestHeader, DisconnectR... |
weixin_bot.py | #!/usr/bin/env python
# coding: utf-8
#===================================================
from wechat import WeChat
from wechat.utils import *
from wx_handler import WeChatMsgProcessor
from wx_handler import Bot
from db import SqliteDB
from db import MysqlDB
from config import ConfigManager
from config import Constan... |
simple_queue.py | from lithops.multiprocessing import Process, SimpleQueue
def f(q):
q.put([42, None, 'hello World'])
if __name__ == '__main__':
q = SimpleQueue()
p = Process(target=f, args=(q,))
p.start()
print(q.get()) # prints "[42, None, 'hello']"
p.join()
|
executor.py | from concurrent.futures import Future
import typeguard
import logging
import threading
import queue
import datetime
import pickle
from multiprocessing import Process, Queue
from typing import Dict # noqa F401 (used in type annotation)
from typing import List, Optional, Tuple, Union, Any
import math
from parsl.seriali... |
predict.py | #!/usr/bin/env python
# Use existing model to predict sql from tables and questions.
#
# For example, you can get a pretrained model from https://github.com/naver/sqlova/releases:
# https://github.com/naver/sqlova/releases/download/SQLova-parameters/model_bert_best.pt
# https://github.com/naver/sqlova/releases/d... |
common.py | import io
import os
import sys
import json
import time
import fcntl
import types
import base64
import fnmatch
import hashlib
import logging
import binascii
import builtins
import functools
import itertools
import threading
import traceback
import contextlib
import collections
import regex
import synapse.exc as s_exc
... |
test_sonoff.py | #!/usr/bin/env python3
# This script can be used to test 2-way communication with a Sonoff device in LAN mode.
# When executed (e.g. from a terminal with `python test_sonoff.py`), it will open a WebSocket connection on port 8081
# to the device on the IP address you specify below, simulating the eWeLink mobile app.
# ... |
__init__.py | # ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistribu... |
data_reader2.py | import os
from Queue import Queue
import sys
from threading import Thread
import time
class DataReader(object):
"""DataReader - simple data reader"""
def __init__(self, num_worker_threads=5):
super(DataReader, self).__init__()
self.num_worker_threads = num_worker_threads
def read_data(self, filenames):
input... |
pydoc.py | #!/usr/bin/env python
# -*- coding: latin-1 -*-
"""Generate Python documentation in HTML or text for interactive use.
In the Python interpreter, do "from pydoc import help" to provide online
help. Calling help(thing) on a Python object documents the object.
Or, at the shell command line outside of Python:
Run "pydo... |
exampletest.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... |
cli.py | #===============================================================================
# Imports
#===============================================================================
from __future__ import print_function
import os
import re
import sys
import optparse
import textwrap
import importlib
from collections import (
... |
run.py | # -*- coding: utf-8 -*-
from azure.storage.blob import BlockBlobService
import UtilityHelper
import asyncio
import requests, datetime
import os, json, threading
import multiprocessing
from azure.eventprocessorhost import (
AbstractEventProcessor,
AzureStorageCheckpointLeaseManager,
EventHubConfig,
E... |
multithread_kokkos.py | from threading import Thread
from parla.multiload import multiload_contexts
import time
if __name__ == '__main__':
m = 2
n_local = 1000000000
N = m * n_local
#Load and configure
#Sequential to avoid numpy bug
t = time.time()
for i in range(m):
multiload_contexts[i].load_stub_libra... |
TestDebugger.py | #!/usr/bin/env python2.7
import unittest
import logging
logging.basicConfig(level=logging.INFO)
from datetime import datetime
import time
from time import sleep
from unittest.case import TestCase
from SiddhiCEP4.core.SiddhiManager import SiddhiManager
from SiddhiCEP4.core.debugger.SiddhiDebugger import SiddhiDebug... |
core.py | #!/bin/env python
import yaml
import multiprocessing
import math
import os
import tarfile
import zipfile
import time
import fnmatch
import zlib
import logging
import advancedSearch
from termcolor import colored
CONFIG = yaml.safe_load(open('config.yaml'))
BASE64_CHARS = CONFIG['base64_chars']
PATH = './'
ARCHIVE_TYPE... |
vnbitfinex.py | # encoding: UTF-8
import json
import requests
import traceback
import ssl
from threading import Thread
from queue import Queue, Empty
import websocket
WEBSOCKET_V2_URL = 'wss://api.bitfinex.com/ws/2'
RESTFUL_V1_URL = 'https://api.bitfinex.com/v1'
###################################################################... |
local_player.py | from typing import List
from threading import Thread
from time import sleep
from pygame import mixer, time
from src.internal.app.interfaces.player import Player
from src.internal.domain.music.playlist import Playlist
from src.internal.domain.music.song import Song
CONTINUOUS_LOOP = 1000000
class LocalPlayer(Player... |
deeplab_train_test.py | #!/usr/bin/env python
# run "pytest deeplab_train_test.py " or "pytest " for test, add " -s for allowing print out"
# "pytest can automatically search *_test.py files "
# import unittest
import os, sys
import time
from multiprocessing import Process
# the path of Landuse_DL
# code_dir = os.path.expanduser('~/codes/P... |
scripts.py | # -*- coding: utf-8 -*-
'''
This module contains the function calls to execute command line scripts
'''
# Import python libs
from __future__ import absolute_import, print_function
import os
import sys
import time
import signal
import logging
import functools
import threading
import traceback
import signal
import funct... |
test_game_play.py | import queue
import threading
import time
import unittest
from datetime import datetime
from battleships_pb2 import Attack, Request, Status
from server import Battleship
REDIS_HOST = 'localhost'
def stream(q, p):
while True:
s = q.get()
if s is not None:
print(f'{datetime.now()} - {p}... |
DDOS_Script.py | """
This is not an actual DDOS attack script
It's just a basic script to understand the fundamentals of DDOS attack.
This is nowhere near powerful enough,
Firstly because this is too slow
Python doesn't actually support multi threading - just simulates it
And this script's got a LOT of security loopholes...
Even if y... |
thread.py | import cv2, threading, queue, time
class ThreadingClass:
# initiate threading class
def __init__(self, name):
time.sleep(1)
self.cap = cv2.VideoCapture(name)
# define an empty queue and thread
self.q = queue.Queue()
t = threading.Thread(target=self._reader)
t.daemon = True
t.start()
# r... |
vec_env.py | # Copyright (c) 2017 OpenAI (http://openai.com)
import numpy as np
from multiprocessing import Process, Pipe
from abc import ABC, abstractmethod
class VecEnv(ABC):
"""
An abstract asynchronous, vectorized environment.
Used to batch data from multiple copies of an environment, so that
each observation ... |
initialize.py | __author__ = 'Aaron Yang'
__email__ = 'byang971@usc.edu'
__date__ = '8/4/2020 11:27 AM'
import multiprocessing
import os
def foo(index):
print("这里是 ", multiprocessing.current_process().name)
print('模块名称:', __name__)
print('父进程 id:', os.getppid()) # 获取父进程id
print('当前子进程 id:', os.getpid()) # 获取自己的进程id... |
openvpn.py | #!/usr/bin/python
# openvpn.py: library to handle starting and stopping openvpn instances
import logging
import os
import signal
import subprocess
import threading
import time
class VPNConnectionError(Exception):
def __init__(self, value, log):
self.value = value
self.log = log
def __str__(se... |
test_pdb.py | # A test suite for pdb; not very comprehensive at the moment.
import doctest
import pdb
import sys
import types
import unittest
import subprocess
import textwrap
from test import support
# This little helper class is essential for testing pdb under doctest.
from test.test_doctest import _FakeInput
class PdbTestInpu... |
freetests.py | #!/usr/bin/env python3
# coding: utf-8
# Copyright 2013 Abram Hindle
#
# 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 ... |
webserver.py | #MIT License
#Copyright (c) 2017 Tim Wentzlau
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publ... |
__main__.py | #Copyright 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.
#You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#Unless required by ap... |
functions.py | # This file is part of khmer, https://github.com/dib-lab/khmer/, and is
# Copyright (C) 2015, Michigan State University.
# Copyright (C) 2015, The Regents of the University of California.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following con... |
mapFrame.py | """
Frame principale avec l'image de la carte, où sera ajouté le chemin à parcourir
"""
from random import randrange # création couleurs aléatoires
from tkinter import * # GUI
from tkinter import ttk # better/other widgets
from PIL import ImageTk, Image, ImageDraw, ImageFont # image handling
from time import sleep # us... |
flesk_api.py | import cv2, numpy, requests, time, pytesseract, flask, os, json, threading, pymysql.cursors
from datetime import datetime
from collections import Counter
from pdf2image import convert_from_bytes
from flask import request, jsonify
app = flask.Flask(__name__)
app.config["DEBUG"] = True
#####Параметры MySQL######
HOST = ... |
ib_hist_general_stk.py | # -*- coding: utf-8 -*-
"""
IBAPI - Getting historical data for stocks from different exchanges and geographies
@author: Mayank Rasu (http://rasuquant.com/wp/)
"""
# Import libraries
from ibapi.client import EClient
from ibapi.wrapper import EWrapper
from ibapi.contract import Contract
import pandas as pd
import thr... |
live_response_api.py | #!/usr/bin/env python3
# *******************************************************
# Copyright (c) VMware, Inc. 2020-2021. All Rights Reserved.
# SPDX-License-Identifier: MIT
# *******************************************************
# *
# * DISCLAIMER. THIS PROGRAM IS PROVIDED TO YOU "AS IS" WITHOUT
# * WARRANTIES OR CO... |
generate_baseline_stats.py | """Generate statistics for baseline"""
import numpy as np
import pickle
import click
import multiprocessing
time = np.arange(0.1, 50, 1)
sim_dt = 0.1
def gen_phase1(return_dict):
from buildup.fenics_.phase1 import phis, phie, cs, ce, j
return_dict["phase1_"] = {
"phis": phis.main(time=time, get_tes... |
run_experiments_verify.py | #!/usr/bin/python
import subprocess
import threading
import multiprocessing
import os
conf_str_incastN = '''init_cwnd: 2
max_cwnd: 30
retx_timeout: 450
queue_size: 10485760
propagation_delay: 0.0000002
bandwidth: 100000000000.0
queue_type: 6
flow_type: 6
num_flow: {0}
num_hosts: {4}
flow_trace: ./CDF_{1}.txt
cut_thro... |
command_control.py | # coding: utf-8
import sys
from flare.tools.utils import bcolors
from flare.base.config import flareConfig
try:
import pandas as pd
except:
print("Please make sure you have pandas installed. pip -r requirements.txt or pip install pandas")
sys.exit(0)
try:
from elasticsearch import Elasticsearch, help... |
__init__.py | # YOLOv3 🚀 by Ultralytics, GPL-3.0 license
"""
Logging utils
"""
import os
import warnings
from threading import Thread
import pkg_resources as pkg
import torch
from torch.utils.tensorboard import SummaryWriter
from utils.general import colorstr, emojis
from utils.loggers.wandb.wandb_utils import WandbLogger
from u... |
operator.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import shutil
import json
import os
import tempfile
import time
import threading
import shlex
import tr... |
geyaApi.py | # encoding: utf-8
import urllib
import hashlib
import os
import jpype
from jpype import *
import math
import requests
from Queue import Queue, Empty
from threading import Thread
from time import sleep
LHANG_API_ROOT = "https://api.lhang.com/v1/"
FUNCTION_TICKER = 'FUNCTION_TICKER'
FUNCTION_ALL_TICKER = 'FUNCTION_AL... |
firebaseversion.py | #!/usr/bin/env python3
#doing all needed imports
from os import system
from firebase import firebase
import threading
import subprocess as s
from sys import argv
from datetime import datetime
from playsound import playsound
#we need it to that thing down here
sound = True
#here's that thing. If you don't want notifi... |
xarm_controller.py | #!/usr/bin/env python
import rospy
import numpy as np
import time
import threading
import xarm_servo_controller
from std_msgs.msg import Float64MultiArray
from std_srvs.srv import SetBool, SetBoolResponse
from xarm.msg import JointCmd
def RAD_2_DEG(x):
return(x * 180.0 / np.pi)
def DEG_2_RAD(x):
return(x * np... |
test_pip_package_installer.py | import os
import re
import pytest
import threading
from script_runner import PipPackageInstaller
@pytest.mark.pip_package_installer
def test_property_access_1():
pip_package_installer = PipPackageInstaller()
with pytest.raises(InterruptedError, match=r".*once.*script.*completed.*"):
pip_package_inst... |
find_tweets.py | import configparser
import tweepy
import argparse
import json
import pymysql.cursors
import logging
import logging.config
import datetime
import threading
class Log:
logs = logging.getLogger('find_tweets')
class Config:
def __init__(self, filename="find-tweets.cfg", logger=None):
self.filename = fi... |
util.py | import os
import re
import sys
import time
from urllib.request import Request, urlopen
from urllib.parse import urlparse, quote
from decimal import Decimal
from datetime import datetime
from multiprocessing import Process
from subprocess import TimeoutExpired, Popen, PIPE, DEVNULL, CompletedProcess, CalledProcessError... |
jobs.py | # coding=utf-8
"""Sopel's Job Scheduler: internal tool for job management.
.. note::
As of Sopel 5.3, :mod:`sopel.tools.jobs` is an internal tool. Therefore,
it is not shown in the public documentation.
"""
from __future__ import unicode_literals, absolute_import, print_function, division
import datetime
im... |
test_utility.py | import threading
import pytest
from base.client_base import TestcaseBase
from base.utility_wrapper import ApiUtilityWrapper
from utils.util_log import test_log as log
from common import common_func as cf
from common import common_type as ct
from common.common_type import CaseLabel, CheckTasks
from common.milvus_sys im... |
test.py | import os.path as p
import random
import threading
import time
import pytest
import io
from helpers.cluster import ClickHouseCluster
from helpers.test_tools import TSV
from helpers.client import QueryRuntimeException
from helpers.network import PartitionManager
import json
import subprocess
import kafka.errors
from k... |
brute.py | from typing import ValuesView
import Cerbrutus.services as services
import time
import sys
import threading
from colorama import Fore, Style
import Cerbrutus
'''
Add estimated time remaining...
Add output of how long its been running for already every few minutes.
'''
class BruteUtil:
threads = []
... |
run_benchmarks.py | import sys
import os
import time
import subprocess
import copy
import numpy
from matplotlib.backends.backend_pdf import PdfPages
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
from matplotlib.font_manager import FontProperties
import multiprocessing
cp... |
__init__.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import bisect
import difflib
import gc
import http.client
import hashlib
import heapq
import lz4.frame
import math
import mmap
import operator
import os
import re
import ... |
pdf-comparison.py | #!/usr/bin/env python
# Copyright 2019 Google LLC.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
'''
This tool compares the PDF output of Skia's DM tool of two commits.
It relies on pdfium_test being in the PATH. To build:
mkdir -p ~/src/pdfium
cd ~/src/pdfium... |
book_loader.py | '''Gui''' # pylint: disable=(invalid-name)
import ast # Use to read list from config file.
import configparser # Read config file.
import csv
import io
import json
import logging # Logging errors.
import os
import pathlib
import re
import shutil
import sys
import time
import traceback
import webbrowser
from distutil... |
connection.py | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# 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 ... |
logger.py | import collections
import threading
import traceback
import json
from subprocess import PIPE, Popen, check_output
import paho.mqtt.client as mqtt
try:
# Transitional fix for breaking change in LTR559
from ltr559 import LTR559
ltr559 = LTR559()
except ImportError:
import ltr559
from bme280 import BME... |
execution.py | import ast
import json
import re
import ssl
import time
from datetime import datetime
from multiprocessing import Pool
from threading import Thread
import pytz
import requests
from bson import ObjectId
from flask import current_app
from requests.cookies import RequestsCookieJar
from app import app
from config import ... |
server_controller.py | import subprocess
import sys
import functools
import os
import os.path as path
from threading import Thread
from queue import Queue, Empty
module_dir = path.abspath(path.join(path.dirname(__file__)))
_root_dir = path.abspath(path.join(module_dir, '..'))
class StdOutReader:
def __init__(self, stream, verbose=False)... |
DataExtractor.py | # Extract the useful data from game files (json)
# Append the useful data to a csv file
import pickle
import os
import queue
import sys
from collections import OrderedDict
import multiprocessing
from multiprocessing.managers import BaseManager, NamespaceProxy
import time
import Modes
import pandas as pd
from collectio... |
test_socket.py | import unittest
from test import support
import errno
import io
import itertools
import socket
import select
import tempfile
import time
import traceback
import queue
import sys
import os
import array
import contextlib
from weakref import proxy
import signal
import math
import pickle
import struct
import random
import... |
model.py | """
Namita Vagdevi Cherukuru
C32671672
Introduction to Information Retrieval
Project Phase II
"""
from __future__ import division
import os
import time
import Queue
import threading
from PIL import Image
from cStringIO import StringIO
import math
from glob import glob
import tensorflow as tf
import numpy as np
from six... |
swift_t.py | """Sample Executor for integration with SwiftT.
This follows the model used by `EMEWS <http://www.mcs.anl.gov/~wozniak/papers/Cancer2_2016.pdf>`_
to some extent.
"""
from concurrent.futures import Future
import logging
import uuid
import threading
import queue
import multiprocessing as mp
from ipyparallel.serialize ... |
communicationModule.py | """
Sample structure for a communication point module.
This module describes the basic uses of SimpleSensor.
To make your own module, this is a good place to start.
This module will receive large_number events and log/count them,
once the threshold is reached as set in config/module.conf, shutdown.
"""
# Standard imp... |
logger_threads.py | import sys
import logging
import traceback
import threading
import multiprocessing
from datetime import time, datetime
from logging import FileHandler as FH
from time import sleep
# ============================================================================
# Define Log Handler
# =====================================... |
consumer.py | import datetime
import logging
import os
import signal
import sys
import threading
import time
from multiprocessing import Event as ProcessEvent
from multiprocessing import Process
try:
import gevent
from gevent import Greenlet
from gevent.event import Event as GreenEvent
except ImportError:
Greenlet ... |
Miranda_Ubuntu_aws_sshrdp_UIv7.py | # --- The MIT License (MIT) Copyright (c) Sat May 3 02:14:00am 2020 ---
# 此程的功能為提供使用 Amazon Web Service (AWS) 的 EC2 服務的使用者一個簡便的使用者界面
# 能夠將每台EC2 Instance(虛擬機器)用Instance ID做成設定檔在使用時可以快速方便地開或/關機
# 方法是在%userprofile%\.aws\目錄建立一個客製的文字檔其副檔名為.aws, 例如 username1.aws
# 同時也用AWS CLI執行AWS Configure以建立%userprofile%\.aws\credent... |
server2.py | import tornado.websocket
import tornado.ioloop
import tornado.web
import cv2
import numpy as np
import time
import ctypes
import threading
import multiprocessing
import random
import sys
from PyQt5 import QtWidgets
from PyQt5.QtCore import QThread, pyqtSignal
from PyQt5.QtGui import QImage, QPixmap
from PyQt5.uic impor... |
http_downloader.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import threading
from ftp_downloader import downloader
from gtime import GTime, GT_list
import pandas as pd
import requests
from queue import Queue
import fcntl
import logging
import time
# TODO: to a package
class HTTP_Downloader():
def __init__(self, threads=... |
Light_Control.py | from flask import Flask, g, render_template, request, session, url_for, redirect
import time
import datetime
import threading
import csv
app = Flask(__name__)
app.secret_key = 'somesecretkeythatonlyishouldknow'
app.session_cookie_name = 'MyBeautifulCookies'
authorize_ip = ["localhost", "127.0.0.1", "172.16.32.199"]
... |
sensor_offline_storage.py | from Queue import Queue
from threading import Thread, Semaphore
import sys
import os
import time
import urllib2
import json
import boto3
import hashlib
import binascii
import pycurl
from OpenSSL import SSL
import random
import datetime
import zymkey
# Global variables for the script
LOGFILE_NAME = 'log.txt'
TOPIC = 'Z... |
local_executor.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... |
utils.py | import os
import threading
import warnings
from wsgiref.simple_server import make_server, WSGIRequestHandler
from wsgiref.util import shift_path_info
import requests
warnings.filterwarnings(action='ignore', category=DeprecationWarning,
module='requests')
TEST_FILE_PATH = os.path.join(os.path... |
select_ticket_info.py | # -*- coding=utf-8 -*-
import datetime
import random
import os
import socket
import sys
import threading
import time
import TickerConfig
import wrapcache
from agency.cdn_utils import CDNProxy
from config import urlConf, configCommon
from config.TicketEnmu import ticket
from config.configCommon import seat_conf_2, seat_... |
getSearchResult.py | # -*- coding: UTF-8 -*-
from HTMLParser import HTMLParser
import re
import urllib,urllib2,cookielib
import threading,time
import publicParams as P
import reHTMLTags as rH
class getSearchResult(HTMLParser):
def __init__(self,addr):
HTMLParser.__init__(self)
self.data={}
self.lstr=None
... |
keyboard.py | import pyHook
import pythoncom
from multiprocessing import Process, Value
# This function is run in its own process to allow it to gather keypresses
def log_key_count(val):
def OnKeyboardEvent(event):
val.value += 1
return True
hm = pyHook.HookManager()
hm.KeyDown = OnKeyboardEvent
h... |
test_crt_temp_image_progress2.py | '''
Test Progress of Create Image Template from Root Volume
@author: quarkonics
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.zstack_test.zstack_test_image as test_image
import zstackwo... |
deoat.py | #!/usr/bin/python
# Copyright 2015 Coron
#
# 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 ... |
app.py | # -*- coding: utf-8 -*-
import socket,time,re,os,sys,traceback,threading,urllib
from . Events import Events
from . common import *
from . import config
from mako.template import Template
from datetime import datetime
from threading import local
from .utill import filetype
from kcweb.utill.cache import cache as kcwcache... |
singleMachine.py | # Copyright (C) 2015-2016 Regents of the University of California
#
# 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 app... |
GUI.py | #!/usr/bin/python
# -*- coding: UTF-8 -*-
# File name : client.py
# Description : client
# Website : www.adeept.com
# E-mail : support@adeept.com
# Author : William
# Date : 2018/08/22
#
import cv2
import zmq
import base64
import numpy as np
from socket import *
import sys
import time
import t... |
simuleval_cli.py | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
try:
from simuleval import READ_ACTION, WRITE_ACTION, options
from simuleval.cli import DataWriter, server
from ... |
dagr_rev02.py | # -*- coding: utf-8 -*-
"""
Created on Fri Dec 6 16:25:14 2019
@author: adsims
"""
from PyQt5.uic import loadUiType
import sys
from PyQt5 import QtWidgets, QtCore, uic
import numpy as np
from matplotlib.figure import Figure
from matplotlib.backends.backend_qt5agg import (
FigureCanvasQTAgg as FigureCanvas,
... |
inference_flame_tw.py | from ntpath import basename
import os
import sys
from turtle import backward, forward
import cv2
import torch
import argparse
import numpy as np
from tqdm import tqdm
from torch.nn import functional as F
import warnings
import _thread
from queue import Queue, Empty
from pprint import pprint, pformat
import time
import... |
connection.py | import sched
from threading import Thread
from collections import defaultdict
import websocket
import logging
import time
import json
class Connection(Thread):
def __init__(self, event_handler, url, reconnect_handler=None, log_level=None,
daemon=True, reconnect_interval=10, socket_kwargs=None, **... |
utils.py | import numpy as np
import math
import os
from os.path import exists, join, split
from PIL import Image
import torch
import shutil
import threading
from torch import nn
def adjust_learning_rate(args, optimizer, epoch):
"""Sets the learning rate to the initial LR decayed by 10 every 30 epochs"""
if args.lr_mod... |
chat.py | #!/usr/bin/python3
"""
The MIT License (MIT)
Copyright (c) 2020 WesleyCSJ - wesleyjr10@gmail.com
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... |
trade.py | from multiprocessing import Queue, Process
from online_prediction import online_prediction
from robot import Robot
import torch
from util import IO, Norm, interest_margin
from datetime import datetime
import time
from momentum_robot import MRobot
from base_robot import TableRobot, ProbRobot
from decision_maker import D... |
DataMessageRouter.py | from Messenger import Messenger
from db import Database as DB
from multiprocessing import Process
import json
class DataMessageRouter(object):
def __init__(self, host):
self._messenger = Messenger(host)
self._db = DB()
self._messenger.wait(self.post, 'post_data')
# self._messenger... |
test_threads.py | # This file is part of h5py, a Python interface to the HDF5 library.
#
# http://www.h5py.org
#
# Copyright 2008-2013 Andrew Collette and contributors
#
# License: Standard 3-clause BSD; see "license.txt" for full license terms
# and contributor agreement.
"""
Tests the h5py.File object.
"""
from __futu... |
run.py | """
Start Application Sequence:
1) bind sockets for flask to bokeh communications
2) start bokeh server (Tornado) running bokeh bkapp
3) start flask server (Tornado) running flask app
"""
import time
import logging
from threading import Thread
from app import start_tornado
from bkapp import (
bk_w... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.