source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
writer.py | import os
import time
from threading import Thread
from queue import Queue
import cv2
import numpy as np
import torch
import torch.multiprocessing as mp
from alphapose.utils.transforms import get_func_heatmap_to_coord
from alphapose.utils.pPose_nms import pose_nms, write_json
from alphapose.utils.data_recorder impor... |
plotting.py | """Pyvista plotting module."""
import pathlib
import collections.abc
from functools import partial
import logging
import os
import time
import warnings
from functools import wraps
from threading import Thread
import imageio
import numpy as np
import scooby
import vtk
from vtk.util import numpy_support as VN
from vtk.... |
random_shuffle_queue_test.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... |
request_data.py | import os
import time
from threading import Thread
from requests import HTTPError
from api import VaingloryApi
from flask_app import db
from models import Team
from process_data import process_batch_query
api_key = os.environ.get('API_KEY', None)
api = VaingloryApi(api_key)
class PlayerNotFound(Exception):
pas... |
test_discovery_and_monitoring.py | # Copyright 2014-present MongoDB, 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 wri... |
server.py | import asyncio
import json
import os
from multiprocessing import Process
from aiohttp import web
from aiohttp_sse import sse_response
from pncl import STATIC_DIR
class Server:
def __init__(self, port=8080, host='0.0.0.0', events_per_second=1):
"""
Creates the backend server.
:param port:... |
demo.py | """Templates Demo
"""
import argparse
import threading
import time
import webbrowser
try:
from bottle import get, run
except ImportError:
print('''\
Error: Templates demo requires the "bottle" web framework.
Install the "bottle" package using:
$ python3 -m pip install bottle
Then try executing the demo... |
nntrain.py | import tensorflow as tf
from utils.nn import linearND, linear
from mol_graph import atom_fdim as adim, bond_fdim as bdim, max_nb, smiles2graph
from models import *
import math, sys, random
from optparse import OptionParser
import threading
parser = OptionParser()
parser.add_option("-t", "--train", dest="train_path")
p... |
ptyprocess.py | # -*- coding: utf-8 -*-
# Standard library imports
import codecs
import os
import shlex
import signal
import socket
import subprocess
import threading
import time
# Local imports
from .winpty_wrapper import PTY, PY2
try:
from shutil import which
except ImportError:
from backports.shutil_which import which
... |
thrift_test.py | # encoding=utf-8
from timer import Timer
import time
import random
from multiprocessing import Process
'''''
该脚本用于尝试 使用 python 通过 Thrift 连接并操作 HBase 数据库
prepare:
1. 启动 ThriftServer 于 HBASE
> hbase-deamn.sh start thrift/thrift2
> 在此,HBASE提供两种 thrift/thrift2 由于种种原因,语法并不兼容,其中 2 的语法封装更优雅,但部分 DDL 操作
... |
translate_py3.py | #!/usr/bin/env python
# -*- coding:utf-8 -*
import os
import argparse
import dbm
import re
from multiprocessing.dummy import Pool as ThreadPool
from multiprocessing import Process
class Bing(object):
def __init__(self):
super(Bing, self).__init__()
def query(self, word):
import requests
... |
daemon.py | import logging
import time
from django.conf import settings
from django.db import connections, connection
from django.db.models import F
from django.utils import timezone
from threading import Thread
from gcoinrpc import connect_to_remote
import requests
from notification.models import AddressSubscription, TxSubscri... |
validate.py | import requests
import requests_cache
import tempfile
requests_cache.install_cache(tempfile.mkdtemp())
from pyld import jsonld
from pyshacl import validate
import json
import os
import threading
from http.server import HTTPServer, SimpleHTTPRequestHandler
def simple_http_server(host='localhost', port=4001, path='.'... |
viewerclient.py | # Used only in removed tests, To REMOVE
import time
import json
import os
import tempfile
import threading
from collections import defaultdict, Iterable
import numpy as np
from lcm import LCM
from robotlocomotion import viewer2_comms_t
from director.thirdparty import transformations
class ClientIDFactory(object):
... |
notice_report.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import logging
import threading
from tornado import gen
import tornado_mysql
from nebula.models.engine import tornado_mysql_config
from nebula.dao.user_dao import authenticated
from nebula.dao import cache
from nebula.views.base import BaseHandler
logger = log... |
tolerance.py | from threading import Thread
import threading
import Queue
import time
from socket import error as SocketError
import sys
try:
import requests
import curses
import click
except ImportError:
print 'Tolerance requires the following Python modules: Requests and Click. You should be able to ' \
'... |
cluster.py | import logging
import random
import threading
import time
import uuid
from hazelcast.core import CLIENT_TYPE, SERIALIZATION_VERSION
from hazelcast.exception import HazelcastError, AuthenticationError, TargetDisconnectedError
from hazelcast.invocation import ListenerInvocation
from hazelcast.lifecycle import LIFECYCLE_S... |
contribs.py | import os
import threading
import time
from ._compat import unittest
from ._adapt import IS_GAE
from pydal._compat import to_bytes
from pydal.contrib.portalocker import lock, unlock, read_locked, write_locked
from pydal.contrib.portalocker import LockedFile, LOCK_EX
def tearDownModule():
if os.path.isf... |
autoscaling_metrics.py | import threading
import bisect
from collections import defaultdict
import time
from typing import Callable, DefaultDict, Dict, List, Optional
from dataclasses import dataclass, field
import ray
def start_metrics_pusher(
interval_s: float,
collection_callback: Callable[[], Dict[str, float]],
controller_ha... |
leader.py | '''
Leader Db File
'''
from ..utils.leader_election import Leader_Election, StoppableThread
from ..utils.logger import getLogger
from threading import Lock
from ..utils.logger import getLogger
from time import sleep
from ..utils.network import Tcp_Message
from threading import Thread
class DbLeader(Leader_Election):
... |
array_utils.py | # coding=utf-8
# Copyright 2022 The Google Research 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 applicab... |
gstreamer_pipeline.py | '''
* Copyright (C) 2019-2020 Intel Corporation.
*
* SPDX-License-Identifier: BSD-3-Clause
'''
import copy
import json
import os
import string
import time
from threading import Lock, Thread
import gi
gi.require_version('Gst', '1.0')
gi.require_version('GstApp', '1.0')
# pylint: disable=wrong-import-position
from gi.re... |
vnokcoin.py | # encoding: UTF-8
import hashlib
import zlib
import json
from time import sleep
from threading import Thread
import websocket
# OKCOIN网站
OKCOIN_CNY = 'wss://real.okcoin.cn:10440/websocket/okcoinapi'
OKCOIN_USD = 'wss://real.okcoin.com:10440/websocket/okcoinapi'
# 账户货币代码
CURRENCY_CNY = 'cny'
CURRENCY_USD = 'usd... |
weather_base_station.py | #! /usr/bin/env python3
import time
import sqlite3
import RPi.GPIO as GPIO
import threading
from flask import Flask, request, jsonify
from flask_cors import CORS
from datetime import datetime
from struct import *
from RF24 import *
from RF24Network import *
def create_database():
conn = sqlite3.connect("weather... |
thread-add-random.py | "prints different results on different runs on Windows 7"
import threading, time
count = 0
def adder():
global count
count = count + 1 # update a shared name in global scope
time.sleep(0.5) # threads share object memory and global names
count = count + 1
threads = []
for i i... |
miniterm.py | #!/usr/bin/env python
#
# Very simple serial terminal
#
# This file is part of pySerial. https://github.com/pyserial/pyserial
# (C)2002-2015 Chris Liechti <cliechti@gmx.net>
#
# SPDX-License-Identifier: BSD-3-Clause
import codecs
import os
import sys
import threading
import serial
from serial.tools.list_ports impo... |
default_controller.py | import connexion
import six
from server import util
from auto_scaling import *
from server.models.scaling_info import DQN_ScalingInfo
from server.models.scaling_info import Threshold_ScalingInfo
from server.models.scaling_info import AutoScaler
def get_all_scaling():
response = []
for process in scaler_list... |
imagenet_train.py | # Copyright (c) Microsoft Corporation
# Copyright (c) Peng Cheng Laboratory
# All rights reserved.
#
# MIT License
#
# 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, includi... |
draw.py | import matplotlib.pyplot as plt
import currentlocation as loc
import time
import threading
#written by 김보라_2020
GUI_FILE_NAME = "draw.txt"
im = plt.imread("MapDisplay.png")
#implot = plt.imshow(im)
plt.imshow(im)
MODE_FINGERPRINT = 1
MODE_KNN = 2
MODE_TRILATERATION = 3
"""
삼변측량을 하면, 지정된 영역 내에서의 위치를 알려 주니까,
해당 영역의 (... |
gold_mentions.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import operator
import random
import math
import json
import threading
import numpy as np
import tensorflow as tf
import h5py
import os
import sys
import util
import coref_ops
import conll
import me... |
test_dota.py | # -*- coding:utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import os
import sys
import tensorflow as tf
import cv2
import numpy as np
import math
from tqdm import tqdm
import argparse
from multiprocessing import Queue, Process
sys.path.append(".... |
another_basic_multiprocessing.py | import random
import multiprocessing
import time
PROCESSES = 5
def worker(number):
sleeping_time = random.randrange(1, 10)
time.sleep(sleeping_time)
print("I'm worker {} and I slept {} seconds".format(number, sleeping_time))
for process_number in range(PROCESSES):
process = multiprocessing.Process... |
conftest.py | # -*- coding: utf-8 -*-
"""Testing conf module."""
# standard library
import os
import threading
# third-party
import pytest
from falcon import testing
from .Custom.app import app_custom_logger
from .Null.app import app_null_logger
from .Rotating_Logger.app import app_rh_logger
from .Syslog.syslog_server import TestS... |
sampleConduct.py | # -*- coding: utf-8 -*-
# @Author: gunjianpan
# @Date: 2018-11-20 16:20:41
# @Last Modified by: gunjianpan
# @Last Modified time: 2018-12-31 12:24:09
import codecs
import logging
import numpy as np
import pickle
import queue
import random
import threading
from utils.utils import begin_time, end_time, flatten, sp... |
SECURITY.py | from tkinter import *
from tkinter import ttk
from PIL import Image, ImageTk
import cv2
import numpy as np
import os
from os.path import isfile, join
from threading import Thread
from userHandler import UserData
import FACE_UNLOCKER as FU
background, textColor = 'black', '#F6FAFB'
background, textColor = t... |
KosarajuSCC.py | import sys
import os
from pprint import pprint
import threading
class Graph(object):
def __init__(self, filepath=None):
self._adj_list = []
self._reverse_adj_list = []
if filepath:
self._read(filepath)
def _read(self, filepath):
with open(filepath) as f:
... |
lldb_batchmode.py | # Copyright 2014 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://... |
test_threads.py | import threading
import queue as stdlib_queue
import time
import pytest
from .. import _core
from .. import Event, CapacityLimiter, sleep
from ..testing import wait_all_tasks_blocked
from .._threads import (
to_thread_run_sync,
current_default_thread_limiter,
from_thread_run,
from_thread_run_sync,
)
... |
trustedcoin.py | #!/usr/bin/env python
#
# Electrum - Lightweight Bitcoin Client
# Copyright (C) 2015 Thomas Voegtlin
#
# 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... |
test_ipc.py | import abc
import itertools
import multiprocessing
import sys
import textwrap
import time
import traceback
from typing import Any, List, Optional, cast
import pytest
import determined as det
from determined import core, ipc
from tests import parallel
class Subproc(multiprocessing.Process):
"""
Subproc execu... |
d2.py | from threading import Lock
a = 0
lock = Lock()
def add():
global a
# global lock
for i in range(1000000):
lock.acquire()
a += 1
lock.release()
def desc():
global a
# global lock
for i in range(1000000):
lock.acquire()
a -= 1
lock.release()
... |
test_runtime_rpc.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... |
deploy.py | #!/usr/bin/python
import threading
from boto.ec2.autoscale import AutoScaleConnection, Tag
from boto.exception import EC2ResponseError, BotoServerError
import time
import os
from boto.ec2.connection import EC2Connection
from boto.ec2.elb import HealthCheck, ELBConnection
from boto.ec2.autoscale import LaunchConfigurat... |
path_planner.py | #!/usr/bin/env python
"""
Zhiang Chen
May 2020
path planner
"""
import rospy
from geometry_msgs.msg import PoseStamped
from geometry_msgs.msg import Pose
from geometry_msgs.msg import Point
from std_msgs.msg import Int8
from nav_msgs.msg import Path
from visualization_msgs.msg import Marker, MarkerArray
import uav_moti... |
Wallet.py | #!/usr/bin/env python3
##########################################
# Duino-Coin Tkinter GUI Wallet (v2.4)
# https://github.com/revoxhere/duino-coin
# Distributed under MIT license
# © Duino-Coin Community 2019-2021
##########################################
import sys
from base64 import b64decode, b64encode
fro... |
streaming_beam_test.py | # 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 agreed to in writing, s... |
reliability_tests.py | import ssl
import threading
import time
from amqpstorm import Connection
from amqpstorm import UriConnection
from amqpstorm.tests import CAFILE
from amqpstorm.tests import PASSWORD
from amqpstorm.tests import SSL_HOST
from amqpstorm.tests import SSL_URI
from amqpstorm.tests import USERNAME
from amqpstorm.tests.functio... |
graphhandlers.py | """
Handlers required by the graph operations
"""
import base64
import hashlib
import json
import os
import time
import requests
from bitcoin.wallet import P2PKHBitcoinAddress
from coincurve.utils import verify_signature
from eccsnacks.curve25519 import scalarmult_base
from logging import getLogger
from threading imp... |
test.py | import json
import pytest
import random
import re
import string
import threading
import time
from multiprocessing.dummy import Pool
from helpers.client import QueryRuntimeException
from helpers.cluster import ClickHouseCluster
from helpers.test_tools import TSV
cluster = ClickHouseCluster(__file__)
node1 = cluster.a... |
test_comms.py | from __future__ import print_function, division, absolute_import
from functools import partial
import os
import sys
import threading
import warnings
import pytest
from tornado import gen, ioloop, locks, queues
from tornado.concurrent import Future
from distributed.compatibility import PY3
from distributed.metrics i... |
ampel.py | import subprocess
import threading
import time
import traceback
import common
import config
class Ampel:
def __init__(self, base_command):
self.base_command = base_command
def signal(self, order, switchto):
switch = '1' if switchto else '0'
cmd = self.base_command + ['-as', str(order... |
AutoExploit.py | #!/usr/bin/python27
import os, re, sys, socket, binascii, time, json, random, threading
from Queue import Queue
try:
import requests
except ImportError:
print '---------------------------------------------------'
print '[*] pip install requests'
print ' [-] you need to install requests Modul... |
process_stream.py | import boto3
import logging
import csv
import os
import requests
from datetime import datetime
from botocore.exceptions import ClientError
from boto3.dynamodb.types import TypeDeserializer
from multiprocessing import Process, Pipe
#leverage freezing
TABLE = None
S3CLIENT = None
DESERIALIZER = None
BUCKET_NAME = os.env... |
imalcolm.py | #!/dls_sw/prod/tools/RHEL6-x86_64/defaults/bin/dls-python
def make_async_logging(log_config):
# Now we have our user specified logging config, pipe all logging messages
# through a queue to make it asynchronous
from malcolm.compat import QueueListener, queue
import logging.config
# These are the ... |
vision.py | #! /usr/bin/env python3
import os
import cv2
import rospy
import rospkg
from copy import deepcopy
from cv_bridge import CvBridge
from threading import Thread, Lock
from dynamic_reconfigure.server import Server
from sensor_msgs.msg import Image
from geometry_msgs.msg import PolygonStamped
from humanoid_league_msgs.msg ... |
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... |
functs.py |
import numpy as np
import pandas as pd
import math
import networkx as nx
import csv
from statistics import median, mean
import queue as Q
import threading
from numba import autojit
# function to open dicts we saved
def open_dict(vocabularyFile):
cats = open(vocabularyFile, 'r', encoding = "utf8").readline... |
runtests.py | #!/usr/bin/env python
from __future__ import print_function
import atexit
import os
import sys
import re
import gc
import heapq
import locale
import shutil
import time
import unittest
import doctest
import operator
import subprocess
import tempfile
import traceback
import warnings
import zlib
import glob
from context... |
gmultiprocessing.py | # -*- coding: utf-8 -*-
"""
Add compatibility for gevent and multiprocessing.
Source based on project GIPC 0.6.0
https://bitbucket.org/jgehrcke/gipc/
"""
import os, sys, signal, multiprocessing, multiprocessing.process, multiprocessing.reduction
gevent=None
geventEvent=None
def _tryGevent():
global gevent, gevent... |
HTTPDownloader.py | # Written by John Hoffman
# see LICENSE.txt for license information
from horde.BitTornado.CurrentRateMeasure import Measure
from random import randint
from urlparse import urlparse
from httplib import HTTPConnection
from urllib import quote
from threading import Thread
from horde.BitTornado.__init__ import product_nam... |
service.py | import base64
import datetime
import os
import random
import re
import sys
import tempfile
import threading
import unicodedata
import zipfile
from itertools import chain
from numbers import Number
from os.path import join
from django.conf import settings
from django.core.files.storage import FileSystemStorage
from res... |
get_beijing_weather.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
下载国家气象局所有气候数据 (VPN连接)
"""
import os
import re
import threading
from ftplib import FTP
from time import sleep
def ftp_get_data(tid, n, step):
# year: 1901 - 2017
# pattern = r"[12][09][0-9]{2}"
start = n
end = n + step - 1
if n == 1:
start ... |
usb_monitor.py | import argparse
import logging
import pathlib
import threading
import time
import requests
import sh
import usb1
from sync import synchronize
MOUNT_POINT = "/tmp/mtp-mount"
log = logging.getLogger(__name__)
args = None
def _mount_device(device):
try:
product_name = device.getProduct()
except:
... |
build_imagenet_data.py | # Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
locators.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2015 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
import gzip
from io import BytesIO
import json
import logging
import os
import posixpath
import re
try:
import threading
except Imp... |
brutespray.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
from argparse import RawTextHelpFormatter
import readline, glob
import sys, time, os
import subprocess
import xml.dom.minidom
import re
import argparse
import argcomplete
import threading
import itertools
import tempfile
import shutil
from multiprocessing import Process
servic... |
LpmsB2.py | import time
import serial
import threading
import struct
import sys
from datetime import datetime, timedelta
from LpmsConfig import *
from lputils import *
from LpmsConfigurationSettings import LpmsConfigurationSettings
#TODO:
# check serial port opened before executing commands
# add wait for ack routine
class LpmsB... |
skunky.py | #!/usr/bin/env python
import hashlib
import json
import logging
import logging.config
import os
import sys
import time
from multiprocessing import Process
import boto3
from botocore.exceptions import ClientError
from decimal import Decimal
import import_string
from skunky.aws.lambdakickass import LambdaKickass
__ver... |
util.py | # Electrum - lightweight Bitcoin client
# Copyright (C) 2011 Thomas Voegtlin
#
# 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 t... |
exercise2.py | from my_functions import ssh_command
from my_devices import devices_list
from datetime import datetime
import threading
start_time = datetime.now()
for device in devices_list:
thread = threading.Thread(target=ssh_command, args=(device, "show version"))
thread.start()
main_thread = threading.currentThread()
... |
mininet_tests.py | #!/usr/bin/env python3
"""Mininet tests for FAUCET."""
# pylint: disable=too-many-lines
# pylint: disable=missing-docstring
# pylint: disable=too-many-arguments
# pylint: disable=unbalanced-tuple-unpacking
import binascii
import collections
import copy
import itertools
import ipaddress
import json
import os
import r... |
test_pickle_core.py | """Test for the Cachier python package."""
# This file is part of Cachier.
# https://github.com/shaypal5/cachier
# Licensed under the MIT license:
# http://www.opensource.org/licenses/MIT-license
# Copyright (c) 2016, Shay Palachy <shaypal5@gmail.com>
# from os.path import (
# realpath,
# dirname
# )
import ... |
tests_onnx.py | import shutil
import sys
import os
import subprocess
import redis
from includes import *
from RLTest import Env
'''
python -m RLTest --test tests_onnx.py --module path/to/redisai.so
'''
def test_onnx_modelrun_mnist(env):
if not TEST_ONNX:
env.debugPrint("skipping {} since TEST_ONNX=0".format(sys._getfram... |
vest_lp_tokens.py | import json
import threading
from decimal import Decimal
from brownie import ERC20MOBI, VestingEscrow, accounts, history, network
from . import deployment_config as config
network.gas_limit(8000000)
TOTAL_AMOUNT = 5_000_000 * 10 ** 18
VESTING_PERIOD = 86400 * 7
# burn addresses / known scammers
BLACKLIST = [
"0... |
testplus.py | #
# The contents of this file are subject to the Mozilla Publics
# License Version 1.1 (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.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" bas... |
facedetect.py | import setproctitle #Set process name to something easily killable
from threading import Thread
import cv2
import os
import subprocess #so I can run subprocesses in the background if I want
#import ConfigParser #To read the config file modified by menu.py
from subprocess import call #to call a process in the foreground... |
yaw_test.py | #!/usr/bin/env python2
#***************************************************************************
#
# Copyright (c) 2020 PX4 Development Team. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#... |
akida_camera.py | import time
import os
import cv2
import threading
from imutils.video import VideoStream
from tensorflow.keras.preprocessing.image import img_to_array
import numpy as np
from pynput import keyboard
from akida_models import mobilenet_edge_imagenet_pretrained
from cnn2snn import convert
from akida import Model, FullyConn... |
test_shell_util.py | # -*- coding: utf-8 -*-
# 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 by applic... |
sdk_worker.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... |
run.py | import json
import queue
import threading
import time
import random
import ybapi.yblogin
from ybapi.ybvote import POETRY
from ybapi.yb import CONFIG_PATH
q = queue.Queue()
def read_passwd():
with open('passwd.txt', 'r') as f:
data = f.readlines()
for line in data:
odom = line.split('|... |
brutespray.py | #! /usr/bin/python3
# -*- coding: utf-8 -*-
from argparse import RawTextHelpFormatter
import readline, glob
import sys, time, os
import subprocess
import xml.etree.ElementTree as ET
import re
import argparse
import threading
import itertools
import tempfile
import shutil
import json
from multiprocessing import Process
... |
test_frozen_attribs.py | from typing import Dict, Any
import torch.multiprocessing as mp
from torch import nn
from core.base_abstractions.experiment_config import ExperimentConfig
from core.base_abstractions.task import TaskSampler
from utils.experiment_utils import TrainingPipeline
# noinspection PyAbstractClass,PyTypeChecker
class MyConf... |
variable_scope.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... |
implant_v2.py | ## Redirector Implant - Encrypted C2 and BindShell
## By ShowNadda
## Version 2.0
## Note: Needs "pycryptodome" Library to be Installed!
# Global Imports
import socket, subprocess, threading, argparse
from Crypto import Cipher
from Crypto.Cipher import AES
from Crypto.Random import get_random_bytes
from Crypto.Util.Pa... |
explorer.py | # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
#
# 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 us... |
fifo_queue_test.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... |
test_folder_sync.py | from diode_ftp.header import hash_file
from diode_ftp.FolderSender import FolderSender
from diode_ftp.FolderReceiver import FolderReceiver
from pathlib import Path
from shutil import Error, copy2
from tests.common import *
import asyncio
import time
def create_send_rcv_folder(root: Path):
send = root / 'send'
rcv = ... |
online_handler.py | import websocket
import time
import threading
import json
from .game_instance import GameInstance
from .components.mino import Mino
from .launcher.online_lobby import OnlineLobby
from .launcher.gui_com import GuiCom
from .consts.urls import URLS
# receiving codes
RCODES = {
'game_data': 'gd',
'game_over': 'go'... |
weak.py | import threading
import os
import time
import codecs
import requests
import json
from ecdsa import SigningKey, SECP256k1
import sha3
import traceback
def getAddress(phrases):
keyList = []
addrList = []
addrStr = ""
try:
for phrase in phrases:
key = sha3.keccak_256(ph... |
func.py | import requests
import json
import whois
from colorama import Fore,init
init(autoreset=True)
def whois_search(domain):
result=whois.whois(domain)
print(Fore.BLUE+"Domain",":",Fore.GREEN+str(result.domain_name))
print(Fore.BLUE+"Registrar",":",Fore.GREEN+str(result.registrar))
print(Fore.BLUE+"Updates at",":",Fo... |
onnxruntime_test_python.py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# -*- coding: UTF-8 -*-
import unittest
import os
import numpy as np
import onnxruntime as onnxrt
import threading
import sys
from helper import get_name
class TestInferenceSession(unittest.TestCase):
def run_model(self... |
server.py | import socket
from threading import Thread
import time
import json
class Service:
def __init__(self, heart_addr):
self.recv_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.send_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.recv_sock.bind(heart_addr)
... |
Host2.py | import socket #İletişim için gereken kütüphane eklendi.
import threading #Çoklu işlem için gereken kütüphane eklendi.
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #Bağlantı türü ve özellikleri belirtildi.
serverRunning = True #Sunucunun çalıştığı belirtildi.
ip = "127.0.0.1" #İp local ip olarak girildi.
... |
part1.py | import threading
import time
def sleeper(n, name):
print(f'Process {name} would sleep.')
time.sleep(n)
print(f'Process {name} has just woken up.')
t = threading.Thread(target=sleeper, name='Thread1', args=(5, 'Thread1'))
t.start()
t.join()
print('Finish!')
|
parallel.py | """Utilities for speeding things up through parallelism.
Currently including:
* A very simple PUSH-PULL reusable producer-consumer pattern
using a ZeroMQ socket instead of the (slow, unnecessarily
copying) multiprocessing.Queue. See :func:`producer_consumer`.
"""
from multiprocessing import Process
import zmq
... |
main.py | #-*-coding:utf8;-*-
"""
This is a sample for qpython webapp
"""
import os.path
from bottle import Bottle, ServerAdapter
from bottle import template,request,response,redirect,HTTPResponse
root = os.path.dirname(os.path.abspath(__file__))#获取当前路径
try:
import androidhelper
Droid = androidhelper.Android()
Droid... |
dns.py | #!/usr/bin/env python
"""
Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from __future__ import print_function
import os
import re
import socket
import threading
import time
class DNSQuery(object):
"""
Used for making fake DNS resolution resp... |
function_plot.py | # Copyright(c) 2020 Max Planck Gesellschaft
# Author: Vincent Berenz
from pyqtgraph.Qt import QtGui, QtCore, QtWidgets
import pyqtgraph as pg
from collections import deque
import threading,math,time
pg.setConfigOptions(antialias=True)
class _Channel:
__slots__=["_get_function",
"_color",
... |
joystick.py | import os
import array
import time
import math
import struct
from threading import Thread
class Joystick():
'''
An interface to a physical joystick available at /dev/input
'''
def __init__(self, dev_fn='/dev/input/js0'):
self.axis_states = {}
self.button_states = {}
self.axis_ma... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.