text
stringlengths
213
32.3k
from __future__ import division, print_function """ Terminal Escape Sequences for input and display """ import re try: from urwid import str_util except ImportError: from urwid import old_str_util as str_util from urwid.compat import bytes, bytes3 # NOTE: because of circular imports (urwid.util -> urwid.e...
from __future__ import print_function import os import platform import sys from glob import glob from optparse import OptionParser lib_suffix = 'so' if (sys.platform == 'darwin'): lib_suffix = 'dylib' link_static = 'ROS_BOOST_LINK' in os.environ and os.environ['ROS_BOOST_LINK'] == 'static' if (link_static): ...
import copy import diamond.collector import json import urllib2 from urlparse import urlparse import diamond.collector from diamond.collector import str_to_bool class MesosCollector(diamond.collector.Collector): def __init__(self, config=None, handlers=[], name=None, configfile=None): self.known_framew...
import sys try: import iptc except TypeError: print( "Failed to import iptc. This happens sometimes during a python upgrade or during bootstrapping" ) sys.exit(0) from paasta_tools import iptables from paasta_tools.utils import get_docker_client def get_container_from_dport(dport, docker_cl...
import urllib.parse from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject, QUrl class PastebinClient(QObject): """A client for Stikked pastebins using HTTPClient. Attributes: _client: The HTTPClient used. Class attributes: API_URL: The base API URL. Signals: success: Emi...
import ldap from flask import current_app from lemur.users import service as user_service from lemur.roles import service as role_service from lemur.common.utils import validate_conf, get_psuedo_random_string class LdapPrincipal: """ Provides methods for authenticating against an LDAP server. """ ...
from datetime import timedelta import mbddns import voluptuous as vol from homeassistant.const import ( CONF_DOMAIN, CONF_HOST, CONF_PASSWORD, CONF_SCAN_INTERVAL, ) from homeassistant.helpers.aiohttp_client import async_get_clientsession import homeassistant.helpers.config_validation as cv from homea...
from __future__ import print_function from logilab.common import modutils, Execute as spawn from logilab.common.astutils import * import os.path MY_DICT = {} def global_access(key, val): """function test""" local = 1 MY_DICT[key] = val for i in val: if i: del MY_DICT[i] ...
from . import SleepIQSensor from .const import DOMAIN, SENSOR_TYPES, SIDES, SLEEP_NUMBER ICON = "mdi:bed" def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the SleepIQ sensors.""" if discovery_info is None: return data = hass.data[DOMAIN] data.update() dev ...
from django.core import mail from django.urls import reverse from weblate.auth.models import Permission, Role from .test_views import ViewTestCase class NewLangTest(ViewTestCase): expected_lang_code = "pt_BR" def create_component(self): return self.create_po_new_base(new_lang="add") def test_...
from test import unittest from diamond.metric import Metric class TestMetric(unittest.TestCase): def testgetPathPrefix(self): metric = Metric('servers.com.example.www.cpu.total.idle', 0, host='com.example.www') actual_value = metric.getPathPrefix...
from __future__ import print_function import argparse import os import shutil import sys def pprint(path): if path.startswith(os.environ['HOME']): return '~' + path.split(os.environ['HOME'], 1)[-1] return path def main(args): ap = argparse.ArgumentParser() ap.add_argument('source', nargs='...
import os import os.path as op import pytest from mne.utils import (_fetch_file, requires_good_network, catch_logging, sizeof_fmt) @pytest.mark.timeout(60) @requires_good_network @pytest.mark.parametrize('url', ( 'https://raw.githubusercontent.com/mne-tools/mne-python/master/README.rst',...
import logging from typing import Callable, List, Optional import attr import voluptuous as vol from homeassistant.components import mqtt from homeassistant.components.automation import AutomationActionType from homeassistant.components.device_automation import TRIGGER_BASE_SCHEMA from homeassistant.const import CON...
import diamond.collector import socket import re class ZookeeperCollector(diamond.collector.Collector): def get_default_config_help(self): config_help = super(ZookeeperCollector, self).get_default_config_help() config_help.update({ 'publish': "Which rows of 'status' y...
import re from datetime import date from uuid import uuid4 from django import template from django.contrib.humanize.templatetags.humanize import intcomma from django.template.loader import render_to_string from django.urls import reverse from django.utils import timezone from django.utils.html import escape from djan...
import datetime import logging import sys from builtins import str from uuid import uuid4 from .client import OpenTSDBClient from .decoder import Decoder from ...common.interfaces import AbstractPlugin, \ MonitoringDataListener, AggregateResultListener logger = logging.getLogger(__name__) # pylint: disable=C010...
import pytest from unittest.mock import Mock from kombu.utils.scheduling import FairCycle, cycle_by_name class MyEmpty(Exception): pass def consume(fun, n): r = [] for i in range(n): r.append(fun(Mock(name='callback'))) return r class test_FairCycle: def test_cycle(self): r...
from flask import jsonify, make_response, request from functools import wraps def add_response_headers(headers=None, default_headers=None, cors=False): """ Adds a bunch of headers to the Flask responses :param headers: a dictionary of headers and values to add to the response :param default_headers: ...
import os import unittest import mock from perfkitbenchmarker.linux_benchmarks import glibc_benchmark from perfkitbenchmarker.linux_packages import glibc # Test metadata values _TEST_GCC_VERSION = '7.4.0' _TEST_NUM_VMS = 5 class GlibcTestCase(unittest.TestCase): def setUp(self): super(GlibcTestCase, self)...
from unittest import mock import pytest from meld.const import ActionMode from meld.matchers.myers import DiffChunk def make_chunk(chunk_type): return DiffChunk(chunk_type, 0, 1, 0, 1) @pytest.mark.parametrize("mode, editable, chunk, expected_action", [ # Replace mode with replace chunks (ActionMode....
import gc from stash.tests.stashtest import StashTestCase class GciTests(StashTestCase): """tests for the 'gci' command.""" def setUp(self): """setup the tests.""" StashTestCase.setUp(self) gc.enable() # make sure gc is enabled. def test_help(self): """test 'gci --help...
import json import httpretty import pytest from hangups import auth # pylint: disable=redefined-outer-name class FakeCredentialsPrompt(auth.CredentialsPrompt): def __init__(self): self.was_prompted = False def get_email(self): self.was_prompted = True return 'test@example.com' ...
import logging from homeassistant.components.notify import ( ATTR_DATA, ATTR_TARGET, ATTR_TITLE, ATTR_TITLE_DEFAULT, BaseNotificationService, ) from homeassistant.const import ATTR_LATITUDE, ATTR_LOCATION, ATTR_LONGITUDE, ATTR_NAME from . import DOMAIN as BMW_DOMAIN ATTR_LAT = "lat" ATTR_LOCATIO...
from flexx.app._component2 import PyComponent, JsComponent from flexx.app._component2 import BaseAppComponent, LocalComponent, ProxyComponent from flexx.event import Component from flexx import event, app from flexx.util.testing import run_tests_if_main, raises, skip class StubSession: id = 'y' status = 2 ...
from __future__ import absolute_import import unittest import lxml.html from .common_imports import doctest, HelperTestCase, skipif try: import cssselect except ImportError: cssselect = None HTML = ''' <div> <a href="foo">link</a> <a>anchor</a> </div> ''' class CSSTestCase(HelperTestCase): pyt...
import numpy as np from .utils import _ensure_int, verbose, logger ############################################################################### # Class for interpolation between adjacent points class _Interp2(object): r"""Interpolate between two points. Parameters ---------- control_points : ar...
from homeassistant.components.binary_sensor import DOMAIN, BinarySensorEntity from homeassistant.exceptions import PlatformNotReady from . import CONF_MONITORED_CONDITIONS, DATA_KEY, LTEEntity from .sensor_types import BINARY_SENSOR_CLASSES async def async_setup_platform(hass, config, async_add_entities, discovery_...
import logging import re from hashlib import md5 import urllib.parse import cherrypy from cherrypy._cpcompat import text_or_bytes from cherrypy.lib import httputil as _httputil from cherrypy.lib import is_iterator # Conditional HTTP request support # def validate_etags(autot...
import hashlib import os import stat import subprocess from base64 import b64decode, b64encode from distutils.spawn import find_executable from django.utils.functional import cached_property from django.utils.translation import gettext as _ from weblate.trans.util import get_clean_env from weblate.utils import messa...
import logging import os import inspect import imp import sys import re import six logging.basicConfig() logger = logging.getLogger("kalliope") def pipe_print(line): line = Utils.encode_text_utf8(line) print(line) class KalliopeModuleNotFoundError(Exception): """ The module can not been found ...
from absl import flags from perfkitbenchmarker import errors from perfkitbenchmarker import os_types from perfkitbenchmarker import regex_util FLAGS = flags.FLAGS flags.DEFINE_string('mofed_version', '4.7-3.2.9.0', 'Mellanox OFED version') # TODO(tohaowu) Add DEBIAN9, CENTOS7, RHEL MOFED_OS_MAPPING = { os_types...
import unittest import numpy as np import numpy.testing as np_test from scipy.special import beta from scipy.stats import multivariate_normal from pgmpy.factors.continuous import ContinuousFactor class TestContinuousFactor(unittest.TestCase): def pdf1(self, x, y): return np.power(x, 1) * np.power(y, 2)...
import pytest from homeassistant.components import updater from homeassistant.helpers.update_coordinator import UpdateFailed from homeassistant.setup import async_setup_component from tests.async_mock import patch from tests.common import mock_component NEW_VERSION = "10000.0" MOCK_VERSION = "10.0" MOCK_DEV_VERSION...
import voluptuous as vol from homeassistant import config_entries, util from homeassistant.const import CONF_NAME import homeassistant.helpers.config_validation as cv from .binding import EmulatedRoku from .config_flow import configured_servers from .const import ( CONF_ADVERTISE_IP, CONF_ADVERTISE_PORT, ...
import collections import json import yaml from molecule import logger from molecule import util from molecule.model import schema_v1 from molecule.model import schema_v2 LOG = logger.get_logger(__name__) class MyDumper(yaml.Dumper): def increase_indent(self, flow=False, indentless=False): return supe...
import logging import posixpath from absl import flags from perfkitbenchmarker import vm_util # Github URL for HPC tools used with flag --gce_hpc_tools _HPC_URL = 'https://github.com/GoogleCloudPlatform/hpc-tools.git' # Remote git checkout directory _HPC_REMOTE_DIR = posixpath.join(vm_util.VM_TMP_DIR, 'hpc-tools') # ...
import pytest from homeassistant.components.input_text import ( ATTR_MAX, ATTR_MIN, ATTR_MODE, ATTR_VALUE, CONF_INITIAL, CONF_MAX_VALUE, CONF_MIN_VALUE, DOMAIN, MODE_TEXT, SERVICE_SET_VALUE, ) from homeassistant.const import ( ATTR_EDITABLE, ATTR_ENTITY_ID, ATTR_FRI...
import typing import tensorflow as tf from keras.engine import Layer class DynamicPoolingLayer(Layer): """ Layer that computes dynamic pooling of one tensor. :param psize1: pooling size of dimension 1 :param psize2: pooling size of dimension 2 :param kwargs: Standard layer keyword arguments. ...
from datetime import timedelta import pytest import homeassistant.components.automation as automation from homeassistant.components.sensor import DOMAIN from homeassistant.components.sensor.device_trigger import ENTITY_TRIGGERS from homeassistant.const import CONF_PLATFORM, PERCENTAGE, STATE_UNKNOWN from homeassista...
import unittest import pydegensac import numpy as np class TestPydegensac(unittest.TestCase): def test_find_homography(self): src_pts = np.float32([ [0,0],[0,1],[1,1],[1,0] ]).reshape(-1,2) dst_pts = np.float32([ [0,0],[0,-1],[-1,-1],[-1,0] ]).reshape(-1,2) H, mask = pydegensac.findHomo...
import logging import RFXtrx as rfxtrxmod from homeassistant.components.switch import SwitchEntity from homeassistant.const import CONF_DEVICES, STATE_ON from homeassistant.core import callback from . import ( CONF_AUTOMATIC_ADD, CONF_DATA_BITS, CONF_SIGNAL_REPETITIONS, DEFAULT_SIGNAL_REPETITIONS, ...
import os import os.path import cherrypy from cherrypy.lib import static localDir = os.path.dirname(__file__) absDir = os.path.join(os.getcwd(), localDir) class FileDemo(object): @cherrypy.expose def index(self): return """ <html><body> <h2>Upload a file</h2> <form ...
import os import warnings __licence__ = "BSD (3 clause)" def get_github_url(app, view, path): return ( f"https://github.com/{app.config.edit_on_github_project}/" f"{view}/{app.config.edit_on_github_branch}/" f"{app.config.edit_on_github_src_path}{path}" ) def html_page_context(app,...
import logging from .canopy_index import CanopyIndex from .index import Index from .core import Enumerator logger = logging.getLogger(__name__) class TfIdfIndex(Index): def __init__(self): self._index = CanopyIndex() self._doc_to_id = Enumerator(start=1) self._parseTerms = self._index.l...
import asyncio import pytest from homeassistant import config_entries, data_entry_flow, setup from homeassistant.components.somfy import DOMAIN, config_flow from homeassistant.const import CONF_CLIENT_ID, CONF_CLIENT_SECRET from homeassistant.helpers import config_entry_oauth2_flow from tests.async_mock import patc...
from __future__ import division import mock import numpy as np import unittest import chainer from chainer import backends from chainer import testing from chainer.testing import attr from chainercv.links.model.fpn import BboxHead from chainercv.links.model.fpn import FasterRCNN from chainercv.links.model.fpn impor...
import math import pytest from jinja2.exceptions import UndefinedError from jinja2.nativetypes import NativeEnvironment from jinja2.nativetypes import NativeTemplate from jinja2.runtime import Undefined @pytest.fixture def env(): return NativeEnvironment() def test_is_defined_native_return(env): t = env....
from homeassistant.components.climate import ClimateEntity from homeassistant.components.climate.const import ( ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_LOW, CURRENT_HVAC_COOL, CURRENT_HVAC_HEAT, HVAC_MODE_AUTO, HVAC_MODE_COOL, HVAC_MODE_HEAT, HVAC_MODE_HEAT_COOL, HVAC_MODE_OFF, ...
import argparse import os import subprocess import sys import shlex import shutil from gitless import core from . import pprint def get_branch(branch_name, repo): return _get_ref("branch", branch_name, repo) def get_tag(tag_name, repo): return _get_ref("tag", tag_name, repo) def _get_ref(ref_type, ref_name...
import logging from numato_gpio import NumatoGpioError from homeassistant.const import CONF_ID, CONF_NAME, CONF_SENSORS from homeassistant.helpers.entity import Entity from . import ( CONF_DEVICES, CONF_DST_RANGE, CONF_DST_UNIT, CONF_PORTS, CONF_SRC_RANGE, DATA_API, DOMAIN, ) _LOGGER = ...
from homeassistant.const import TEMP_CELSIUS from homeassistant.helpers.entity import Entity from . import AVAILABLE_SENSORS, DATA_ECOAL_BOILER def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the ecoal sensors.""" if discovery_info is None: return devices = [] ...
from datetime import timedelta import pytest import homeassistant.components.automation as automation from homeassistant.components.remote import DOMAIN from homeassistant.const import CONF_PLATFORM, STATE_OFF, STATE_ON from homeassistant.helpers import device_registry from homeassistant.setup import async_setup_com...
import datetime import voluptuous as vol from homeassistant import config_entries from homeassistant.components.http import HomeAssistantView from homeassistant.const import HTTP_BAD_REQUEST, HTTP_INTERNAL_SERVER_ERROR from homeassistant.core import callback from homeassistant.exceptions import HomeAssistantError fr...
from collections import namedtuple import json import threading from absl import flags from perfkitbenchmarker import errors from perfkitbenchmarker import network from perfkitbenchmarker import providers from perfkitbenchmarker.providers.openstack import utils OSC_FLOATING_IP_CMD = 'floating ip' OSC_SEC_GROUP_CMD =...
from datetime import timedelta import logging from haphilipsjs import PhilipsTV import voluptuous as vol from homeassistant.components.media_player import ( PLATFORM_SCHEMA, BrowseMedia, MediaPlayerEntity, ) from homeassistant.components.media_player.const import ( MEDIA_CLASS_CHANNEL, MEDIA_CLAS...
from datetime import datetime, timedelta import json from homeassistant.components import recorder from homeassistant.components.recorder.const import DATA_INSTANCE from homeassistant.components.recorder.models import Events, RecorderRuns, States from homeassistant.components.recorder.purge import purge_old_data from...
from flask import Flask, jsonify from flasgger import Swagger, swag_from app = Flask(__name__) swagger_config = { "headers": [], "specs": [ { "endpoint": "swagger", "route": "/characteristics/swagger.json", "rule_filter": lambda rule: True, # all in "m...
from datetime import timedelta import requests import voluptuous as vol from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.const import ( ATTR_ATTRIBUTION, ATTR_LATITUDE, ATTR_LONGITUDE, CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME, CONF_RADIUS, LENGTH_KILOMETE...
from flexx import flx class AppLayoutExample(flx.Widget): def init(self): with flx.VBox(): flx.Label(style='background:#cfc;', wrap=1, text='Here is some content at the top for which we want to ' 'use minimal size. Thus the use of a VBox. ' ...
import asyncio from datetime import timedelta import logging import voluptuous as vol from xiaomi_gateway import XiaomiGateway, XiaomiGatewayDiscovery from homeassistant import config_entries, core from homeassistant.const import ( ATTR_BATTERY_LEVEL, ATTR_VOLTAGE, CONF_HOST, CONF_MAC, CONF_PORT,...
from typing import Sequence, Union _InnerJsArgType = Union[None, str, bool, int, float] _JsArgType = Union[_InnerJsArgType, Sequence[_InnerJsArgType]] def string_escape(text: str) -> str: """Escape values special to javascript in strings. With this we should be able to use something like: elem.evalua...
from textwrap import wrap from weblate.addons.models import ADDONS from weblate.utils.management.base import BaseCommand class Command(BaseCommand): help = "List installed addons" def handle(self, *args, **options): """List installed addons.""" for _unused, obj in sorted(ADDONS.items()): ...
from datetime import timedelta import pytest from homeassistant.components.google_assistant import helpers from homeassistant.components.google_assistant.const import ( # noqa: F401 EVENT_COMMAND_RECEIVED, NOT_EXPOSE_LOCAL, ) from homeassistant.config import async_process_ha_core_config from homeassistant.c...
import posixpath from absl import flags from perfkitbenchmarker import linux_packages from perfkitbenchmarker.linux_packages import cuda_toolkit PACKAGE_NAME = 'hpcg' HPCG_BASE_URL = 'https://www.hpcg-benchmark.org/downloads' HPCG_CUDA_11_BINARY = 'xhpcg-3.1_cuda-11_ompi-4.0_sm_60_sm70_sm80' HPCG_CUDA_10_TAR = 'hpcg...
import os import unittest import roslib.rosenv class EnvTest(unittest.TestCase): def test_get_ros_root(self): from roslib.rosenv import get_ros_root self.assertEquals(None, get_ros_root(required=False, env={})) self.assertEquals(None, get_ros_root(False, {})) try: ge...
from unittest import mock import pytest @pytest.fixture def timer(stubs): return stubs.FakeTimer() def test_timeout(timer): """Test whether timeout calls the functions.""" func = mock.Mock() func2 = mock.Mock() timer.timeout.connect(func) timer.timeout.connect(func2) func.assert_not_ca...
from datetime import timedelta from homeassistant.components import recorder from homeassistant.util import dt as dt_util from tests.common import fire_time_changed def wait_recording_done(hass): """Block till recording is done.""" trigger_db_commit(hass) hass.block_till_done() hass.data[recorder.D...
import unicodedata def is_whitespace(char): """Checks whether `chars` is a whitespace character.""" # \t, \n, and \r are technically contorl characters but we treat them # as whitespace since they are generally considered as such. return (char == " ") or \ (char == "\t") or \ (c...
import io import logging from operator import itemgetter import bson import six from bson.binary import Binary from bson.errors import InvalidDocument from six.moves import cPickle, xrange from ._version_store_utils import checksum, pickle_compat_load, version_base_or_id from .._compression import decompress, compre...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import ntpath import os import re from absl import flags import numpy as np from perfkitbenchmarker import data from perfkitbenchmarker import sample from perfkitbenchmarker import vm_util import six from six....
from django.db.models import Count, Sum from django.utils.translation import gettext_lazy as _ from django.views.generic import TemplateView from weblate.accounts.models import Profile from weblate.checks.models import Check from weblate.trans.models import Component, Project from weblate.utils.requirements import ge...
from flexx import flx class ThemedForm(flx.Widget): CSS = """ .flx-Button { background: #9d9; } .flx-LineEdit { border: 2px solid #9d9; } """ def init(self): with flx.HFix(): with flx.FormLayout() as self.form: self.b1 = flx.LineEdit(...
from pscript import window from flexx import flx SPLINES = ['linear', 'basis', 'cardinal', 'catmullrom', 'lagrange', 'lanczos'] GENERAL_TEXT = """ The splines in this exampe are used to interpolate a line between control points. The the range of influence is shown when a control point is clicked. Move the control ...
import pytest import homeassistant.components.automation as automation from homeassistant.components.media_player import DOMAIN from homeassistant.const import ( STATE_IDLE, STATE_OFF, STATE_ON, STATE_PAUSED, STATE_PLAYING, ) from homeassistant.helpers import device_registry from homeassistant.set...
import logging import voluptuous as vol from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.const import ( ATTR_ATTRIBUTION, CONCENTRATION_PARTS_PER_MILLION, CONF_MONITORED_CONDITIONS, DEVICE_CLASS_HUMIDITY, DEVICE_CLASS_TEMPERATURE, PERCENTAGE, TEMP_CELSIUS, ) ...
import astroid from pylint import interfaces, checkers from pylint.checkers import utils class OpenEncodingChecker(checkers.BaseChecker): """Checker to check open() has an encoding set.""" __implements__ = interfaces.IAstroidChecker name = 'open-encoding' msgs = { 'W9400': ('open() called ...
from pcal9535a import PCAL9535A import voluptuous as vol from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity from homeassistant.const import DEVICE_DEFAULT_NAME import homeassistant.helpers.config_validation as cv CONF_INVERT_LOGIC = "invert_logic" CONF_I2C_ADDRESS = "i2c_address" ...
import json import urllib.request import urllib.error from http import HTTPStatus import pytest @pytest.mark.parametrize('path, content, expected', [ ('/', 'qutebrowser test webserver', True), # https://github.com/Runscope/server/issues/245 ('/', 'www.google-analytics.com', False), ('/data/hello.txt...
import unittest from absl import flags import mock from perfkitbenchmarker import benchmark_spec from perfkitbenchmarker import context from perfkitbenchmarker import pkb # pylint: disable=unused-import from perfkitbenchmarker import vm_util from perfkitbenchmarker.configs import benchmark_config_spec from tests imp...
from __future__ import absolute_import, unicode_literals import atexit import functools import sys import threading import time import cursor from log_symbols.symbols import LogSymbols from spinners.spinners import Spinners from halo._utils import (colored_frame, decode_utf_8_text, get_environment, ...
import diamond.collector class NetstatCollector(diamond.collector.Collector): PROC_TCP = "/proc/net/tcp" STATE = { '01': 'ESTABLISHED', '02': 'SYN_SENT', '03': 'SYN_RECV', '04': 'FIN_WAIT1', '05': 'FIN_WAIT2', '06': 'TIME_WAIT', '07': 'CLOSE', '...
import random import time from hashlib import sha1 from django.conf import settings from weblate.machinery.base import ( MachineTranslation, MachineTranslationError, MissingConfiguration, ) NETEASE_API_ROOT = "https://jianwai.netease.com/api/text/trans" class NeteaseSightTranslation(MachineTranslation...
from __future__ import unicode_literals import os import itertools import traceback from lib.data.data import pyoptions from lib.fun.fun import finishprinter, cool, finalsavepath, fun_name def hybrider_magic(*args): """[file1] [file2] ...""" args = list(args[0]) filepaths = [] hybrid_list = [] ...
revision = "5ae0ecefb01f" down_revision = "1db4f82bc780" from alembic import op import sqlalchemy as sa def upgrade(): op.alter_column( table_name="pending_certs", column_name="status", nullable=True, type_=sa.TEXT() ) def downgrade(): op.alter_column( table_name="pending_certs", ...
import logging from streamlabswater import streamlabswater import voluptuous as vol from homeassistant.const import CONF_API_KEY from homeassistant.helpers import discovery import homeassistant.helpers.config_validation as cv DOMAIN = "streamlabswater" _LOGGER = logging.getLogger(__name__) ATTR_AWAY_MODE = "away_...
from . import helpers, pprint def parser(subparsers, _): """Adds the publish parser to the given subparsers object.""" desc = 'publish commits upstream' publish_parser = subparsers.add_parser( 'publish', help=desc, description=desc.capitalize(), aliases=['pb']) publish_parser.add_argument( 'dst',...
import mock import pytest from kubernetes.client import V1DeleteOptions from kubernetes.client.rest import ApiException from paasta_tools.kubernetes.bin.paasta_cleanup_stale_nodes import does_instance_exist from paasta_tools.kubernetes.bin.paasta_cleanup_stale_nodes import main from paasta_tools.kubernetes.bin.paasta...
from unittest import mock import pytest from homeassistant.components.modbus.const import ( CALL_TYPE_COIL, CALL_TYPE_DISCRETE, CALL_TYPE_REGISTER_INPUT, DEFAULT_HUB, MODBUS_DOMAIN as DOMAIN, ) from homeassistant.const import CONF_PLATFORM, CONF_SCAN_INTERVAL from homeassistant.setup import async...
from pydeconz.sensor import Switch from homeassistant.const import CONF_EVENT, CONF_ID, CONF_UNIQUE_ID from homeassistant.core import callback from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.util import slugify from .const import CONF_ANGLE, CONF_GESTURE, CONF_XY, LOGGER, NEW...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import random from absl import flags from absl.testing import absltest FLAGS = flags.FLAGS flags.DEFINE_boolean('set_up_module_error', False, 'Cause setupModule to error.') flags.DEFINE...
import argparse import concurrent.futures import json import logging import os import re from typing import Any from typing import Dict from typing import List from typing import Tuple from mypy_extensions import TypedDict from paasta_tools import remote_git from paasta_tools.cli.utils import get_instance_configs_fo...
from __future__ import division from __future__ import print_function from builtins import object import os import numpy as np from scipy.linalg import orth class PPCA(object): def __init__(self): self.raw = None self.data = None self.C = None self.means = None self.st...
from flexx import app, ui class Red(ui.Widget): CSS = '.flx-Red { background: #ff0000;}' class Deep2(ui.Widget): def init(self): with ui.VBox(): ui.Label(text='Widgets in BoxPanels in a widget in a vbox') with ui.Widget(flex=1): with ui.VFix(): ...
import mock from paasta_tools.cli.cmds.cook_image import paasta_cook_image from paasta_tools.utils import get_username @mock.patch("paasta_tools.cli.cmds.cook_image.validate_service_name", autospec=True) @mock.patch("paasta_tools.cli.cmds.cook_image.makefile_responds_to", autospec=True) @mock.patch("paasta_tools.cl...
from pypjlink import MUTE_AUDIO, Projector from pypjlink.projector import ProjectorError import voluptuous as vol from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity from homeassistant.components.media_player.const import ( SUPPORT_SELECT_SOURCE, SUPPORT_TURN_OFF, SUPPORT_...
import numpy as np from .constants import FIFF from .tag import Tag from .tag import read_tag from .write import write_id, start_block, end_block, _write from ..utils import logger, verbose def dir_tree_find(tree, kind): """Find nodes of the given kind from a directory tree structure. Parameters ------...
from __future__ import absolute_import from __future__ import print_function import pytest from keras.models import Sequential, Model from keras.layers import Dense, Dropout, Activation, Input from elephas.spark_model import SparkModel def test_sequential_serialization(): # Create Spark context pytest.mark...
from datetime import timedelta import logging from pybotvac.exceptions import NeatoRobotException from homeassistant.components.sensor import DEVICE_CLASS_BATTERY from homeassistant.const import PERCENTAGE from homeassistant.helpers.entity import Entity from .const import NEATO_DOMAIN, NEATO_LOGIN, NEATO_ROBOTS, SC...
from django.contrib.sites.models import Site from django.views.generic.base import TemplateView from zinnia.settings import COPYRIGHT from zinnia.settings import FEEDS_FORMAT from zinnia.settings import PROTOCOL class CapabilityView(TemplateView): """ Base view for the weblog capabilities. """ def ...