source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
hist.py | from __future__ import absolute_import, division, print_function
from .kwargs import KWArgs
from .. import _core
from .view import _to_view
from .axis import Axis
from .axistuple import AxesTuple
from .sig_tools import inject_signature
from .storage import Double, Storage
from .utils import cast, register, set_family... |
test_state.py | """
Tests for the state runner
"""
import errno
import logging
import os
import queue
import shutil
import signal
import tempfile
import textwrap
import threading
import time
import salt.exceptions
import salt.utils.event
import salt.utils.files
import salt.utils.json
import salt.utils.platform
import salt.utils.stri... |
test_threading.py | # Very rudimentary test of threading module
import test.test_support
from test.test_support import verbose, cpython_only
from test.script_helper import assert_python_ok
import random
import re
import sys
thread = test.test_support.import_module('thread')
threading = test.test_support.import_module('threading')
import... |
bootstrap.py | """
Bootstrap an installation of TLJH.
Sets up just enough TLJH environments to invoke tljh.installer.
This script is run as:
curl <script-url> | sudo python3 -
Constraints:
- Entire script should be compatible with Python 3.6 (We run on Ubuntu 18.04+)
- Script should parse in Python 3.4 (since we exit with... |
utils.py | import asyncio
from asyncio import TimeoutError
import atexit
import click
from collections import deque, OrderedDict, UserDict
from concurrent.futures import ThreadPoolExecutor, CancelledError # noqa: F401
from contextlib import contextmanager, suppress
import functools
from hashlib import md5
import html
import json... |
dispatcher.py | #!/usr/bin/env python3
# Copyright 2020 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
socket_server.py | import socket
import threading
import time
import json
server_ip = '0.0.0.0'
server_port = 8091
is_accepted = False
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind((server_ip, server_port))
server.listen(10)
# print('[*] listening on ' + self.server_ip + ':' + str(self.server_port))
def... |
parallel_runner.py | from envs import REGISTRY as env_REGISTRY
from functools import partial
from components.episode_buffer import EpisodeBatch
from multiprocessing import Pipe, Process
import numpy as np
import torch as th
# Based (very) heavily on SubprocVecEnv from OpenAI Baselines
# https://github.com/openai/baselines/blob/m... |
state_test.py | import numpy as np
import pytest
from procgen import ProcgenGym3Env
from .env import ENV_NAMES
import gym3
import multiprocessing as mp
NUM_STEPS = 10000
def gather_rollouts(
env_kwargs, actions, state=None, get_state=False, set_state_every_step=False
):
env = ProcgenGym3Env(**env_kwargs)
if state is no... |
face_det_sfd.py | import os
import cv2
import glob
import time
import face_alignment
from multiprocessing import Pool, Process, Queue
def run(gpu, files):
os.environ["CUDA_VISIBLE_DEVICES"] = gpu
fa = face_alignment.FaceAlignment(face_alignment.LandmarksType._2D, flip_input=False, device='cuda')
print('gpu={},n_files={}'.fo... |
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... |
msfs_landing_inspector.py | from flask import Flask, render_template, jsonify, request
from SimConnect import *
from threading import Thread
simconnect_dict = {}
def flask_thread_func(threadname):
global simconnect_dict
app = Flask(__name__)
@app.route('/_stuff', methods = ['GET'])
def stuff():
... |
main.py | from PyQt5.QtWidgets import QApplication, QPushButton, QVBoxLayout, QScrollArea, QGroupBox, QWidget, QFormLayout, \
QLabel, QLineEdit, QHBoxLayout, QBoxLayout, QSizePolicy,QStackedWidget ,QVBoxLayout,QGridLayout,QCheckBox,QMessageBox
from PyQt5 import QtCore,Qt
from PyQt5.QtGui import QFont
from PyQt5.QtMultimedia ... |
tpu_estimator.py | # Copyright 2017 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... |
keep_alive.py | from flask import Flask
from threading import Thread
app = Flask('')
@app.route('/')
def main():
return "Your bot is alive!"
def run():
app.run(host="0.0.0.0", port=8080)
def keep_alive():
server = Thread(target=run)
server.start()
|
mp-pack-bz2.py | #!/usr/bin/env python
# Test of parallelizing bz2 and packing via multiprocessing
# Pushing record-lists through multiprocessing.Queue dies at 10 MiB/s
# Packing in the main thread seems to die at around 70 MiB/s, which is weird
# since split-lines can run at >140 MiB/s -- I guess packing + pickling is
# expensive.
... |
_sframe_loader.py | # -*- coding: utf-8 -*-
# Copyright © 2017 Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can
# be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
from __future__ import print_function as _
from __future__ import division as _
from... |
main.py | #!/usr/bin/env python
from telegram.ext import Updater, CommandHandler, MessageHandler
from telegram.ext.filters import Filters
import logging
import json
import jsonpickle
import re
import threading
import schedule
import time
from os import path
USERDATA_FILE = "userdata.json"
GROUPS_FILE = ".groups"
GENERAL_LOL_RE... |
cache_azure.py | from __future__ import annotations
import collections
import functools
import pickle
import sys
from abc import ABC, abstractmethod
from concurrent.futures.thread import ThreadPoolExecutor
from typing import Callable, Dict, Union, Any, List, Sequence, Optional
import json
import logging
import re
import threading
fro... |
exp_monitor.py | from monitor import monitor_qlen
from subprocess import Popen, PIPE
from time import sleep, time
from multiprocessing import Process
from argparse import ArgumentParser
import sys
import os
parser = ArgumentParser(description="CWND/Queue Monitor")
parser.add_argument('--exp', '-e',
dest="exp",
... |
rpc_api.py | from jsonrpclib.SimpleJSONRPCServer import SimpleJSONRPCServer
import threading
class RPCApi(object):
functions = []
def __init__(self, config):
self.config = config
self.server = SimpleJSONRPCServer((self.config['rpc_host'], self.config['rpc_port']))
self.server.timeout = self.config... |
PlexAPI.py | #!/usr/bin/env python
"""
Collection of "connector functions" to Plex Media Server/MyPlex
PlexGDM:
loosely based on hippojay's plexGDM:
https://github.com/hippojay/script.plexbmc.helper... /resources/lib/plexgdm.py
Plex Media Server communication:
source (somewhat): https://github.com/hippojay/plugin.video.plexbmc... |
bot.py | # AutoWaifuClaimer
# Copyright (C) 2020 RandomBananazz
#
# 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 3 of the License, or
# (at your option) any later versio... |
zmq_socket_tests.py | #!/usr/bin/env python3
#
# Copyright (c) 2014-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
from __future__ import absolute_import, division, print_function, unicode_literals
import unittest
from multiprocessing... |
vchiq-server.py | import sys, time, socket, threading, pickle
#Crude Mock-up of VCHIQ Server in Python
#VCHIQ is Inter-Silicon Remote Procedure Call using a Vector Table
#and is the mechanism used for the ARM to communicate with the VC4 GPU
def server_say_hello():
print("hello")
def server_say_world():
print("world")
def mai... |
replay.py | import curses
import json
import logging
import logging.config
from threading import Thread
from typing import List, Optional, cast
from scrabble.game import GameState
from scrabble.game.api import Event, GameInitEvent, GameStartEvent, PlayerAddLettersEvent, PlayerMoveEvent
from scrabble.gui.window import CallbackConf... |
main.py | """
mlperf inference benchmarking tool
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import array
import collections
import json
import logging
import os
import threading
import time
from queue import Queue
import mlperf_loadgen as l... |
client.py | import os
import sys
import socket
import threading
import platform
from Crypto.Cipher import AES
server_udp = ('127.0.0.1', 5671)
server_tcp = ('127.0.0.1', 5572)
obj = AES.new('This is a key123', AES.MODE_CBC, 'This is an IV456')
def udp_request(number):
print('requesting udp file')
my_socket = socket.soc... |
thread2.py | #!/usr/bin/python -u
import string, sys, time
import thread
from threading import Thread, Lock
import libxml2
THREADS_COUNT = 15
failed = 0
class ErrorHandler:
def __init__(self):
self.errors = []
self.lock = Lock()
def handler(self,ctx,str):
self.lock.acquire()
... |
client.py | from ..libs import websocket
from ..types import TD_ViewSnapshot, ListenerEvent
from typing import Optional, Protocol
import sublime
import threading
class TransportCallbacks(Protocol):
def on_open(self, ws: websocket.WebSocketApp) -> None:
"""Called when connected to the websocket."""
...
de... |
waterrowerinterface.py | # ---------------------------------------------------------------------------
# Original code from the bfritscher Repo waterrower
# https://github.com/bfritscher/waterrower
# ---------------------------------------------------------------------------
#
# -*- coding: utf-8 -*-
import threading
import logging
import ti... |
events.py | import collections
import copy
import threading
import time
import six
class Listener(object):
raildriver = None
bindings = None
exc = None
interval = None
running = False
thread = None
subscribed_fields = None
current_data = None
previous_data = None
iteration = 0
spe... |
device.py | # -*- coding: utf-8 -*-
import os
import sys
import json
import time
import logging
import threading
import logging.config
import numpy as np
from datetime import datetime
from collections import defaultdict
from .io import discover_hosts, io_from_host, Ws
from .services import name2mod
from anytree import AnyNode, ... |
test_functionality.py | import os
import sys
import time
import threading
import unittest
import yappi
import _yappi
import utils
import multiprocessing # added to fix http://bugs.python.org/issue15881 for > Py2.6
import subprocess
class BasicUsage(utils.YappiUnitTestCase):
def test_callback_function_int_return_overflow(... |
Win10CleanApp.py | import tkinter as tk
import tkinter.ttk as ttk
import os
from tkinter import simpledialog
import shutil
import winreg
import subprocess
import threading
import time
import ctypes
import enum
import sys
class Cleaner():
def __init__(self, root):
'''window & app settings'''
self.root ... |
forch_proxy.py | """Module for proxy server to aggregate and serve data"""
import functools
import threading
import requests
from forch.http_server import HttpServer
from forch.utils import get_logger
LOGGER = get_logger('proxy')
DEFAULT_PROXY_PORT = 8080
LOCALHOST = '0.0.0.0'
class ForchProxy():
"""Class that implements the m... |
test_threading.py | '''
Testing for race conditions and deadlocks.
'''
from destructure import *
from destructure import Match
import random
from threading import Thread
import time
import unittest
class FuzzyBinding(Binding):
'Delays getting an unbound attribute to reveal race conditions'
def __setattr__(self, name, value):
... |
preparer.py | # -*- coding: utf-8 -*-
# Copyright CERN since 2020
#
# 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 ... |
InstanceHelper.py | import sys
import logging
import os
import SocketServer
import SimpleSocket
import socket
import threading
RemoteArgumentCallBack=None
_GII_INSTANCE_PORT = 61957
class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler):
def handle(self):
data = self.request.recv(1024)
cur_thread = threadin... |
stacks.py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root
# for license information.
from __future__ import absolute_import, division, print_function, unicode_literals
"""Provides facilities to dump all stacks of all threads in the process.
"""
impo... |
main_price_fetcher.py | # coding=utf-8
"""
PAT - the name of the current project.
main_subscriber.py - the name of the new file which you specify in the New File
dialog box during the file creation.
Hossein - the login name of the current user.
7 / 27 / 18 - the current system date.
9: 14 AM - the current system time.
PyCharm - the name of th... |
manager.py | #!/usr/bin/env python3
import os
import time
import sys
import fcntl
import errno
import signal
import shutil
import subprocess
import datetime
import textwrap
from typing import Dict, List
from selfdrive.swaglog import cloudlog, add_logentries_handler
from common.basedir import BASEDIR
from common.hardware import HA... |
Server.py | import socket
import threading
import beepy
DIS_MSG = "disconnect"
FORMAT = "utf-8"
HEADER = 64
PORT = 9090
SERVER = socket.gethostbyname(socket.gethostname())
ADDR = (SERVER, PORT)
print(SERVER)
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind(ADDR)
def handle_client(conn, addr... |
bot_uptime.py | from flask import Flask
from threading import Thread
from waitress import serve
app = Flask('')
@app.route('/')
def home():
return "Bot is online!"
def run():
# production server using waitress
serve(app, host="0.0.0.0", port=8082)
def start_server():
t = Thread(target=run)
t.start()
|
testclient_launcher.py | #!/usr/bin/env python
# Copyright 2018 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
test_0.py | import threading
import thread
from time import sleep
from math import sqrt, ceil, floor
import random
from random import Random
import time
import copy
import ACS__POA
from ACS import CBDescIn
from Acspy.Clients.SimpleClient import PySimpleClient
import sb
import jsonAcs
class MockSched():
# -------------------... |
language_server_client.py | import logging
import itertools
from functools import partial
log = logging.getLogger(__name__)
def _read_into_queue(reader, queue):
def _put_into_queue(msg):
queue.put(msg)
reader.listen(_put_into_queue)
class _LanguageServerClient(object):
def __init__(self, writer, reader):
import t... |
test-driver.py | #! /somewhere/python3
from contextlib import contextmanager, _GeneratorContextManager
from queue import Queue, Empty
from typing import Tuple, Any, Callable, Dict, Iterator, Optional, List, Iterable
from xml.sax.saxutils import XMLGenerator
from colorama import Style
from pathlib import Path
import queue
import io
impo... |
digitalocean-cluster-manager.py | import time
import threading
import http.server
import random
import json
import digitalocean
SECRET = '[REDACTED]'
BEARER = '[REDACTED]'
manager = digitalocean.Manager(token=BEARER)
keys = manager.get_all_sshkeys()
baseApi = digitalocean.baseapi.BaseAPI(token=manager.token)
projects = manager.get_all_projects()
pro... |
webcore.py | # Copyright 2011,2012,2018 James McCauley
#
# 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 t... |
test_backfill_job.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... |
trader_thread.py | import logging
import sys
import threading
import time
from collections import deque
import pandas as pd
from datetime import datetime
# ---
from win10toast import ToastNotifier
import pandas as pd
import numpy as np
import pickle
import os
import asyncio
import datetime
from datetime import datetime
from datetime imp... |
filemanager.py | import os
import re
import threading
import urllib
try:
import urllib.parse as urlparse
except ImportError: # py2
import urlparse
import xbmc
import xbmcvfs
from contextlib import closing
from lib import cleaner
from lib.libs import mediainfo as info, mediatypes, pykodi, quickjson, utils
from lib.libs.addonset... |
example_threads.py | from farmbot import Farmbot, FarmbotToken
import threading
# PYTHON MULTITHREAD EXAMPLE.
# ==========================================================
# The main thread has a blocking loop that waits for user
# input. The W/A/S/D keys are used to move FarmBot. Commands
# are entered in a queue that are processed in a b... |
process.py | import os
import sys
import pty
import threading
import subprocess
import time
from select import select
class ProHelper(object):
"""
A helper class for keeping track of long-running processes. It launches the process
in background, receives output from it, sends input to it. It also can emulate an
int... |
example_userInfoCrawler.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
注意:
1. 服务端上需自行配置代理
2. start_num end_num 为需手动填写
"""
from luogu import *
from openpyxl import Workbook
from openpyxl import load_workbook
from bs4 import BeautifulSoup
from urllib import request, error
from queue import Queue
import time
import queue
import os
i... |
crypto_util_test.py | """Tests for acme.crypto_util."""
import itertools
import socket
import threading
import time
import unittest
import six
from six.moves import socketserver # pylint: disable=import-error
from acme import errors
from acme import jose
from acme import test_util
class SSLSocketAndProbeSNITest(unittest.TestCase):
... |
collaborative.py | from __future__ import annotations
import logging
from dataclasses import dataclass
from threading import Thread, Lock, Event
from typing import Dict, Optional, Iterator
import numpy as np
import torch
from pydantic import BaseModel, StrictBool, StrictFloat, confloat, conint
from hivemind.averaging.training import T... |
util.py | import os
import re
import sys
import time
import json
from urllib.request import Request, urlopen
from urllib.parse import urlparse
from decimal import Decimal
from urllib.parse import quote
from datetime import datetime
from subprocess import TimeoutExpired, Popen, PIPE, DEVNULL, CompletedProcess, CalledProcessError... |
cluster.py | from collections import namedtuple
import copy
import functools
import heapq
import itertools
import logging
import queue
import random
import threading
# data types
Proposal = namedtuple('Proposal', ['caller', 'client_id', 'input'])
Ballot = namedtuple('Ballot', ['n', 'leader'])
# message types
Accepted = namedtuple... |
wavingdetected.py | # DOCUMENTATION
# http://doc.aldebaran.com/2-5/naoqi/peopleperception/alengagementzones-api.html#alengagementzones-api
import qi
import argparse
import sys
import os
import time
import threading
import math
from naoqi import ALProxy
import conditions
from conditions import set_condition
waving_person_id = 0
def wa... |
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... |
drum_server_utils.py | import os
import psutil
import requests
import signal
import time
from threading import Thread
from datarobot_drum.drum.utils import CMRunnerUtils
from datarobot_drum.drum.common import ArgumentsOptions, ArgumentOptionsEnvVars
from datarobot_drum.resource.utils import _exec_shell_cmd, _cmd_add_class_labels
def _wait... |
main.py | """This module contains the overall UI frame object and is responsible for launching it."""
from helper import wipe_prediction_input_images, update_dropdown, filter_city, initialize_cities
from label import ImageLabel
from detect import Detection
from debug import QTextEditLogger
from PyQt5.QtWidgets import (
QWidg... |
base.py | # Copyright (c) 2016, Intel Corporation.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This program is distributed in the hope it will be useful, but WITHOUT
#... |
test.py | #!/usr/bin/env python
#
# Copyright 2008 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# noti... |
ar_207_测试_批量添加线程.py | from time import ctime,sleep
import threading
def super_player(func,time):
for i in range(3):
print('正在播放%s %s'%(func,ctime()))
sleep(time)
file_dict={'断点.mp3':3,'蜡笔小新.mp4':2,'你还要我怎么样.mp3':4}
threads=[]
times=range(len(file_dict))
'将两个参数的值分别从一个字典的键跟值里面拿出来再传参'
for file,time in file_dict.items():
... |
test_environments.py | # Copyright 2018 Tensorforce Team. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
runInIndesign.py | import sublime, sublime_plugin
import os
import threading
import socketserver
import subprocess
import sys
import re
import tempfile
PATH = os.path.dirname(os.path.realpath(__file__))
HOST, PORT = "localhost", 0
class RunInIndesignCommand(sublime_plugin.TextCommand):
def run(self,edit, command):
if command== 'run'... |
burst.py | # -*- coding: utf-8 -*-
"""
Burst processing thread
"""
import re
import json
import time
import xbmc
import xbmcgui
from Queue import Queue
from threading import Thread
from urlparse import urlparse
from urllib import unquote
from elementum.provider import append_headers, get_setting, set_setting, log
from parser.e... |
http_server.py | #!/usr/bin/env python
# Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
# Many tests expect there to be an http server on port 4545 servering the deno
# root directory.
from collections import namedtuple
from contextlib import contextmanager
import os
import SimpleHTTPServer
import SocketServer
... |
dx_operations_vdb.py | #!/usr/bin/env python
# Corey Brune - Oct 2016
#This script starts or stops a VDB
#requirements
#pip install docopt delphixpy
#The below doc follows the POSIX compliant standards and allows us to use
#this doc to also define our arguments for the script.
"""List all VDBs or Start, stop, enable, disable a VDB
Usage:
... |
run.py |
# Copyright (c) 2020 Institution of Parallel and Distributed System, Shanghai Jiao Tong University
# ServerlessBench is licensed under the Mulan PSL v1.
# You can use this software according to the terms and conditions of the Mulan PSL v1.
# You may obtain a copy of Mulan PSL v1 at:
# http://license.coscl.org.cn/M... |
__init__.py | """
asyncio - package for asynchronous computing
Notes
=====
Asynchronous computing allows for delayed responses to function or method calls.
Decorator `async_method` adds an argument `callback` for the function which
handles the eventual result.
Example
-------
import datetime
import time
import urllib
fro... |
producer.py | from kafka import KafkaProducer
import time, threading, random
import os
import configparser
from org.sfu.billing.simulator.module.datagenerator import generate
from org.sfu.billing.simulator.utility.data_loader import load_customer
def load_properties():
config_dir = os.environ.get('APP_HOME')
config_fileName... |
cluster_model_final_v1.py | # coding: utf-8
import json
import Queue
import Levenshtein
import numpy as np
from scipy import spatial
import file_config
from xgboost_rank import *
from collections import Counter
from similarity import similarity, sent_distance, sent_ratio, sentence_sim, keyword_sim, vec_dict, vocab_set, is_mutual_sub
from utils i... |
actionproxy.py | #
# ActionProxy base class
#
import time
from threading import Thread
import rospy
from std_msgs.msg import String
'''
pnp_ros publishes a String topic named `pnp/action_str` in the form
[<robotname>#]<actionname>[_<params>].<command>
Action executors should listen to this message and execute the correspondin... |
c31.py | """
Implement and break HMAC-SHA1 with an artificial timing leak
"""
import sys # isort:skip
from pathlib import Path # isort:skip
sys.path.append(str(Path(__file__).parent.resolve().parent))
import logging
from secrets import token_bytes
from threading import Thread
from time import sleep, time
import requests
f... |
SetAlertToFriends.py | # -*- coding:utf-8 -*-
from __future__ import unicode_literals
from wxpy import *
from requests import get
from requests import post
from platform import system
from os import chdir
from random import choice
from threading import Thread
import configparser
import time
import sys
# 获取每日励志精句
def get_message():
r = ... |
ntds_parser.py | import sys, re, itertools, time
from binascii import hexlify
from threading import Thread, Event
from impacket.examples.secretsdump import LocalOperations, RemoteOperations, NTDSHashes
from impacket.smbconnection import SMBConnection, SessionError
from socket import error as socket_error
def process_remote(username,... |
enqueuer_thread.py | # coding=utf-8
"""Given the dataset object, make a multithread enqueuer"""
import os
import queue
import threading
import contextlib
import multiprocessing
import time
import random
import sys
import utils
import traceback
# for video queuer
from nn import resizeImage
import cv2
# modified from keras
class DatasetEnq... |
tf_util.py | import joblib
import numpy as np
import tensorflow as tf # pylint: ignore-module
import copy
import os
import functools
import collections
import multiprocessing
def switch(condition, then_expression, else_expression):
"""Switches between two operations depending on a scalar value (int or bool).
Note that bot... |
build_config.py | #!/usr/bin/env python3
"""Utilities for generating/processing logger configurations.
Typical use would be something like this:
import pprint
import threading
from logger.utils.build_config import BuildConfig
from logger.utils.read_json import read_json
from logger.listener.listen import ListenerFromLoggerConfig
var... |
io_eth.py | """--------------------------------------------------------------------
COPYRIGHT 2016 Stanley Innovation Inc.
Software License Agreement:
The software supplied herewith by Stanley Innovation Inc. (the "Company")
for its licensed SI Vector Platform is intended and supplied to you,
the Company's customer, for use so... |
trainer_base.py | """Base class of trainers
Explanation of batched n-step training and arguments:
1. Rollout:
The basic unit of training is a length-L "rollout" of the form
{ s_t, a_t, r_t, s_{t+1}, ..., s_{t+L} }
which contains L transitions. In practice, L is not always a fixed length
as a rollout must terminate at ... |
watcher.py | import logging
import os.path
import threading
import time
try:
from watchdog.events import FileSystemEventHandler
from watchdog.observers import Observer
from watchdog.observers.polling import PollingObserver
can_watch = True
except ImportError:
Observer = None
FileSystemEventHandler = object
... |
py_cli.py | """
This module privodes core algrithm to pick up proxy ip resources.
"""
import time
import threading
from utils import get_redis_conn
from config.settings import (
DATA_ALL, LOWEST_TOTAL_PROXIES)
from .core import IPFetcherMixin
__all__ = ['ProxyFetcher']
lock = threading.RLock()
class Strategy:
strateg... |
cc_dcr.py | # coding=utf-8
"""The main file of the dcr-cc that is executed"""
from threading import Thread
import cmd_parser
import eventlog_parser
from conf_data import ConformanceAnalysisData, TraceConformanceAnalysisData
from graph import DCRGraph
from marking import Marking
def perform_conformance_checking(trace, ca):
"... |
collections.py | import collections
import threading
import time
from multiprocessing import Process
candle = collections.deque("candle")
def burn(direction,nextsource):
while True:
try:
next = nextsource()
time.sleep(0.1)
except IndexError:
break
else:
... |
reconnect_test.py | import time
from threading import Thread
from hazelcast.errors import HazelcastError, TargetDisconnectedError
from hazelcast.lifecycle import LifecycleState
from hazelcast.util import AtomicInteger
from tests.base import HazelcastTestCase
from tests.util import event_collector
class ReconnectTest(HazelcastTestCase):... |
alarm_perf.py | import datetime
import re
import sys
import time
import multiprocessing
from monascaclient import client
from monascaclient import ksclient
from agent_sim import agent_sim_process
import warnings
# suppress warnings to improve performance
def no_warnings(message, category, filename, lineno):
pass
warnings.showw... |
views.py | import datetime
import logging
import re
import threading
from typing import Optional, List
import pytz
import simplejson as json
from django.contrib.auth.decorators import login_required
from laboratory.decorators import group_required
from django.core.exceptions import ValidationError
from django.db import transact... |
utils.py | # -*- coding: utf-8 -*-
from __future__ import division
import os
import sys
import socket
import signal
import functools
import atexit
import tempfile
from subprocess import Popen, PIPE, STDOUT
from threading import Thread
try:
from Queue import Queue, Empty
except ImportError:
from queue import Queue, Empty
f... |
__main__.py | """
This is what happens when __main__ gets called. We dance:
- initialize an Administration object
- process params, sort of like you would with optparse
- analyze params, call methods of the Administration obect
"""
# standard library imports
import argparse
from collections import Ordered... |
client.py | import socket,sys,threading
def worker1(sock):
try:
while True:
s = input()+"\r\n"
sock.sendall(s.encode('utf-8'))
except:
pass
def worker2(sock):
try:
while True:
# ネットワークのバッファサイズは1024。サーバからの文字列を取得する
data = sock.recv(1024)
... |
__init__.py | #####################################################################
# #
# /plugins/progress_bar/__init__.py #
# #
# Copyright 2018, Christopher Billington... |
learn.py | #!/usr/bin/python3
import json
import csv
from random import shuffle
import warnings
import pickle
import gzip
import operator
import time
import logging
import math
from threading import Thread
import functools
# create logger with 'spam_application'
logger = logging.getLogger('learn')
logger.setLev... |
RunnerUtils.py | #!/usr/bin/env python
"""
Job runner utils for both SGE jobs and local jobs.
"""
import subprocess
import logging
import time
import os
from multiprocessing.pool import ThreadPool
from pbcore.util.Process import backticks
from pbtranscript.ClusterOptions import SgeOptions
__author__ = 'etseng|yli@pacificbiosciences.c... |
test_pipeline_process.py | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2020 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... |
mttcp_serv.py | import socket
import threading
from time import strftime
class TcpTimeServer:
def __init__(self, host='', port=12345):
self.addr = (host, port)
self.serv = socket.socket()
self.serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self.serv.bind(self.addr)
self.serv.lis... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.