source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
xcvrd.py | #!/usr/bin/env python2
"""
xcvrd
Transceiver information update daemon for SONiC
"""
try:
import ast
import json
import multiprocessing
import os
import signal
import sys
import threading
import time
from sonic_py_common import daemon_base, device_info, logger
from son... |
server.py | #!/usr/bin/env python
import urllib
import atexit
import os
import socket
from threading import Thread
from subprocess import Popen
from flask import render_template
from flask import Flask, Response
# Allow us to reuse sockets after the are bound.
# http://stackoverflow.com/questions/25535975/release-python-flask-po... |
13_05_post_search.py | def search(paths, query_q, results_q):
lines = []
for path in paths:
lines.extend(l.strip() for l in path.open())
query = query_q.get()
while query:
results_q.put([l for l in lines if query in l])
query = query_q.get()
if __name__ == '__main__':
from multiprocessing import ... |
kb_mashServer.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... |
main.py | #!/usr/bin/python
# Libraries
import paho.mqtt.client as paho
import psutil
import pywapi
import signal
import sys
import time
import dweepy
import random
import plotly.plotly as py
import pyupm_i2clcd as lcd
import pyupm_grove as grove
from threading import Thread
from flask import Flask
from flask_restful import A... |
managers.py | #
# Module providing manager classes for dealing
# with shared objects
#
# multiprocessing/managers.py
#
# Copyright (c) 2006-2008, R Oudkerk
# Licensed to PSF under a Contributor Agreement.
#
__all__ = [ 'BaseManager', 'SyncManager', 'BaseProxy', 'Token',
'SharedMemoryManager' ]
#
# Imports
#
import sys... |
test_random.py | #!/usr/bin/env python
# Copyright (c) 2017-2019, Intel Corporation
#
# 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 co... |
max-threads-in-system.py | import multiprocessing
import os
import threading
import time
import _thread # for except _thread.error
class LimitedThread(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.die_out = threading.Event()
def run(self):
self.die_out.wait()
def info(title):
p... |
logging_test.py | # Copyright 2017 The Abseil 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 ... |
yaftp.py | from socket import socket, AF_INET, SOCK_STREAM
from .yaftp_request import YAFTPRequest, YAFTPLogin, YAFTPPwd, YAFTPDir, YAFTPCd, YAFTPGet, YAFTPSend, YAFTPBye, YAFTPDelete
from .yaftp_response import YAFTPResponse, YAFTPResponseParser
import threading
class YAFTP:
def __init__(self, address: (str, int) = ("127.0.... |
__init__.py | # import nonebot
from nonebot import get_driver
from .config import Config
from nonebot import on_command, on_keyword
from nonebot.rule import to_me, regex, Rule
from nonebot.log import logger
from .model import database
import time
import asyncio
from threading import Thread, Lock
import re
import requests
import w... |
child.py | """Child worker process module."""
import os
import sys
import time
import pickle
import signal
import socket
import shutil
import inspect
import logging
import argparse
import platform
import threading
import subprocess
def parse_cmdline():
"""Child worker command line parsing"""
parser = argparse.ArgumentP... |
leader.py | # import socket programming library
import socket
import json
# import thread module
from _thread import *
import threading
from time import sleep
import partitionFile as pf
import backup as bk
print_lock = threading.Lock()
nodes = {'l':{},'f':{}}
resources = {}
not_available = []
def ping_udp(host,port):
s... |
soundhandler.py | # This file is part of the pyBinSim project.
#
# Copyright (c) 2017 A. Neidhardt, F. Klein, N. Knoop, T. Köllmer
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, includi... |
mineCoin.py | import hashlib as hl
import requests as rq
from sys import argv, maxsize
from base64 import b64encode
from json import dumps
from time import time, sleep, asctime
from multiprocessing import Process, Manager
class Miner():
def __init__(self, id, id_of_miner, nonce_interval, event):
self.event = event
... |
params.py | #!/usr/bin/env python3
"""ROS has a parameter server, we have files.
The parameter store is a persistent key value store, implemented as a directory with a writer lock.
On Android, we store params under params_dir = /data/params. The writer lock is a file
"<params_dir>/.lock" taken using flock(), and data is stored in... |
camgear.py | """
===============================================
vidgear library source-code is deployed under the Apache 2.0 License:
Copyright (c) 2019 Abhishek Thakur(@abhiTronix) <abhi.una12@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with th... |
rpyc_tools.py | from . import greenlets
import threading
import os
DEFAULT_PORT = 6666
DEFAULT_HOST = "127.0.0.1"
def run_server(host=DEFAULT_HOST, port=DEFAULT_PORT, unix_socket=None, patch_greenlet=True, service_class_getter=None, **server_args):
if patch_greenlet and greenlets.greenlet_available:
greenlets.patch()
... |
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... |
triangulate.py | """!
\file triangulate.py
\module lammpstools.py
Routines for performing a triangulation and analysing it.
"""
def triangulate( b, rc, dims, method = None ):
""" ! Triangulates given block. """
lammpstools = cdll.LoadLibrary("/usr/local/lib/liblammpstools.so")
pname_base = '/tmp/lammpstools_triangulat... |
loopFunctions.py | from __future__ import division
from Tkinter import *
from pyo import *
from generalDicts import *
import os
import threading
import time
from changeFunctions import *
# Contains framework for recording, playing, and pausing loops.
def convertBPMToTime(data):
secondsPerBeat = 60/data.BPM
return secondsPerBe... |
webapp.py | import flask
import flask_compress
from gevent.pywsgi import WSGIServer
import threading
import sqlite3
import os
import sys
import json
from collections import deque
import gettext
from pprint import pprint
import settings
import screen
import playlist
dbconn = None
def extractSingers(song):
song2={'id':song[... |
diagnostic.py | #!/usr/bin/env python
#
# Azure Linux extension
#
# Linux Azure Diagnostic Extension (Current version is specified in manifest.xml)
# Copyright (c) Microsoft Corporation All rights reserved.
# MIT License
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated do... |
test_flask_idempotent.py | import multiprocessing.pool
import threading
import time
import uuid
import requests
import unittest2
from flask import Flask, render_template_string
from werkzeug.serving import make_server
from flask_idempotent import Idempotent
app = Flask(__name__)
idempotent = Idempotent(app)
@app.route("/", methods=['GET', '... |
QuarryPlayer.py | from quarry.types.buffer import Buffer1_14
from quarry.types.chat import Message
from threading import Thread
from enum import Enum
from typing import Dict
from bitstring import BitStream
import numpy as np
import time
_MinecraftQuarryClient = object
if __name__ == '__main__':
from MinecraftQuarryClient import Min... |
fsfreezer.py | #!/usr/bin/env python
#
# VM Backup extension
#
# Copyright 2014 Microsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... |
multiprocess.py | import logging
import multiprocessing
import os
import signal
import sys
import time
import click
HANDLED_SIGNALS = (
signal.SIGINT, # Unix signal 2. Sent by Ctrl+C.
signal.SIGTERM, # Unix signal 15. Sent by `kill <pid>`.
)
logger = logging.getLogger("uvicorn.error")
class Multiprocess:
def __init__(... |
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, Callable, Dict, Iterator, List, Optional, Tuple, Union
# Ray modules
from ra... |
RemoteSystem.py | from JumpScale import j
# This extension is available at j.tools.ssh_remotesystem
import warnings
# warnings.filterwarnings('ignore', r'.*sha.*')
import paramiko
import os
import socket
from JumpScale import j
try:
import socketserver as socketserver
except:
import socketserver
import select
import threadi... |
blobstore_service.py | import os
import threading
import logging
import re
blobstore_service = None
server = None
from wsgiref.simple_server import WSGIRequestHandler
class NoLogRequestHandler(WSGIRequestHandler):
def log_request(self, code='-', size='-'):
"""Normally logs an accepted request. Bug given
that this is ... |
util.py | import os
import re
import sys
import time
import json
import signal
from urllib.request import urlopen
from urllib.parse import urlparse
from decimal import Decimal
from urllib.parse import quote
from datetime import datetime
from subprocess import TimeoutExpired, Popen, PIPE, DEVNULL, CompletedProcess, CalledProcess... |
applications_test.py | import pytest
import random
import os
from multiprocessing import Process, Queue
from keras.utils.test_utils import keras_test
from keras.utils.test_utils import layer_test
from keras.models import Sequential
from keras import applications
from keras import backend as K
pytestmark = pytest.mark.skipif(
os.environ... |
Bot.py | #######################
####### Imports #######
#######################
from selenium import webdriver
from selenium.webdriver.support import expected_conditions as when
from selenium.webdriver.common.by import By as by
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriver... |
contributor_interface.py | from requests.api import head
from workers.worker_base import *
import logging
from logging import FileHandler, Formatter, StreamHandler, log
from workers.worker_git_integration import WorkerGitInterfaceable
from workers.util import read_config
from psycopg2.errors import UniqueViolation
from random import randint
impo... |
tscout.py | #!/usr/bin/python3
import argparse
import logging
import multiprocessing as mp
import os
import sys
from dataclasses import dataclass
import model
import psutil
import setproctitle
from bcc import ( # pylint: disable=no-name-in-module
BPF,
USDT,
PerfHWConfig,
PerfType,
utils,
)
@dataclass
class ... |
task_adapter.py | #!/usr/bin/python
from global_var import config, logger
from utils import check_kingship, start_dbpc
import threading
def run():
from kombu import Connection, Exchange, Queue
from consumer import consumer
with Connection(config['mq_connection']) as conn:
ex = Exchange(config['query_exchange'])
... |
mpi.py | from __future__ import absolute_import, division, print_function
import inspect
import os
import pickle
import sys
import threading
import time
import types
from abc import ABCMeta, abstractmethod
from collections import defaultdict
from functools import wraps
from multiprocessing import (Lock, Pipe, Process, Queue, V... |
ableton_playground.py | import sys
import live
from instruments.drums import Drums
from instruments.synth_lead import SynthLead
from instruments.synth_harmony import SynthHarmony
from threading import Thread
import time
import mido
# def start_ableton_thread():
# t = Thread(target=ableton_thread)
# t.start()
def ableton_thread():
... |
async_rl.py |
import time
import multiprocessing as mp
import psutil
import torch
from collections import deque
from rlpyt.runners.base import BaseRunner
from rlpyt.utils.quick_args import save__init__args
from rlpyt.utils.logging import logger
from rlpyt.utils.collections import AttrDict
from rlpyt.utils.seed import set_seed
from... |
viewsets.py | from appfd.models import Basemap, Feature, Order, Place, Test
from appfd.views import get_map, request_map_from_sources
from appfd.scripts.ai import update_popularity_for_order
from apifd.mixins import CsrfExemptSessionAuthentication
from apifd.serializers import BasemapSerializer, FeatureSerializer, QueryableOrderSeri... |
service_manager.py | import json
import multiprocessing
import os
import subprocess
import sys
import tempfile
import uvicorn
from ariadne.asgi import GraphQL
LAUNCHED_SERVICES = []
federation = []
GATEWAY_PATH = os.path.join(os.path.dirname(__file__), "..", "gateway")
class ServiceTypes:
SELF = "self"
EXTERNAL = "external"
... |
test_scheduler.py | import os
from datetime import datetime, timedelta, timezone
from multiprocessing import Process
import mock
from rq import Queue
from rq.compat import PY2
from rq.exceptions import NoSuchJobError
from rq.job import Job, Retry
from rq.registry import FinishedJobRegistry, ScheduledJobRegistry
from rq.scheduler import R... |
tasks.py | import json
import logging
from datetime import datetime, timedelta
from hashlib import sha256
from billiard import Pipe, Process
from celery import shared_task, chord
from celery.result import AsyncResult
from celery.states import READY_STATES, PENDING
#from celery_haystack.tasks import CeleryHaystackSignalHandler, C... |
Binance_Detect_Moonings.py | """
Disclaimer
All investment strategies and investments involve risk of loss.
Nothing contained in this program, scripts, code or repositoy should be
construed as investment advice.Any reference to an investment's past or
potential performance is not, and should not be construed as, a recommendation
or as a guarantee... |
rse.py | # -*- coding: utf-8 -*-
# Copyright CERN since 2014
#
# 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 ... |
utils.py | """
Some common functions
"""
from __future__ import division
import os
import re
import string
import random
import urlparse
import socket
import subprocess
import functools
import multiprocessing
import threading
from passlib.hash import bcrypt as crypt_engine
import slugify
import jinja2
def get_base_dir():
""... |
tuq_cluster_ops.py | import time
import threading
import json
from security.auditmain import audit
from tuqquery.tuq_join import JoinTests
from remote.remote_util import RemoteMachineShellConnection
from membase.api.rest_client import RestConnection
from membase.helper.cluster_helper import ClusterOperationHelper
from backuptests import Ba... |
cfbypass.py | import cfscrape
import os
import random
import time
import requests
import threading
from colorama import Fore
print(Fore.YELLOW + """
____ _____ ______ ______ _ ____ ____
/ ___| ___| | __ ) \ / / _ \ / \ / ___/ ___|
| | | |_ | _ \\ V /| |_) / _ \ \___ \___ \ \r
| |___| _| | |_) || | | __/ _... |
ray_tracing_in_python.py | # -*- coding: utf-8 -*-
"""----------------------------------------------------------------------------
Author:
Huang Quanyong (wo1fSea)
quanyongh@foxmail.com
Date:
2018/9/13
Description:
ray_tracing_in_python.py
----------------------------------------------------------------------------"""
import thr... |
__init__.py | # Copyright 2017 Mycroft AI 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 writin... |
my_deepzoom_pdf.py | #!/usr/bin/python
## Copyright (c) 2008, Kapil Thangavelu <kapil.foss@gmail.com>
## All rights reserved.
## Redistribution and use in source and binary forms, with or without
## modification, are permitted provided that the following conditions are
## met:
## Redistributions of source code must retain the above c... |
handlers.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
.. module:: __init__
:synopsis: module that contains request handlers.
"""
import json
import logging
import os
import re
import time
import socket
import struct
import traceback
import copy
import threading
from urllib.parse import quote_plus, urlparse, unquote
from... |
common.py | # SPDX-FileCopyrightText: Copyright (c) 2020 Dan Halbert for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
`_bleio.common`
=======================================================================
_bleio implementation for Adafruit_Blinka_bleio
* Author(s): Dan Halbert for Adafruit Industries
"""
from __futu... |
test_wsgi.py | import sys
import asyncio
import threading
import httpx
import pytest
from a2wsgi.wsgi import WSGIMiddleware, Body, build_environ
def test_body():
event_loop = asyncio.new_event_loop()
threading.Thread(target=event_loop.run_forever, daemon=True).start()
async def receive():
return {
... |
test_IndexSemaphore.py | from threading import Lock, Thread
from lox import IndexSemaphore
from time import time, sleep
from collections import deque
SLEEP_TIME = 0.01
n_resource = 5
n_threads = 20
def test_multithread_args():
resp = deque()
sem = IndexSemaphore(n_resource)
locks = [Lock() for _ in range(n_resource)]
def fu... |
Data.py | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 27 09:17:25 2018
@author: William Huang
"""
import pandas as pd
from yahoofinancials import YahooFinancials
import datetime as dt
import numpy as np
import math
import threading
from bdateutil import isbday
from bdateutil import relativedelta
import holidays
class Fina... |
sdca_ops_test.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
server.py | import os
import threading
import socketserver
import logging
import signal
from converter import convert
class ThreadedUDPRequestHandler(socketserver.BaseRequestHandler):
def handle(self):
try:
data = self.request[0].decode()
except Exception:
logging.exception("Unable to... |
disposallist.py | # список задач
from libs.uix.baseclass.disposalsdroid import connect_manager
from kivymd.uix.button import MDFlatButton
from kivy.app import App
from kivymd.uix.label import MDLabel
from kivy.metrics import dp
import threading
from kivy.clock import Clock, mainthread
from kivy.uix.recycleview import RecycleView,Recycle... |
main.py | #!/bin/env python
"""
The MIT License
Copyright (c) 2010 The Chicago Tribune & Contributors
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 ... |
wikiextractor.py | # -*- coding: utf-8 -*-
import bz2
import codecs
import re
from Queue import Queue
from threading import Thread
from infobox import parse_infobox
class WikiExtractor:
def __init__(self, fn, relwords):
self.fp = codecs.getreader('utf-8')(bz2.BZ2File(fn), errors='replace')
self.relre = re.compile(... |
Hiwin_RT605_ArmCommand_Socket_20190627173923.py | #!/usr/bin/env python3
# license removed for brevity
import rospy
import os
import socket
##多執行序
import threading
import time
import sys
import matplotlib as plot
import HiwinRA605_socket_TCPcmd as TCP
import HiwinRA605_socket_Taskcmd as Taskcmd
import numpy as np
from std_msgs.msg import String
from ROS_Socket.srv imp... |
runjobhandler.py | from strongr.clouddomain.handler.abstract.cloud import AbstractRunJobHandler
import sys
from strongr.clouddomain.model.gateways import Gateways
if sys.version_info[0] > 3 and sys.version_info[1] > 3:
# python > 3.3 uses shlex.quote
from shlex import quote
else:
from pipes import quote
import os
import su... |
insight.py | # !/usr/local/bin/python3
############################################################
#
# Python3 only
#
# must install matplotlib to work properly
#
#
# Given a list of statistics
# scan csv files and draw
# graph
#
# By default, run this script from sdk/testing directory,
# it will list subdirectories unde... |
test_cluster_setup.py | import re
from django.utils.unittest import TestCase
from testconfig import config
from tests.integration.core.remote_operations import RealRemoteOperations
import logging
logger = logging.getLogger("test")
logger.setLevel(logging.DEBUG)
class TestClusterSetup(TestCase):
@property
def config_servers(self)... |
kinesis.py |
from __future__ import absolute_import
import argparse
from datetime import datetime
import logging
import Queue
import sys
import time
import threading
import uuid
import boto3
import msgpack
import strongfellowbtc.constants as constants
import strongfellowbtc.hex
from strongfellowbtc.protocol import ds256
import ... |
test_pooling.py | # Copyright 2009-2012 10gen, 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,... |
proxy.py | import socket, sys
import threading
import time
allowedDomains = ["iitkgp.ac.in","iitk.ac.in"]
def httpUrlParser(url):
"Parses the given URL to get URI and Port"
portocolIndicator = url.find("://")
portIndicator = url.find(":", portocolIndicator + 3)
if portIndicator == -1:
port = 80
if portocolIndicator == -... |
power_monitoring.py | import random
import threading
import time
from statistics import mean
from typing import Optional
from cereal import log
from common.params import Params, put_nonblocking
from common.realtime import sec_since_boot
from selfdrive.hardware import HARDWARE
from selfdrive.swaglog import cloudlog
from selfdrive.statsd imp... |
mp02process.py | #!/usr/bin/env python
"""mp2process.py: Use multiprocessing.Process
Usage:
mp2process.py
"""
from multiprocessing import Process
def f(name):
print('hello', name)
def main():
p = Process(target=f, args=('bob',))
p.start()
p.join()
if __name__ == '__main__':
main()
|
__init__.py | """Support for functionality to download files."""
import logging
import os
import re
import threading
import requests
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.util import sanitize_filename
_LOGGER = logging.getLogger(__name__)
ATTR_FILENAME = "filename"
ATTR_... |
collate_all_multiprocess.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import time
import sys
import subprocess
import signal
import socket
import json
import urllib.request
import urllib.error
import urllib.parse
import multiprocessing
import logging
import collatex
from contextlib import contextmanager
# Collatex settings:
COLLA... |
test_geodesc.py | #!/usr/bin/env python
"""
Copyright 2018, Zixin Luo, HKUST.
Conduct pair-wise image matching.
"""
# adapted from https://github.com/lzx551402/geodesc/blob/master/examples/image_matching.py
import sys
sys.path.append("../../")
import config
config.cfg.set_lib('geodesc')
#from __future__ import print_function
impor... |
draw_gap_trading_delay.py | import numpy as np
np.set_printoptions(linewidth=200)
import matplotlib.pyplot as plt
import matplotlib.dates
import matplotlib.ticker
import socket
import multiprocessing
import time
import pickle
import datetime
UDP_IP = "188.166.115.7"
UDP_BROADCAST_PORT = 7001
UDP_EXCHANGE_PORT = 8001
HELLO_MESSAGE = "TYPE=SUBSCRI... |
Six.py | # -*- coding: utf-8 -*-
import KRIS
from KRIS.lib.curve.ttypes import *
from datetime import datetime
import time, random, sys, ast, re, os, io, json, subprocess, threading, string, codecs, requests, ctypes, urllib, urllib2, urllib3, wikipedia, tempfile
from bs4 import BeautifulSoup
from urllib import urlopen
import r... |
emails.py | # -*- coding: utf-8 -*-
"""
Created by 亥虫 on 2019/5/12
"""
from threading import Thread
from flask import current_app, render_template
from flask_mail import Message
from albumy.extensions import mail
def _send_async_mail(app, message):
with app.app_context():
mail.send(message)
def send_mail(to, ... |
serveur_config.py | #!/usr/bin/env python
#coding: utf-8
from __future__ import division, print_function
from picamera import PiCamera
from picamera.array import PiRGBArray
from PIL import Image
import Adafruit_PCA9685
import os
import glob
import bottle
import threading
from argparse import ArgumentParser
import inotify.adapters
from c... |
augment_trajectories.py | import os
import sys
sys.path.append(os.path.join(os.environ['ALFRED_ROOT']))
sys.path.append(os.path.join(os.environ['ALFRED_ROOT'], 'gen'))
import json
import glob
import os
import constants
import cv2
import shutil
import numpy as np
import argparse
import threading
import time
import copy
import random
from utils.... |
agents.py | import torch.multiprocessing as mp
from pytorch_rl.utils import *
class OffPolicyContinuousAgent:
def __init__(self, algorithm, policy, callbacks, args):
self.algorithm = algorithm
self.policy = policy
self.args = args
self.callbacks = callbacks
def train(self, env):
#T... |
test_event_api.py | import unittest
from threading import Thread
from metaroot.api.event_client import EventClientAPI
from metaroot.api.result import Result
from metaroot.event.consumer import Consumer
class EventAPIRequestHandler:
def add_group(self, group_atts: dict) -> Result:
return Result(0, group_atts)
def initial... |
build_pretraining_dataset.py | # coding=utf-8
# Copyright 2020 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
traceroute.py | #!/usr/bin/env python3
import os
import socket
import struct
import icmplib
import platform
import threading
R = '\033[31m' # red
G = '\033[32m' # green
C = '\033[36m' # cyan
W = '\033[0m' # white
Y = '\033[33m' # yellow
def icmp_trace(ip, tr_tout, output, collect):
result = icmplib.traceroute(ip, count=1, interva... |
ops_test.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... |
runintegration.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from argparse import ArgumentParser
import threading
import sys
import socket
import os
import time
import SocketServer... |
supervisor.py | # Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
mp_tutorial_2_input.py | import multiprocessing
def worker(num):
"""
Worker function
"""
print("worker:", num)
return
if __name__ == '__main__':
jobs = []
for i in range(5):
#target is the function we are sending to Process
#args must be a tuple otherwise it will evaluate the item itself
p ... |
run_hk.py | import json
import logging
import os
import random
import signal
import time
import toml
from forms import convert
from paho.mqtt import client as mqtt_client
from pyhap.accessory import Accessory, Bridge
from pyhap.const import CATEGORY_SENSOR
from domoticz import fresh_list, acc_data
from multiprocessing import Proc... |
Thread.py | import threading
import time
import inspect
import ctypes
def _async_raise(tid, exctype):
"""raises the exception, performs cleanup if needed"""
tid = ctypes.c_long(tid)
if not inspect.isclass(exctype):
exctype = type(exctype)
res = ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, ctypes.py_obje... |
db_rss_channel_mod.py | from threading import Thread
from webapp import app, db_log_mod
from webapp.db_context_manager_mod import DatabaseConnection, ConnectionError, CredentialsError, SQLError
def add_channel(list_from_request: tuple, list_for_log: tuple) -> None:
"""
Добавляет элемент в channel_tab.
:param list_from_request: ... |
priority_queue_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... |
QRCode.py | import json
import cv2 #OpenCV in my opinion best library for work with camera
from pyzbar.pyzbar import decode #Zbar - best opensource library for work with QRcode. OpenCV also can it, but not in every build.
import socket
import time
import os
import script
from pynput import keyboard
import threading
RPicamera = F... |
postproc.py | #!/usr/bin/python -OO
# Copyright 2007-2018 The SABnzbd-Team <team@sabnzbd.org>
#
# 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... |
host.py | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright (c) 2010 Citrix Systems, Inc.
# Copyright (c) 2011 Piston Cloud Computing, Inc
# Copyright (c) 2012 University Of Minho
# (c) Copyright 2013 Hewlett-Pa... |
event_source.py | # -*- coding: utf-8 -*-
#
# Copyright 2017 Ricequant, 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 ... |
atcp_server.py | #!/usr/bin/env python
#coding=utf-8
import socket
import select
import time
import logging
import urlparse
import threading
#==conf==
READ_CHUNK_SIZE = 1024*1024
BAKLOG_SIZE = 1024
SERVER_TAG = "interma atcpserver 0.1"
#logger
logger = logging.getLogger('interma.atcpserver')
#fh = logging.FileHandler("sample.log")... |
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... |
Client.py | import socket
import threading
PORT = 5050
FORMAT = 'ascii'
SERVER = socket.gethostbyname(socket.gethostname())
nickname = input("Enter Username: ")
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect((SERVER, PORT))
def write():
run = True
while run:
msg = f"{nickname}: {input(... |
helpers.py | """High-level functions to help perform complex tasks
"""
from __future__ import print_function, division
import os
import multiprocessing as mp
import warnings
from datetime import datetime
import platform
import struct
import shutil
import copy
import time
from ast import literal_eval
import traceback
import sys
im... |
data_plane.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... |
syncmd.py | import sys
from subprocess import Popen, PIPE
from threading import Thread
try:
from Queue import Queue, Empty
except ImportError:
from queue import Queue, Empty
ON_POSIX = 'posix' in sys.builtin_module_names
__STDOUTBUF__ = ''
def exec_cmd(cmd):
ret = {}
proc = Popen(cmd,
shell=Tr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.