source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
default.py | from threading import Event
import os
import sys
import time
import colorsys
import paho.mqtt.client as mqtt
import xbmc
import xbmcaddon
__addon__ = xbmcaddon.Addon()
__addondir__ = xbmc.translatePath(__addon__.getAddonInfo('profile'))
__cwd__ = __addon__.getAddonInfo('path')
__resource__ = xbmc.translatePath(os.pa... |
lifx-poly.py | #!/usr/bin/env python3
##!/home/e42/dev/py3_envs/udi-lifx-poly-venv/bin/python
"""
LiFX NodeServer for UDI Polyglot v2
by Einstein.42 (James Milne) milne.james@gmail.com
"""
import polyinterface
import time
import sys
import lifxlan
from copy import deepcopy
import json
import yaml
from threading import Thread
from pa... |
kb_prokkaServer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from wsgiref.simple_server import make_server
import sys
import json
import traceback
import datetime
from multiprocessing import Process
from getopt import getopt, GetoptError
from jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError,\
JSONRPCError, Inva... |
conftest.py | """
Unit test fixture module.
"""
import os
import threading
import time
import pytest
from mock.mock import MagicMock
from core.api.grpc.client import InterfaceHelper
from core.api.grpc.server import CoreGrpcServer
from core.api.tlv.coreapi import CoreConfMessage, CoreEventMessage
from core.api.tlv.corehandlers imp... |
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://... |
hw.py | """Hardware module hw.py
Interfacing and controlling hardware.
"""
import time
import math
import threading
import logging
from abc import ABC, abstractmethod
from typing import Tuple, Type
class HardwareInterface(ABC):
"""Abstract hardware interfacing class.
Interfaces the hardware to perform all acti... |
subchapter_03_coordinator_queuerunner.py | import tensorflow as tf
import threading
import time
sess = tf.InteractiveSession()
gen_random_normal = tf.random_normal(shape=())
queue = tf.FIFOQueue(capacity=100, dtypes=[tf.float32], shapes=())
enque = queue.enqueue(gen_random_normal)
def add(coord, i):
while not coord.should_stop():
sess.run(enque)
... |
utility.py | import os
import math
import time
import datetime
from multiprocessing import Process
from multiprocessing import Queue
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import imageio
import torch
import torch.optim as optim
import torch.optim.lr_scheduler as lrs
class ti... |
sius_client.py | # -*- coding: utf-8 -*-
import time
import datetime
import requests
import logging
import win32api
import win32gui
import win32process
import wmi
import win32con
import threading
from tkinter import *
server_url = 'http://vps362165.ovh.net:8000'
user = {
"username": "admin",
"password": "adminpass1"
}
auth_... |
soak_test_base.py | #!/usr/bin/python
"""
(C) Copyright 2019-2021 Intel Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
"""
import os
import time
from datetime import datetime, timedelta
import multiprocessing
import threading
import random
from filecmp import cmp
from apricot import TestWithServers
from general_utils import r... |
test_carpark.py | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the ... |
flow_control.py | import sys
import threading
import logging
import time
from parsl.dataflow.strategy import Strategy
logger = logging.getLogger(__name__)
class FlowNoControl(object):
"""FlowNoControl implements similar interfaces as FlowControl.
Null handlers are used so as to mimic the FlowControl class.
"""
def... |
test_sync_clients.py | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import py... |
parallel_runner_x.py | from envs import REGISTRY as env_REGISTRY
from functools import partial
from components.episode_buffer import EpisodeBatch
from multiprocessing import Pipe, Process
import numpy as np
import torch as th
# Based (very) heavily on SubprocVecEnv from OpenAI Baselines
# https://github.com/openai/baselines/blob/master/bas... |
planner.py | import pycuda.driver as drv
from pycuda.compiler import SourceModule
import time
import cv2
import numpy as np
import sys
import math
sys.path.append(".")
from subroutine import Subroutine
from data_class import Data
from data_source import Source
from lane_cam import LaneCam
from parabola import Parabola
ACTUAL_RADI... |
githubcloner.py | #!/usr/bin/env python3
# coding=utf-8
# *******************************************************************
# *** GithubCloner ***
# * Description:
# A script that clones public Github repositories
# of users and organizations automatically.
# * Version:
# v0.3
# * Homepage:
# https://github.com/mazen160/Github... |
worker.py | from contextlib import contextmanager
import atexit
import faulthandler
import hashlib
import inspect
import io
import json
import logging
import os
import redis
import sys
import threading
import time
import traceback
from typing import Any, Dict, List, Iterator
# Ray modules
from ray.autoscaler._private.constants im... |
ExperiMaster.py | '''
This is the main program which executes an experiment
description by communicating with the Node_Managers on
the configured nodes.
It has threads.
* The main thread executes the experiment description
* One thread is providing an XMLRPC Server for the Nodes
to sent asynchonous feedback (mainly events) to the m... |
app.py | import argparse
import os
import multiprocessing
from configparser import ConfigParser
import functools
import logging
import sys
from flask import (
Flask,
render_template,
request,
session,
jsonify,
abort
)
from flask import redirect
from flask import url_for
from analysis.generator impo... |
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... |
simple_thread.py | '''
Threads run between like context switch on the cpu core.
Scenario:
- we have single core (A1) that supports single thread
- 1200 Threads Running on the core (A1) within specific interval of time
constraint:
- one core handle one thread per time only
... |
standalone.py | """Standalone Authenticator."""
import argparse
import collections
import logging
import socket
import threading
import OpenSSL
import six
import zope.interface
from acme import challenges
from acme import standalone as acme_standalone
from certbot import errors
from certbot import interfaces
from certbot.plugins i... |
thread_buffer.py | # Copyright 2020 MONAI Consortium
# 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... |
parallel.py | import os
from copy import deepcopy
from time import sleep
from concurrent.futures import ThreadPoolExecutor
from typing import Any, Callable, Optional, Union, Generator, List, Type
from zipfile import ZipFile, ZIP_DEFLATED
from six.moves.queue import PriorityQueue, Queue, Empty
from pathlib2 import Path
from tempfile... |
homework718.py | import re
import pymongo
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait,Select
from selenium.webdriver.support import expected_conditions as EC
import multiprocessing
def Spider_for_dytt(queue):
"""
processing 1:
Respo... |
ultrasonic.py | import time
from datetime import datetime
from threading import Thread
import gpiozero
from actors.generic import GenericActor
from collections import deque
from gpiozero import DistanceSensor
from gpiozero.pins.mock import MockFactory
from utils.messages import Response, SensorMsg, SensorReq, SensorResp
# conversio... |
filemanager.py | """
File Manager
============
Copyright (c) 2019 Ivanov Yuri
For suggestions and questions:
<kivydevelopment@gmail.com>
This file is distributed under the terms of the same license,
as the Kivy framework.
A simple manager for selecting directories and files.
Example
-------
from kivy.app import App
from kivy.core... |
proc.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
# 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... |
test__internal.py | import errno
import os
import socket
import subprocess
import sys
import tempfile
import zipfile
from subprocess import check_output
import pytest
from tf_yarn._internal import (
MonitoredThread,
reserve_sock_addr,
xset_environ
)
def test_monitored_thread():
def fail():
raise RuntimeError(42... |
test_threading.py | '''测试threading
made by Ian in 2017-10-8 15:39:40
'''
import time, threading
# 假定这是你的银行存款:
balance = 0
lock = threading.Lock()
def change_it(n):
# 先存后取,结果应该为0:
global balance
balance = balance + n
balance = balance - n
def run_thread(n):
for i in range(100000):
# 先要获取锁:... |
run.py | #!/usr/bin/env python
"""dMRI preprocessing workflow."""
from pathlib import Path
import sys
import uuid
import warnings
warnings.filterwarnings("ignore")
from argparse import ArgumentParser
from argparse import ArgumentDefaultsHelpFormatter
from multiprocessing import cpu_count
from time import strftime
def get_par... |
scanner.py | #!/usr/bin/python3
import sys
import time
import shodan
import argparse
import requests
from datetime import datetime
from threading import Thread, activeCount
# Shodan API Key (change according to your Shodan API key)
api_key = ''
# Shodan search query
search_query = '"http://cis.citrix.com"'
def getTime():
now = d... |
utils.py | from pathlib import Path
from threading import Thread
from datetime import datetime
from typing import (
Callable,
Dict,
Tuple,
Union
)
from .constants import (
BASE_SIZE,
UNITS,
MAX_PATH_LENGTH
)
def bytes_conversion(
size: int, unit: str = UNITS[0]
) -> Tuple[str, str]:
"""
... |
rdd.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... |
controller.py | # Copyright (c) 2017 Tigera, 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... |
pytest.py | import csv
import sys
import time
import mysql.connector
from io import StringIO
from multiprocessing import Process
def _connect(user, host, port, database):
return mysql.connector.connect(user=user, host=host, port=port, database=database)
def _print_err_and_exit(e):
print(e, file=sys.stderr)
sys.exi... |
docker_registry_image_checker.py | import json
import multiprocessing as mp
from typing import Dict
import docker
class DockerRegistryImageChecker:
def map(self, image: str, queue: mp.Queue):
client = docker.from_env()
try:
generator = client.api.pull(
repository=image,
stream=True,
... |
manager.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2015 clowwindy
#
# 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... |
lh_console.py | #!/usr/bin/env python
import threading
from win32com.shell import shell, shellcon
from threading import Thread
from queue import Queue, Empty
import sys
import time
import subprocess
class lh_console:
def __init__(self,file_name=False):
#steamPath = "D:\\Steam"
#lh_path = steamPath + "\\steamapps... |
multiprocess.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from multiprocessing import Process, Pipe
import psutil
from time import sleep
from chatbot_m import main
from cam.pan_tilt_tracking import run
#https://stackoverflow.com/questions/43861164/passing-data-between-separately-running-python-scripts
if __name__ == "__main__"... |
base.py | # Based on DT-SLAM article:
# - "DT-SLAM: Deferred Triangulation for Robust SLAM", Herrera, Kim, Kannala, Pulli, Heikkila
# https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=7035876
#
# code also available, it wasn't used for any reference though:
# - https://github.com/plumonito/dtslam/tree/master/cod... |
vessel_udp.py | #!/usr/bin/env python
import rospy
from geometry_msgs.msg import Twist
import socket
import json
from threading import Thread
class UdpServer:
def __init__(self, host, port, buffer_size=1024):
self.addr = (host, port)
self.buffer_size = buffer_size
self.available = {'kalman': True, 'roboc... |
Service.py | import re
import threading
import requests
def validate_amount(amount_str):
try:
parts = amount_str.split(' ')
return len(parts[0]) == 3 and float(parts[1])
except ValueError:
return False
def validate_phone(phone_str):
try:
return re.match('^\+\d{1,3}\d{3,}$', phone_str)... |
localbus.py | import logging
import threading
from collections import Counter, defaultdict, namedtuple
from rebus.bus import Bus, DEFAULT_DOMAIN
from rebus.storage_backends.ramstorage import RAMStorage
from rebus.storage import StorageRegistry
from rebus.tools.config import get_output_altering_options
from rebus.tools.sched import S... |
Benchmark.py | #!/usr/bin/env python
# -*- coding: utf-8 -*
__author__ = 'pablo'
import subprocess
import os
import matrix
import count
import sort
import random
from threading import Thread
threads = []
num_threads = 20
def my_function(another_function, param):
"""
Llama a una función dada por parámetro (param1) y le pa... |
export_spec.py | import os
import sys
d = os.path.dirname(os.getcwd())
sys.path.append(d)
from pychron.core.ui import set_toolkit
set_toolkit('qt4')
#e=ExportSpec(p='/Users/ross/Sandbox/aaaa_isotopes.h5')
#for iso,det in
#
#from pychron.core.ui.dialogs import myConfirmationDialog
#
#from traits.api import HasTraits, Button
#from... |
server.py | import Pyro4
import os
import psutil
import socket
import logging
import sys
from multiprocessing import Process
from . import framework
# start nameserver using: python -m Pyro4.naming
@Pyro4.expose
class JobDispatcher():
def run(self, config, workingDirectory):
os.chdir(workingDirectory)
retu... |
TFSparkNode.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.
"""
This module provides Spark-compatible functions to launch TensorFlow on the executors.
There are three main phases of operation:
1. Reservation - reserves a port for the Tensor... |
client_manager.py | from LURKconfig import game_settings
from player import Player
from LURKp import LURKprot
from math import ceil
import threading, time
import multiprocessing.dummy as mp
class ClientManager: ### Uses a threaded loop to relay messages between Game and Players ###
def __init__(self, game_queue, client_queue):
... |
site_list.py | """Sherlock: Supported Site Listing
This module generates the listing of supported sites.
"""
import json
import sys
import requests
import threading
import xml.etree.ElementTree as ET
from datetime import datetime
from argparse import ArgumentParser, RawDescriptionHelpFormatter
pool = list()
def get_rank(domain_to_q... |
change_notify.py | # -*- coding: utf-8 -*-
# Copyright: (c) 2019, Jordan Borean (@jborean93) <jborean93@gmail.com>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
import logging
import threading
from smbprotocol.connection import (
Commands,
NtStatus,
)
from smbprotocol.exceptions import (
SMBResponseExc... |
bot.py | # -*- coding: utf-8 -*-
try:
from constants import *
from command import *
from settings import *
from line import *
import urllib2, urllib, json
import re, sys, os, argparse
from threading import Thread
from time import sleep
from random import randint, randrange, unifo... |
monitored_session_test.py | # pylint: disable=g-bad-file-header
# 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/LICENS... |
microtvm_api_server.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... |
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... |
nginterface.py | """
nginterface.py: NovaGenesis Interface
"""
__author__ = "Daniel Mazzer"
__copyright__ = "Copyright 2016, CogRIoT Project"
__credits__ = "Antonio Marcos Alberti"
__license__ = "MIT"
__maintainer__ = "Daniel Mazzer"
__email__ = "dmazzer@gmail.com"
import sys
import zmq
import threading
from bzrlib.plugins.launchpad... |
tb_watcher.py | #
"""
tensor b watcher.
"""
import logging
import os
import socket
import sys
import threading
import time
from typing import TYPE_CHECKING
import six
from six.moves import queue
import wandb
from wandb import util
from wandb.viz import custom_chart_panel_config, CustomChart
from . import run as internal_run
if TY... |
mp_test.py | import torch.multiprocessing as mp
from model import MyModel
################################################################################
def train(model):
# Construct data_loader, optimizer, etc.
for data, labels in data_loader:
optimizer.zero_grad()
loss_fn(model(data), labels).backward()
... |
netConditionTest.py |
# Copyright 2017-present Open Networking 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 applicable law or ag... |
distrib.py | import torch.multiprocessing as mp
from multiprocessing.connection import Connection
from multiprocessing.synchronize import RLock
from threading import Thread
from typing import List, Tuple, Optional, Union
import numpy as np
def router(receiver: Connection, sender: Connection, lock: RLock, idx: int):
i = 0
... |
datasets.py | import glob
import math
import os
import random
import shutil
import time
from pathlib import Path
from threading import Thread
import cv2
import numpy as np
import torch
from PIL import Image, ExifTags
from torch.utils.data import Dataset
from tqdm import tqdm
from utils.utils import xyxy2xywh, xywh2xyxy
help_url =... |
host_images.py | """
This module serves the images in this directory.
"""
import http.server
from socketserver import TCPServer
import threading
def run_on_new_thread():
"""
This function creates and runs an HTTP server on a new thread to host images in this directory.
"""
server_address = '127.0.0.1'
port_number... |
Example2.py | from threading import Thread
from time import sleep
def slower(text, time):
sleep(time)
print(text)
# Instanciando Thread com a função criada anteriormente
# Se tiver só um argumento, inserir uma virgula porteirior ao mesmo
t1 = Thread(target=slower, args=('Hello from Thread 1!', 5))
t2 = Thread(target=slow... |
ReadsUtilsServer.py | #!/usr/bin/env python
from wsgiref.simple_server import make_server
import sys
import json
import traceback
import datetime
from multiprocessing import Process
from getopt import getopt, GetoptError
from jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError,\
JSONRPCError, InvalidRequestError
from jso... |
test_concurrent_futures.py | import test.support
# Skip tests if _multiprocessing wasn't built.
test.support.import_module('_multiprocessing')
# Skip tests if sem_open implementation is broken.
test.support.import_module('multiprocessing.synchronize')
# import threading after _multiprocessing to raise a more relevant error
# message: "No module n... |
PortfolioManagementSystem.py | from Alpaca.AlpacaPaperApi import AlpacaPaperApi
from ModelRunner import ModelRunner
import pandas as pd
import numpy as np
import time
class PortfolioManagementSystem:
# TODO config
def __init__(self) # , api, symbol, time_frame, system_id, system_label):
# Connect to api
# Connect to BrokenP... |
monsoon_profiler.py | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Profiler using data collected from a Monsoon power meter.
http://msoon.com/LabEquipment/PowerMonitor/
Data collected is a namedtuple of (amps, volts), at... |
detect_webcam.py | ######## Webcam Object Detection Using Tensorflow-trained Classifier #########
#
# Author: Evan Juras
# Date: 10/27/19
# Description:
# This program uses a TensorFlow Lite model to perform object detection on a live webcam
# feed. It draws boxes and scores around the objects of interest in each frame from the
# webcam... |
hydrus_server.py | #!/usr/bin/env python3
# Hydrus is released under WTFPL
# You just DO WHAT THE FUCK YOU WANT TO.
# https://github.com/sirkris/WTFPL/blob/master/WTFPL.md
action = 'start'
try:
import locale
try: locale.setlocale( locale.LC_ALL, '' )
except: pass
import os
import sys
import threa... |
framework_test.py | # 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
#
# Unless required by applica... |
ctl.py | #!/usr/bin/python
import argparse
import hashlib
import sys
import os
import subprocess
import signal
import getpass
import urlparse
import simplejson
from termcolor import colored
import ConfigParser
import StringIO
import functools
import time
import random
import string
from configobj import ConfigObj
import tempf... |
run.py | """Methods that support running tests"""
import time
import collections
import multiprocessing
import warnings
from alarmageddon.config import Config
from alarmageddon.reporter import Reporter
from alarmageddon.publishing import hipchat, pagerduty, graphite, junit
from alarmageddon.validations.validation import Prior... |
backend.py | import json
import pickle
import pprint
import re
import threading
import time
import traceback
import uuid
import cloudscraper
import requests
import requests.adapters
from .constant import (
AUTH_FINISH_PATH,
AUTH_GET_FACTORS,
AUTH_PATH,
AUTH_START_PATH,
AUTH_VALIDATE_PATH,
DEFAULT_RESOURCES... |
vulnscan.py | import multiprocessing
import queue
import threading
import json
from datetime import datetime
import enum
import logging
from sqlalchemy import MetaData, Table
from ..db.datamodel import db, app, project, portscanner, target, vulnLookupTable
from ..utils import Ports, PortStatus
class WorkerCommand(enum.Enum):
STO... |
dbus_runner.py | # NOTE: Borrowed basically all of this from Gosa project.
import sys
try:
import pydbus
from pydbus import SessionBus
except ImportError:
print("Please install the python dbus module.")
sys.exit(1)
import time
import threading
import logging
from scarlett_os.internal.gi import GLib
logger = logging... |
websocket.py | from __future__ import annotations
import logging
from contextlib import contextmanager
try:
from functools import cached_property # type: ignore
# Support 3.7
except ImportError:
cached_property = property # type: ignore
import re
import threading
from functools import partial, wraps
from threading import... |
audio_process.py | #!/usr/bin/env python
#WARNING : First press finish button then cut program
import main_lis_gui
import json
import pyaudio
from os.path import join, dirname
from pocketsphinx import LiveSpeech, AudioFile
import wave
import threading # multi threading
import os # for listing di... |
nets_test.py | # -*- coding:utf-8 -*-
import time
import pytest
import tensorflow as tf
from sklearn.model_selection import train_test_split
from tensorflow.keras import backend as K
from tensorflow.keras import layers
from deeptables.datasets import dsutils
from deeptables.models import deepnets
from deeptables.models import deep... |
Client4_3.py | import socket
from threading import Thread
class Client:
def __init__(self, port):
self._socket = socket.socket(family=socket.AF_INET,
type=socket.SOCK_STREAM,
proto=0)
self._socket.connect(('127.0.0.1', port))
def get(... |
multi_processing.py | class ParallelProcessing():
def __init__(self, function, iter, *args, **kwargs):
"""
This is a specialized wrapper around multiprocessing.Process object. It
launches multiple separate processes with the same input 'function' but different argument that comes from an iterable object like tupl... |
test_cuda.py | from itertools import repeat, chain, product
from typing import NamedTuple
import collections
import gc
import io
import pickle
import queue
import sys
import tempfile
import threading
import unittest
import torch
import torch.cuda
import torch.cuda.comm as comm
from torch.nn.parallel import scatter_gather
from torch.... |
_compat_test.py | # Copyright 2019 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
server.py | # Adafruit BNO055 WebGL Example
#
# Requires the flask web framework to be installed. See http://flask.pocoo.org/
# for installation instructions, however on a Linux machine like the Raspberry
# Pi or BeagleBone black you can likely install it by running:
# sudo apt-get update
# sudo apt-get install python3-flask
#
... |
udf.py | """Fonduer UDF."""
import logging
from multiprocessing import Manager, Process
from queue import Queue
from threading import Thread
from typing import Any, Collection, Dict, List, Optional, Set, Type, Union
from sqlalchemy import inspect
from sqlalchemy.orm import Session
from fonduer.meta import Meta, new_sessionmak... |
local_executor.py | """Local based implementation of the executor using multiprocessing"""
import signal
from multiprocessing import Process, Queue
try:
from queue import Empty
except ImportError:
from Queue import Empty
try:
import psutil
except ImportError:
psutil = None
from . import executor
def kill_child_proces... |
io.py | """Data iterators for common data formats."""
from __future__ import absolute_import
from collections import OrderedDict, namedtuple
import sys
import ctypes
import logging
import threading
import numpy as np
from .base import _LIB
from .base import c_array, c_str, mx_uint, py_str
from .base import DataIterHandle, NDA... |
test_app.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# test_app.py
#
# Copyright 2020 Bruce Schubert <bruce@emxsys.com>
#
# 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... |
server.py | """
A high-speed, production ready, thread pooled, generic HTTP server.
For those of you wanting to understand internals of this module, here's the
basic call flow. The server's listening thread runs a very tight loop,
sticking incoming connections onto a Queue::
server = HTTPServer(...)
server.start()
->... |
train_net.py | #!/usr/bin/env python
# --------------------------------------------------------
# FCN
# Copyright (c) 2016 RSE at UW
# Licensed under The MIT License [see LICENSE for details]
# Written by Yu Xiang
# --------------------------------------------------------
"""Train a Fully Convolutional Network (FCN) on image segmen... |
wiki_generator_GCP.py | import json
import threading, queue
import tensorflow as tf
import argparse
import time
import random
import re
from urllib.request import urlopen
import pickle
#from bs4 import BeautifulSoup
#import html2text
import htmlparser
from google.cloud import storage
def upload_blob(bucket_name, source_file_name, destinatio... |
dispyadmin.py | #!/usr/bin/python3
"""
This file is part of dispy; see https://dispy.org for details.
"""
import sys
import os
import socket
import threading
import json
import cgi
import time
import ssl
import re
import hashlib
import struct
import collections
import traceback
import pycos
from pycos import Task, AsyncSocket, seria... |
wallet.py | # Electrum ABC - lightweight eCash client
# Copyright (C) 2020 The Electrum ABC developers
# Copyright (C) 2017-2022 The Electron Cash Developers
# 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
# ... |
IsaacGym.py | import multiprocessing as mp
import sys
import isaacgym
import numpy as np
import torch # import torch after import IsaacGym modules
from elegantrl.envs.utils.config import set_seed, get_args, parse_sim_params, load_cfg
from elegantrl.envs.utils.parse_task import parse_task
from typing import Tuple
dir((isaacgym, t... |
title.py | # pylint: disable=C0111,R0903
"""Displays focused i3 window title.
Requirements:
* i3ipc
Parameters:
* title.max : Maximum character length for title before truncating. Defaults to 64.
* title.placeholder : Placeholder text to be placed if title was truncated. Defaults to "...".
* title.scroll : Bool... |
ci-tool.py | #!/usr/bin/env python3
# CI SCRIPT
#
# Helper script used to help make CI based build simpler.
import argparse
import fnmatch
import multiprocessing
import os
import re
import shutil
import subprocess
import sys
import threading
import time
import xml.etree.ElementTree as ET
from os.path import abspath, dirname, exis... |
periodic.py | import logging
import os
import time
from multiprocessing import Process
from django.conf import settings
from django.db import connections
from schedule import Scheduler
from django_guid import set_guid
from django_guid.utils import generate_guid
from awx.main.dispatch.worker import TaskWorker
logger = logging.getL... |
server.py | import numpy as np
import os
import io
# import for server
from flask import Flask, render_template, request, Response, send_file, jsonify
from queue import Queue, Empty
import threading
import time
# import for model
from transformers import AutoTokenizer, AutoModelWithLMHead, top_k_top_p_filtering, AutoModelForMask... |
gdaltest_python3.py | # -*- coding: utf-8 -*-
###############################################################################
# $Id$
#
# Project: GDAL/OGR Test Suite
# Purpose: Python Library supporting GDAL/OGR Test Suite
# Author: Even Rouault, <even dot rouault at mines dash paris dot org>
#
########################################... |
main.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# The MIT License (MIT)
# Copyright (c) 2020 SBofGaySchoolBuPaAnything
#
# 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, in... |
collective_ops_test.py | # Copyright 2020 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 applicab... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.