source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
cli.py | import collections
import csv
import multiprocessing as mp
import os
import datetime
import sys
from pprint import pprint
import re
import ckan.logic as logic
import ckan.model as model
import ckan.include.rjsmin as rjsmin
import ckan.include.rcssmin as rcssmin
import ckan.lib.fanstatic_resources as fanstatic_resources... |
socket_cv_client.py | # -*- coding:utf-8 -*-
__author__ = 'shichao'
# 客户端
import socket
import cv2
import threading
import struct
import numpy
class Camera_Connect_Object:
def __init__(self, D_addr_port=["", 8880]):
self.resolution = [640, 480]
self.addr_port = D_addr_port
self.src = 888 + 15 # 双方确定传输帧数,(88... |
process_pty_test.py | import os
import threading
import unittest
from execution.process_pty import PtyProcessWrapper
from react.observable import read_until_closed
from tests import test_utils
from utils import file_utils
class TestPtyProcessWrapper(unittest.TestCase):
def test_many_unicode_characters(self):
long_unicode_text... |
pyusb_backend.py | """
mbed CMSIS-DAP debugger
Copyright (c) 2006-2013 ARM 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 License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable ... |
file_access_distributed_system_optimized.py | from multiprocessing import Process, Pipe
import os
import threading
import time
import numpy as np
process_number = 3
event_number = 3
file_name = "shared_file.txt"
total_requests = 3
shared_number = 0
with open(file_name, 'w') as f_shared:
f_shared.write(str(shared_number) + ",")
def sending_events_thread(pid... |
picam.py | from picamera.array import PiRGBArray
from picamera import PiCamera
from threading import Thread
from time import sleep
class PiCam:
def __init__(self, resolution=(320, 240), framerate=32, **kargs):
self.camera = PiCamera()
self.camera.framerate = framerate
self.camera.resolution = resolution
self.rawCapture... |
ViridaePy.py | import requests
import json
import time
import pymongo
import config
import threading
def main():
# MongoDb
client = pymongo.MongoClient(config.mongoConnnectionString)
db = client['viridaedb']
# Key
apiKey = config.api_key
# Riot Api Endpoints See: Riot Developer Portal
riotApi_GetSummone... |
run_manager.py | # -*- encoding: utf-8 -*-
import errno
import json
import logging
import os
import re
import signal
import socket
import stat
import subprocess
import sys
import time
from tempfile import NamedTemporaryFile
import threading
import yaml
import numbers
import inspect
import glob
import platform
import fnmatch
import cl... |
bacnet_scan.py | # -*- coding: utf-8 -*-
'''
Copyright (c) 2016, Virginia Tech
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of condi... |
test_otcwps.py | from ..drivers.misc.udp import UdpConnector, MessageQueueItem
import rospy
import ftplib
from mock import patch
from struct import pack, unpack
import socket
import configparser
import src.drivers.otc_wps
import os
import time
from threading import Thread, currentThread
from mocks import *
from rosweld_drivers.srv impo... |
test_dota_base_rh.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(".... |
core.py | #############################################################################
#
# $Id: core.py,v 2.104 2007/03/04 13:25:07 irmen Exp $
# Pyro Core Library
#
# This is part of "Pyro" - Python Remote Objects
# which is (c) Irmen de Jong - irmen@users.sourceforge.net
#
###################################################... |
cbmonitor.py | from calendar import timegm
from collections import OrderedDict
from copy import copy
from datetime import datetime
from multiprocessing import Process
import requests
from decorator import decorator
from logger import logger
from cbagent.collectors import (IO, PS, ActiveTasks, ElasticStats, FtsLatency,
... |
main.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# author: 'zfb'
# time: 19-01-10 23:58:14
import time
import pymysql
import config
import SQLHelper
# 中国人名字
CNNAMES = './Chinese_Names_Corpus/Chinese_Names_Corpus(120W).txt'
# 古代中国人名字
CNANAMES = './Chinese_Names_Corpus/Ancient_Names_Corpus(25W).txt'
# 中国成语
CNIDIOM = './Chi... |
qt.py | #!/usr/bin/env python3
#
# Electron Cash - a lightweight Bitcoin Cash client
# CashFusion - an advanced coin anonymizer
#
# Copyright (C) 2020 Mark B. Lundeberg
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to d... |
search.py | from datetime import datetime
import threading
from Queue import Queue
import logging
LOGGER = logging.getLogger("PYWPS")
def date_from_filename(filename):
"""Example cordex:
tas_EUR-44i_ECMWF-ERAINT_evaluation_r1i1p1_HMS-ALADIN52_v1_mon_200101-200812.nc
"""
LOGGER.debug('filename=%s', filename)
... |
realtime_test.py | import time
import urlparse
import threading
import json
import os.path
import webbrowser
from optparse import OptionParser
from . import webserver
from . import monitor
from . import background_test
from . import project
background_test.RunTests.instance = background_test.RunTests()
class RunAllTestsW... |
async_checkpoint.py | # Copyright 2018 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... |
mprocessing.py | from multiprocessing import Process
import concurrent.futures
import time
def do_something():
print('Sleeping 1 second...')
time.sleep(1)
print('Done sleeping...')
def do_something_with_args(seconds):
print(f'Sleeping {seconds} second(s)...')
time.sleep(seconds)
feedback= 'Done sleeping..'
... |
app_utils.py | # From http://www.pyimagesearch.com/2015/12/21/increasing-webcam-fps-with-python-and-opencv/
import struct
import six
import collections
import cv2
import datetime
from threading import Thread
from matplotlib import colors
class FPS:
def __init__(self):
# store the start time, end time, and total number ... |
lambda_executors.py | import base64
import contextlib
import glob
import json
import logging
import os
import re
import subprocess
import sys
import threading
import time
import traceback
import uuid
from multiprocessing import Process, Queue
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
from localstack import config... |
data_structures_test.py | # Lint as: python3
# Copyright 2019 DeepMind Technologies Limited. 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
#
# ... |
main.py | # Name: Multi information clock main
# Author: marksard
# Version: 2.0
# Python 3.6 or later (maybe)
# Require Device: Raspberry PI 1 Model B+ or later.
# Temperature and humidiry sensor BME280
# datasheet (http://akizukidenshi.com/download/ds/bosch/BST-BME280_DS001-10.pdf)
# ... |
build_data.py | #!/usr/bin/env python3
# Copyright 2016 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
#
# Unl... |
ex_workers.py | #
# Simple example which uses a pool of workers to carry out some tasks.
#
# Notice that the results will probably not come out of the output
# queue in the same in the same order as the corresponding tasks were
# put on the input queue. If it is important to get the results back
# in the original order then con... |
sea_agg_check.py | import paramiko
import sys
import datetime
import threading
import logging
"""
Edit this line and add your command
"""
cmd2run = "ioscli lsdev -type adapter | grep 802.3ad; ioscli lsdev -type adapter | grep Shared; for agg in $(ioscli lsdev -type adapter | grep 802.3ad | awk {'print $1'}); do for sea in $(ioscli lsdev... |
stats_collector.py | import redis
import time
from threading import Thread
class StatsCollector():
'''
A redis based statistics generator class. Use the following methods
below to generate collectors for various statistic gathering.
Example usage:
from utils.stats_collector import StatsCollector
# create a rolli... |
build.py | ## @file
# build a platform or a module
#
# Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR>
# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD Li... |
__init__.py | import ctypes
import functools
import multiprocessing as mp
import os
import time
import wave
import simpleaudio as sa
_AUDIO_DIR = os.path.join(
os.path.dirname(os.path.realpath(__file__)), "audio"
)
def skrrt(_func=None, *, audio_file=""):
if not audio_file:
audio_file = os.path.join(_AUDIO_DIR, ... |
agent_a3c_2.py | #!/usr/bin/env python
from __future__ import print_function
import numpy as np
import cv2
import tensorflow as tf
import threading
import sys
import time
import os
def MakeDir(path):
try:
os.makedirs(path)
except:
pass
lab = False
load_model = False
train = True
test_display = False
test_wri... |
process_array_0410.py | # -*- coding: utf-8 -*-
# @version : Python3.6
# @Time : 2017/4/10 14:22
# @Author : Jianyang-Hu
# @contact : jianyang1993@163.com
# @File : process_array_0410.py
# @Software: PyCharm
"""
不同进程间内存是不共享的,要想实现两个进程间的数据交换
数据可以用Value或Array存储在一个共享内存地图里
"""
from multiprocessing import Process, Value, Array
de... |
pixels.py | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... |
client.py | import sys
import time
import asyncio
import logging
from asyncio import Transport, Protocol
from threading import Thread
from typing import Union, List, Tuple
from bs4 import BeautifulSoup
import kik_unofficial.datatypes.xmpp.chatting as chatting
import kik_unofficial.datatypes.xmpp.group_adminship as group_adminship... |
transplant_master.py | from subprocess import Popen, DEVNULL, PIPE
from signal import SIGINT
import sys
import re
import os
import tempfile
from glob import glob
import zmq
import numpy as np
import base64
from threading import Thread
import msgpack
import ctypes.util
try:
from scipy.sparse import spmatrix as sparse_matrix
except Import... |
count_aws_resources.py | """
SYNOPSIS
--------
Get the count of resources present across regions in the AWS account.
DESCRIPTION
-----------
This script provides a detailed overview of the number of resources present in the AWS account.
It provides a service-wise count of resources created in all the regions of the AWS account.
PR... |
dump_kv.py | #!/usr/local/bin/python3
# coding: utf-8
# YYeTsBot - dump_kv.py
# 2/6/21 18:12
#
__author__ = "Benny <benny.think@gmail.com>"
import threading
import requests
import json
from concurrent.futures.thread import ThreadPoolExecutor
s = requests.Session()
with open("index.json", ) as f:
ids = json.load(f)
chunk =... |
_magic.py | """Jupyter Integration."""
import ast
import socket
from os.path import join as pjoin
from urllib.parse import urljoin
import json
import re
import sys
import types
import time
from multiprocessing import Process
from IPython import get_ipython
from IPython.display import display, HTML, clear_output
from IPython.core... |
facerec_from_webcam_multiprocessing.py | import face_recognition
import cv2
from multiprocessing import Process, Manager, cpu_count, set_start_method
import time
import numpy
import threading
import platform
# This is a little bit complicated (but fast) example of running face recognition on live video from your webcam.
# This example is using mul... |
serve.py | from http.server import HTTPServer, BaseHTTPRequestHandler
from urllib.parse import unquote
import importlib
import importlib.machinery
import importlib.util
import json
import os
import sys
import threading
import time
from pathlib import Path
ROOT = Path(__file__).absolute().parent.parent
sys.path.ins... |
torch_ml_dataset.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... |
registry.py | import logging
import os
import threading
import time
from collections import Counter
from typing import List
from brownie import Contract, chain, web3
from joblib import Parallel, delayed
from web3._utils.abi import filter_by_name
from web3._utils.events import construct_event_topic_set
from yearn.events import creat... |
camera.py | import time
import argparse
import socket
import asyncio
from aiohttp.payload_streamer import StreamWrapperPayload
import socketio
import cv2
import base64
import logging
import multiprocessing
from detector import Detector
import requests
import aiohttp
from aiohttp import web
stream_url = ''
sio = socketio.AsyncServ... |
diocpTest.py | #!/usr/bin/env python
#coding=utf8
import httplib,urllib
import urllib2
import time,datetime
import random
import threading
def Inidbtest():
for i in range(10):
httpClient = None
try:
params="test=你好我是参数"
httpClient = httplib.HTTPConnection('127.0.0.1','8081',30... |
engine.py | import threading
from connect import connection, server, stagers, util
class Engine():
connections = {}
STAGERS = {}
def __init__(self, ip, port, cli):
self.cli = cli
self.ip = ip
self.port = port
self.STAGERS = {
util.generate_id():stagers.JScriptStager(ip, p... |
tests.py | # -*- coding: utf-8 -*-
import os
import shutil
import sys
import tempfile
import time
from datetime import datetime, timedelta
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
try:
import threading
except ImportError:
import dummy_threading as threading
from djang... |
socketOCR.py | #!/usr/bin/python3
import time
from PIL import Image
import numpy as np
from tesserocr import PyTessBaseAPI, RIL, PSM, OEM
import cv2
import websocket
import json
import pytesseract
import requests
import os
os.environ["OMP_NUM_THREADS"] = '1'
os.environ["OMP_THREAD_LIMIT"] = '1'
os.environ["MKL_NUM_THREADS"] = '1'
os... |
unittest_targets.py | #!/usr/bin/env python3
#
# Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
# 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
#
... |
client.py | import socket
import threading
import json
import sys
import os
HOST ='127.0.0.1'
PORT =5002
M_SIZE=1024
#send to server
def send_to_sv(cli_socket):
while True:
inp = input()
if inp=='out_chat':
out_chat(cli_socket)
else:
normal_chat(cli_socket,inp)
#out of chat... |
cluster.py | # Future
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
# Standard
import ast
import uuid
import signal
import socket
import traceback
import importlib
from time import sleep
from inspect import getfullargspec
from mu... |
test_client.py | import asyncio
from collections import deque
from concurrent.futures import CancelledError
import gc
import logging
from operator import add
import os
import pickle
import random
import subprocess
import sys
import threading
from threading import Semaphore
from time import sleep
import traceback
import warnings
import ... |
main.py | import os
from flask import Flask, render_template, request, url_for
import oauth2 as oauth
import urllib.request
import urllib.parse
import urllib.error
import json
import mysql.connector
import time
import threading
from datetime import datetime, timedelta
from TwitterAPI import TwitterAPI
from pprint import pprint
i... |
data_reader_mp.py | """
Created on: 2018-Jun-02
File: data_reader_mp.py
'''
DataReader by multiprocessing
@author: Alvin(Xinyao) Sun
"""
import glob
import multiprocessing
import threading
import time
import matplotlib.pyplot as plt
import numpy as np
from skimage.color import rgb2gray
from skimage.transform import resize
from skimage.i... |
test_runner_local.py | import os
import threading
import time
from unittest import TestCase
import psutil
from galaxy import model
from galaxy.jobs import metrics
from galaxy.jobs.runners import local
from galaxy.util import bunch
from ..tools_support import (
UsesApp,
UsesTools
)
class TestLocalJobRunner(TestCase, UsesApp, UsesT... |
test_logging.py | # Copyright 2001-2017 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permissio... |
index.py | import os
import json
import glob
import requests
from threading import Thread, RLock
import logging
import datetime
import time
import re
from .constants import TOKYO_TZ
__all__ = ['ShowroomIndex']
index_logger = logging.getLogger('showroom.index')
_filename_re = re.compile(
r'''
(?:\d{6}\ Showroom\ -\ )... |
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... |
safe_t.py | from binascii import hexlify, unhexlify
import traceback
import sys
from electrum.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException
from electrum.bitcoin import TYPE_ADDRESS, TYPE_SCRIPT
from electrum.bip32 import BIP32Node
from electrum import constants
from electrum.i18n import _
from electrum.... |
runCtaTrading.py | # encoding: UTF-8
import multiprocessing
from time import sleep
from datetime import datetime, time
from vnpy.event import EventEngine2
from vnpy.trader.vtEvent import EVENT_LOG
from vnpy.trader.vtEngine import MainEngine, LogEngine
from vnpy.trader.gateway import ctpGateway
from vnpy.trader.app import ctaStrategy
fr... |
HumanAgent.py | import cv2
import numpy as np
import time
from threading import Thread
try:
import pygame
from pygame.locals import K_DOWN
from pygame.locals import K_LEFT
from pygame.locals import K_RIGHT
from pygame.locals import K_UP
from pygame.locals import K_a
from pygame.locals import K_d
from p... |
test.py |
from __future__ import absolute_import, division, print_function
import logging
import scapy.config
import scapy.layers.l2
import scapy.route
import socket
import math
import errno
import os
import getopt
import sys
from scapy.all import *
from scapy.all import ICMP,IP,ARP,Ether
from printUtils import PrintUtils
log... |
socketserver_test.py | # Used by test_threading_jy.py to verify no memory leaks in using a
# relatively large number of threads. This is of course an absolutely
# silly way to write real code on the JVM :), use a thread pool. So
# just for testing.
#
# However, the client here does use a thread pool.
#
# TODO monitor heap consumption too fro... |
coverage_test.py | # -*- coding: utf-8 -*-
from queue import Queue
import random
import socket
import asyncio
import logging
import unittest
from Bubot_CoAP.server import Server
from Bubot_CoAP import defines
from Bubot_CoAP.messages.message import Message
from Bubot_CoAP.messages.option import Option
from Bubot_CoAP.messages.request i... |
minio_utils.py | import atexit
import logging
import multiprocessing
import subprocess
import time
from urlparse import urlparse
import minio
from django.conf import settings
from minio import policy
from minio.error import BucketAlreadyOwnedByYou
from minio.error import ResponseError
logger = logging.getLogger(__name__)
def start_... |
database_connection.py | # Copyright 2018 Braxton Mckee
#
# 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... |
init.py | # Imports
import os, ctypes, keyboard, json, mss, PIL, PyQt5, time, sys, threading
from PyQt5 import QtCore, QtGui, QtWidgets
from PIL.Image import frombytes
from ctypes import wintypes
from os import system
# Settings
settings = json.load(open(os.getcwd()+'\\config.json'))
# System Constants
krnl32 = c... |
classes.py | import datetime
import decimal
import hashlib
import random
import threading
import time
from collections import defaultdict, deque
from typing import Any, Dict, Iterable, List, Mapping, Tuple, Union
from requests import Response, Session, post
from erepublik import utils
try:
import simplejson as json
except Im... |
touch.py | from evdev import InputDevice, categorize, ecodes
import json
import threading
dev = InputDevice('/dev/input/event0')
#print(dev)
lastx = 0
lasty = 0
width = 480
height = 320
minx = 9e9
miny = 9e9
maxx = -9e9
maxy = -9e9
touch_fn = lambda: None
def save_calibration():
cal = {
'minx': minx,
... |
gceProvisioner.py | # Copyright (C) 2015 UCSC Computational Genomics Lab
#
# 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 o... |
engine.py | # Copyright 2013: Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... |
test_client.py | from __future__ import annotations
import asyncio
import functools
import gc
import inspect
import logging
import os
import pickle
import random
import subprocess
import sys
import threading
import traceback
import warnings
import weakref
import zipfile
from collections import deque
from contextlib import suppress
fro... |
transport.py | """
Communication channel for debug client.
"""
import abc
import logging
import socket
import select
from threading import Thread
class Transport(metaclass=abc.ABCMeta):
"""
Inherit this for each debug communication channel
"""
@abc.abstractmethod
def rx_avail(self): # pragma: no cover... |
main.py | # Author: David Alexander
from __future__ import absolute_import, division, print_function
import argparse, atexit, cProfile, gc, glob, logging, multiprocessing
import os, pstats, random, shutil, tempfile, time, threading, Queue, traceback, pprint
import functools
import re
import sys
import pysam
from pbcommand.uti... |
a3c-standard.py | import tensorflow as tf
from time import sleep
import threading
import numpy as np
from tensorflow.contrib import slim
import time
import scipy.signal
import cv2
#import gym
import csv
from scipy.ndimage.filters import gaussian_filter1d
from simulator import simulator
num_workers = 6
environment = 'Doom_Predict'
set_l... |
gui.py | import textwrap
import pyperclip
from threading import Thread
from tkinter import Tk, Label, Button, Frame
from time import sleep
import db
def copy_from_history(text):
print("Copy", text)
pyperclip.copy(text)
def delete_all():
db.delete_all()
def set_pastes():
pastes = list(db.get_pastes())
... |
minion.py | # -*- coding: utf-8 -*-
'''
Routines to set up a minion
'''
# Import python libs
from __future__ import absolute_import, print_function, with_statement, unicode_literals
import functools
import os
import re
import sys
import copy
import time
import types
import signal
import random
import fnmatch
import logging
import ... |
fish.py | from multiprocessing import Process
from random import randint
import os
def fish():
while True:
os.system("adb shell input tap 550 1490")
def helper():
while True:
os.system("adb shell input tap %d %d" % (randint(500, 600), randint(950, 1050)))
if __name__ == '__main__':
p = Process(target = fish)
p1 = Pro... |
test_zeromq.py | """
:codeauthor: Thomas Jackson <jacksontj.89@gmail.com>
"""
import ctypes
import hashlib
import logging
import multiprocessing
import os
import threading
import time
import uuid
import pytest
import salt.channel.client
import salt.channel.server
import salt.config
import salt.crypt
import salt.exceptions
import ... |
common_utils.py | r"""Importing this file must **not** initialize CUDA context. test_distributed
relies on this assumption to properly run. This means that when this is imported
no CUDA calls shall be made, including torch.cuda.device_count(), etc.
torch.testing._internal.common_cuda.py can freely initialize CUDA context when imported.... |
crafty.py | import os
import sys
import time
import json
import logging
import argparse
import threading
import logging.config
import datetime
import subprocess
def is_venv():
return hasattr(sys, 'real_prefix') or sys.base_prefix != sys.prefix
try:
import argon2
import yaml
import secrets
import schedule
... |
enumerate_threads.py | import threading
import time
import random
def my_thread(i):
print("Thread {}: started".format(i))
time.sleep(random.randint(1, 5))
print("Thread {}: finished".format(i))
def main():
for i in range(4):
thread = threading.Thread(target=my_thread, args=(i,))
thread.start()
print("... |
infolog.py | import atexit
import json
from datetime import datetime
from threading import Thread
from urllib.request import Request, urlopen
_format = '%Y-%m-%d %H:%M:%S.%f'
_file = None
_run_name = None
_slack_url = None
def init(filename, run_name, slack_url=None):
global _file, _run_name, _slack_url
_close_logfile()
_file... |
directory_finder.py | from termcolor import colored
from requests.packages.urllib3.exceptions import InsecureRequestWarning
import os, os.path, requests, argparse, threading, time
from tqdm import tqdm
class Error(Exception):
pass
def verify(wordlist, url, threads, output, extensions, bl):
if os.path.exists(wordlist):
tqdm... |
language_server.py | import enum
import logging
import os
import sys
import threading
import urllib.parse
from collections import defaultdict
from dataclasses import dataclass
from pathlib import Path, PurePath
from typing import (
Any,
BinaryIO,
Callable,
DefaultDict,
Dict,
List,
Optional,
Sequence,
Tup... |
dispatcher.py | import abc
import logging as lg
import time
from threading import Thread
import six
_logger = lg.getLogger(__name__)
@six.add_metaclass(abc.ABCMeta)
class Dispatcher(object):
"""
The Dispatcher distribute scheduled tasks between workers.
Initially tasks are queued when submitted to the dispatcher
t... |
client_server.py | import time
import random
import socket
import logging
import threading
import socketserver
from abc import ABCMeta, abstractmethod
from saltchannel.channel import SocketChannel
from .mitm_channel import MitmChannel
class Session(metaclass=ABCMeta):
"""Client session + server session routines"""
@abstractme... |
test_state.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import logging
import os
import shutil
import sys
import tempfile
import textwrap
import threading
import time
import pytest
import salt.utils.atomicfile
import salt.utils.files
import salt.utils.path
import salt.utils.p... |
bruteforce.py | import hashlib
import sys
import threading
alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
ans = 'a17b713167841563563ac6903a8bd44801be3c0fb81b086a4816ea457f8c829a6d5d785b49161972b7e94ff9790d37311e12b32221380041a99c16d765e8776c'
def tryhard(key, size, end):
if len(key) == size:
if h... |
acq435st.py | #
# Copyright (c) 2017, Massachusetts Institute of Technology 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 notice, this
# list ... |
web_service.py | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
superfsmon.py | #!/usr/bin/env python
# Superfsmon - Supervisor plugin to watch a directory and restart
# programs on changes
#
# Copyright (C) 2018 Tim Schumacher
#
# 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 So... |
plotting.py | """
vtk plotting module
"""
from multiprocessing import Process
import colorsys
import numpy as np
import vtkInterface
import imageio
try:
import vtk
from vtk.util import numpy_support as VN
font_keys = {'arial': vtk.VTK_ARIAL,
'courier': vtk.VTK_COURIER,
'times': vtk.VTK... |
test_failure.py | import json
import logging
import os
import sys
import tempfile
import threading
import time
import numpy as np
import pytest
import redis
import ray
import ray.ray_constants as ray_constants
from ray.cluster_utils import Cluster
from ray.test_utils import (
relevant_errors,
wait_for_condition,
wait_for_e... |
welcome.py |
import os
import socketio
import eventlet
import eventlet.wsgi
from flask import Flask, jsonify, render_template
from regression import Regression
import threading
from sentiments import Sentiments
pairs = ['BTC_DASH', 'BTC_ETH','BTC_XMR','BTC_LTC','BTC_XRP']
output_data={'BTC_DASH':{
'predictions':{},
'senti... |
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... |
py_ad_2_5_1.py | """
Section 2
Parallelism with Multiprocessing - multiprocessing(4) - Sharing state
Keyword - memory sharing, array, value
"""
from multiprocessing import Process, current_process
import os
# 프로세스 메모리 공유 예제(공유x)
# 실행함수
def generate_update_number(v: int):
for _ in range(50):
v += 1
print(current_proces... |
handlers.py | import math
import sys
import gi
gi.require_version('Gtk', '3.0')
import time, datetime
import os
import threading
from gi.repository import Gtk, GObject
from cardvault import util, application
from legacy.search import SearchHandlers
from legacy.library import LibraryHandlers
from legacy.wants import WantsHandlers
... |
server_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... |
example_bookticker.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# File: example_bookticker.py
#
# Part of ‘UNICORN Binance WebSocket API’
# Project website: https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api
# Documentation: https://oliver-zehentleitner.github.io/unicorn-binance-websocket-api
# PyPI: https://pypi.o... |
subproc_vec_env.py | import numpy as np
from multiprocessing import Process, Pipe
from baselines.common.vec_env import VecEnv, CloudpickleWrapper
from baselines.common.tile_images import tile_images
def worker(remote, parent_remote, env_fn_wrapper):
parent_remote.close()
env = env_fn_wrapper.x()
while True:
cmd, data ... |
collect_logs.py | # Microsoft Azure Linux Agent
#
# Copyright 2020 Microsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.