sample_id
stringlengths
21
196
text
stringlengths
105
936k
metadata
dict
category
stringclasses
6 values
home-assistant/core:homeassistant/components/template/update.py
"""Support for updates which integrates with other components.""" from __future__ import annotations import logging from typing import TYPE_CHECKING, Any import voluptuous as vol from homeassistant.components.update import ( ATTR_INSTALLED_VERSION, ATTR_LATEST_VERSION, DEVICE_CLASSES_SCHEMA, DOMAIN ...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/template/update.py", "license": "Apache License 2.0", "lines": 268, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/togrill/config_flow.py
"""Config flow for the ToGrill integration.""" from __future__ import annotations from typing import Any from bleak.exc import BleakError from togrill_bluetooth import SUPPORTED_DEVICES from togrill_bluetooth.client import Client from togrill_bluetooth.packets import PacketA0Notify import voluptuous as vol from hom...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/togrill/config_flow.py", "license": "Apache License 2.0", "lines": 108, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/togrill/const.py
"""Constants for the ToGrill integration.""" DOMAIN = "togrill" MAX_PROBE_COUNT = 6 CONF_PROBE_COUNT = "probe_count" CONF_HAS_AMBIENT = "has_ambient" CONF_VERSION = "version"
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/togrill/const.py", "license": "Apache License 2.0", "lines": 6, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/togrill/coordinator.py
"""Coordinator for the ToGrill Bluetooth integration.""" from __future__ import annotations import asyncio from collections.abc import Callable from datetime import timedelta import logging from bleak.exc import BleakError from togrill_bluetooth.client import Client from togrill_bluetooth.exceptions import DecodeErr...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/togrill/coordinator.py", "license": "Apache License 2.0", "lines": 190, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/togrill/entity.py
"""Provides the base entities.""" from __future__ import annotations from bleak.exc import BleakError from togrill_bluetooth.client import Client from togrill_bluetooth.exceptions import BaseError from togrill_bluetooth.packets import PacketWrite from homeassistant.exceptions import HomeAssistantError from homeassis...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/togrill/entity.py", "license": "Apache License 2.0", "lines": 47, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/togrill/event.py
"""Support for event entities.""" from __future__ import annotations from togrill_bluetooth.packets import Packet, PacketA5Notify from homeassistant.components.event import EventEntity from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallb...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/togrill/event.py", "license": "Apache License 2.0", "lines": 46, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/togrill/number.py
"""Support for number entities.""" from __future__ import annotations from collections.abc import Callable, Generator, Mapping from dataclasses import dataclass from typing import Any from togrill_bluetooth.packets import ( AlarmType, PacketA0Notify, PacketA6Write, PacketA8Notify, PacketA300Write...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/togrill/number.py", "license": "Apache License 2.0", "lines": 160, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/togrill/sensor.py
"""Support for sensor entities.""" from __future__ import annotations from collections.abc import Callable, Mapping from dataclasses import dataclass from typing import Any, cast from togrill_bluetooth.packets import Packet, PacketA0Notify, PacketA1Notify from homeassistant.components.sensor import ( SensorDevi...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/togrill/sensor.py", "license": "Apache License 2.0", "lines": 129, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/tuya/valve.py
"""Support for Tuya valves.""" from __future__ import annotations from tuya_device_handlers.device_wrapper.base import DeviceWrapper from tuya_device_handlers.device_wrapper.common import DPCodeBooleanWrapper from tuya_sharing import CustomerDevice, Manager from homeassistant.components.valve import ( ValveDevic...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/tuya/valve.py", "license": "Apache License 2.0", "lines": 141, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/volvo/binary_sensor.py
"""Volvo binary sensors.""" from __future__ import annotations from dataclasses import dataclass, field from volvocarsapi.models import VolvoCarsApiBaseModel, VolvoCarsValue from homeassistant.components.binary_sensor import ( BinarySensorDeviceClass, BinarySensorEntity, BinarySensorEntityDescription, )...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/volvo/binary_sensor.py", "license": "Apache License 2.0", "lines": 369, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/waze_travel_time/coordinator.py
"""The Waze Travel Time data coordinator.""" import asyncio from collections.abc import Collection from dataclasses import dataclass from datetime import timedelta import logging from typing import Literal from pywaze.route_calculator import CalcRoutesResponse, WazeRouteCalculator, WRCError from homeassistant.config...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/waze_travel_time/coordinator.py", "license": "Apache License 2.0", "lines": 215, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/workday/entity.py
"""Base workday entity.""" from __future__ import annotations from abc import abstractmethod from datetime import date, datetime, timedelta from holidays import HolidayBase, __version__ as python_holidays_version from homeassistant.core import CALLBACK_TYPE, ServiceResponse, callback from homeassistant.helpers.devi...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/workday/entity.py", "license": "Apache License 2.0", "lines": 91, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/workday/util.py
"""Helpers functions for the Workday component.""" from __future__ import annotations from datetime import date, timedelta from functools import partial from typing import TYPE_CHECKING from holidays import PUBLIC, DateLike, HolidayBase, country_holidays from homeassistant.const import CONF_COUNTRY from homeassista...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/workday/util.py", "license": "Apache License 2.0", "lines": 232, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/yalexs_ble/config_cache.py
"""The Yale Access Bluetooth integration.""" from __future__ import annotations from yalexs_ble import ValidatedLockConfig from homeassistant.core import HomeAssistant, callback from homeassistant.util.hass_dict import HassKey CONFIG_CACHE: HassKey[dict[str, ValidatedLockConfig]] = HassKey( "yalexs_ble_config_c...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/yalexs_ble/config_cache.py", "license": "Apache License 2.0", "lines": 23, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/yolink/select.py
"""YoLink select platform.""" from __future__ import annotations from collections.abc import Awaitable, Callable from dataclasses import dataclass from typing import Any from yolink.client_request import ClientRequest from yolink.const import ATTR_DEVICE_SPRINKLER from yolink.device import YoLinkDevice from yolink.m...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/yolink/select.py", "license": "Apache License 2.0", "lines": 99, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/helpers/automation.py
"""Helpers for automation.""" from typing import Any import voluptuous as vol from homeassistant.const import CONF_OPTIONS from .typing import ConfigType def get_absolute_description_key(domain: str, key: str) -> str: """Return the absolute description key.""" if not key.startswith("_"): return f"...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/helpers/automation.py", "license": "Apache License 2.0", "lines": 64, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:pylint/plugins/hass_enforce_greek_micro_char.py
"""Plugin for checking preferred coding of μ is used.""" from __future__ import annotations from typing import Any from astroid import nodes from pylint.checkers import BaseChecker from pylint.lint import PyLinter class HassEnforceGreekMicroCharChecker(BaseChecker): """Checker for micro char.""" name = "h...
{ "repo_id": "home-assistant/core", "file_path": "pylint/plugins/hass_enforce_greek_micro_char.py", "license": "Apache License 2.0", "lines": 62, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:tests/components/ai_task/test_media_source.py
"""Test ai_task media source.""" import pytest from homeassistant.components import media_source from homeassistant.components.ai_task.media_source import async_get_media_source from homeassistant.core import HomeAssistant from homeassistant.exceptions import HomeAssistantError async def test_local_media_source(has...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/ai_task/test_media_source.py", "license": "Apache License 2.0", "lines": 27, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/airos/test_binary_sensor.py
"""Test the Ubiquiti airOS binary sensors.""" from unittest.mock import AsyncMock import pytest from syrupy.assertion import SnapshotAssertion from homeassistant.const import Platform from homeassistant.core import HomeAssistant from homeassistant.helpers import entity_registry as er from . import setup_integration...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/airos/test_binary_sensor.py", "license": "Apache License 2.0", "lines": 31, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/airq/common.py
"""Common methods used across tests for air-Q.""" from aioairq import DeviceInfo from homeassistant.const import CONF_IP_ADDRESS, CONF_PASSWORD TEST_USER_DATA = { CONF_IP_ADDRESS: "192.168.0.0", CONF_PASSWORD: "password", } TEST_DEVICE_INFO = DeviceInfo( id="id", name="name", model="model", s...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/airq/common.py", "license": "Apache License 2.0", "lines": 16, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/airq/test_number.py
"""Test the NUMBER platform from air-Q integration.""" from unittest.mock import AsyncMock import pytest from homeassistant.const import Platform from homeassistant.core import HomeAssistant from homeassistant.exceptions import ServiceValidationError from . import setup_platform from .common import TEST_BRIGHTNESS,...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/airq/test_number.py", "license": "Apache License 2.0", "lines": 54, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/asuswrt/test_helpers.py
"""Tests for AsusWRT helpers.""" from typing import Any import pytest from homeassistant.components.asuswrt.helpers import clean_dict, translate_to_legacy DICT_TO_CLEAN = { "key1": "value1", "key2": None, "key3_state": "value3", "key4_state": None, "state": None, } DICT_CLEAN = { "key1": "v...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/asuswrt/test_helpers.py", "license": "Apache License 2.0", "lines": 76, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/bayesian/test_config_flow.py
"""Test the Config flow for the Bayesian integration.""" from __future__ import annotations from types import MappingProxyType from unittest.mock import patch import pytest import voluptuous as vol from homeassistant import config_entries from homeassistant.components.bayesian.config_flow import ( OBSERVATION_S...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/bayesian/test_config_flow.py", "license": "Apache License 2.0", "lines": 1099, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/emoncms_history/test_init.py
"""The tests for the emoncms_history init.""" from collections.abc import AsyncGenerator from datetime import timedelta from unittest.mock import AsyncMock, patch import aiohttp from freezegun.api import FrozenDateTimeFactory import pytest from homeassistant.const import CONF_API_KEY, CONF_URL, STATE_UNAVAILABLE, ST...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/emoncms_history/test_init.py", "license": "Apache License 2.0", "lines": 94, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/fan/test_intent.py
"""Intent tests for the fan platform.""" from homeassistant.components.fan import ( ATTR_PERCENTAGE, DOMAIN, SERVICE_TURN_ON, intent as fan_intent, ) from homeassistant.const import STATE_OFF from homeassistant.core import HomeAssistant from homeassistant.helpers import intent from tests.common import...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/fan/test_intent.py", "license": "Apache License 2.0", "lines": 30, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/foscam/test_switch.py
"""Test for the switch platform entity of the foscam component.""" from unittest.mock import patch from syrupy.assertion import SnapshotAssertion from homeassistant.components.foscam.const import DOMAIN from homeassistant.const import Platform from homeassistant.core import HomeAssistant from homeassistant.helpers i...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/foscam/test_switch.py", "license": "Apache License 2.0", "lines": 26, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/husqvarna_automower/test_event.py
"""Tests for init module.""" from collections.abc import Callable from copy import deepcopy from datetime import UTC, datetime from unittest.mock import AsyncMock, patch from aioautomower.model import MowerAttributes, SingleMessageData from aioautomower.model.model_message import Message, Severity, SingleMessageAttri...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/husqvarna_automower/test_event.py", "license": "Apache License 2.0", "lines": 191, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/huum/test_number.py
"""Tests for the Huum number entity.""" from unittest.mock import AsyncMock from huum.const import SaunaStatus from syrupy.assertion import SnapshotAssertion from homeassistant.components.number import ( ATTR_VALUE, DOMAIN as NUMBER_DOMAIN, SERVICE_SET_VALUE, ) from homeassistant.const import ATTR_ENTITY...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/huum/test_number.py", "license": "Apache License 2.0", "lines": 61, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/letpot/test_select.py
"""Test select entities for the LetPot integration.""" from unittest.mock import MagicMock, patch from letpot.exceptions import LetPotConnectionException, LetPotException from letpot.models import LightMode import pytest from syrupy.assertion import SnapshotAssertion from homeassistant.components.select import ( ...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/letpot/test_select.py", "license": "Apache License 2.0", "lines": 86, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/lg_thinq/test_switch.py
"""Tests for the LG ThinQ switch platform.""" from unittest.mock import AsyncMock, patch from syrupy.assertion import SnapshotAssertion from homeassistant.const import Platform from homeassistant.core import HomeAssistant from homeassistant.helpers import entity_registry as er from . import setup_integration from ...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/lg_thinq/test_switch.py", "license": "Apache License 2.0", "lines": 20, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/nina/test_diagnostics.py
"""Test the Nina diagnostics.""" from unittest.mock import AsyncMock from syrupy.assertion import SnapshotAssertion from homeassistant.core import HomeAssistant from . import setup_platform from tests.common import MockConfigEntry from tests.components.diagnostics import get_diagnostics_for_config_entry from tests...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/nina/test_diagnostics.py", "license": "Apache License 2.0", "lines": 22, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/opower/test_repairs.py
"""Test the Opower repairs.""" from homeassistant.components.opower.const import DOMAIN from homeassistant.components.recorder import Recorder from homeassistant.components.repairs import DOMAIN as REPAIRS_DOMAIN from homeassistant.config_entries import ConfigEntryState from homeassistant.core import HomeAssistant fro...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/opower/test_repairs.py", "license": "Apache License 2.0", "lines": 68, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/pooldose/test_config_flow.py
"""Test the PoolDose config flow.""" from datetime import timedelta from typing import Any from unittest.mock import AsyncMock from freezegun.api import FrozenDateTimeFactory import pytest from homeassistant.components.pooldose.const import DOMAIN from homeassistant.config_entries import SOURCE_DHCP, SOURCE_USER fro...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/pooldose/test_config_flow.py", "license": "Apache License 2.0", "lines": 408, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/pooldose/test_init.py
"""Test the PoolDose integration initialization.""" from unittest.mock import AsyncMock import pytest from syrupy.assertion import SnapshotAssertion from homeassistant.components.pooldose.const import DOMAIN from homeassistant.config_entries import ConfigEntryState from homeassistant.core import HomeAssistant from h...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/pooldose/test_init.py", "license": "Apache License 2.0", "lines": 145, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/pooldose/test_sensor.py
"""Test the PoolDose sensor platform.""" from datetime import timedelta from unittest.mock import AsyncMock, patch from freezegun.api import FrozenDateTimeFactory from pooldose.request_status import RequestStatus import pytest from syrupy.assertion import SnapshotAssertion from homeassistant.const import ( ATTR_...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/pooldose/test_sensor.py", "license": "Apache License 2.0", "lines": 134, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/qbus/test_binary_sensor.py
"""Test Qbus binary sensors.""" from collections.abc import Awaitable, Callable from unittest.mock import patch from syrupy.assertion import SnapshotAssertion from homeassistant.const import Platform from homeassistant.core import HomeAssistant from homeassistant.helpers import entity_registry as er from tests.comm...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/qbus/test_binary_sensor.py", "license": "Apache License 2.0", "lines": 19, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/qbus/test_sensor.py
"""Test Qbus sensors.""" from collections.abc import Awaitable, Callable from unittest.mock import patch from syrupy.assertion import SnapshotAssertion from homeassistant.const import Platform from homeassistant.core import HomeAssistant from homeassistant.helpers import entity_registry as er from tests.common impo...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/qbus/test_sensor.py", "license": "Apache License 2.0", "lines": 19, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/russound_rio/test_media_browser.py
"""Tests for the Russound RIO media browser.""" from unittest.mock import AsyncMock from syrupy.assertion import SnapshotAssertion from homeassistant.core import HomeAssistant from . import setup_integration from .const import ENTITY_ID_ZONE_1 from tests.common import MockConfigEntry from tests.typing import WebSo...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/russound_rio/test_media_browser.py", "license": "Apache License 2.0", "lines": 50, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/sleep_as_android/test_config_flow.py
"""Test the Sleep as Android config flow.""" from unittest.mock import AsyncMock, patch from homeassistant.components.sleep_as_android.const import DOMAIN from homeassistant.config_entries import SOURCE_USER from homeassistant.const import CONF_WEBHOOK_ID from homeassistant.core import HomeAssistant from homeassistan...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/sleep_as_android/test_config_flow.py", "license": "Apache License 2.0", "lines": 32, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/sleep_as_android/test_diagnostics.py
"""Tests for Sleep as Android diagnostics.""" from syrupy.assertion import SnapshotAssertion from homeassistant.core import HomeAssistant from tests.common import MockConfigEntry from tests.components.diagnostics import get_diagnostics_for_config_entry from tests.typing import ClientSessionGenerator async def test...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/sleep_as_android/test_diagnostics.py", "license": "Apache License 2.0", "lines": 20, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/sleep_as_android/test_event.py
"""Test the Sleep as Android event platform.""" from collections.abc import Generator from http import HTTPStatus from unittest.mock import patch import pytest from syrupy.assertion import SnapshotAssertion from homeassistant.config_entries import ConfigEntryState from homeassistant.const import STATE_UNKNOWN, Platf...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/sleep_as_android/test_event.py", "license": "Apache License 2.0", "lines": 150, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/sleep_as_android/test_init.py
"""Test the Sleep as Android integration setup.""" from homeassistant.config_entries import ConfigEntryState from homeassistant.core import HomeAssistant from tests.common import MockConfigEntry async def test_entry_setup_unload( hass: HomeAssistant, config_entry: MockConfigEntry ) -> None: """Test integrat...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/sleep_as_android/test_init.py", "license": "Apache License 2.0", "lines": 14, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/sleep_as_android/test_sensor.py
"""Test the Sleep as Android sensor platform.""" from collections.abc import Generator from datetime import datetime from http import HTTPStatus from unittest.mock import patch import pytest from syrupy.assertion import SnapshotAssertion from homeassistant.config_entries import ConfigEntryState from homeassistant.co...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/sleep_as_android/test_sensor.py", "license": "Apache License 2.0", "lines": 133, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/smarla/test_sensor.py
"""Test sensor platform for Swing2Sleep Smarla integration.""" from unittest.mock import MagicMock, patch import pytest from syrupy.assertion import SnapshotAssertion from homeassistant.const import Platform from homeassistant.core import HomeAssistant from homeassistant.helpers import entity_registry as er from . ...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/smarla/test_sensor.py", "license": "Apache License 2.0", "lines": 72, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/sonos/test_select.py
"""Tests for the Sonos select platform.""" import logging from unittest.mock import patch from freezegun.api import FrozenDateTimeFactory import pytest from homeassistant.components.select import ( DOMAIN as SELECT_DOMAIN, SERVICE_SELECT_OPTION, ) from homeassistant.components.sonos.const import ( ATTR_D...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/sonos/test_select.py", "license": "Apache License 2.0", "lines": 174, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/switchbot_cloud/test_cover.py
"""Test for the switchbot_cloud Cover.""" from unittest.mock import patch import pytest from switchbot_api import ( BlindTiltCommands, CommonCommands, CurtainCommands, Device, RollerShadeCommands, ) from homeassistant.components.cover import DOMAIN as COVER_DOMAIN from homeassistant.components.sw...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/switchbot_cloud/test_cover.py", "license": "Apache License 2.0", "lines": 407, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/telegram_bot/test_notify.py
"""Test the telegram bot notify platform.""" from datetime import datetime from unittest.mock import AsyncMock, patch import pytest from telegram import Chat, Message from telegram.constants import ChatType, ParseMode from homeassistant.components.notify import ( ATTR_MESSAGE, ATTR_TITLE, DOMAIN as NOTIF...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/telegram_bot/test_notify.py", "license": "Apache License 2.0", "lines": 61, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/template/test_event.py
"""The tests for the Template event platform.""" from typing import Any import pytest from syrupy.assertion import SnapshotAssertion from homeassistant.components import event, template from homeassistant.const import ( ATTR_ENTITY_PICTURE, ATTR_ICON, STATE_UNAVAILABLE, STATE_UNKNOWN, ) from homeassi...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/template/test_event.py", "license": "Apache License 2.0", "lines": 722, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/template/test_update.py
"""The tests for the Template update platform.""" from typing import Any import pytest from syrupy.assertion import SnapshotAssertion from homeassistant.components import template, update from homeassistant.const import ( ATTR_ENTITY_PICTURE, ATTR_ICON, STATE_OFF, STATE_ON, STATE_UNAVAILABLE, ...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/template/test_update.py", "license": "Apache License 2.0", "lines": 877, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/togrill/test_config_flow.py
"""Test the ToGrill config flow.""" from unittest.mock import Mock from bleak.exc import BleakError import pytest from homeassistant import config_entries from homeassistant.components.togrill.const import DOMAIN from homeassistant.core import HomeAssistant from homeassistant.data_entry_flow import FlowResultType f...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/togrill/test_config_flow.py", "license": "Apache License 2.0", "lines": 140, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/togrill/test_event.py
"""Test events for ToGrill integration.""" from unittest.mock import Mock import pytest from syrupy.assertion import SnapshotAssertion from togrill_bluetooth.packets import PacketA1Notify, PacketA5Notify from homeassistant.components.event import ATTR_EVENT_TYPE from homeassistant.const import STATE_UNKNOWN, Platfor...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/togrill/test_event.py", "license": "Apache License 2.0", "lines": 60, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/togrill/test_init.py
"""Test for initialization of ToGrill integration.""" from unittest.mock import Mock from bleak.exc import BleakError from syrupy.assertion import SnapshotAssertion from homeassistant.config_entries import ConfigEntryState from homeassistant.core import HomeAssistant from homeassistant.helpers import device_registry...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/togrill/test_init.py", "license": "Apache License 2.0", "lines": 49, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/togrill/test_number.py
"""Test numbers for ToGrill integration.""" from unittest.mock import Mock from bleak.exc import BleakError import pytest from syrupy.assertion import SnapshotAssertion from togrill_bluetooth.exceptions import BaseError from togrill_bluetooth.packets import ( PacketA0Notify, PacketA6Write, PacketA8Notify,...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/togrill/test_number.py", "license": "Apache License 2.0", "lines": 270, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/togrill/test_sensor.py
"""Test sensors for ToGrill integration.""" from unittest.mock import Mock, patch from habluetooth import BluetoothServiceInfoBleak import pytest from syrupy.assertion import SnapshotAssertion from togrill_bluetooth.packets import PacketA0Notify, PacketA1Notify from homeassistant.const import Platform from homeassis...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/togrill/test_sensor.py", "license": "Apache License 2.0", "lines": 145, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/totalconnect/const.py
"""Constants for the Total Connect tests.""" LOCATION_ID = 1234567 CODE = "7890" USERNAME = "username@me.com" PASSWORD = "password" USERCODES = {LOCATION_ID: "7890"}
{ "repo_id": "home-assistant/core", "file_path": "tests/components/totalconnect/const.py", "license": "Apache License 2.0", "lines": 6, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/tuya/test_button.py
"""Test Tuya button platform.""" from __future__ import annotations from unittest.mock import patch import pytest from syrupy.assertion import SnapshotAssertion from tuya_sharing import CustomerDevice, Manager from homeassistant.components.button import DOMAIN as BUTTON_DOMAIN, SERVICE_PRESS from homeassistant.cons...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/tuya/test_button.py", "license": "Apache License 2.0", "lines": 52, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/tuya/test_camera.py
"""Test Tuya camera platform.""" from __future__ import annotations from typing import Any from unittest.mock import patch import pytest from syrupy.assertion import SnapshotAssertion from tuya_sharing import CustomerDevice, Manager from homeassistant.components.camera import ( DOMAIN as CAMERA_DOMAIN, SERV...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/tuya/test_camera.py", "license": "Apache License 2.0", "lines": 84, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/tuya/test_vacuum.py
"""Test Tuya vacuum platform.""" from __future__ import annotations from typing import Any from unittest.mock import patch import pytest from syrupy.assertion import SnapshotAssertion from tuya_sharing import CustomerDevice, Manager from homeassistant.components.vacuum import ( ATTR_FAN_SPEED, DOMAIN as VAC...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/tuya/test_vacuum.py", "license": "Apache License 2.0", "lines": 115, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/tuya/test_valve.py
"""Test Tuya valve platform.""" from __future__ import annotations from typing import Any from unittest.mock import patch from freezegun.api import FrozenDateTimeFactory import pytest from syrupy.assertion import SnapshotAssertion from tuya_sharing import CustomerDevice, Manager from homeassistant.components.valve ...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/tuya/test_valve.py", "license": "Apache License 2.0", "lines": 148, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/volvo/test_binary_sensor.py
"""Test Volvo binary sensors.""" from collections.abc import Awaitable, Callable from unittest.mock import patch import pytest from syrupy.assertion import SnapshotAssertion from homeassistant.components.volvo.const import DOMAIN from homeassistant.const import Platform from homeassistant.core import HomeAssistant f...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/volvo/test_binary_sensor.py", "license": "Apache License 2.0", "lines": 47, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/zimi/common.py
"""Common items for testing the zimi component.""" from unittest.mock import MagicMock, create_autospec, patch from zcc.device import ControlPointDevice from homeassistant.components.zimi.const import DOMAIN from homeassistant.const import CONF_HOST, CONF_PORT from homeassistant.core import HomeAssistant from homeas...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/zimi/common.py", "license": "Apache License 2.0", "lines": 61, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/zimi/test_cover.py
"""Test the Zimi cover entity.""" from unittest.mock import MagicMock from syrupy.assertion import SnapshotAssertion from homeassistant.components.cover import CoverEntityFeature from homeassistant.const import ( SERVICE_CLOSE_COVER, SERVICE_OPEN_COVER, SERVICE_SET_COVER_POSITION, Platform, ) from ho...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/zimi/test_cover.py", "license": "Apache License 2.0", "lines": 87, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/zimi/test_fan.py
"""Test the Zimi fan entity.""" from unittest.mock import MagicMock from syrupy.assertion import SnapshotAssertion from homeassistant.components.fan import FanEntityFeature from homeassistant.const import SERVICE_TURN_OFF, SERVICE_TURN_ON, Platform from homeassistant.core import HomeAssistant from homeassistant.help...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/zimi/test_fan.py", "license": "Apache License 2.0", "lines": 55, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/zimi/test_light.py
"""Test the Zimi light entity.""" from unittest.mock import MagicMock from syrupy.assertion import SnapshotAssertion from homeassistant.components.light import ColorMode from homeassistant.const import SERVICE_TURN_OFF, SERVICE_TURN_ON, Platform from homeassistant.core import HomeAssistant from homeassistant.helpers...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/zimi/test_light.py", "license": "Apache License 2.0", "lines": 85, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/zimi/test_switch.py
"""Test the Zimi switch entity.""" from unittest.mock import MagicMock from syrupy.assertion import SnapshotAssertion from homeassistant.const import SERVICE_TURN_OFF, SERVICE_TURN_ON, Platform from homeassistant.core import HomeAssistant from homeassistant.helpers import entity_registry as er from .common import E...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/zimi/test_switch.py", "license": "Apache License 2.0", "lines": 42, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/helpers/test_automation.py
"""Test automation helpers.""" import pytest import voluptuous as vol from homeassistant.helpers.automation import ( get_absolute_description_key, get_relative_description_key, move_options_fields_to_top_level, move_top_level_schema_fields_to_options, ) @pytest.mark.parametrize( ("relative_key",...
{ "repo_id": "home-assistant/core", "file_path": "tests/helpers/test_automation.py", "license": "Apache License 2.0", "lines": 172, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/pylint/test_enforce_greek_micro_char.py
"""Tests for pylint hass_enforce_greek_micro_char plugin.""" from __future__ import annotations import astroid from pylint.checkers import BaseChecker from pylint.testutils.unittest_linter import UnittestLinter from pylint.utils.ast_walker import ASTWalker import pytest from . import assert_no_messages @pytest.mar...
{ "repo_id": "home-assistant/core", "file_path": "tests/pylint/test_enforce_greek_micro_char.py", "license": "Apache License 2.0", "lines": 153, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:homeassistant/components/airos/config_flow.py
"""Config flow for the Ubiquiti airOS integration.""" from __future__ import annotations import asyncio from collections.abc import Mapping import logging from typing import Any from airos.airos6 import AirOS6 from airos.airos8 import AirOS8 from airos.discovery import airos_discover_devices from airos.exceptions im...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/airos/config_flow.py", "license": "Apache License 2.0", "lines": 378, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/airos/const.py
"""Constants for the Ubiquiti airOS integration.""" from datetime import timedelta DOMAIN = "airos" SCAN_INTERVAL = timedelta(minutes=1) MANUFACTURER = "Ubiquiti" DEFAULT_VERIFY_SSL = False DEFAULT_SSL = True SECTION_ADVANCED_SETTINGS = "advanced_settings" # Discovery related DEFAULT_USERNAME = "ubnt" HOSTNAME =...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/airos/const.py", "license": "Apache License 2.0", "lines": 14, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/airos/coordinator.py
"""DataUpdateCoordinator for AirOS.""" from __future__ import annotations import logging from airos.airos6 import AirOS6, AirOS6Data from airos.airos8 import AirOS8, AirOS8Data from airos.exceptions import ( AirOSConnectionAuthenticationError, AirOSConnectionSetupError, AirOSDataMissingError, AirOSDe...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/airos/coordinator.py", "license": "Apache License 2.0", "lines": 68, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/airos/diagnostics.py
"""Diagnostics support for airOS.""" from __future__ import annotations from typing import Any from homeassistant.components.diagnostics import async_redact_data from homeassistant.const import CONF_HOST, CONF_PASSWORD from homeassistant.core import HomeAssistant from .coordinator import AirOSConfigEntry IP_REDACT...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/airos/diagnostics.py", "license": "Apache License 2.0", "lines": 26, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/airos/entity.py
"""Generic AirOS Entity Class.""" from __future__ import annotations from homeassistant.const import CONF_HOST, CONF_SSL from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC, DeviceInfo from homeassistant.helpers.update_coordinator import CoordinatorEntity from .const import DOMAIN, MANUFACTURER,...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/airos/entity.py", "license": "Apache License 2.0", "lines": 36, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/airos/sensor.py
"""AirOS Sensor component for Home Assistant.""" from __future__ import annotations from collections.abc import Callable from dataclasses import dataclass import logging from typing import Generic, TypeVar from airos.data import ( AirOSDataBaseClass, DerivedWirelessMode, DerivedWirelessRole, NetRole,...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/airos/sensor.py", "license": "Apache License 2.0", "lines": 187, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/alexa_devices/services.py
"""Support for services.""" from aioamazondevices.const.metadata import ALEXA_INFO_SKILLS from aioamazondevices.const.sounds import SOUNDS_LIST import voluptuous as vol from homeassistant.config_entries import ConfigEntryState from homeassistant.const import ATTR_DEVICE_ID from homeassistant.core import HomeAssistant...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/alexa_devices/services.py", "license": "Apache License 2.0", "lines": 122, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/amberelectric/helpers.py
"""Formatting helpers used to convert things.""" from amberelectric.models.price_descriptor import PriceDescriptor DESCRIPTOR_MAP: dict[str, str] = { PriceDescriptor.SPIKE: "spike", PriceDescriptor.HIGH: "high", PriceDescriptor.NEUTRAL: "neutral", PriceDescriptor.LOW: "low", PriceDescriptor.VERYLO...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/amberelectric/helpers.py", "license": "Apache License 2.0", "lines": 19, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/amberelectric/services.py
"""Amber Electric Service class.""" from amberelectric.models.channel import ChannelType import voluptuous as vol from homeassistant.const import ATTR_CONFIG_ENTRY_ID from homeassistant.core import ( HomeAssistant, ServiceCall, ServiceResponse, SupportsResponse, callback, ) from homeassistant.exce...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/amberelectric/services.py", "license": "Apache License 2.0", "lines": 90, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/analytics/http.py
"""HTTP endpoints for analytics integration.""" from aiohttp import web from homeassistant.components.http import KEY_HASS, HomeAssistantView, require_admin from homeassistant.core import HomeAssistant from .analytics import async_devices_payload class AnalyticsDevicesView(HomeAssistantView): """View to handle...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/analytics/http.py", "license": "Apache License 2.0", "lines": 20, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/anthropic/entity.py
"""Base entity for Anthropic.""" import base64 from collections.abc import AsyncGenerator, Callable, Iterable from dataclasses import dataclass, field from datetime import UTC, datetime import json from mimetypes import guess_file_type from pathlib import Path from typing import Any, Literal, cast import anthropic fr...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/anthropic/entity.py", "license": "Apache License 2.0", "lines": 854, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/backup/services.py
"""The Backup integration.""" from homeassistant.core import HomeAssistant, ServiceCall from homeassistant.helpers.hassio import is_hassio from .const import DATA_MANAGER, DOMAIN async def _async_handle_create_service(call: ServiceCall) -> None: """Service handler for creating backups.""" backup_manager = c...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/backup/services.py", "license": "Apache License 2.0", "lines": 28, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/blue_current/switch.py
"""Support for Blue Current switches.""" from __future__ import annotations from collections.abc import Callable from dataclasses import dataclass from typing import Any from homeassistant.components.switch import SwitchEntity, SwitchEntityDescription from homeassistant.core import HomeAssistant, callback from homea...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/blue_current/switch.py", "license": "Apache License 2.0", "lines": 133, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/bring/services.py
"""Actions for Bring! integration.""" from bring_api import ( ActivityType, BringAuthException, BringNotificationType, BringRequestException, ReactionType, ) import voluptuous as vol from homeassistant.components.event import ATTR_EVENT_TYPE from homeassistant.components.todo import DOMAIN as TODO...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/bring/services.py", "license": "Apache License 2.0", "lines": 99, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/datadog/config_flow.py
"""Config flow for Datadog.""" from typing import Any from datadog import DogStatsd import voluptuous as vol from homeassistant.config_entries import ( ConfigEntry, ConfigFlow, ConfigFlowResult, OptionsFlow, ) from homeassistant.const import CONF_HOST, CONF_PORT, CONF_PREFIX from homeassistant.core i...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/datadog/config_flow.py", "license": "Apache License 2.0", "lines": 131, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/datadog/const.py
"""Constants for the Datadog integration.""" DOMAIN = "datadog" CONF_RATE = "rate" DEFAULT_HOST = "127.0.0.1" DEFAULT_PORT = 8125 DEFAULT_PREFIX = "hass" DEFAULT_RATE = 1
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/datadog/const.py", "license": "Apache License 2.0", "lines": 7, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/esphome/encryption_key_storage.py
"""Encryption key storage for ESPHome devices.""" from __future__ import annotations import logging from typing import TypedDict from homeassistant.core import HomeAssistant from homeassistant.helpers.json import JSONEncoder from homeassistant.helpers.singleton import singleton from homeassistant.helpers.storage imp...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/esphome/encryption_key_storage.py", "license": "Apache License 2.0", "lines": 74, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/google_generative_ai_conversation/ai_task.py
"""AI Task integration for Google Generative AI Conversation.""" from __future__ import annotations from json import JSONDecodeError from typing import TYPE_CHECKING from google.genai.errors import APIError from google.genai.types import GenerateContentConfig, Part, PartUnionDict from homeassistant.components impor...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/google_generative_ai_conversation/ai_task.py", "license": "Apache License 2.0", "lines": 172, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/google_generative_ai_conversation/stt.py
"""Speech to text support for Google Generative AI.""" from __future__ import annotations from collections.abc import AsyncIterable from google.genai.errors import APIError, ClientError from google.genai.types import Part from homeassistant.components import stt from homeassistant.config_entries import ConfigEntry,...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/google_generative_ai_conversation/stt.py", "license": "Apache License 2.0", "lines": 239, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/growatt_server/coordinator.py
"""Coordinator module for managing Growatt data fetching.""" from __future__ import annotations import datetime import json import logging from typing import TYPE_CHECKING, Any import growattServer from homeassistant.components.sensor import SensorStateClass from homeassistant.config_entries import ConfigEntry from...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/growatt_server/coordinator.py", "license": "Apache License 2.0", "lines": 371, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/growatt_server/models.py
"""Models for the Growatt server integration.""" from __future__ import annotations from dataclasses import dataclass from typing import TYPE_CHECKING if TYPE_CHECKING: from .coordinator import GrowattCoordinator @dataclass class GrowattRuntimeData: """Runtime data for the Growatt integration.""" tota...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/growatt_server/models.py", "license": "Apache License 2.0", "lines": 11, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/homematicip_cloud/valve.py
"""Support for HomematicIP Cloud valve devices.""" from homematicip.base.functionalChannels import FunctionalChannelType from homematicip.device import Device from homeassistant.components.valve import ( ValveDeviceClass, ValveEntity, ValveEntityFeature, ) from homeassistant.core import HomeAssistant from...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/homematicip_cloud/valve.py", "license": "Apache License 2.0", "lines": 49, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/huawei_lte/diagnostics.py
"""Diagnostics support for Huawei LTE.""" from __future__ import annotations from typing import Any from homeassistant.components.diagnostics import async_redact_data from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant from .const import DOMAIN ENTRY_FIELDS_DATA_TO_RED...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/huawei_lte/diagnostics.py", "license": "Apache License 2.0", "lines": 79, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/husqvarna_automower_ble/sensor.py
"""Support for sensor entities.""" from __future__ import annotations from homeassistant.components.sensor import ( SensorDeviceClass, SensorEntity, SensorEntityDescription, SensorStateClass, ) from homeassistant.const import PERCENTAGE, EntityCategory from homeassistant.core import HomeAssistant from...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/husqvarna_automower_ble/sensor.py", "license": "Apache License 2.0", "lines": 41, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/huum/binary_sensor.py
"""Sensor for door state.""" from __future__ import annotations from homeassistant.components.binary_sensor import ( BinarySensorDeviceClass, BinarySensorEntity, ) from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback from .coordinator i...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/huum/binary_sensor.py", "license": "Apache License 2.0", "lines": 30, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/huum/coordinator.py
"""DataUpdateCoordinator for Huum.""" from __future__ import annotations from datetime import timedelta import logging from huum.exceptions import Forbidden, NotAuthenticated from huum.huum import Huum from huum.schemas import HuumStatusResponse from homeassistant.config_entries import ConfigEntry from homeassistan...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/huum/coordinator.py", "license": "Apache License 2.0", "lines": 46, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/huum/entity.py
"""Define Huum Base entity.""" from homeassistant.helpers.device_registry import DeviceInfo from homeassistant.helpers.update_coordinator import CoordinatorEntity from .const import DOMAIN from .coordinator import HuumDataUpdateCoordinator class HuumBaseEntity(CoordinatorEntity[HuumDataUpdateCoordinator]): """H...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/huum/entity.py", "license": "Apache License 2.0", "lines": 17, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/huum/light.py
"""Control for light.""" from __future__ import annotations import logging from typing import Any from homeassistant.components.light import ColorMode, LightEntity from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback from .const import CONFIG_...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/huum/light.py", "license": "Apache License 2.0", "lines": 45, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/immich/services.py
"""Services for the Immich integration.""" import logging from aioimmich.exceptions import ImmichError import voluptuous as vol from homeassistant.components.media_source import async_resolve_media from homeassistant.core import HomeAssistant, ServiceCall from homeassistant.exceptions import ServiceValidationError f...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/immich/services.py", "license": "Apache License 2.0", "lines": 70, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/ituran/binary_sensor.py
"""Binary sensors for Ituran vehicles.""" from __future__ import annotations from collections.abc import Callable from dataclasses import dataclass from pyituran import Vehicle from homeassistant.components.binary_sensor import ( BinarySensorDeviceClass, BinarySensorEntity, BinarySensorEntityDescription...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/ituran/binary_sensor.py", "license": "Apache License 2.0", "lines": 57, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/knx/knx_module.py
"""Base module for the KNX integration.""" from __future__ import annotations import logging from xknx import XKNX from xknx.core import XknxConnectionState from xknx.core.state_updater import StateTrackerType, TrackerOptions from xknx.core.telegram_queue import TelegramQueue from xknx.dpt import DPTBase from xknx.e...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/knx/knx_module.py", "license": "Apache License 2.0", "lines": 308, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/knx/storage/migration.py
"""Migration functions for KNX config store schema.""" from typing import Any from homeassistant.const import Platform from ..const import CONF_RESPOND_TO_READ from . import const as store_const def migrate_1_to_2(data: dict[str, Any]) -> None: """Migrate from schema 1 to schema 2.""" if lights := data.get...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/knx/storage/migration.py", "license": "Apache License 2.0", "lines": 44, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/knx/storage/util.py
"""Utility functions for the KNX integration.""" from functools import partial from typing import Any from xknx.typing import DPTMainSubDict from homeassistant.helpers.typing import ConfigType from .const import CONF_DPT, CONF_GA_PASSIVE, CONF_GA_STATE, CONF_GA_WRITE def dpt_string_to_dict(dpt: str) -> DPTMainSub...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/knx/storage/util.py", "license": "Apache License 2.0", "lines": 51, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple