source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
ruuvi_gw_http_server.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import binascii
import copy
import datetime
from socketserver import ThreadingMixIn
from http.server import BaseHTTPRequestHandler, HTTPServer
import socketserver
import threading
import argparse
import re
import json
import time
import os
import sys
import shutil
import io... |
local.py | import os
import sys
import re
from threading import Thread, Timer
import time
from PyQt5.QtCore import QSize, pyqtSignal, QTimer
from PyQt5.QtGui import QIcon, QPixmap, QKeyEvent, QBitmap
from PyQt5.QtWidgets import QWidget, QMainWindow, QLabel, QPushButton, QHBoxLayout, QVBoxLayout, QDesktopWidget, \
QApplicati... |
lisp.py | # -----------------------------------------------------------------------------
#
# Copyright 2013-2019 lispers.net - Dino Farinacci <farinacci@gmail.com>
#
# 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... |
websocket.py | """
@author: rakeshr
"""
"""
Websocket client that streams data of all strikes contract
for requested option symbol
"""
import json, logging, asyncio, time
from multiprocessing import Process, Queue
from kiteconnect import KiteConnect, KiteTicker
from optionchain_stream.instrument_file import InstrumentMaster
clas... |
ScrollPhat.py | #!/usr/bin/python3f
# -*- coding: utf-8 -*-
from datetime import datetime
from threading import Thread
from time import sleep
import scrollphat
from modules.Config import *
from modules.Data import Data
from modules.Log import log_str
class ScrollPhat(object):
brightness = LOW.scrollphat
brightness_setting... |
runner.py | import click
import os
import multiprocessing
import time
import hashlib
import shlex
import json
import logging
from tempfile import TemporaryDirectory
from concurrent.futures import ThreadPoolExecutor, TimeoutError
from contextlib import contextmanager
from threading import Thread, Lock, RLock, Condition
from flask_s... |
test_wsgiref.py | from unittest import mock
from test import support
from test.test_httpservers import NoLogRequestHandler
from unittest import TestCase
from wsgiref.util import setup_testing_defaults
from wsgiref.headers import Headers
from wsgiref.handlers import BaseHandler, BaseCGIHandler, SimpleHandler
from wsgiref import ut... |
human_agent.py | #!/usr/bin/env python
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
This module provides a human agent to control the ego vehicle via keyboard
"""
import time
from threading import Thread
import cv2
import numpy as np
try:
import pygame
... |
tools.py | from threading import Thread
import random
import string
def gettext_between(text: str, before: str, after: str, is_include=False) -> str:
"""
取出中间文本
:param text: 原文本
:param before: 前面文本
:param after: 后面文本
:param is_include: 是否取出标识文本
:return: 操作后的文本
"""
b_index = text.find(before)
... |
main.py | #!/usr/bin/env python
import os
import multiprocessing
import time
from system import version_request
print("This is main.py , progress:" + __name__)
def __doLoadModules():
try:
import rmrb.modules
except Exception, e:
print '__doLoadModules, excp:%s' % e.message
finally:
print(... |
main.py | import math
import time
import traceback
from datetime import timedelta
from threading import Lock, Thread
import pymongo
from pymongo import UpdateOne
from utils import api, battlenet, config, datetime, keys, log, redis, stats
from utils.mongo import mongo
task_index = 0
lock = Lock()
def inactive_ladder(region_n... |
command_output.py | #!/usr/bin/python2.4
# Copyright 2008, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of... |
smart-contract-rest-api.py | """
Example of running a NEO node, receiving smart contract notifications and
integrating a simple REST API.
Smart contract events include Runtime.Notify, Runtime.Log, Storage.*,
Execution.Success and several more. See the documentation here:
http://neo-python.readthedocs.io/en/latest/smartcontracts.html
This example... |
test_sys.py | from test import support
from test.support.script_helper import assert_python_ok, assert_python_failure
import builtins
import codecs
import gc
import locale
import operator
import os
import struct
import subprocess
import sys
import sysconfig
import test.support
import textwrap
import unittest
import warnings
# coun... |
ssl_loop_backup_20220102.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
loop thread to run ssl
"""
from scipy import stats
import numpy as np
from pyaudio import PyAudio, paInt16
from SoundSourceLocalization.SSL_Settings import *
from SoundSourceLocalization.ssl_feature_extractor import FeatureExtractor
# from SoundSourceLocalization... |
test_mcp23008_linux.py | import cpboard
import os
import periphery
import pytest
import queue
import random
import subprocess
import sys
import threading
import time
if not pytest.config.option.i2cbus:
pytest.skip("--bus is missing, skipping tests", allow_module_level=True)
address = 0x20
def mcp23008slave_func(tout, address, pins, int... |
test_connection.py | #!/usr/bin/env python
# test_connection.py - unit test for connection attributes
#
# Copyright (C) 2008-2011 James Henstridge <james@jamesh.id.au>
#
# psycopg2 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 Foun... |
automated.py | #!/usr/bin/env python3
# Copyright (c) 2017 Intel Corporation. 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
#
# Unle... |
crawl_and_scrape.py | import scrapy
from scrapy.http import Response
from scrapy.crawler import CrawlerProcess, CrawlerRunner
from scrapy.linkextractors import LinkExtractor
from scrapy.spiders import CrawlSpider, Rule
from twisted.internet import reactor
from .util import get_content, get_contents_path, get_domain
import os
import json
im... |
ARAX_query.py | #!/bin/env python3
import sys
def eprint(*args, **kwargs): print(*args, file=sys.stderr, **kwargs)
import os
import json
import ast
import re
import time
from datetime import datetime
import subprocess
import traceback
from collections import Counter
import numpy as np
import threading
import json
import uuid
from AR... |
xla_client_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... |
autograd-mechanics.py | # https://pytorch.org/docs/stable/notes/autograd.html
import torch, torchvision
import torch.nn as nn
from torch import optim
# excluding subgraphs from backward
x = torch.randn(5, 5)
y = torch.randn(5, 5)
z = torch.randn((5, 5), requires_grad=True)
a = x + y
a.requires_grad
b = a + z
b.requires_grad
model = torch... |
bpytop.py | #!/usr/bin/env python3
# pylint: disable=not-callable, no-member
# indent = tab
# tab-size = 4
# Copyright 2020 Aristocratos (jakob@qvantnet.com)
# 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... |
command.py | # -*- coding: utf-8 -*-
# Copyright 2015 Marko Dimjašević
#
# This file is part of JDoop.
#
# JDoop 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 3 of the License, or
# (at your option) any l... |
SWHear.py | #Found at https://github.com/swharden/Python-GUI-examples/blob/master/2016-07-37_qt_audio_monitor/SWHear.py
import pyaudio
import time
import numpy as np
import threading
def getFFT(data,rate):
"""Given some data and rate, returns FFTfreq and FFT (half)."""
data=data*np.hamming(len(data))
fft=np.fft.fft(d... |
util.py | import multiprocessing
import os
import threading
import time
import traceback
from typing import Callable, List
from bluefoglite.common import const
from bluefoglite.common.logger import Logger
def multi_thread_help(
size: int, fn: Callable[[int, int], None], timeout=10
) -> List[Exception]:
errors: List[Ex... |
tracker.py | """
This script is a variant of dmlc-core/dmlc_tracker/tracker.py,
which is a specialized version for xgboost tasks.
"""
# pylint: disable=invalid-name, missing-docstring, too-many-arguments, too-many-locals
# pylint: disable=too-many-branches, too-many-statements, too-many-instance-attributes
import socket
import str... |
monitoring.py | import sys
import libvirt
import time
import socket
import threading
IP = '0.0.0.0'
PORT_NO = 8080
IP_vm2 = '192.168.122.3'
PORT_vm2 = 50000
DOM1_NAME = "vm1_name"
DOM2_NAME = "vm2_name"
CPU_USAGE_THRESHOLD = 85
HIGH_USAGE_ITERS_THRESHOLD = 3
# virConnectPtr handle
conn = None
# virDomainPtr handles
dom1 = None
dom2... |
power_monitoring.py | import random
import threading
import time
from statistics import mean
from cereal import log
from common.realtime import sec_since_boot
from common.params import Params, put_nonblocking
from common.hardware import TICI
from selfdrive.swaglog import cloudlog
PANDA_OUTPUT_VOLTAGE = 5.28
CAR_VOLTAGE_LOW_PASS_K = 0.091 ... |
train.py | import abc
import gym
import threading
class AbstractTrainer:
def __init__(self, env_kwargs, model_kwargs, **kwargs):
super().__init__(**kwargs)
self.env = None
self._env_kwargs = env_kwargs
self.model = None
self._model_kwargs = model_kwargs
self.is_initialized = F... |
client.py | import socket
import errno
import sys
import tkinter as tk
import threading
PORT = 1234
DEBUG_MODE = True
HEADER_LENGTH = 10
ENCODING = "UTF-8"
WIDTH = 325
HEIGHT = 500
THEME_COLOR = "#0D1216"
class ChatClient:
def __init__(self, port, name='Unknown'):
self.port = port
self.name = name
se... |
sltron.py | import csv
# use for environment variables
import os
import math
# use if needed to pass args to external modules
import sys
import telegram_send
# used to create threads & dynamic loading of modules
import threading
import importlib
# used for directory handling
import glob
# Needed for colorful console output Ins... |
status.py | import json
import logging
import os
import subprocess
import sys
import threading
import time
import kubernetes
from datetime import datetime
from http.client import responses
from tornado import ioloop, web
from gpsdclient import GPSDClient
API_PREFIX = '/api/v1'
UPDATE_INTERVAL = 10.0
ANNOTATION_PREFIX = 'time-syn... |
test_utils.py | # Copyright 2019 Google LLC
#
# 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, ... |
custom_multiprocessing.py | from queue import Queue, Empty
from threading import Thread
import subprocess
import sys
import time
def custom_async(f):
def wrapper(*args, **kwargs):
thr = Thread(target=f, args=args, kwargs=kwargs)
thr.start()
return wrapper
class process_pool(object):
def __init__(self, ... |
managers.py | #
# Module providing the `SyncManager` class 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' ]
#
# Imports
#
import sys
import threading
import ar... |
async_replay_memory.py | from franQ.Replay.replay_memory import ReplayMemory, OversampleError
from torch import multiprocessing as mp
from threading import Thread
import time
from franQ.common_utils import kill_proc_tree
class AsyncReplayMemory:
"""Creates a replay memory in another process and sets up an API to access it"""
def __i... |
client.py | #-----------------Boilerplate Code Start-----------
import socket
from tkinter import *
from threading import Thread
import random
from PIL import ImageTk, Image
screen_width = None
screen_height = None
SERVER = None
PORT = None
IP_ADDRESS = None
playerName = None
canvas1 = None
canvas2 = None
nameEntry = None
na... |
star_buffer.py | from collections import deque
import time
import os
from ctools.utils import remove_file
import queue
import threading
class StarBuffer(object):
def __init__(self, cfg, name):
self.name = name
self.meta_maxlen = cfg.meta_maxlen
self.min_sample_ratio = cfg.min_sample_ratio
self.data ... |
plot_server.py | from typing import Dict, Union, Tuple, Iterable, Callable, NoReturn, Optional, List, Sequence
import geopandas as gpd
import joblib as jl
import numpy as np
import shapely.geometry as sg
from holoviews import Overlay, Element
from holoviews.element import Geometry
from seedpod_ground_risk.core.utils import m... |
scheduler_job.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... |
texttospeech.py | #************************************************************************************************************************************************************************************
# Copyright (c) 2021 Tony L. Jones
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and a... |
tmp.py | import itertools
import json
import logging
import os
import time
from collections import deque
from six import iteritems, itervalues
from six.moves import queue as Queue
from pyspider.libs import counter, utils
from pyspider.libs.base_handler import BaseHandler
from .task_queue import TaskQueue
logger = logging.get... |
mqtt_tcp_example_test.py | import re
import os
import sys
from socket import *
from threading import Thread
import time
global msgid
def get_my_ip():
s1 = socket(AF_INET, SOCK_DGRAM)
s1.connect(("8.8.8.8", 80))
my_ip = s1.getsockname()[0]
s1.close()
return my_ip
def mqqt_server_sketch(my_ip, port):
global msgid
pri... |
handlers.py | # Copyright 2001-2016 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permissio... |
HiwinRA605_socket_ros_20190530112817.py | #!/usr/bin/env python3
# license removed for brevity
#接收策略端命令 用Socket傳輸至控制端電腦
import socket
##多執行序
import threading
import time
##
import sys
import os
import numpy as np
import rospy
import matplotlib as plot
from std_msgs.msg import String
from ROS_Socket.srv import *
from ROS_Socket.msg import *
import HiwinRA605_s... |
__init__.py | __author__ = "Johannes Köster"
__copyright__ = "Copyright 2022, Johannes Köster"
__email__ = "johannes.koester@uni-due.de"
__license__ = "MIT"
import os
import sys
import contextlib
import time
import datetime
import json
import textwrap
import stat
import shutil
import shlex
import threading
import concurrent.futures... |
download.py | import mimetypes
import os
import threading
from datetime import datetime, timedelta
from django.conf import settings
from django.http import Http404
from django.http import HttpResponse
from django.utils.encoding import iri_to_uri
from utils.jinja2.globals import url_encode
def respond_as_attachment(request, file_... |
freecad-pyopenvr.py | import time
import sdl2
import openvr
import numpy
from threading import Thread
from OpenGL.GL import *
from sdl2 import *
from pivy.coin import SoSeparator
from pivy.coin import SoGroup
from pivy.coin import SoBaseColor
from pivy.coin import SbColor
from pivy.coin import SbColor4f
from pivy.coin import SoSceneManage... |
server_v11.py | import socket
from threading import Thread
from lesson11_projects.house.data.const import (
MY_ROOM,
MSG_OPEN,
OUT,
MSG_SIT_DOWN,
STAIRS,
MSG_UP,
)
class ServerV11:
def __init__(self, host="0.0.0.0", port=5002, message_size=1024):
"""初期化
Parameters
----------
... |
queue_priority.py | #!/usr/bin/env python3
# encoding: utf-8
#
# Copyright (c) 2010 Doug Hellmann. All rights reserved.
#
"""PriorityQueue
"""
#end_pymotw_header
import functools
import queue
import threading
@functools.total_ordering
class Job:
def __init__(self, priority, description):
self.priority = priority
s... |
capacity.py | import multiprocessing as mp
import numpy as np
from scipy.cluster.vq import kmeans2
from scipy.optimize import linear_sum_assignment
from scipy.spatial.distance import cdist
import golf_course.estimate.numba as nestimate
from golf_course.utils import uniform_on_sphere
from tqdm import tqdm
def estimate_capacity(
... |
profiler_test.py | # Copyright 2020 Google LLC
#
# 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 writing, ... |
flats.py | #!/usr/bin/env python
import click
import sys
import json
from datetime import datetime
import os
import threading
import time
from random import random
sys.path.append("libs");
from log import log
import logging
import worker
class Config(object):
def __init(self):
self.debug = False
pass_config = clic... |
doc_isolation.py | import json
from threading import Thread
from basetestcase import ClusterSetup
from couchbase_helper.documentgenerator import doc_generator
from sdk_client3 import SDKClient
import com.couchbase.test.transactions.SimpleTransaction as Transaction
from reactor.util.function import Tuples
from sdk_exceptions import SDK... |
installwizard.py | # Copyright (C) 2018 The Electrum developers
# Distributed under the MIT software license, see the accompanying
# file LICENCE or http://www.opensource.org/licenses/mit-license.php
import os
import sys
import threading
import traceback
from typing import Tuple, List, Callable, NamedTuple, Optional, TYPE_CHECKING
from ... |
websocket_server.py | import socket
import threading
import hashlib
import base64
import struct
from colorama import Back
from loguru import logger as LOG
def server(host, port, backlog=100):
sock_srv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
with sock_srv:
sock_srv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEAD... |
roll_paillier_tensor.py | import uuid
from concurrent.futures.thread import ThreadPoolExecutor
from threading import Thread
from eggroll.core.aspects import _method_profile_logger
from eggroll.core.command.command_model import ErCommandRequest
from eggroll.core.constants import StoreTypes
from eggroll.core.io.kv_adapter import RocksdbSortedKvA... |
Importer.py | # -*- coding:utf-8 -*-
__all__ = ['Importer']
import sys, os,threading,json,math,traceback,gc,time
import requests,xlrd,pymysql
from requests_toolbelt import MultipartEncoder
from pymysql.cursors import DictCursor
from lib.Base import Base
class Importer(Base):
rootPath = os.path.dirname(os.path.realpath(sys.ar... |
test_conveyor.py | # -*- coding: utf-8 -*-
# Copyright European Organization for Nuclear Research (CERN) since 2012
#
# 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-... |
directory_tree_scanner.py | """ Module to output virtual scan a whole directory. """
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
try:
from Queue import Queue
except ModuleNotFoundError:
from queue import Queue
import os
from ocnn.virtualscanner.scanner_settings import S... |
run2_yundao2026.py | import os
from datetime import datetime
import time
import sys
import threading
import yaml
import moxing as mox
def copy_file(obs_path, cache_path):
if not os.path.exists(os.path.dirname(cache_path)): os.makedirs(os.path.dirname(cache_path))
print('start copy {} to {}: {}'.format(obs_path, cache_path, datetim... |
__init__.py | from service import MiningService
from subscription import MiningSubscription
from twisted.internet import defer
from twisted.internet.error import ConnectionRefusedError
import time
import simplejson as json
from twisted.internet import reactor
import threading
from mining.work_log_pruner import WorkLogPruner
@defer.... |
test_salesforce.py | import http.client
import threading
import time
import unittest
import urllib.error
import urllib.parse
import urllib.request
from unittest import mock
import responses
from cumulusci.oauth.salesforce import SalesforceOAuth2
from cumulusci.oauth.salesforce import CaptureSalesforceOAuth
class TestSalesforceOAuth(uni... |
chunk.py | from __future__ import print_function
from __future__ import unicode_literals
import logging
import threading
import warnings
import requests
logger = logging.getLogger(__name__)
class Chunk(object):
INIT = 0
DOWNLOADING = 1
PAUSED = 2
FINISHED = 3
STOPPED = 4
def __init__(self, downloader... |
build_image_data.py | """Converts image data to TFRecords file format with Example protos.
The image data set is expected to reside in JPEG files located in the
following directory structure.
data_dir/label_0/image0.jpeg
data_dir/label_0/image1.jpg
...
data_dir/label_1/weird-image.jpeg
data_dir/label_1/my-image.jpeg
...
where... |
test_sources.py | #
# Runtime Tests for Source Modules
#
import contextlib
import ctypes
import http.server
import json
import os
import socketserver
import subprocess
import tempfile
import threading
import pytest
import osbuild.objectstore
import osbuild.meta
import osbuild.sources
from .. import test
def errcheck(ret, _func, _ar... |
camera.py | import cv2
import threading
import time
import logging
import numpy as np
logger = logging.getLogger(__name__)
thread = None
def proccess(frame):
copy = frame.copy()
gray = cv2.cvtColor(copy, cv2.COLOR_BGR2GRAY)
return gray
class Camera:
def __init__(self,fps=30,video_source='rtmp://x.x.x.x:1935/live'):
logg... |
whisperbot.py | import config
from twisted.words.protocols import irc
from twisted.internet import reactor, protocol
import messagequeue
import datetime, time, sys, threading, os.path
class WhisperBot(irc.IRCClient):
"""Connects to twitch chat to carry out dirty whispers."""
nickname = config.botNick
passwo... |
test_backend.py | import datetime
import threading
import time
from datetime import timedelta
from typing import List, Union, cast
from unittest.mock import patch
import pytest
from django.core.cache import caches
from pytest_django.fixtures import SettingsWrapper
from pytest_mock import MockerFixture
import django_redis.cache
from dj... |
video.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
import cv2
import time
from threading import Thread
try:
from queue import Queue
except ImportError:
from Queue import Queue
from NumPyNet.image import Image
from NumPyNet.exception import Vide... |
async.py | """
raven.contrib.async
~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from Queue import Queue
from raven.base import Client
from threading import Thread, Lock
import atexit
import os
SENTRY_WAIT_SECONDS = 10
class... |
twisterlib.py | #!/usr/bin/env python3
# vim: set syntax=python ts=4 :
#
# Copyright (c) 2018 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import contextlib
import string
import mmap
import sys
import re
import subprocess
import select
import shutil
import shlex
import signal
import threading
import concurrent.fu... |
tsproxy.py | #!/usr/bin/env python
"""
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 applicab... |
interface.py | # Date: 06/07/2018
# Author: Pure-L0G1C
# Description: Interface for the master
from re import match
from lib import const
from hashlib import sha256
from time import time, sleep
from os import urandom, path
from threading import Thread
from datetime import datetime
from os import getcwd, path, remove
from... |
communication.py | import bpy
import time
import flask
import debugpy
import random
import requests
import threading
from functools import partial
from . utils import run_in_main_thread
from . environment import blender_path, scripts_folder
EDITOR_ADDRESS = None
OWN_SERVER_PORT = None
DEBUGPY_PORT = None
def setup(address, path_mapping... |
srhandler.py | from pox.core import core
import pox.openflow.libopenflow_01 as of
from pox.lib.revent import *
from pox.lib.util import dpidToStr
from pox.lib.util import str_to_bool
from pox.lib.recoco import Timer
from pox.lib.packet import ethernet
import time
import threading
import asyncore
import collections
import logging
imp... |
util.py | #
# Copyright (C) 2012-2016 The Python Software Foundation.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
import codecs
from collections import deque
import contextlib
import csv
from glob import iglob as std_iglob
import io
import json
import logging
import os
import py_compile
import re
import shutil
import socket
try:
... |
basic_functions.py | # -*- coding: utf-8 -*-
import os
import tempfile
import copy
import sys
import subprocess
import logging
import queue
import threading
import numpy as np
from .data_structures import Parameter, ParameterSet, SimulationSetup, \
SimulationSetupSet, Relation
#####################
# INPUT FILE HANDLING
def create... |
render.py | import time
from threading import Thread
import data_loader as dl
import torch
torch.backends.cudnn.benchmark = True
import numpy as np
from models import *
import utils
from tqdm import tqdm
import cv2
from pytorch_unet import UNet, SRUnet, SimpleResNet
from queue import Queue
# from apex import amp
def save_with_... |
reverse.py | import logging
import time
from BaseHTTPServer import BaseHTTPRequestHandler
from threading import Thread, Lock, Condition
from lib.proxy import proxy_sockets
from lib.stats import EC2StatsModel
from lib.utils import ThreadedHTTPServer
logger = logging.getLogger(__name__)
class Message(object):
def __init__(s... |
test_web_profile.py | """
Test the web profile using Python classes that have been adapted to act like a
web client. We can only put a single test here because only one hub can run
with the web profile active, and the user might want to run the tests in
parallel.
"""
import os
import threading
import tempfile
from urllib.request import Req... |
tracker.py | import sys
import time
import socket
import pickle
import threading
class Tracker:
def __init__(self, tag_id, port = 5555):
self.tag_id = tag_id
self.port = port
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
self.sock.... |
test_subprocess.py | import unittest
from unittest import mock
from test import support
import subprocess
import sys
import platform
import signal
import io
import itertools
import os
import errno
import tempfile
import time
import selectors
import sysconfig
import select
import shutil
import threading
import gc
import textwrap
from test.s... |
Dev_FastTsa.py | #!/usr/bin/python3
import os
import gzip
import json
import time
import threading
from b64 import b64encode
def get_ts_writer(ts_keyname, value_keynames):
def ts_writer(filename, key, data):
firstrow = True
with gzip.open(filename, "wt") as outfile:
for ts in sorted(data.keys()):
... |
serve.py | # -*- coding: utf-8 -*-
from __future__ import print_function
import abc
import argparse
import importlib
import json
import logging
import multiprocessing
import os
import platform
import signal
import socket
import subprocess
import sys
import threading
import time
import traceback
import urllib
import uuid
from co... |
tests.py | # -*- coding: utf-8 -*-
# Unit tests for cache framework
# Uses whatever cache backend is set in the test settings file.
from __future__ import unicode_literals
import copy
import os
import re
import shutil
import tempfile
import threading
import time
import unittest
import warnings
from django.conf import settings
... |
main.py | import itchat
import tkinter as tk
import threading
import time
import random
def itchat_thread(app):
@itchat.msg_register(itchat.content.TEXT)
def print_content(msg):
print(msg.text)
app.add_msg(msg)
itchat.auto_login()
itchat.run()
class FlyingText():
def __i... |
test_pdb.py | # A test suite for pdb; not very comprehensive at the moment.
import doctest
import os
import pdb
import sys
import types
import unittest
import subprocess
import textwrap
from contextlib import ExitStack
from io import StringIO
from test import support
# This little helper class is essential for testing pdb under do... |
extensions.py | import threading
from mycroft.configuration import Configuration
from mycroft.messagebus import Message
from mycroft.util.log import LOG
from mycroft.api import is_paired
from ovos_utils.system import ssh_enable, ssh_disable
from mycroft.gui.homescreen import HomescreenManager
from mycroft.gui.interfaces.smartspeaker ... |
events.py | # coding=utf8
from __future__ import unicode_literals, absolute_import, division, print_function
"""
This is the SpiceBot Events system.
"""
import sopel
from threading import Thread
import inspect
from SpiceBotCore.spicebot import spicebot
@sopel.module.event(spicebot.events.BOT_WELCOME, spicebot.events.BOT_READY, ... |
results_2_19_code.py | import tensorflow as tf
from tensorflow.keras.layers import Dense, Conv2D, MaxPooling2D, Dropout, Flatten, BatchNormalization
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras.callbacks import Callback
from os.path import join
from os ... |
_watchdog.py | """
Copyright 2022 InfAI (CC SES)
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... |
visualiser_test.py | """
Test the visualiser's javascript using PhantomJS.
"""
from __future__ import print_function
import os
import luigi
import subprocess
import sys
import unittest
import time
import threading
from selenium import webdriver
here = os.path.dirname(__file__)
# Patch-up path so that we can import from the directory ... |
playlist.py | import requests
import re
from bs4 import BeautifulSoup
import json
import time
import threading
import os
import pickle
headers = {
"Host":"music.163.com",
"Referer":"http://music.163.com/",
"User-Agent":"New"}
def Find(pat,text):
match = re.search(pat,text)
if match == None:
return ''
#print(match.group(1))
r... |
refactor.py | # Copyright 2006 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Refactoring framework.
Used as a main program, this can refactor any number of files and/or
recursively descend down directories. Imported as a module, this
provides infrastructure to write your own refactoring too... |
sstress.py | #!/usr/bin/env python
# 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 ... |
VIN.py | import torch
import torch.nn.functional as F
import numpy as np
from torch.utils.tensorboard import SummaryWriter
import datetime
import threading
import time
from rlib.utils.VecEnv import*
from rlib.utils.wrappers import*
from rlib.utils.utils import fold_batch, stack_many, one_hot, totorch, totorch_many, tonumpy
... |
competition_example.py | #!/usr/bin/env python3
import ffai
import socket
from ffai.ai.competition import PythonSocketClient, PythonSocketServer
from multiprocessing import Process
import time
import secrets
import ffai
def run_agent(registration_name, port, token):
"""
Starts a server that hosts an agent.
"""
agent = ffai.m... |
controller.py | """
.. _view-api:
Experiment Controller
=====================
Runs, controls, and displays Ceed experiments on screen, both during a "real"
experiment and when previewing it.
The purpose of Ceed is to run visual-temporal experiments. Once a
:mod:`~ceed.stage` containing one or more :mod:`~ceed.function`
a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.