source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
discover.py | # -*- coding: utf-8 -*-
"""
xled.discover
~~~~~~~~~~~~~
This module contains interface for discovery devices on the network
"""
from __future__ import absolute_import
import logging
import time
import uuid
import collections
from threading import Thread
import ipaddress
import zmq
from arpreq import arpreq
import... |
misc.py | # coding=utf-8
"""
Misc. functions that don't really fit anywhere else.
"""
import os
import subprocess
import sys
from functools import wraps
from threading import Thread
from weakref import proxy
import sublime
def format_msg(message):
"""
Used to format user messages.
Replaces newline characters with ... |
Listen.py | #!/usr/bin/python
#$Id: Listen.py,v 1.1 2008/03/03 20:18:38 okola Exp $
# "Copyright (c) 2000-2003 The Regents of the University of California.
# All rights reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose, without fee, and without written agreement
... |
start_sploit.py | #!/usr/bin/env python3
from urllib.request import Request, urlopen
from urllib.parse import urljoin
from math import ceil
from enum import Enum
from concurrent.futures import ThreadPoolExecutor
import threading
import time
import subprocess
import stat
import re
import random
import os
import logging
import json
impor... |
queued.py | import multiprocessing
import os
import queue
import threading
import traceback
from logging import getLogger
from pulsar.managers.unqueued import Manager
log = getLogger(__name__)
STOP_SIGNAL = object()
RUN = object()
# Number of concurrent jobs used by default for
# QueueManager.
DEFAULT_NUM_CONCURRENT_JOBS = 1
J... |
mark_for_deployment.py | #!/usr/bin/env python
# Copyright 2015-2016 Yelp 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 ... |
pickletester.py | import collections
import copyreg
import dbm
import io
import functools
import os
import math
import pickle
import pickletools
import shutil
import struct
import sys
import threading
import unittest
import weakref
from textwrap import dedent
from http.cookies import SimpleCookie
try:
import _testbuffer
except Impo... |
interface_rpc.py | #!/usr/bin/env python3
# Copyright (c) 2018-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Tests some generic aspects of the RPC interface."""
import os
from test_framework.authproxy import JSO... |
app.py | # (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2020
import time
import threading
import random
import traceback
import sys
import os
sys.path.append('../..')
os.environ['INSTANA_DEBUG'] = 'yes'
os.environ['INSTANA_AUTOPROFILE'] = 'yes'
import instana
try:
# python 2
from urllib2 import urlopen
e... |
pack.py | # -*- coding:utf-8 -*-
# @author : cbingcan
# @time : 2021/8/24/024 9:53
from threading import Thread
import sophon.sail as sail
from capture.Capture import Capture
from detection.RetinaDetector import RetinaDetector
import time
import signal
import os
import threading
from threading import Thread
from upload ... |
graph.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020 Alibaba Group Holding 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... |
test_httplib.py | import errno
from http import client
import io
import itertools
import os
import array
import socket
import unittest
TestCase = unittest.TestCase
from test import support
here = os.path.dirname(__file__)
# Self-signed cert file for 'localhost'
CERT_localhost = os.path.join(here, 'keycert.pem')
# Self-signed cert fil... |
agent.py | from utils.aid import AID
import Pyro4
from threading import Thread
# Agents states
INITIATED = 0 # The Agent object is built, but hasn't registered itself yet with the AMS, has neither a name nor an address and cannot communicate with other agents.
ACTIVE = 1 # The Agent object is registered with the AMS, has ... |
macos_adapter.py | from threading import Thread, Event, Lock
import ctypes
from bleson.interfaces.adapter import Adapter
from bleson.core.types import Advertisement, UUID16, UUID128
from bleson.core.hci.constants import *
from bleson.logger import log
from bleson.core.hci.type_converters import bytearray_to_hexstring
# Work around for ... |
moca_utils.py | # Ω*
# ■ ■■■■■
# ■ ■■ ■■
# ■ ■■ ■
# ■ ■■
# ■■■■■ ■ ■■■
# ■■ ■■ ■ ■■■
# ■■ ■■ ■ ■■■■
# ■■ ■■ ■ ■■■■
# ■■■■■■■■■ ■ ■■■
... |
test_util.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... |
runner.py | #!/usr/bin/env python2
# This Python file uses the following encoding: utf-8
'''
Simple test runner
These tests can be run in parallel using nose, for example
nosetests --processes=4 -v -s tests/runner.py
will use 4 processes. To install nose do something like
|pip install nose| or |sudo apt-get install python-no... |
ext_sandbox.py | 11# @th3_protoCOL
import os, sys, time, asyncio, threading, requests, zipfile, json
from selenium import webdriver
from multiprocessing import Process
from mitmproxy.options import Options
from mitmproxy.proxy.config import ProxyConfig
from mitmproxy.proxy.server import ProxyServer
from mitmproxy.tools.dump import Dump... |
AutoClicker.py | from tkinter import *
from pynput import mouse
from pynput.keyboard import Key, Listener
import pyautogui, tkinter.messagebox, threading, time, os
#VARS
clicks=0
### GETTING THE PATH OF THE ICON ###
current_path = os.path.dirname(__file__)
####################################
try:
open(str(current_path+"/config... |
test_util.py | # Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
process.py | # -*- coding: utf-8 -*-
# Import python libs
from __future__ import absolute_import, with_statement
import copy
import os
import sys
import time
import errno
import types
import signal
import logging
import threading
import contextlib
import subprocess
import multiprocessing
import multiprocessing.util
# Import salt... |
multi_echo_server.py | import socket, time
from multiprocessing import Process
HOST = ""
PORT = 8001
BUFFER_SIZE = 1024
def main():
with socket.socket(socket.AF_INET, socket.SOCK_STREAM)as s:
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind((HOST,PORT))
s.listen(2)
while True:
... |
test_upload.py | import json
import logging
import time
import requests
from RLBotServer import start_server
from backend.database.objects import GameVisibilitySetting, User, Player
from backend.blueprints.spa_api.errors.errors import PlayerNotFound
from tests.utils.killable_thread import KillableThread
from tests.utils.replay_utils ... |
test_capi.py | # Run the _testcapi module tests (tests for the Python/C API): by defn,
# these are all functions _testcapi exports whose name begins with 'test_'.
from collections import OrderedDict
import importlib.machinery
import importlib.util
import os
import pickle
import random
import re
import subprocess
import sys
import t... |
train.py | # -*- coding: utf-8 -*-
import torch, misc, ccboard
from helper import args, model_predict_train
# exploration
def try_reload_model(model_path, best_model, gpu_id, proc_id, iters):
import os
from log import Logger
cur_model_path = Logger.lastest_model_path(args().logdir)
if best_model is None or model_path != cu... |
xmppclient.py | import logging
from Queue import Queue
from threading import Lock
from threading import Thread
import time
import xmpp
from core.settings import Settings
class XMPPQueue(object):
MAX_RETRY_COUNT = 3
retry_messages = {}
retry_messages_lock = Lock()
message_queue = Queue()
@classmethod
def st... |
receiver.py | from __future__ import unicode_literals
from threading import Thread
from six.moves.queue import Queue
from scapy.all import sniff, Raw, Ether
from .conf import config
class Receiver(object):
def __init__(self, handler, encryptor):
self.handler = handler
self.encryptor = encryptor
self.in... |
procutils.py | # Copyright 2011-2013 Colin Scott
# Copyright 2011-2013 Andreas Wundsam
#
# 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 requir... |
othello.py | import argparse
import gc
import os
import random
import traceback
from multiprocessing import Pool, Process
import numpy as np
import tensorflow.compat.v1 as tf
import api
import board
import config
import gui
import net
import tree
from util import log, plane_2_line
class SelfPlayGame:
def __init__(self, work... |
launch_function_helper.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... |
core.py | """Core managing the models.
Usage example:
# Create a core
core = ModelsManagementCore()
# Train a new model based on a configuration
model_name = core.train_model("/tmp/model_configuration.yaml")
# Scan a file and save the predictions
result = core.predict_synchronously(model_name, "/tmp/m... |
tcp.py | # -*- coding: utf-8 -*-
'''
TCP transport classes
Wire protocol: "len(payload) msgpack({'head': SOMEHEADER, 'body': SOMEBODY})"
'''
# Import Python Libs
from __future__ import absolute_import
import logging
import msgpack
import socket
import os
import weakref
import time
import traceback
# Import Salt Libs
import ... |
run_generation.py | # Parts of this file were adopted from https://github.com/huggingface/transformers.
# See the original copyright notice below.
# Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed unde... |
slodb_gui.py | """Main entry point for the GUI application. Sets up the window and all the controls"""
from tkinter import *
import math
import threading
import cv2
from PIL import Image
from PIL import ImageTk
import tkinter.filedialog as tkFileDialog
import tkinter.font as font
from pathlib import Path
from ground_truth_parser imp... |
train.py | # coding=utf-8
import torch
import torch.distributed as dist
import torch.nn as nn
import torch.nn.functional as F
import torch.multiprocessing as mp
from biglm import BIGLM
from data import Vocab, DataLoader, s2xy
from optim import Optim
import argparse, os
import random
def parse_config():
parser = argparse.Ar... |
scripts.py | # -*- coding: utf-8 -*-
'''
This module contains the function calls to execute command line scripts
'''
# Import python libs
from __future__ import absolute_import, print_function
import os
import sys
import time
import logging
import threading
import traceback
from random import randint
# Import salt libs
from salt.... |
list_biggest_objects.py | from pathlib import Path
import trimesh
from tqdm import tqdm
import multiprocessing
import numpy as np
def get_valid_objects(mesh_dir, limit=None):
list_of_scenes = Path(mesh_dir).iterdir()
list_of_objects = []
for scene in list_of_scenes:
for room in scene.iterdir():
objects = [Path(s... |
ocg.py | #--------------------------------------------------------
#File Name: ocg.py
#Purpose: App router for the Ozark Creek Gauges Web App
#Author: Capstone Group 1
#Date: January 31, 2021
#Includes Templates from templated.co
#--------------------------------------------------------
from flask import Flask, request, render_... |
test_nsjail.py | import io
import logging
import sys
import unittest
import unittest.mock
from textwrap import dedent
from snekbox.nsjail import NsJail, OUTPUT_MAX, READ_CHUNK_SIZE
class NsJailTests(unittest.TestCase):
def setUp(self):
super().setUp()
self.nsjail = NsJail()
self.logger = logging.getLogge... |
vcommon.py | from collections import defaultdict
import multiprocessing
import logging
"""
To run doctest
$ python -m doctest -v common.py
"""
def is_python3():
import sys
return sys.version_info > (3, 0)
def pause(s=None):
input("Press any key to continue ..." if s is None else s)
def iread(filename):
""" ret... |
crawl.py | import requests
import re
import json
from multiprocessing import Process, Queue, freeze_support
import math
url = 'https://dhlottery.co.kr/gameResult.do?method=byWin'
response = requests.get(url)
body = response.content.decode(response.encoding)
pattern = re.compile('동행복권\s([\d]{1,4})회')
result = re.findall(pattern,... |
area_grid.py | import logging, json
from Queue import Queue
from threading import Thread, Semaphore
from UserDict import DictMixin
#from mobiletrans.mtdistmap.utils import shapefile
import shapefile
from django.contrib.gis.geos import Point
from pyproj import Geod
logger = logging.getLogger('simple_example')
logger.setLevel(loggin... |
applet.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright 2013 Kitware 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 cop... |
data_store.py | #!/usr/bin/env python
"""The main data store abstraction.
The data store is responsible for storing AFF4 objects permanently. This file
defines the basic interface of the data store, but there is no specific
implementation. Concrete implementations should extend the DataStore class and
provide non-abstract methods.
T... |
discovery_listener.py | # Software License Agreement (BSD License)
#
# Copyright (c) 2012, Fraunhofer FKIE/US, Alexander Tiderko
# 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 mus... |
buildkite-webhook-listener.py | #!/usr/bin/env python
#
# auto-deploy listener script
#
# Listens for buildkite webhook pokes. When it gets one, downloads the artifact
# from buildkite and unpacks it.
#
# Copyright 2019 New Vector Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance ... |
tensorboard_manager.py | from dataclasses import dataclass
import os
import pdb # noqa
import signal
import socket
import threading
from typing import Callable, Dict, List, cast
import matplotlib.pyplot as plt
import psutil
from tensorboardX import SummaryWriter
import torch
from torch import Tensor
from torch.nn import Sequential
from cont... |
runrun.py | import subprocess, time, os, sys, re, socket
if os.name == 'nt':
from blessed import Terminal
else:
from blessings import Terminal
bless_term = Terminal()
MAXLINES=100
def print_red(s, **kw):
print (bless_term.red(s), **kw)
def run(*args, **kw):
# print ("DBG", args, kw)
if 'showoutput' in kw:
... |
TwitchLinkUtils.py | import os
import requests
import threading
import re
from PyQt5.QtGui import QIcon, QPixmap, QImage
from PyQt5.QtWidgets import QMessageBox, QFileDialog
from TwitchLinkConfig import Config
from Services.TwitchLinkTranslator import translator, T
class NoDefaultImage(Exception):
def __str__(self):
return... |
fuse.py | import sublime, sublime_plugin, traceback
import json, threading, time, sys, os, time, subprocess
from types import *
from .interop import *
from .msg_parser import *
from .fuse_parseutils import *
from .fuse_util import *
from .settings import *
from .go_to_definition import *
from .version import VERSION
from .log im... |
ccbench.py | # This file should be kept compatible with both Python 2.6 and Python >= 3.0.
from __future__ import division
from __future__ import print_function
"""
ccbench, a Python concurrency benchmark.
"""
import time
import os
import sys
import itertools
import threading
import subprocess
import socket
from optparse import ... |
cluster.py | ################################################################################
# Copyright (c) 2009 The MadGraph5_aMC@NLO Development team and Contributors
#
# This file is a part of the MadGraph5_aMC@NLO project, an application which
# automatically generates Feynman diagrams and matrix eleme... |
test_multiprocessing.py | import asyncio
import copy
import os
import platform
import sys
import threading
import time
import pytest
import loguru
from loguru import logger
@pytest.fixture
def fork_context(monkeypatch):
import multiprocessing
context = multiprocessing.get_context("fork")
monkeypatch.setattr(loguru._handler, "mu... |
train_efficientnet.py | import os
import traceback
import time
import numpy as np
from models.efficientnet import EfficientNet
from tinygrad.tensor import Tensor
from extra.utils import get_parameters
from tqdm import trange
from tinygrad.nn import BatchNorm2D
import tinygrad.optim as optim
from datasets import fetch_cifar
class TinyConvNet:... |
base.py | import requests
import datetime
from time import sleep
import threading
from picamera import PiCamera
import logging
from ftplib import FTP_TLS
import i2ctemp
import config
#default period in seconds for how often to update each item
P_GET_INSIDE_TEMPERATURE = 50
P_TRANSMIT_TEMPS = 60
P_FETCH_REQUESTS = 30
P_FETCH_OU... |
tube.py | # -*- coding: utf-8 -*-
import logging
import re
import string
import subprocess
import sys
import threading
import time
from .. import atexit
from .. import term
from ..context import context
from ..log import Logger
from ..timeout import Timeout
from ..util import fiddling
from ..util import misc
from ..util import ... |
main.py | # This is a sample Python script.
# All imported libraries
from mojang import MojangAPI
import requests
import os
from PIL import Image
from io import BytesIO
import numpy as np
import sys
import time
from queue import Queue
import threading
from itertools import islice
# Default options.txt location
def optionsLoc... |
AutoTrain.py | #!/usr/bin/env python
# --------------------------------------------------------
# Faster R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Train a Faster R-CNN network using alternat... |
fake_statsd_server.py | #!/usr/bin/env python
# Unless explicitly stated otherwise all files in this repository are licensed
# under the BSD-3-Clause License. This product includes software developed at
# Datadog (https://www.datadoghq.com/).
# Copyright 2021-Present Datadog, Inc
import ctypes
import os
import shutil
import socket
import sy... |
intercept.py | from threading import Thread
import time
import serial
import sys
import os
# this port address is for the serial tx/rx pins on the GPIO header
SERIAL_PORT_BUT = '/dev/ttyUSB1'
SERIAL_PORT_CTRL = '/dev/ttyUSB0'
# be sure to set this to the same rate used on the Arduino
SERIAL_RATE = 9600
ser_but = serial.Serial(SERIA... |
home_process.py | import json
from threading import Thread
import sysv_ipc
from time import sleep
import impl.home.home_comm_utils as comm_utils
from impl.home.home_comm_utils import cprint
# object representing a home and wrapping a home thread
class Home:
def __init__(self, id_count_tuple, interval, slot_timeout, policy, market... |
ViewController.py | # -*- coding: utf-8 -*-
import os
import time
import datetime
import tkinter as tk
import tkinter.ttk as ttk
from Model import Model
from Presenter import Presenter
import tkinter.filedialog
import tkinter.messagebox as tkmsg
import threading
class ViewController():
def __init__(self, master, model):
self... |
OGL.py | #from oauthlib.oauth2.rfc6749.clients import backend_application
__author__ = 'Dylan'
from OpenGL.GL import *
from OpenGL.GLU import *
from math import cos, sin, radians
import pygame
from macros import *
import copy
import threading
import numpy as np
loading_objects = 0
class Object:
def __init__(self , width ... |
configure_and_test_integration_instances.py | from __future__ import print_function
import argparse
import ast
import json
import logging
import os
import subprocess
import sys
import uuid
import zipfile
from datetime import datetime
from distutils.version import LooseVersion
from enum import IntEnum
from pprint import pformat
from threading import Thread
from ti... |
get_parks_addr_long_lati.py | import csv
import pandas as pd
from get_addr_longitude_latitude import get_addr_longitude_latitude
import threading
import time
file_name = './csv/全国工业园区信息.csv'
csv_data = pd.read_csv(file_name)
length = len(csv_data)
print(length)
csv_data['parkaddr'] = ''
csv_data['parkxy'] = ''
csv_data['parkx'] = ''
csv_data['par... |
worker.py | from bluetooth import BluetoothSocket
from bluetooth import *
import threading
import json
import requests
import sys
# ***** CONFIG *****
uuid = "94f39d29-7d6d-437d-973b-fba39e49d4ee"
data_webhook = 'http://127.0.0.1:4909/new_msg'
deviceCount = 6
# ***** CONFIG *****
## Bluetooth Worker Thread
def bluetoothWorker(i... |
trainer.py | import atexit
import secrets
import time
import multiprocessing as mp
import perwez
def _data_fetcher():
pwz = perwez.connect("default")
data_watcher = pwz.subscribe("data", False)
cnt = 0
while True:
latest_res = data_watcher.get()
shapes = [x.shape for x in latest_res]
cnt +... |
test_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 re
import threading
import uuid
import pytest
from smbprotocol._text import (
to_native,
)
from smbprotocol.connection import (
Connection... |
wamp.py | from twisted.internet import reactor, threads
from threading import Thread
_REACTOR_THREAD = Thread(target=reactor.run, args=(False,))
_REACTOR_THREAD.start()
from twisted.python import log
from twisted.internet.task import LoopingCall
from twisted.internet.defer import inlineCallbacks, returnValue, Deferred, AlreadyC... |
controller.py | #!/usr/bin/python
import logging
import os
import Queue
import requests
import sys
import simplejson as json
import time
from threading import Thread
from pycalico.datastore import DatastoreClient
from pycalico.datastore_datatypes import Rules, Rule
from handlers.network_policy import (add_update_network_policy,
... |
threading.py | import gc
import time
try:
import threading
def start_thread(target, *args, **kwargs):
_thread = threading.Thread(target=target, args=args, kwargs=kwargs)
_thread.start()
return _thread
class Semaphore():
def __init__(self):
self.__lock = threading.Lock()
def acquire(self):
self.__lock.acquire()... |
botapi.py | # -*- coding: utf-8 -*-
"""Unofficial Telegram Bot API
.. _Google Python Style Guide:
http://google.github.io/styleguide/pyguide.html
"""
import os
from requests import Request, Session
from collections import namedtuple
from abc import ABCMeta, abstractmethod
from threading import Thread
from enum import Enum
im... |
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... |
main.py | import boto3
import datetime as dt
import logging
import os
import pandas as pd
import pytz
import time
import threading
import watchtower
import yaml
from trading_ig import (IGService, IGStreamService)
from trading_ig.config import config
from trading_ig.lightstreamer import Subscription
from aws_config import TOPIC... |
kafka_mgmt_message_processor.py | #!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2020 FABRIC Testbed
#
# 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 ... |
spiderdownloadtaskstore.py | """
精简代码
插件下载数据
create by judy 2018/01/24
短信任务,同步之前短信登陆的登陆令牌
update by judy 2019/03/25
"""
import threading
import traceback
from idownclient.spidermanagent.spidermanagebase import SpiderManagebase
from idownclient.spider.spiderbase import SpiderBase
from datacontract import Task, ETokenType, ECommandStatus
from data... |
optimizer.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from byteps.torch.compression import Compression
from byteps.torch.ops import push_pull_async_inplace as byteps_push_pull
from byteps.torch.ops import poll, synchronize
from byteps.torch.ops import init, shutdo... |
vectorized_env_executor.py | import numpy as np
import pickle as pickle
from multiprocessing import Process, Pipe
import copy
class MetaIterativeEnvExecutor(object):
"""
Wraps multiple environments of the same kind and provides functionality to reset / step the environments
in a vectorized manner. Internally, the environments are exe... |
ranking.py | '''
Calculates Recall Rate @ k
'''
import itertools
import logging
import math
import os
import pickle
import random
from multiprocessing import Queue
from queue import Empty
import numpy as np
from scipy.sparse import csr_matrix
from sklearn.metrics.pairwise import cosine_similarity
from torch.utils.data import Data... |
__init__.py | import contextlib
import datetime
import errno
import functools
import inspect
import os
import re
import signal
import socket
import subprocess
import sys
import tempfile
import threading
from collections import namedtuple
from enum import Enum
from warnings import warn
import six
import yaml
from six.moves import co... |
generate_forward_simulations_fault_2ms_r_validate.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat May 4 13:38:15 2019
@author: bmoseley
"""
import shutil
import sys
import numpy as np
import multiprocessing, queue
import time
sys.path.insert(0, '../shared_modules/')
import io_utils
from helper import run_command
### TODO:
#
# Consider writing ... |
portfwd.py | # -*- coding: UTF8 -*-
# Copyright (c) 2015, Nicolas VERDIER (contact@n1nj4.eu)
# Pupy is under the BSD 3-Clause license. see the LICENSE file at the root of the project for the detailed licence terms
from pupylib.PupyModule import *
import StringIO
import SocketServer
import threading
import socket
import logging
imp... |
tasks.py | import multiprocessing
from fabric import Connection
from invoke import task
from flask_server.app import create_app
from flask_server.config import ProdConfig
from flask_server.ext import freezer
try:
from fabfile import HOST, PORT, USERNAME, PASSWORD
except ModuleNotFoundError:
HOST, PORT, USERNAME, PASSWOR... |
test_workflow_runner.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 use ... |
P42_MultiprocessingPipes.py | # Author: OMKAR PATHAK
# This example illustrates an example for multiprocessing and synchronization using pipes
from multiprocessing import Process, Pipe
def parentData(parent):
''' This function sends the data for the child process '''
parent.send(['Hello'])
parent.close()
def childData(child):
'''... |
AppManager.py | #! /usr/bin/python
# -*- coding:utf-8 -*-
# Author: Joker
# Copyright (c) 2019 minsx.com All rights reserved.
import os
import time
from threading import Thread
import wx
import sys
import psutil
import logging
import webbrowser
import subprocess
from com.minsx.pycontainer.Logger import Logger
from com.minsx.util impo... |
hikvision.py | """
pyhik.hikvision
~~~~~~~~~~~~~~~~~~~~
Provides api for Hikvision events
Copyright (c) 2016-2018 John Mihalic <https://github.com/mezz64>
Licensed under the MIT license.
Based on the following api documentation:
System:
http://oversea-download.hikvision.com/uploadfile/Leaflet/ISAPI/HIKVISION%20ISAPI_2.0-IPMD%20Servi... |
kb_ballgownServer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import json
import os
import random as _random
import sys
import traceback
from getopt import getopt, GetoptError
from multiprocessing import Process
from os import environ
from wsgiref.simple_server import make_server
import requests as _requests
from json... |
samsungws.py | """
SamsungTVWS - Samsung Smart TV WS API wrapper
Copyright (C) 2019 Xchwarze
Copyright (C) 2020 Ollo69
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of t... |
test_result_server_fake.py | # Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
announce.py | """Handle text-to-speech announcements in a multi-processing setting."""
import enum
import multiprocessing
import queue
from typing import Optional
import pyttsx3
class _Code(enum.Enum):
"""Represent command codes to instruct announcer what to do."""
SAY = 1
STOP = 2
TERMINATE = 3
class _Command:... |
test_grpc_server_registry.py | import sys
import threading
import time
import pytest
from dagster import file_relative_path, pipeline, repository
from dagster.core.errors import DagsterUserCodeProcessError
from dagster.core.host_representation.grpc_server_registry import ProcessGrpcServerRegistry
from dagster.core.host_representation.origin import ... |
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... |
TCP_server.py | from HelperFunctions import *
from Robot import Robot
import socket
from threading import Thread
class TCP_Server:
def __init__(self):
self.listOfThreads = []
def Communicate(self,mySocket):
while True:
# Wait for a connection
print('waiting for a connection')
... |
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... |
client6.py | import socket
from threading import Thread
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(('localhost', 12367))
nick = input('Who are you?\n')
print("Welcome to the chat!")
def send_message():
while True:
text = input("")
message = (f'{nick}: {text}')
... |
__init__.py | ##~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~##
## ##
## This file forms part of the Underworld geophysics modelling application. ##
## ... |
AliceServer.py | # Copyright (c) 2016 Gabriel Oliveri (<gabrieloandco@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 restriction, including without limitation the rights
# to use, copy,... |
test_ssl.py | """Tests for TLS support."""
# -*- coding: utf-8 -*-
# vim: set fileencoding=utf-8 :
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import functools
import os
import ssl
import subprocess
import sys
import threading
import time
import OpenSSL.SSL
import pytest
import requests
i... |
PerfModule.py | #!/usr/bin/env python
# The MIT License (MIT)
#
# Copyright (c) 2017 Caian Benedicto <caian@ggaunicamp.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 restriction, including w... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.