source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
thread__with__callback.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
import time
from threading import Thread
def go(callback_func):
while True:
time.sleep(2)
callback_func(":)")
def it_callback(s):
global status
status = s
status = ":("
thread = Thread(target=go, args=(it_callba... |
test_socket.py | import unittest
from test import support
import errno
import io
import itertools
import socket
import select
import tempfile
import time
import traceback
import queue
import sys
import os
import array
import contextlib
from weakref import proxy
import signal
import math
import pickle
import struct
import random
import... |
__init__.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Implements context management so that nested/scoped contexts and threaded
contexts work properly and as expected.
"""
from __future__ import absolute_import
from __future__ import division
import collections
import functools
import logging
import os
import platform
im... |
realtime_api.py | import json
import threading
import time
import websocket
from logging import getLogger
class RealtimeAPI(object):
"""
Realtime API (JSON-RPC 2.0 over WebSocket)
https://bf-lightning-api.readme.io/docs/realtime-api
"""
def __init__(self, channel, data_queue, is_daemon=False):
self.logger... |
Code-09-Daemon_Thread_joinMethod.py | '''
DEVELOPER NAME: BALAVIGNESH.M
IMPLEMETED DATE: 17-11-2018
Implementation Details:
If the main thread is wait to complete the child thread process means we should use the
join() method so the main mehod will execute and main thread will wait.
'''
import thre... |
youzan_main.py | import re
import json
import time
import random
import pymysql
import encrypt
import schedule
import datetime
import warnings
import requests
import threading
warnings.filterwarnings('ignore')
y = True # 忽略,倒计时用
proxies = [] # 可手动添加,可通过url添加
good_id = '' # 商品id,自动读取
sku_map = {}
uid_dict = {}
add_dict = {} # 地址ma... |
fast_gaussian_runner.py | from __future__ import print_function
import json
import sys
import subprocess
import os
import threading
from bazel_tools.tools.python.runfiles import runfiles
def main(params):
r = runfiles.Create()
generator = r.Rlocation('org_frc971/y2020/vision/sift/fast_gaussian_generator')
ruledir = sys.argv[2]
targe... |
test_rollbar.py | import base64
import copy
import json
import socket
import threading
import uuid
import sys
try:
from unittest import mock
except ImportError:
import mock
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
import unittest
import rollbar
from rollbar.lib import python_majo... |
AudioClipProcessor.py | #!/usr/bin/python3
# system-wide requirements
from sepy.SEPAClient import *
from uuid import uuid4
import threading
import requests
import logging
import json
import datetime
import rdflib
from .GraphStoreClient import GraphStoreClient
# debug requirements
import traceback
import pdb
# local requirements
from .Query... |
ue_mac.py | """
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... |
executor.py | from concurrent.futures import Future
import typeguard
import logging
import threading
import queue
import datetime
import pickle
from multiprocessing import Process, Queue
from typing import Dict # noqa F401 (used in type annotation)
from typing import List, Optional, Tuple, Union, Any
import math
from parsl.seriali... |
connection.py | # Copyright (c) 2015 Red Hat, 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 ... |
application_runners.py | from __future__ import print_function
import sys
import os
import uuid
import shlex
import threading
import shutil
import subprocess
import logging
import inspect
import runpy
import future.utils as utils
import flask
import requests
from dash.testing.errors import NoAppFoundError, TestingTimeoutError, ServerCloseEr... |
threadpool.py | # xpyBuild - eXtensible Python-based Build System
#
# This class is responsible for working out what tasks need to run, and for
# scheduling them
#
# Copyright (c) 2013 - 2018 Software AG, Darmstadt, Germany and/or its licensors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use ... |
__init__.py | """Module for SIA Hub."""
import asyncio
import base64
from binascii import hexlify, unhexlify
from collections import defaultdict
from datetime import datetime, timedelta
import json
import logging
import random
import re
import socketserver
import string
import sys
import threading
from threading import Thread
impor... |
run_rec.py | # #########################################################################
# Copyright (c) , UChicago Argonne, LLC. All rights reserved. #
# #
# See LICENSE file. #
# ##############... |
manager.py | from secrets import token_hex
from threading import Thread
from typing import Dict
import socketio
from consoles.sports import WaterPolo, WaterPoloDaktronics
class WaterPoloManager:
'''Water Polo Game State Manager'''
def __init__(self, home_team, home_mascot, home_color, visitor_team, visitor_mascot, visito... |
easyrequests.py | import asyncio
from dataclasses import dataclass
import aiohttp
from datetime import datetime, timedelta
from enum import Enum
import platform
from functools import wraps
class Methods(Enum):
GET = 1
POST = 2
PUT = 3
DELETE = 4
PATCH = 5
OPTIONS = 6
HEAD = 7
@dataclass
class CallbackRespon... |
test_remote_account.py | # Copyright 2015 Confluent Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
threading_try.py | from __future__ import print_function
import sys
import threading
def safe_print(msg):
return sys.stdout.write("%s\n" % msg)
def worker(num):
# print 'Worker: %s \n' % num
msg = 'Worker: ' + repr(num)
safe_print(msg)
def main():
threads = []
for i in range(10):
thread = threading.T... |
optimization_checks.py | # Copyright 2017 Google Inc. All rights reserved.
# Use of this source code is governed by the Apache 2.0 license that can be
# found in the LICENSE file.
"""Run the various optimization checks"""
import binascii
import gzip
import logging
import os
import Queue
import re
import shutil
import struct
import subprocess
i... |
tui.py | # Copyright 2020-2021 NXP
#
# SPDX-License-Identifier: BSD-3-Clause
#
# 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 of conditions an... |
back.py | #-*- encoding: utf-8 -*-
from multiprocessing import Process
import collections
import threading
import datetime
import requests
import execjs
import json
import os.path
js_function ="""
function baseEncryption(e) {
function h(b, a) { var d, c, e, f, g; e = b & 2147483648; f = a & 2147483648; d = b & 1... |
vec_env.py | import redis
import time
import subprocess
from multiprocessing import Process, Pipe
def start_redis():
print('Starting Redis')
subprocess.Popen(['redis-server', '--save', '\"\"', '--appendonly', 'no'])
time.sleep(1)
def start_openie(install_path):
print('Starting OpenIE from', install_path)
subp... |
train_dist.py | import sys
sys.path.append('.')
import os
import tqdm
import torch
import random
import tempfile
import argparse
import numpy as np
import multiprocessing
from torch import optim
from torch.utils.data import DataLoader
from torch.utils.tensorboard import SummaryWriter
from data.aug.compose import Compose
from data.a... |
core.py | # Copyright 2019 Jake Magers
#
# 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, ... |
executormarionette.py | import json
import os
import socket
import threading
import traceback
import urlparse
import uuid
errors = None
marionette = None
pytestrunner = None
here = os.path.join(os.path.split(__file__)[0])
from .base import (CallbackHandler,
RefTestExecutor,
RefTestImplementation,
... |
vox_scene.py | ##############################################################################
# This file is a part of PFFDTD.
#
# PFFTD is released under the MIT License.
# For details see the LICENSE file.
#
# Copyright 2021 Brian Hamilton.
#
# File name: vox_scene.py
#
# Description: a scene voxelizer for FDTD
#
# Sets up prima... |
statusmodel.py | #!/usr/bin/python3
""" DIYHA MQTT CPU and OS monitor """
# The MIT License (MIT)
#
# Copyright (c) 2019 parttimehacker@gmail.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without res... |
reservation.py | # Copyright 2017 Yahoo Inc.
# Licensed under the terms of the Apache 2.0 license.
# Please see LICENSE file in the project root for terms.
from __future__ import absolute_import
from __future__ import division
from __future__ import nested_scopes
from __future__ import print_function
import logging
import pickle
impor... |
_health_servicer_test.py | # Copyright 2016 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... |
parallel_query.py | from netmiko import ConnectHandler
from datetime import datetime
from threading import Thread
startTime = datetime.now()
threads = []
def checkparallel(ip):
device = ConnectHandler(device_type='cisco_ios', ip=ip, username='test', password='test')
output = device.send_command("show run | in hostname")
o... |
multi-threading-newway.py | import concurrent.futures
import time
from time import gmtime, strftime
start = time.perf_counter()
def take_action(duration_length):
"""Define a function to perform some actions
:argument
:return: an ending information showing that the actions has been executed
"""
print(
f'... |
dler_dl.py | import os
import threading
import time
import requests
from altfe.interface.root import interRoot
from app.lib.core.dl.model.dler import Dler
requests.packages.urllib3.disable_warnings()
class DlDler(Dler):
def __init__(self, url, folder="./downloads/", name=None, dlArgs=Dler.TEMP_dlArgs, dlCacheDir=None, dlRe... |
scheduler_command.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... |
startup.py | from api.hangups import HangupsApi
from api.models import HangupsApiUser, HangupsApiToken
import threading
import tempfile
'''
serverがstartする時にあらかじめ呼び出すメソッドをここに定義する。
'''
def get_hangout_info():
"""Hangoutのアカウント情報から会話の履歴などを取得する"""
users = HangupsApiUser.objects.all()
for u in users:
try:
... |
rpc_parameter_server.py | import argparse
import os
import time
from threading import Lock
import torch
import torch.distributed.autograd as dist_autograd
import torch.distributed.rpc as rpc
import torch.multiprocessing as mp
import torch.nn as nn
import torch.nn.functional as F
from torch import optim
from torch.distributed.optim import Distr... |
test_submit_handlers.py | # Copyright 2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... |
simulationdriver.py | # The MIT License (MIT)
#
# Copyright (c) 2016 Petr Fejfar
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modif... |
test_threading.py | """
Tests for the threading module.
"""
import test.support
from test.support import threading_helper
from test.support import verbose, cpython_only
from test.support.import_helper import import_module
from test.support.script_helper import assert_python_ok, assert_python_failure
import random
import sys
import _thre... |
request.py | import socket
import threading
import warnings
import http.server
import urllib.parse
import time
import requests
import tldextract
from selenium.common.exceptions import NoSuchWindowException, WebDriverException
FIND_WINDOW_HANDLE_WARNING = (
"Created window handle could not be found reliably. Using less reliabl... |
env_semantic_grasp.py | import open3d as o3d
import warnings
warnings.filterwarnings("ignore")
import operator
import numpy as np
import sys,os,glob,re,time,copy,trimesh,logging,gzip,gc
logging.getLogger().setLevel(logging.FATAL)
code_dir = os.path.dirname(os.path.realpath(__file__))
sys.path.append(code_dir)
sys.path.append('{}/../'.format(c... |
server.py | from __future__ import division, print_function
import sys
import time
import logging
import numbers
import os
import threading
import traceback
import utils
if sys.version_info.major < 3:
import Queue as queue
def fix_threading():
# thread.get_ident moved to threading.get_ident in py3.3
impor... |
command_line.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""The Dallinger command-line utility."""
from __future__ import print_function
from __future__ import unicode_literals
from collections import Counter
from functools import wraps
from six.moves import shlex_quote as quote
import inspect
import os
import pkg_resources
import... |
v1.2.py | from random_user_agent.user_agent import UserAgent
import threading
import random
import logging
import socket
import socks
import time
import sys
import ssl
logging.basicConfig(
format="[%(asctime)s] %(message)s",
datefmt="%H:%m:%S",
level=logging.INFO
)
active_threads = 0
max_threads = 777
hrs = 0
usera = UserA... |
websocket_server.py | #!/usr/bin/env python3
"""A simple websocket server. Producer and consumer routines may be
passed in that will generate messages to be sent to the websocket
(producer) and will take messages retrieved from the websocket and
process them (consumer).
The attached executable script uses default routines that look for
mes... |
ntlmrelayx.py | #!/usr/bin/env python
# SECUREAUTH LABS. Copyright 2018 SecureAuth Corporation. All rights reserved.
#
# This software is provided under under a slightly modified version
# of the Apache Software License. See the accompanying LICENSE file
# for more information.
#
# Generic NTLM Relay Module
#
# Authors:
# Alberto Sol... |
test.py | # -*- coding: utf8 -*-
from contextlib import contextmanager
from functools import wraps
from os.path import exists, join, realpath, dirname, split
import errno
import fcntl
import inspect
import logging
import os
import platform
import pty
import resource
import sh
import signal
import stat
import sys
import tempfile
... |
power_monitoring.py | import random
import threading
import time
from statistics import mean
from cereal import log
from common.params import Params, put_nonblocking
from common.numpy_fast import interp
from common.realtime import sec_since_boot
from selfdrive.hardware import HARDWARE
from selfdrive.swaglog import cloudlog
CAR_VOLTAGE_LOW... |
camera.py | # Python
import logging
import time
import picamera
from picamera.array import PiRGBArray
from picamera import PiCamera
import numpy as np
from threading import Thread
logging.basicConfig()
LOGLEVEL = logging.getLogger().getEffectiveLevel()
RESOLUTION = (320, 320)
logging.basicConfig()
# https://github.com/dtresku... |
l_xlog.py | # Copyright 2015 by J Kelly Dresser. All rights reserved.
#
## l_xlog: Class for tx'ing to tcp/ip socket logger app "xlog".
## Messages (actually dicts) are saved to a queue and sent
## from within a thread. As much processing as possible is
## deferred to the thread.
## Functions th... |
tcp-stream-reader-example.py | ################################################################################
# Copyright (C) 2016-2020 Abstract Horizon
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License v2.0
# which accompanies this distribution, and is available at
# http... |
example_test.py | import re
import os
import socket
from threading import Thread
import ssl
from tiny_test_fw import DUT
import ttfw_idf
import random
import subprocess
try:
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
except ImportError:
import http.server as BaseHTTPServer
from http.ser... |
__init__.py | import json
import os
import copy
import threading
import time
import pkg_resources
from sqlalchemy.exc import IntegrityError
# anchore modules
import anchore_engine.common.helpers
import anchore_engine.common.images
from anchore_engine.clients.services import internal_client_for
from anchore_engine.clients.services ... |
local_search.py | import random
import math
import multiprocessing
from time import time
from src.utility import is_win
from src.utility import place
from src.constant import ColorConstant, ShapeConstant
from src.model import Piece, State
from typing import Tuple
def sortPossibleMoves(moves_score):
return moves_score[2][0] + mov... |
cli.py | # -*- coding: utf-8 -*-
import configparser
import random
import sys
import time
from pathlib import Path
from threading import Thread
from urllib.parse import urlparse
import click
from . import __codename__
from . import __version__
from .controllers import CastState
from .controllers import setup_cast
from .contro... |
connection.py | #!/usr/bin/env python3
import threading
from util import *
from request import Request
from router import Router, static, not_found
class HTTPConnection:
"""A class that handles a single HTTP conversation to a TCP client.
Supports sending and receiving well-formed messages in the event of success or failure... |
idf_monitor.py | #!/usr/bin/env python
#
# esp-idf serial output monitor tool. Does some helpful things:
# - Looks up hex addresses in ELF file with addr2line
# - Reset ESP32 via serial RTS line (Ctrl-T Ctrl-R)
# - Run flash build target to rebuild and flash entire project (Ctrl-T Ctrl-F)
# - Run app-flash build target to rebuild and f... |
test_identity.py | """CSI node Identity RPC tests."""
import os
import threading
import time
from pytest_bdd import (
given,
scenario,
then,
when,
)
import pytest
import docker
import subprocess
import csi_pb2 as pb
from common.csi import CsiHandle
from common.deployer import Deployer
from common.apiclient import ApiCli... |
test_metrics.py | from __future__ import print_function, division, absolute_import
import sys
import threading
import time
from distributed import metrics
from distributed.compatibility import PY3
from distributed.utils_test import run_for
def test_wall_clock():
for i in range(3):
time.sleep(0.01)
t = time.time()... |
soccer.py | # -*- coding: UTF-8 -*-
from spider import *
class Prepare:
def __init__(self,col=None):
self.url = BASE_URL
self.col = col
self.content_type = 'application/json; charset=utf-8'
self.collect = mongodb.db[self.col]
def update_one(self,matchid,item):
""... |
e2e.py | """
This is an end to end release test automation script used to kick off periodic
release tests, running on Anyscale.
The tool leverages app configs and compute templates.
Calling this script will run a single release test.
Example:
python e2e.py --test-config ~/ray/release/xgboost_tests/xgboost_tests.yaml --test-... |
PySC2_A3C_FullyConvBeacon.py | """
PySC2_A3C_AtariNetNew.py
A script for training and running an A3C agent on the PySC2 environment, with reference to DeepMind's paper:
[1] Vinyals, Oriol, et al. "Starcraft II: A new challenge for reinforcement learning." arXiv preprint arXiv:1708.04782 (2017).
Advantage estimation uses generalized advantage estimat... |
test_mysqlx_crud.py | # -*- coding: utf-8 -*-
# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0, as
# published by the Free Software Foundation.
#
# This program is also d... |
session_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... |
schedulecmd.py | import sched, time, datetime, threading, sys
import subprocess
def processing(a):
subprocess.call( ["python3", "sch.py"] )
def schedule():
s = sched.scheduler(time.time, time.sleep)
set_time = datetime.datetime.strptime('2018/08/22,06:57', '%Y/%m/%d,%H:%M') # イベントの開始日時
add_date = datetime.timedel... |
mapd.py | #!/usr/bin/env python
# Add phonelibs openblas to LD_LIBRARY_PATH if import fails
try:
from scipy import spatial
except ImportError as e:
import os
import sys
from common.basedir import BASEDIR
openblas_path = os.path.join(BASEDIR, "phonelibs/openblas/")
os.environ['LD_LIBRARY_PATH'] += ':' + openblas_pat... |
main_services.py | from endpoint.service_endpoint import ServiceEndpoint
from services.service_repository.service_api import ServicesAPI
from services.service_repository.service_api import ServiceAPI
from services.service_discovery.service_discovery_endpoint import ServiceDiscoveryEndpoint
from services.service_discovery.service_discover... |
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 Impo... |
compute_stream.py | from queue import Queue
from threading import Thread
from functools import reduce
class ComputeStream:
def __init__(self, stream, buffer_size = 100):
self.__stream = stream
self.__buffer_size = buffer_size
self.__is_opened = False
self.__buffer = Queue(maxsize = self.__buffer_size)
self.__stag... |
streaming_pure.py | #!/usr/bin/env python3
# encoding: UTF-8
import http.server
import os
import re
import socket
import threading
from http import HTTPStatus
class StreamingHTTPRequestHandler(http.server.SimpleHTTPRequestHandler):
__version___ = "1.0"
protocol_version = 'HTTP/1.1'
server_version = "StreamingHTTP/" + __v... |
mq_server_base.py | import os
import pika
from multiprocessing.pool import ThreadPool
import threading
import pickle
from functools import partial
from typing import Tuple
from queue import Queue
import time
from abc import ABCMeta, abstractmethod
import sys
sys.setrecursionlimit(100000)
import functools
import termcolor
import dateti... |
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... |
vprwave-bot.py | # ⋆ ˚。⋆୨୧˚ v a p o r w a v e b o t ˚୨୧⋆。˚ ⋆
# Simple Telegram bot that converts standard unicode chars to full-width ones
# Unicode full width characters, means that all characters has the size of a chinese character.
# Full width characters goes from 0xFF1 to 0xFFE5
# Japanese hirigana char... |
model.py | import os
try:
import subprocess32 as subprocess
except ImportError:
import subprocess
import hashlib
import logging
from backports import tempfile
import threading
import filelock
import numpy as np
from . import io
logger = logging.getLogger('cmdstanpy.model')
class CmdStanNotFound(RuntimeError):
pass
... |
runtime_manager_dialog.py | #!/usr/bin/env python3
#
# Copyright 2015-2019 Autoware Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... |
enviro.py | from bme280 import BME280
from pms5003 import PMS5003, SerialTimeoutError, ChecksumMismatchError, ReadTimeoutError
from enviroplus import gas
from subprocess import PIPE, Popen
import ST7735
import os
import logging
import colorsys
from collections import deque, defaultdict
import pandas as pd
import math
from multipro... |
slave.py | # ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... |
test_pyexe.py | import os
import pytest
import subprocess
import time
@pytest.fixture
def exepath(request):
return request.config.getoption("--exe")
@pytest.fixture
def pyversion(exepath):
out, err = runPyExe(exepath, ['--version'])
version = (out + err).strip().split()[-1]
return tuple(int(part) for part in versio... |
hybrid_pretrain_SdA_multiproc.py | """ SdA hybrid pretraining script that uses two GPUs, one per sub-process,
via the Python multiprocessing module. """
# These imports will not trigger any theano GPU binding, so are safe to sit here.
from multiprocessing import Process, Manager
from optparse import OptionParser
import os
import cPickle
import gzip
... |
sdd1306.py | import logging
import threading
import time
from typing import Any, Dict, List, Union
from luma.core.interface import serial
from luma.oled import device
from PIL import Image, ImageDraw, ImageFont
import gpiozero
from calchas import utils
from calchas.common import base
def _readable_bytes(num: int) -> str:
... |
miniterm.py | #!/home/taha/Downloads/rizpardazande-master/rizpar/bin/python2
#
# 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... |
pod.py | """
Pod related functionalities and context info
Each pod in the openshift cluster will have a corresponding pod object
"""
import logging
import re
import yaml
import tempfile
from time import sleep
from threading import Thread
import base64
from ocs_ci.ocs.ocp import OCP
from ocs_ci.ocs import constants, defaults, ... |
main.py | import sys
from threading import Thread, Lock
import logging
import webview
from time import sleep
from server import run_server
server_lock = Lock()
logger = logging.getLogger(__name__)
def url_ok(url, port):
# Use httplib on Python 2
try:
from http.client import HTTPConnection
except ImportEr... |
render_work.py | import os
import sys
import random
import subprocess
import multiprocessing
import time
from rendering_config import *
NPROC = 10
def split_task():
if not os.path.exists(DIR_RENDERING_PATH):
os.mkdir(DIR_RENDERING_PATH)
if not os.path.exists(TASK_SPLIT_ROOT):
os.mkdir(TASK_SPLI... |
EFS.py | """ The Request Handler for Edge Fair Scheduler
This class handles all the client requests provided
the client has the correct access certificates. It also
serves as the main class for all of EFS and hence is responsible
for stating up all the sub-processes.
Arkadiusz Madej
"""
import struct
from Scheduler import S... |
main.py | import sys
from PyQt5.Qt import QThread
from PyQt5.QtWidgets import QApplication, QMainWindow
import serial
import Ui_mainwindow
from kinematic import inverse_kin , positive , transpos_kin,calcuInLine
import app
from threading import Thread
posx = 0
posy = 0
posz = 0
flag =0
class Thread_2(QThread): # 线程2
de... |
__init__.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
SignalPy
Real-time Communication for web applications with SignalR Incredibly simple real-time web for python WSGI servers and frameworks
- Realtime
- WSGI compatible
- Open source, open protocol
- Connect from everywhere
- Simple
"""
from __future__ import print_function... |
installwizard.py |
from functools import partial
import threading
from kivy.app import App
from kivy.clock import Clock
from kivy.lang import Builder
from kivy.properties import ObjectProperty, StringProperty, OptionProperty
from kivy.core.window import Window
from kivy.uix.button import Button
from kivy.utils import platform
from kivy... |
client.py | """
Web socket client mixins.
| Copyright 2017-2020, Voxel51, Inc.
| `voxel51.com <https://voxel51.com/>`_
|
"""
import asyncio
from collections import defaultdict
import logging
import requests
from retrying import retry
from threading import Thread
import time
from bson import json_util
from tornado import gen
from... |
mocks.py | from contextlib import closing
from datetime import timedelta
from http import HTTPStatus
from http.server import BaseHTTPRequestHandler, HTTPServer
import json
import re
import socket
from threading import Thread
TEST_ACCESS_TOKEN = 'test_access_token'
class MockSpotifyRequestHandler(BaseHTTPRequestHandler):
TO... |
test_queue.py | #!/usr/bin/env python
from multiprocessing import Process, Queue
def f(q):
q.put([42, None, 'hello'])
if __name__ == '__main__':
q = Queue()
p = Process(target=f, args=(q,))
p.start()
print(q.get()) # prints "[42, None, 'hello']"
p.join()
|
main.py | import threading
import time
import schedule
import yaml
from reddit_monitor import RedditMonitor
from state import State
def run_threaded(job_func):
job_thread = threading.Thread(target=job_func)
job_thread.start()
def main():
config = yaml.safe_load(open("config.yml"))
state = State(config)
... |
matplot_qt.py |
# embedding_in_qt5.py --- Simple Qt5 application embedding matplotlib canvases
#
# Copyright (C) 2005 Florent Rougon
# 2006 Darren Dale
# 2015 Jens H Nielsen
#
# This file is an example program for matplotlib. It may be used and
# modified with no restriction; raw copies as well as modified... |
htcondor_utils.py |
#=== Imports ===================================================
import re
import time
import datetime
import threading
import random
import multiprocessing
import tempfile
import functools
import traceback
import xml.etree.ElementTree as ET
try:
import subprocess32 as subprocess
except Exception:
import sub... |
docker.py | # -*- encoding: utf-8 -*-
from __future__ import nested_scopes, generators, division, absolute_import, \
with_statement, print_function, unicode_literals
import logging
from subprocess import Popen, PIPE
from app.easyCI.strings import get_random_string
import io
import threading
import subprocess
log = logging.g... |
clusterDroplets.py | # clusterDroplets.py
#######################################################
#
# Classification based on the size distribution:
# - Load collection of vectors
# - For each patient, take all images, and cluster every cells in two classes
# -> Many small (MS), lot of LDs in small bins [0-15]
# -> Few large (FL),... |
runtest.py | #!/usr/bin/env python3
#
# Copyright 2017 Jeff Bush
#
# 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... |
__init__.py | import os
import io
import sys
import time
import glob
import socket
import winreg
import locale
import hashlib
import platform
import tempfile
import datetime
import threading
import subprocess
from ctypes import windll
from urllib.request import urlopen
import psutil
import win32gui
import pythoncom
import win32proc... |
activateenv.py | from multiprocessing import Process, Queue
from contextlib import contextmanager
import os
__copyright__ = 'Copyright (C) 2019, Nokia'
class _QueueItem(object):
def __init__(self, ret=None, exception=None):
self._ret = ret
self._exception = exception
def get_return(self):
if self._e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.