text
stringlengths
213
32.3k
from django import template from django.conf import settings from django.contrib.staticfiles.storage import staticfiles_storage from django.utils.safestring import mark_safe from django.utils.translation import gettext_lazy register = template.Library() SOCIALS = { "auth0": { "name": settings.SOCIAL_AUTH...
from gzip import GzipFile import os.path as op import re import time import uuid import numpy as np from scipy import linalg, sparse from .constants import FIFF from ..utils import logger, _file_like from ..utils.numerics import _cal_to_julian # We choose a "magic" date to store (because meas_date is obligatory) # ...
import re # noqa: F401 import sys # noqa: F401 from paasta_tools.paastaapi.api_client import ApiClient, Endpoint from paasta_tools.paastaapi.model_utils import ( # noqa: F401 check_allowed_values, check_validations, date, datetime, file_type, none_type, validate_and_convert_types ) from...
import re from typing import Optional from homeassistant import core, setup from homeassistant.components.cover.intent import INTENT_CLOSE_COVER, INTENT_OPEN_COVER from homeassistant.components.shopping_list.intent import ( INTENT_ADD_ITEM, INTENT_LAST_ITEMS, ) from homeassistant.const import EVENT_COMPONENT_...
import ipaddress import logging from pyaehw4a1.aehw4a1 import AehW4a1 import pyaehw4a1.exceptions import voluptuous as vol from homeassistant import config_entries from homeassistant.components.climate import DOMAIN as CLIMATE_DOMAIN from homeassistant.const import CONF_IP_ADDRESS import homeassistant.helpers.config...
import os import sys import os.path as op import shutil from invoke import task from ._config import DOC_DIR, DOC_BUILD_DIR @task(help=dict(clean='clear the doc output; start fresh', build='build html docs', show='show the docs in the browser.')) def docs(ctx, clean=False, build=Fals...
import unittest from unittest import mock from libpurecool.dyson_pure_cool import DysonPureCool from libpurecool.dyson_pure_cool_link import DysonPureCoolLink from homeassistant.components import dyson as dyson_parent from homeassistant.components.dyson import sensor as dyson from homeassistant.const import ( PE...
import os import pytest from jinja2 import Environment from jinja2 import loaders from jinja2.utils import have_async_gen def pytest_ignore_collect(path): if "async" in path.basename and not have_async_gen: return True return False @pytest.fixture def env(): """returns a new environment.""" ...
import copy from django.core.exceptions import ImproperlyConfigured from django.db.models.base import ModelBase from django.db import models from django.utils.functional import LazyObject, empty from polymorphic.models import PolymorphicModelBase from shop.conf import app_settings class DeferredRelatedField: de...
from pytile import async_login from pytile.errors import TileError import voluptuous as vol from homeassistant import config_entries from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from homeassistant.helpers import aiohttp_client from .const import DOMAIN # pylint: disable=unused-import class TileFlo...
import sys import mne from mne.io import read_raw_kit from mne.utils import ETSContext def run(): """Run command.""" from mne.commands.utils import get_optparser parser = get_optparser(__file__) parser.add_option('--input', dest='input_fname', help='Input data file name', met...
import asyncio import logging from copy import copy from re import search from string import Formatter from typing import Dict, List, Literal import discord from redbot.core import Config, commands, checks from redbot.core.i18n import Translator, cog_i18n from redbot.core.utils.chat_formatting import box, pagify from...
from jinja2 import nodes from jinja2.idtracking import symbols_for_node def test_basics(): for_loop = nodes.For( nodes.Name("foo", "store"), nodes.Name("seq", "load"), [nodes.Output([nodes.Name("foo", "load")])], [], None, False, ) tmpl = nodes.Template( ...
from docutils import nodes from docutils.parsers.rst import Directive, directives from nikola.plugin_categories import RestExtension try: import pygal except ImportError: pygal = None _site = None class Plugin(RestExtension): """Plugin for chart role.""" name = "rest_chart" def set_site(self...
import os import shutil import tempfile from configparser import RawConfigParser import pytest from radicale import config from radicale.tests.helpers import configuration_to_dict class TestConfig: """Test the configuration.""" def setup(self): self.colpath = tempfile.mkdtemp() def teardown(s...
import logging import voluptuous as vol from homeassistant.components.lock import DOMAIN, LockEntity from homeassistant.core import callback import homeassistant.helpers.config_validation as cv from homeassistant.helpers.dispatcher import async_dispatcher_connect from . import ZWaveDeviceEntity, const _LOGGER = lo...
from datetime import timedelta from functools import partial import logging import random import aiohue import async_timeout from homeassistant.components.light import ( ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_EFFECT, ATTR_FLASH, ATTR_HS_COLOR, ATTR_TRANSITION, EFFECT_COLORLOOP, EFFECT...
import logging from api.soma_api import SomaApi from requests import RequestException import voluptuous as vol from homeassistant import config_entries from homeassistant.const import CONF_HOST, CONF_PORT from .const import DOMAIN _LOGGER = logging.getLogger(__name__) DEFAULT_PORT = 3000 class SomaFlowHandler(c...
import asyncio import logging from sisyphus_control import Table import voluptuous as vol from homeassistant.const import CONF_HOST, CONF_NAME, EVENT_HOMEASSISTANT_STOP from homeassistant.helpers.aiohttp_client import async_get_clientsession import homeassistant.helpers.config_validation as cv from homeassistant.hel...
import asyncio import time from unittest.mock import patch import pytest import zigpy.profiles.zha as zha import zigpy.zcl.clusters.general as general import zigpy.zcl.clusters.lighting as lighting from homeassistant.components.light import DOMAIN as LIGHT_DOMAIN from homeassistant.components.zha.core.group import G...
from django.test import TestCase from django.test.utils import override_settings from zinnia.admin.widgets import MPTTFilteredSelectMultiple from zinnia.admin.widgets import MiniTextarea from zinnia.admin.widgets import TagAutoComplete from zinnia.models.entry import Entry from zinnia.signals import disconnect_entry_...
import logging from homeassistant.components.mqtt import ( async_subscribe_connection_status, is_connected as mqtt_connected, ) from homeassistant.core import callback from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC from homeassistant.helpers.dispatcher import async_dispatcher_connect...
import argparse import logging import sys from typing import Any from typing import Callable from typing import List from typing import Optional from typing import Sequence from typing import Tuple from typing import Type from typing import Union import a_sync from marathon import MarathonClient from marathon.models....
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os # pylint: disable=unused-import from absl import app from absl import flags from absl import logging from compare_gan import datasets from compare_gan import runner_lib # Import GAN types so that ...
import os import unittest from perfkitbenchmarker.linux_packages import wrk import six class WrkParseOutputTestCase(unittest.TestCase): def setUp(self): data_dir = os.path.join(os.path.dirname(__file__), '..', 'data') result_path = os.path.join(data_dir, 'wrk_result.txt') with open(result_path) as res...
import logging from kalliope.core import Utils logging.basicConfig() logger = logging.getLogger("kalliope") class TriggerLauncher(object): def __init__(self): pass @staticmethod def get_trigger(settings, callback): """ Start a trigger module :param callback: Callback fu...
import pytest from homeassistant.components.debugpy import ( CONF_HOST, CONF_PORT, CONF_START, CONF_WAIT, DOMAIN, SERVICE_START, ) from homeassistant.core import HomeAssistant from homeassistant.setup import async_setup_component from tests.async_mock import patch @pytest.fixture def mock_d...
from homeassistant.components import mysensors from homeassistant.components.sensor import DOMAIN from homeassistant.const import ( CONDUCTIVITY, DEGREE, ELECTRICAL_CURRENT_AMPERE, ELECTRICAL_VOLT_AMPERE, ENERGY_KILO_WATT_HOUR, FREQUENCY_HERTZ, LENGTH_METERS, LIGHT_LUX, MASS_KILOGRA...
revision = '8323a5ea723a' down_revision = 'b33c838cb669' from alembic import op from sqlalchemy import text import sqlalchemy as sa def upgrade(): op.create_index( "ix_certificates_cn_lower", "certificates", [text("lower(cn)")], unique=False, postgresql_ops={"lower(cn)":...
from homeassistant.const import ATTR_ATTRIBUTION, ATTR_STATE from homeassistant.core import callback from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity import Entity from .const import ( CATEGORY_CDC_REPORT, CATEGORY_USER_REPORT, DATA_CLIENT, DOMAIN...
import os from openrazer_daemon.dbus_services import endpoint @endpoint('razer.device.lighting.brightness', 'getBrightness', out_sig='d') def get_brightness(self): """ Get the device's brightness :return: Brightness :rtype: float """ self.logger.debug("DBus call get_brightness") return ...
from test import CollectorTestCase from test import get_collector_config from test import unittest from mock import Mock from mock import patch try: from cStringIO import StringIO except ImportError: from StringIO import StringIO from diamond.collector import Collector from memory import MemoryCollector ###...
from . import async_setup_auth from tests.common import CLIENT_ID, CLIENT_REDIRECT_URI async def async_get_code(hass, aiohttp_client): """Return authorization code for link user tests.""" config = [ { "name": "Example", "type": "insecure_example", "users": [ ...
import logging from typing import Any, Dict, Optional from aiohttp import ContentTypeError from requests.exceptions import ConnectTimeout, HTTPError import voluptuous as vol from homeassistant import config_entries from homeassistant.const import CONF_PASSWORD, CONF_USERNAME from homeassistant.helpers.typing import ...
import logging import unittest import numpy as np from gensim import utils from gensim.test.utils import datapath, get_tmpfile class TestIsCorpus(unittest.TestCase): def test_None(self): # test None result = utils.is_corpus(None) expected = (False, None) self.assertEqual(expecte...
from gogogate2_api import GogoGate2Api import pytest from homeassistant.components.gogogate2 import DEVICE_TYPE_GOGOGATE2, async_setup_entry from homeassistant.components.gogogate2.common import DeviceDataUpdateCoordinator from homeassistant.components.gogogate2.const import DEVICE_TYPE_ISMARTGATE, DOMAIN from homeas...
from io import BytesIO import responses from django.urls import reverse from PIL import Image from weblate.accounts import avatar from weblate.auth.models import User from weblate.trans.tests.test_views import FixtureTestCase TEST_URL = ( "https://www.gravatar.com/avatar/" "55502f40dc8b7c769880b10874abc9d0?...
import os import pytest from molecule import config from molecule.driver import digitalocean @pytest.fixture def _instance(patched_config_validate, config_instance): return digitalocean.DigitalOcean(config_instance) def test_config_private_member(_instance): assert isinstance(_instance._config, config.Co...
import functools import operator from paasta_tools.tron import tron_timeutils def build_context(object, parent): """Construct a CommandContext for object. object must have a property 'context_class'. """ return CommandContext(object.context_class(object), parent) def build_filled_context(*context_...
__docformat__ = "restructuredtext en" import sys from logilab.common import flatten from logilab.common.visitor import VisitedMixIn, FilteredIterator, no_filter ## Exceptions ################################################################# class NodeNotFound(Exception): """raised when a node has not been foun...
from absl import flags from perfkitbenchmarker import configs from perfkitbenchmarker.linux_benchmarks import fio_benchmark as linux_fio from perfkitbenchmarker.windows_packages import fio FLAGS = flags.FLAGS _FIO_MEDIUM_SIZE = 2 _FIO_LARGE_SIZE = 2 * _FIO_MEDIUM_SIZE _MAX_SIZE = 100000 _SIZE_EXPLANATION = ('This i...
from homeassistant.exceptions import HomeAssistantError class UnifiException(HomeAssistantError): """Base class for UniFi exceptions.""" class AlreadyConfigured(UnifiException): """Controller is already configured.""" class AuthenticationRequired(UnifiException): """Unknown error occurred.""" class...
from homeassistant.components.ipp.const import CONF_BASE_PATH, CONF_UUID, DOMAIN from homeassistant.config_entries import SOURCE_USER, SOURCE_ZEROCONF from homeassistant.const import CONF_HOST, CONF_NAME, CONF_SSL from homeassistant.core import HomeAssistant from homeassistant.data_entry_flow import ( RESULT_TYPE_...
from django.test import SimpleTestCase from weblate.utils.html import extract_bleach class HtmlTestCase(SimpleTestCase): def test_noattr(self): self.assertEqual( extract_bleach("<b>text</b>"), {"tags": {"b"}, "attributes": {"b": set()}} ) def test_attrs(self): self.asser...
from pyruckus.exceptions import AuthenticationError from homeassistant.components.ruckus_unleashed import ( API_AP, API_DEVICE_NAME, API_ID, API_MAC, API_MODEL, API_SYSTEM_OVERVIEW, API_VERSION, DOMAIN, MANUFACTURER, ) from homeassistant.config_entries import ( ENTRY_STATE_LOAD...
from collections import OrderedDict from homeassistant import helpers def test_extract_domain_configs(): """Test the extraction of domain configuration.""" config = { "zone": None, "zoner": None, "zone ": None, "zone Hallo": None, "zone 100": None, } assert {...
import asyncio import logging import queue import pytest import homeassistant.util.logging as logging_util from tests.async_mock import patch def test_sensitive_data_filter(): """Test the logging sensitive data filter.""" log_filter = logging_util.HideSensitiveDataFilter("mock_sensitive") clean_recor...
from datetime import timedelta import logging from homeassistant.const import ATTR_BATTERY_LEVEL, LIGHT_LUX, PERCENTAGE, TEMP_CELSIUS from homeassistant.helpers.entity import Entity from . import DOMAIN as TAHOMA_DOMAIN, TahomaDevice _LOGGER = logging.getLogger(__name__) SCAN_INTERVAL = timedelta(seconds=60) ATTR...
import os import unittest import mock from perfkitbenchmarker import test_util from perfkitbenchmarker.linux_benchmarks import mnist_benchmark from perfkitbenchmarker.sample import Sample class Inception3BenchmarkTestCase(unittest.TestCase, test_util.SamplesTestMixin): def setUp...
from unittest import mock import pytest from gi.repository import GtkSource @pytest.mark.parametrize("text, newline, expected_text", [ # For the following tests, newlines and text match # Basic CRLF tests ("ree\r\neee", GtkSource.NewlineType.CR_LF, 'ree'), ("ree\r\neee\r\n", GtkSource.NewlineType.CR...
from django.db import migrations def update_index(apps, schema_editor): if schema_editor.connection.vendor != "postgresql": return # This ensures that extensions are loaded into the session. Without that # the next ALTER database fails unless we're running as superuser (which # is allowed to ...
import keras from keras.activations import softmax from keras.initializers import RandomUniform from matchzoo.engine.base_model import BaseModel from matchzoo.engine.param import Param from matchzoo.engine.param_table import ParamTable from matchzoo.engine import hyper_spaces class ANMM(BaseModel): """ ANMM...
from typing import List, Optional from aioesphomeapi import FanInfo, FanSpeed, FanState from homeassistant.components.fan import ( SPEED_HIGH, SPEED_LOW, SPEED_MEDIUM, SPEED_OFF, SUPPORT_OSCILLATE, SUPPORT_SET_SPEED, FanEntity, ) from homeassistant.config_entries import ConfigEntry from h...
_DEB_REPO_FILE = '/etc/apt/sources.list.d/azure-cli.list' _DEB_REPO_KEY = 'https://packages.microsoft.com/keys/microsoft.asc' _DEB_REPO = ('deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ ' '{az_repo} main') # RedHat info _YUM_REPO_FILE = '/etc/yum.repos.d/azure-cli.repo' _YUM_REPO_KEY =...
from socket import timeout as TimeoutError # noqa from amqp import ChannelError, ConnectionError, ResourceError __all__ = ( 'reraise', 'KombuError', 'OperationalError', 'NotBoundError', 'MessageStateError', 'TimeoutError', 'LimitExceeded', 'ConnectionLimitExceeded', 'ChannelLimitExceeded', 'Connecti...
import random from collections import namedtuple from pathlib import Path import weakref import pytest from redbot.core import Config from redbot.core.bot import Red from redbot.core import config as config_module, drivers __all__ = [ "override_data_path", "coroutine", "driver", "config", "config...
import numpy as np from ..source_estimate import SourceEstimate, VolSourceEstimate from ..source_space import _ensure_src from ..fixes import rng_uniform from ..utils import check_random_state, warn, _check_option, fill_doc from ..label import Label from ..surface import _compute_nearest @fill_doc def select_source...
import html import json import os import time import textwrap import urllib import collections import secrets from typing import TypeVar, Callable, Dict, List, Optional, Union, Sequence, Tuple from PyQt5.QtCore import QUrlQuery, QUrl import qutebrowser from qutebrowser.browser import pdfjs, downloads, history from q...
import functools import hashlib from flask import jsonify, request, make_response from sandman2.exception import BadRequestException def etag(func): """Return a decorator that generates proper ETag values for a response. :param func: view function """ @functools.wraps(func) def wrapped(*args, *...
from datetime import timedelta import logging import requests import voluptuous as vol from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.const import ( CONF_MONITORED_VARIABLES, CONF_NAME, CONF_RESOURCE, CONF_UNIT_OF_MEASUREMENT, CONF_VALUE_TEMPLATE, HTTP_OK, ) fr...
from homeassistant import auth from homeassistant.setup import async_setup_component from tests.common import ensure_auth_manager_loaded BASE_CONFIG = [ { "name": "Example", "type": "insecure_example", "users": [ {"username": "test-user", "password": "test-pass", "name": "Test...
import os import importlib import pytest import cherrypy from cherrypy.test import helper curdir = os.path.join(os.getcwd(), os.path.dirname(__file__)) class RoutesDispatchTest(helper.CPWebCase): """Routes dispatcher test suite.""" @staticmethod def setup_server(): """Set up cherrypy test ins...
from __future__ import division import unittest import numpy as np from chainercv.evaluations import calc_semantic_segmentation_confusion from chainercv.evaluations import calc_semantic_segmentation_iou from chainercv.evaluations import eval_semantic_segmentation from chainercv.utils import testing @testing.param...
from PyQt5.QtCore import QObject, QEvent, Qt, QTimer from qutebrowser.config import config from qutebrowser.utils import message, log, usertypes, qtutils from qutebrowser.misc import objects from qutebrowser.keyinput import modeman class ChildEventFilter(QObject): """An event filter re-adding TabEventFilter on...
import os import pytest import sh from molecule import config from molecule.dependency import gilt @pytest.fixture def _patched_gilt_has_requirements_file(mocker): m = mocker.patch('molecule.dependency.gilt.Gilt._has_requirements_file') m.return_value = True return m @pytest.fixture def _dependency_...
import logging from urllib.parse import ParseResult, urlparse from requests.exceptions import HTTPError, Timeout from sunwatcher.solarlog.solarlog import SolarLog import voluptuous as vol from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.config_entries import SOURCE_IMPORT from homeassis...
from pykwb import kwb import voluptuous as vol from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.const import ( CONF_DEVICE, CONF_HOST, CONF_NAME, CONF_PORT, EVENT_HOMEASSISTANT_STOP, ) import homeassistant.helpers.config_validation as cv from homeassistant.helpers.ent...
import pickle import pytest from itertools import count from unittest.mock import Mock from case import mock from kombu.utils import functional as utils from kombu.utils.functional import ( ChannelPromise, LRUCache, fxrange, fxrangemax, memoize, lazy, maybe_evaluate, maybe_list, reprcall, reprkwargs, retry...
import unittest from trashcli.fs import FileSystemReader from trashcli.fs import mkdirs from trashcli.fs import has_sticky_bit from .files import require_empty_dir, make_empty_file, set_sticky_bit import os class TestWithInSandbox: def test_mkdirs_with_default_mode(self): mkdirs("sandbox/test-dir/sub-d...
from django.conf import settings from weblate.machinery.base import ( MachineTranslation, MachineTranslationError, MissingConfiguration, ) YOUDAO_API_ROOT = "https://openapi.youdao.com/api" class YoudaoTranslation(MachineTranslation): """Youdao Zhiyun API machine translation support.""" name =...
from miio import DeviceException from homeassistant import config_entries from homeassistant.components import zeroconf from homeassistant.components.xiaomi_miio import config_flow, const from homeassistant.const import CONF_HOST, CONF_NAME, CONF_TOKEN from tests.async_mock import Mock, patch ZEROCONF_NAME = "name"...
import io import logging import re from zipfile import ZipFile from babelfish import Language, language_converters from guessit import guessit from requests import Session from . import ParserBeautifulSoup, Provider from ..cache import EPISODE_EXPIRATION_TIME, SHOW_EXPIRATION_TIME, region from ..exceptions import Pr...
import pytest from homeassistant.components import switch from homeassistant.components.mochad import switch as mochad from homeassistant.setup import async_setup_component import tests.async_mock as mock @pytest.fixture(autouse=True) def pymochad_mock(): """Mock pymochad.""" with mock.patch("homeassistant...
from itertools import chain from warnings import warn import numpy as np import numbers from pgmpy.estimators import ParameterEstimator from pgmpy.factors.discrete import TabularCPD from pgmpy.models import BayesianModel class BayesianEstimator(ParameterEstimator): def __init__(self, model, data, **kwargs): ...
import copy from datetime import timedelta import json from hatasmota.utils import ( get_topic_stat_status, get_topic_tele_sensor, get_topic_tele_will, ) import pytest from homeassistant import config_entries from homeassistant.components import sensor from homeassistant.components.tasmota.const import D...
import posixpath from perfkitbenchmarker import data from perfkitbenchmarker import linux_packages # TODO: Make collection interval configurable. INTERVAL = 10 SCRIPT_NAME = 'build_collectd.sh.j2' COLLECTD_URL = ('https://github.com/collectd/collectd/archive/' 'collectd-5.5.0.tar.gz') BUILD_DIR = pos...
import pytest from unittest.mock import Mock from kombu import Connection, Consumer, Exchange, Producer, Queue from kombu.message import Message from kombu.transport.base import ( StdChannel, Transport, Management, to_rabbitmq_queue_arguments, ) @pytest.mark.parametrize('args,input,expected', [ ({}, {'mess...
import threading from json import loads, dumps from queue import Empty from sqlalchemy import create_engine from sqlalchemy.exc import OperationalError from sqlalchemy.orm import sessionmaker from kombu.transport import virtual from kombu.utils import cached_property from kombu.utils.encoding import bytes_to_str fro...
from django.conf import settings from django.utils.translation import gettext_lazy as _ from cmsplugin_cascade.bootstrap4.mixins import BootstrapUtilities CASCADE_PLUGINS = getattr(settings, 'SHOP_CASCADE_PLUGINS', ['auth', 'breadcrumb', 'catalog', 'cart', 'checkout', 'extensions', 'order', 'processbar', 'search...
import unittest from urwid import text_layout from urwid.compat import B import urwid class CalcBreaksTest(object): def cbtest(self, width, exp): result = text_layout.default_layout.calculate_text_segments( B(self.text), width, self.mode ) assert len(result) == len(exp), repr((result...
from homeassistant.const import SERVICE_RELOAD from homeassistant.helpers.reload import async_reload_integration_platforms from .const import DOMAIN, EVENT_TEMPLATE_RELOADED, PLATFORMS async def async_setup_reload_service(hass): """Create the reload service for the template domain.""" if hass.services.has_...
import logging from datetime import datetime, timedelta from pymongo.errors import OperationFailure logger = logging.getLogger(__name__) CACHE_COLL = 'cache' CACHE_DB = 'meta_db' CACHE_SETTINGS = 'settings' CACHE_SETTINGS_KEY = 'cache' """ Sample cache_settings collection entry: meta_db.cache_settings.insertOne({"t...
import logging from typing import Optional from homeassistant.const import ( ATTR_ATTRIBUTION, ATTR_LATITUDE, ATTR_LONGITUDE, CONF_UNIT_SYSTEM_IMPERIAL, LENGTH_KILOMETERS, ) from homeassistant.core import callback from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassis...
import time import functools from hashlib import md5 from urllib.request import parse_http_list, parse_keqv_list import cherrypy from cherrypy._cpcompat import ntob, tonative __author__ = 'visteya' __date__ = 'April 2009' def md5_hex(s): return md5(ntob(s, 'utf-8')).hexdigest() qop_auth = 'auth' qop_auth_in...
from bson.json_util import dumps, loads from bson.objectid import ObjectId from flask import Blueprint, request, Response from app.commons import build_response from app.commons.utils import update_document from app.entities.models import Entity entities_blueprint = Blueprint('entities_blueprint', __name__, ...
import asyncio from homeassistant.components import cloud, notify as hass_notify from homeassistant.components.webhook import ( async_register as webhook_register, async_unregister as webhook_unregister, ) from homeassistant.const import CONF_WEBHOOK_ID from homeassistant.helpers import device_registry as dr,...
import pytest from molecule.model import schema_v2 @pytest.fixture def _model_driver_section_data(): return { 'driver': { 'name': 'docker', 'provider': { 'name': None, }, 'options': { 'managed': True, 'foo': ...
from unittest import TestCase import io import pandas as pd from scattertext.CorpusFromParsedDocuments import CorpusFromParsedDocuments from scattertext.WhitespaceNLP import whitespace_nlp_with_sentences from scattertext.diachronic.DiachronicTermMiner import DiachronicTermMiner class TestDiachronicTermMiner(TestCas...
import logging import unittest import numpy as np from gensim.corpora.mmcorpus import MmCorpus from gensim.models import logentropy_model from gensim.test.utils import datapath, get_tmpfile class TestLogEntropyModel(unittest.TestCase): TEST_CORPUS = [[(1, 1.0)], [], [(0, 0.5), (2, 1.0)], []] def setUp(self...
from datetime import timedelta import logging from typing import Optional from geojson_client.usgs_earthquake_hazards_program_feed import ( UsgsEarthquakeHazardsProgramFeedManager, ) import voluptuous as vol from homeassistant.components.geo_location import PLATFORM_SCHEMA, GeolocationEvent from homeassistant.co...
revision = "a02a678ddc25" down_revision = "8ae67285ff14" from alembic import op import sqlalchemy as sa from sqlalchemy.sql import text def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "rotation_policies", sa.Column("id", sa.Integer(), nullable=Fa...
from aiohomekit.model.characteristics import CharacteristicsTypes from aiohomekit.model.services import ServicesTypes from homeassistant.const import ( DEVICE_CLASS_BATTERY, DEVICE_CLASS_HUMIDITY, DEVICE_CLASS_ILLUMINANCE, DEVICE_CLASS_TEMPERATURE, ) from tests.components.homekit_controller.common im...
from weblate.fonts.models import FONT_STORAGE, Font from weblate.utils.celery import app @app.task(trail=False) def cleanup_font_files(): """Remove stale fonts.""" try: files = FONT_STORAGE.listdir(".")[1] except OSError: return for name in files: if name == "fonts.conf": ...
import io from vcr.stubs import VCRHTTPResponse def test_response_should_have_headers_field(): recorded_response = { "status": {"message": "OK", "code": 200}, "headers": { "content-length": ["0"], "server": ["gunicorn/18.0"], "connection": ["Close"], ...
from pylutron_caseta import OCCUPANCY_GROUP_OCCUPIED from homeassistant.components.binary_sensor import ( DEVICE_CLASS_OCCUPANCY, BinarySensorEntity, ) from . import DOMAIN as CASETA_DOMAIN, LutronCasetaDevice async def async_setup_entry(hass, config_entry, async_add_entities): """Set up the Lutron Cas...
from homeassistant.components.light import ( ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, LightEntity, ) from . import LUTRON_CONTROLLER, LUTRON_DEVICES, LutronDevice def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Lutron lights.""" devs = [] for (area_name, device...
import urllib2 from urllib import urlencode try: from xml.etree import ElementTree except ImportError: ElementTree = None try: from ElementTree import ParseError as ETParseError except ImportError: ETParseError = Exception import diamond.collector class KafkaCollector(diamond.collector.Collector)...
import sys from flexx.util.testing import run_tests_if_main, skipif, skip, raises from flexx.event.both_tester import run_in_both, this_is_js from flexx import event loop = event.loop class MyObject(event.Component): @event.emitter def foo(self, v): if not isinstance(v, (int, float)): ...
import os import shutil import time from urllib import parse, request from urllib.error import HTTPError, URLError from .progressbar import ProgressBar from .numerics import hashfunc from .misc import sizeof_fmt from ._logging import logger, verbose # Adapted from nilearn def _get_http(url, temp_file_name, initia...
from test import CollectorTestCase from test import get_collector_config from test import unittest from test import run_only from mock import patch from diamond.collector import Collector from puppetagent import PuppetAgentCollector ########################################################################## def run...