sample_id
stringlengths
21
196
text
stringlengths
105
936k
metadata
dict
category
stringclasses
6 values
home-assistant/core:homeassistant/components/droplet/sensor.py
"""Support for Droplet.""" from __future__ import annotations from collections.abc import Callable from dataclasses import dataclass from datetime import datetime from pydroplet.droplet import Droplet from homeassistant.components.sensor import ( SensorDeviceClass, SensorEntity, SensorEntityDescription,...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/droplet/sensor.py", "license": "Apache License 2.0", "lines": 110, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/ekeybionyx/application_credentials.py
"""application_credentials platform the Ekey Bionyx integration.""" from homeassistant.components.application_credentials import AuthorizationServer from homeassistant.core import HomeAssistant from .const import OAUTH2_AUTHORIZE, OAUTH2_TOKEN async def async_get_authorization_server(hass: HomeAssistant) -> Authori...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/ekeybionyx/application_credentials.py", "license": "Apache License 2.0", "lines": 10, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/ekeybionyx/config_flow.py
"""Config flow for ekey bionyx.""" import asyncio import json import logging import re import secrets from typing import Any, NotRequired, TypedDict import aiohttp import ekey_bionyxpy import voluptuous as vol from homeassistant.components.webhook import ( async_generate_id as webhook_generate_id, async_gene...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/ekeybionyx/config_flow.py", "license": "Apache License 2.0", "lines": 238, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/ekeybionyx/const.py
"""Constants for the Ekey Bionyx integration.""" import logging DOMAIN = "ekeybionyx" INTEGRATION_NAME = "ekey bionyx" LOGGER = logging.getLogger(__package__) OAUTH2_AUTHORIZE = "https://ekeybionyxprod.b2clogin.com/ekeybionyxprod.onmicrosoft.com/B2C_1_sign_in_v2/oauth2/v2.0/authorize" OAUTH2_TOKEN = "https://ekeybi...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/ekeybionyx/const.py", "license": "Apache License 2.0", "lines": 9, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/ekeybionyx/event.py
"""Event platform for ekey bionyx integration.""" from http import HTTPStatus from aiohttp.hdrs import METH_POST from aiohttp.web import Request, Response from homeassistant.components.event import EventDeviceClass, EventEntity from homeassistant.components.webhook import ( async_register as webhook_register, ...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/ekeybionyx/event.py", "license": "Apache License 2.0", "lines": 65, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/file/services.py
"""File Service calls.""" from collections.abc import Callable import json import voluptuous as vol import yaml from homeassistant.core import HomeAssistant, ServiceCall, SupportsResponse, callback from homeassistant.exceptions import HomeAssistantError, ServiceValidationError from homeassistant.helpers import confi...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/file/services.py", "license": "Apache License 2.0", "lines": 72, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/foscam/number.py
"""Foscam number platform for Home Assistant.""" from __future__ import annotations from collections.abc import Callable from dataclasses import dataclass from typing import Any from libpyfoscamcgi import FoscamCamera from homeassistant.components.number import NumberEntity, NumberEntityDescription from homeassista...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/foscam/number.py", "license": "Apache License 2.0", "lines": 73, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/geocaching/entity.py
"""Sensor entities for Geocaching.""" from typing import cast from geocachingapi.models import GeocachingCache from homeassistant.helpers.device_registry import DeviceEntryType, DeviceInfo from homeassistant.helpers.update_coordinator import CoordinatorEntity from .const import DOMAIN from .coordinator import Geoca...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/geocaching/entity.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/hassio/switch.py
"""Switch platform for Hass.io addons.""" from __future__ import annotations import logging from typing import Any from aiohasupervisor import SupervisorError from homeassistant.components.switch import SwitchEntity, SwitchEntityDescription from homeassistant.config_entries import ConfigEntry from homeassistant.con...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/hassio/switch.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/history_stats/diagnostics.py
"""Diagnostics support for history_stats.""" from __future__ import annotations from typing import Any from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant from homeassistant.helpers import entity_registry as er async def async_get_config_entry_diagnostics( hass: Ho...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/history_stats/diagnostics.py", "license": "Apache License 2.0", "lines": 16, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/homeassistant_connect_zbt2/config_flow.py
"""Config flow for the Home Assistant Connect ZBT-2 integration.""" from __future__ import annotations import logging from typing import TYPE_CHECKING, Any, Protocol from homeassistant.components import usb from homeassistant.components.homeassistant_hardware import firmware_config_flow from homeassistant.components...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/homeassistant_connect_zbt2/config_flow.py", "license": "Apache License 2.0", "lines": 192, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/homeassistant_connect_zbt2/const.py
"""Constants for the Home Assistant Connect ZBT-2 integration.""" DOMAIN = "homeassistant_connect_zbt2" NABU_CASA_FIRMWARE_RELEASES_URL = ( "https://api.github.com/repos/NabuCasa/silabs-firmware-builder/releases" ) FIRMWARE = "firmware" FIRMWARE_VERSION = "firmware_version" SERIAL_NUMBER = "serial_number" MANUFA...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/homeassistant_connect_zbt2/const.py", "license": "Apache License 2.0", "lines": 15, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/homeassistant_connect_zbt2/hardware.py
"""The Home Assistant Connect ZBT-2 hardware platform.""" from __future__ import annotations from homeassistant.components.hardware import HardwareInfo, USBInfo from homeassistant.core import HomeAssistant, callback from .config_flow import HomeAssistantConnectZBT2ConfigFlow from .const import DOMAIN, HARDWARE_NAME,...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/homeassistant_connect_zbt2/hardware.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/homeassistant_connect_zbt2/update.py
"""Home Assistant Connect ZBT-2 firmware update entity.""" from __future__ import annotations import logging from homeassistant.components.homeassistant_hardware.coordinator import ( FirmwareUpdateCoordinator, ) from homeassistant.components.homeassistant_hardware.update import ( BaseFirmwareUpdateEntity, ...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/homeassistant_connect_zbt2/update.py", "license": "Apache License 2.0", "lines": 166, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/homeassistant_connect_zbt2/util.py
"""Utility functions for Home Assistant Connect ZBT-2 integration.""" from __future__ import annotations import logging from homeassistant.config_entries import ConfigEntry from homeassistant.helpers.service_info.usb import UsbServiceInfo _LOGGER = logging.getLogger(__name__) def get_usb_service_info(config_entry...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/homeassistant_connect_zbt2/util.py", "license": "Apache License 2.0", "lines": 16, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/imeon_inverter/select.py
"""Imeon inverter select support.""" from collections.abc import Awaitable, Callable from dataclasses import dataclass import logging from homeassistant.components.select import SelectEntity, SelectEntityDescription from homeassistant.config_entries import ConfigEntry from homeassistant.const import EntityCategory fr...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/imeon_inverter/select.py", "license": "Apache License 2.0", "lines": 55, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/irm_kmi/config_flow.py
"""Config flow to set up IRM KMI integration via the UI.""" import logging from irm_kmi_api import IrmKmiApiClient, IrmKmiApiError import voluptuous as vol from homeassistant.config_entries import ( ConfigFlow, ConfigFlowResult, OptionsFlow, OptionsFlowWithReload, ) from homeassistant.const import ( ...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/irm_kmi/config_flow.py", "license": "Apache License 2.0", "lines": 110, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/irm_kmi/const.py
"""Constants for the IRM KMI integration.""" from typing import Final from homeassistant.components.weather import ( ATTR_CONDITION_CLEAR_NIGHT, ATTR_CONDITION_CLOUDY, ATTR_CONDITION_FOG, ATTR_CONDITION_LIGHTNING_RAINY, ATTR_CONDITION_PARTLYCLOUDY, ATTR_CONDITION_POURING, ATTR_CONDITION_RA...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/irm_kmi/const.py", "license": "Apache License 2.0", "lines": 94, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/irm_kmi/coordinator.py
"""DataUpdateCoordinator for the IRM KMI integration.""" from datetime import timedelta import logging from irm_kmi_api import IrmKmiApiClientHa, IrmKmiApiError from homeassistant.config_entries import ConfigEntry from homeassistant.const import ATTR_LATITUDE, ATTR_LONGITUDE, CONF_LOCATION from homeassistant.core im...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/irm_kmi/coordinator.py", "license": "Apache License 2.0", "lines": 76, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/irm_kmi/data.py
"""Define data classes for the IRM KMI integration.""" from dataclasses import dataclass, field from irm_kmi_api import CurrentWeatherData, ExtendedForecast from homeassistant.components.weather import Forecast @dataclass class ProcessedCoordinatorData: """Dataclass that will be exposed to the entities consumi...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/irm_kmi/data.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/irm_kmi/entity.py
"""Base class shared among IRM KMI entities.""" from homeassistant.helpers.device_registry import DeviceEntryType, DeviceInfo from homeassistant.helpers.update_coordinator import CoordinatorEntity from .const import DOMAIN, IRM_KMI_NAME from .coordinator import IrmKmiConfigEntry, IrmKmiCoordinator from .utils import ...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/irm_kmi/entity.py", "license": "Apache License 2.0", "lines": 21, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/irm_kmi/utils.py
"""Helper functions for use with IRM KMI integration.""" from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant from .const import CONF_LANGUAGE_OVERRIDE, LANGS def preferred_language(hass: HomeAssistant, config_entry: ConfigEntry | None) -> str: """Get the preferred l...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/irm_kmi/utils.py", "license": "Apache License 2.0", "lines": 12, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/irm_kmi/weather.py
"""Support for IRM KMI weather.""" from irm_kmi_api import CurrentWeatherData from homeassistant.components.weather import ( Forecast, SingleCoordinatorWeatherEntity, WeatherEntityFeature, ) from homeassistant.const import ( CONF_UNIQUE_ID, UnitOfPrecipitationDepth, UnitOfPressure, UnitOfS...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/irm_kmi/weather.py", "license": "Apache License 2.0", "lines": 130, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/lawn_mower/intent.py
"""Intents for the lawn mower integration.""" from homeassistant.core import HomeAssistant from homeassistant.helpers import intent from . import DOMAIN, SERVICE_DOCK, SERVICE_START_MOWING, LawnMowerEntityFeature INTENT_LANW_MOWER_START_MOWING = "HassLawnMowerStartMowing" INTENT_LANW_MOWER_DOCK = "HassLawnMowerDock"...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/lawn_mower/intent.py", "license": "Apache License 2.0", "lines": 32, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/letpot/number.py
"""Support for LetPot number entities.""" from collections.abc import Callable, Coroutine from dataclasses import dataclass from typing import Any from letpot.deviceclient import LetPotDeviceClient from letpot.models import DeviceFeature from homeassistant.components.number import ( NumberEntity, NumberEntit...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/letpot/number.py", "license": "Apache License 2.0", "lines": 122, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/libre_hardware_monitor/config_flow.py
"""Config flow for LibreHardwareMonitor.""" from __future__ import annotations from collections.abc import Mapping import logging from typing import Any from librehardwaremonitor_api import ( LibreHardwareMonitorClient, LibreHardwareMonitorConnectionError, LibreHardwareMonitorNoDevicesError, LibreHar...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/libre_hardware_monitor/config_flow.py", "license": "Apache License 2.0", "lines": 131, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/libre_hardware_monitor/const.py
"""Constants for the LibreHardwareMonitor integration.""" DOMAIN = "libre_hardware_monitor" DEFAULT_HOST = "localhost" DEFAULT_PORT = 8085 DEFAULT_SCAN_INTERVAL = 10
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/libre_hardware_monitor/const.py", "license": "Apache License 2.0", "lines": 5, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/libre_hardware_monitor/coordinator.py
"""Coordinator for LibreHardwareMonitor integration.""" from __future__ import annotations from datetime import timedelta import logging from librehardwaremonitor_api import ( LibreHardwareMonitorClient, LibreHardwareMonitorConnectionError, LibreHardwareMonitorNoDevicesError, LibreHardwareMonitorUnau...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/libre_hardware_monitor/coordinator.py", "license": "Apache License 2.0", "lines": 130, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/libre_hardware_monitor/sensor.py
"""Support for LibreHardwareMonitor Sensor Platform.""" from __future__ import annotations from typing import Any from librehardwaremonitor_api.model import LibreHardwareMonitorSensorData from librehardwaremonitor_api.sensor_type import SensorType from homeassistant.components.sensor import SensorEntity, SensorStat...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/libre_hardware_monitor/sensor.py", "license": "Apache License 2.0", "lines": 80, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/media_source/helper.py
"""Helpers for media source.""" from __future__ import annotations from collections.abc import Callable from homeassistant.components.media_player import BrowseError, BrowseMedia from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.frame import report_usage from homeassistant.helpers.typ...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/media_source/helper.py", "license": "Apache License 2.0", "lines": 85, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/media_source/http.py
"""HTTP views and WebSocket commands for media sources.""" from __future__ import annotations from typing import Any import voluptuous as vol from homeassistant.components import frontend, websocket_api from homeassistant.components.media_player import ( ATTR_MEDIA_CONTENT_ID, CONTENT_AUTH_EXPIRY_TIME, ...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/media_source/http.py", "license": "Apache License 2.0", "lines": 67, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/nederlandse_spoorwegen/config_flow.py
"""Config flow for Nederlandse Spoorwegen integration.""" from __future__ import annotations import logging from typing import Any from ns_api import NSAPI, Station from requests.exceptions import ( ConnectionError as RequestsConnectionError, HTTPError, Timeout, ) import voluptuous as vol from homeassis...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/nederlandse_spoorwegen/config_flow.py", "license": "Apache License 2.0", "lines": 201, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/nederlandse_spoorwegen/const.py
"""Constants for the Nederlandse Spoorwegen integration.""" from datetime import timedelta from zoneinfo import ZoneInfo DOMAIN = "nederlandse_spoorwegen" INTEGRATION_TITLE = "Nederlandse Spoorwegen" SUBENTRY_TYPE_ROUTE = "route" ROUTE_MODEL = "Route" # Europe/Amsterdam timezone for Dutch rail API expectations AMS_TZ...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/nederlandse_spoorwegen/const.py", "license": "Apache License 2.0", "lines": 22, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/ntfy/entity.py
"""Base entity for ntfy integration.""" from __future__ import annotations from yarl import URL from homeassistant.config_entries import ConfigSubentry from homeassistant.const import CONF_URL from homeassistant.helpers.device_registry import DeviceEntryType, DeviceInfo from homeassistant.helpers.entity import Entit...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/ntfy/entity.py", "license": "Apache License 2.0", "lines": 53, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/ntfy/event.py
"""Event platform for ntfy integration.""" from __future__ import annotations import asyncio import logging from typing import TYPE_CHECKING from aiontfy import Event, Notification from aiontfy.exceptions import ( NtfyConnectionError, NtfyForbiddenError, NtfyHTTPError, NtfyTimeoutError, ) from homea...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/ntfy/event.py", "license": "Apache License 2.0", "lines": 152, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/ntfy/repairs.py
"""Repairs for ntfy integration.""" from __future__ import annotations import voluptuous as vol from homeassistant import data_entry_flow from homeassistant.components.repairs import ConfirmRepairFlow, RepairsFlow from homeassistant.core import HomeAssistant from homeassistant.helpers import entity_registry as er f...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/ntfy/repairs.py", "license": "Apache License 2.0", "lines": 43, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/opnsense/const.py
"""Constants for OPNsense component.""" DOMAIN = "opnsense" OPNSENSE_DATA = DOMAIN CONF_API_SECRET = "api_secret" CONF_INTERFACE_CLIENT = "interface_client" CONF_TRACKER_INTERFACES = "tracker_interfaces"
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/opnsense/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/portainer/binary_sensor.py
"""Binary sensor platform for Portainer.""" from __future__ import annotations from collections.abc import Callable from dataclasses import dataclass from homeassistant.components.binary_sensor import ( BinarySensorDeviceClass, BinarySensorEntity, BinarySensorEntityDescription, ) from homeassistant.const...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/portainer/binary_sensor.py", "license": "Apache License 2.0", "lines": 157, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/portainer/config_flow.py
"""Config flow for the portainer integration.""" from __future__ import annotations from collections.abc import Mapping import logging from typing import Any from pyportainer import ( Portainer, PortainerAuthenticationError, PortainerConnectionError, PortainerTimeoutError, ) import voluptuous as vol ...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/portainer/config_flow.py", "license": "Apache License 2.0", "lines": 165, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/portainer/const.py
"""Constants for the Portainer integration.""" DOMAIN = "portainer" DEFAULT_NAME = "Portainer" ENDPOINT_STATUS_DOWN = 2 CONTAINER_STATE_RUNNING = "running" STACK_STATUS_ACTIVE = 1 STACK_STATUS_INACTIVE = 2 STACK_TYPE_SWARM = 1 STACK_TYPE_COMPOSE = 2 STACK_TYPE_KUBERNETES = 3
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/portainer/const.py", "license": "Apache License 2.0", "lines": 10, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/portainer/coordinator.py
"""Data Update Coordinator for Portainer.""" from __future__ import annotations import asyncio from collections.abc import Callable from dataclasses import dataclass from datetime import timedelta import logging from pyportainer import ( Portainer, PortainerAuthenticationError, PortainerConnectionError, ...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/portainer/coordinator.py", "license": "Apache License 2.0", "lines": 266, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/portainer/entity.py
"""Base class for Portainer entities.""" from yarl import URL from homeassistant.const import CONF_URL from homeassistant.helpers.device_registry import DeviceEntryType, DeviceInfo from homeassistant.helpers.entity import EntityDescription from homeassistant.helpers.update_coordinator import CoordinatorEntity from ....
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/portainer/entity.py", "license": "Apache License 2.0", "lines": 152, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/route_b_smart_meter/config_flow.py
"""Config flow for Smart Meter B Route integration.""" import logging from typing import Any from momonga import Momonga, MomongaSkJoinFailure, MomongaSkScanFailure from serial.tools.list_ports import comports from serial.tools.list_ports_common import ListPortInfo import voluptuous as vol from homeassistant.compone...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/route_b_smart_meter/config_flow.py", "license": "Apache License 2.0", "lines": 99, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/route_b_smart_meter/const.py
"""Constants for the Smart Meter B Route integration.""" from datetime import timedelta DOMAIN = "route_b_smart_meter" ENTRY_TITLE = "Route B Smart Meter" DEFAULT_SCAN_INTERVAL = timedelta(seconds=300) ATTR_API_INSTANTANEOUS_POWER = "instantaneous_power" ATTR_API_TOTAL_CONSUMPTION = "total_consumption" ATTR_API_INST...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/route_b_smart_meter/const.py", "license": "Apache License 2.0", "lines": 9, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/route_b_smart_meter/coordinator.py
"""DataUpdateCoordinator for the Smart Meter B-route integration.""" from dataclasses import dataclass import logging import time from momonga import Momonga, MomongaError from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_DEVICE, CONF_ID, CONF_PASSWORD from homeassistant.core ...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/route_b_smart_meter/coordinator.py", "license": "Apache License 2.0", "lines": 83, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/route_b_smart_meter/sensor.py
"""Smart Meter B Route.""" from collections.abc import Callable from dataclasses import dataclass from typing import Literal from homeassistant.components.sensor import ( SensorDeviceClass, SensorEntity, SensorEntityDescription, SensorStateClass, ) from homeassistant.const import UnitOfElectricCurrent...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/route_b_smart_meter/sensor.py", "license": "Apache License 2.0", "lines": 109, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/satel_integra/config_flow.py
"""Config flow for Satel Integra.""" from __future__ import annotations import logging from typing import Any from satel_integra.satel_integra import AsyncSatel import voluptuous as vol from homeassistant.components.binary_sensor import BinarySensorDeviceClass from homeassistant.config_entries import ( ConfigEn...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/satel_integra/config_flow.py", "license": "Apache License 2.0", "lines": 428, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/satel_integra/const.py
"""Constants for the Satel Integra integration.""" DEFAULT_CONF_ARM_HOME_MODE = 1 DEFAULT_PORT = 7094 DEFAULT_ZONE_TYPE = "motion" DOMAIN = "satel_integra" SUBENTRY_TYPE_PARTITION = "partition" SUBENTRY_TYPE_ZONE = "zone" SUBENTRY_TYPE_OUTPUT = "output" SUBENTRY_TYPE_SWITCHABLE_OUTPUT = "switchable_output" CONF_PAR...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/satel_integra/const.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/satel_integra/diagnostics.py
"""Diagnostics support for Satel Integra.""" from __future__ import annotations from typing import Any from homeassistant.components.diagnostics import async_redact_data from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_CODE from homeassistant.core import HomeAssistant TO_RED...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/satel_integra/diagnostics.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/sftp_storage/backup.py
"""Backup platform for the SFTP Storage integration.""" from __future__ import annotations from collections.abc import AsyncIterator, Callable, Coroutine from typing import Any from asyncssh.sftp import SFTPError from homeassistant.components.backup import ( AgentBackup, BackupAgent, BackupAgentError, ...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/sftp_storage/backup.py", "license": "Apache License 2.0", "lines": 126, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/sftp_storage/client.py
"""Client for SFTP Storage integration.""" from __future__ import annotations from collections.abc import AsyncIterator from dataclasses import dataclass import json from types import TracebackType from typing import TYPE_CHECKING, Self from asyncssh import ( SFTPClient, SFTPClientFile, SSHClientConnecti...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/sftp_storage/client.py", "license": "Apache License 2.0", "lines": 248, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/sftp_storage/config_flow.py
"""Config flow to configure the SFTP Storage integration.""" from __future__ import annotations from contextlib import suppress from pathlib import Path import shutil from typing import Any, cast from asyncssh import KeyImportError, SSHClientConnectionOptions, connect from asyncssh.misc import PermissionDenied from ...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/sftp_storage/config_flow.py", "license": "Apache License 2.0", "lines": 205, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/sftp_storage/const.py
"""Constants for the SFTP Storage integration.""" from __future__ import annotations from collections.abc import Callable import logging from typing import Final from homeassistant.util.hass_dict import HassKey DOMAIN: Final = "sftp_storage" LOGGER = logging.getLogger(__package__) CONF_HOST: Final = "host" CONF_P...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/sftp_storage/const.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/sonos/services.py
"""Support to interface with Sonos players.""" from __future__ import annotations import voluptuous as vol from homeassistant.components.media_player import DOMAIN as MEDIA_PLAYER_DOMAIN from homeassistant.const import ATTR_TIME from homeassistant.core import HomeAssistant, ServiceCall, SupportsResponse, callback fr...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/sonos/services.py", "license": "Apache License 2.0", "lines": 120, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/switchbot_cloud/humidifier.py
"""Support for Switchbot humidifier.""" import asyncio from typing import Any from switchbot_api import CommonCommands, HumidifierCommands, HumidifierV2Commands from homeassistant.components.humidifier import ( MODE_AUTO, MODE_NORMAL, HumidifierDeviceClass, HumidifierEntity, HumidifierEntityFeatu...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/switchbot_cloud/humidifier.py", "license": "Apache License 2.0", "lines": 131, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/tasmota/camera.py
"""Support for Tasmota Camera.""" from __future__ import annotations import asyncio import logging from typing import Any import aiohttp from hatasmota import camera as tasmota_camera from hatasmota.entity import TasmotaEntity as HATasmotaEntity from hatasmota.models import DiscoveryHashType from homeassistant.comp...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/tasmota/camera.py", "license": "Apache License 2.0", "lines": 88, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/togrill/select.py
"""Support for select entities.""" from __future__ import annotations from collections.abc import Callable, Generator, Mapping from dataclasses import dataclass from enum import Enum from typing import Any, TypeVar from togrill_bluetooth.packets import ( GrillType, PacketA8Notify, PacketA303Write, Pa...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/togrill/select.py", "license": "Apache License 2.0", "lines": 134, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/usage_prediction/common_control.py
"""Code to generate common control usage patterns.""" from __future__ import annotations from collections import Counter from collections.abc import Callable, Sequence from datetime import datetime, timedelta from functools import cache import logging from typing import Any, Literal, cast from sqlalchemy import sele...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/usage_prediction/common_control.py", "license": "Apache License 2.0", "lines": 194, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/usage_prediction/const.py
"""Constants for the usage prediction integration.""" import asyncio from homeassistant.util.hass_dict import HassKey from .models import EntityUsageDataCache, EntityUsagePredictions DOMAIN = "usage_prediction" DATA_CACHE: HassKey[ dict[str, asyncio.Task[EntityUsagePredictions] | EntityUsageDataCache] ] = Hass...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/usage_prediction/const.py", "license": "Apache License 2.0", "lines": 8, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/usage_prediction/models.py
"""Models for the usage prediction integration.""" from dataclasses import dataclass, field from datetime import datetime from homeassistant.util import dt as dt_util @dataclass class EntityUsagePredictions: """Prediction which entities are likely to be used in each time category.""" morning: list[str] = f...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/usage_prediction/models.py", "license": "Apache License 2.0", "lines": 16, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/victron_remote_monitoring/config_flow.py
"""Config flow for the Victron VRM Solar Forecast integration.""" from __future__ import annotations from collections.abc import Mapping import logging from typing import Any from victron_vrm import VictronVRMClient from victron_vrm.exceptions import AuthenticationError, VictronVRMError from victron_vrm.models impor...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/victron_remote_monitoring/config_flow.py", "license": "Apache License 2.0", "lines": 221, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/victron_remote_monitoring/const.py
"""Constants for the Victron VRM Solar Forecast integration.""" import logging DOMAIN = "victron_remote_monitoring" LOGGER = logging.getLogger(__package__) CONF_SITE_ID = "site_id" CONF_API_TOKEN = "api_token"
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/victron_remote_monitoring/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/victron_remote_monitoring/coordinator.py
"""VRM Coordinator and Client.""" from dataclasses import dataclass import datetime from victron_vrm import VictronVRMClient from victron_vrm.exceptions import AuthenticationError, VictronVRMError from victron_vrm.models.aggregations import ForecastAggregations from victron_vrm.utils import dt_now from homeassistant...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/victron_remote_monitoring/coordinator.py", "license": "Apache License 2.0", "lines": 83, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/victron_remote_monitoring/sensor.py
"""Support for the VRM Solar Forecast sensor service.""" from __future__ import annotations from collections.abc import Callable from dataclasses import dataclass from datetime import datetime from homeassistant.components.sensor import ( SensorDeviceClass, SensorEntity, SensorEntityDescription, Sens...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/victron_remote_monitoring/sensor.py", "license": "Apache License 2.0", "lines": 276, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/components/weatherflow/event.py
"""Event entities for the WeatherFlow integration.""" from __future__ import annotations from dataclasses import dataclass from pyweatherflowudp.device import EVENT_RAIN_START, EVENT_STRIKE, WeatherFlowDevice from homeassistant.components.event import EventEntity, EventEntityDescription from homeassistant.config_en...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/weatherflow/event.py", "license": "Apache License 2.0", "lines": 82, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/components/workday/calendar.py
"""Workday Calendar.""" from __future__ import annotations from datetime import date, datetime, timedelta from holidays import HolidayBase from homeassistant.components.calendar import CalendarEntity, CalendarEvent from homeassistant.const import CONF_NAME from homeassistant.core import HomeAssistant from homeassis...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/components/workday/calendar.py", "license": "Apache License 2.0", "lines": 92, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/helpers/service_info/esphome.py
"""ESPHome discovery data.""" from dataclasses import dataclass from yarl import URL from homeassistant.data_entry_flow import BaseServiceInfo @dataclass(slots=True) class ESPHomeServiceInfo(BaseServiceInfo): """Prepared info from ESPHome entries.""" name: str zwave_home_id: int | None ip_address:...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/helpers/service_info/esphome.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/helpers/template/context.py
"""Template context management for Home Assistant.""" from __future__ import annotations from contextlib import AbstractContextManager from contextvars import ContextVar from types import TracebackType from typing import Any import jinja2 # Context variable for template string tracking template_cv: ContextVar[tuple...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/helpers/template/context.py", "license": "Apache License 2.0", "lines": 33, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/helpers/template/extensions/base.py
"""Base extension class for Home Assistant template extensions.""" from __future__ import annotations from collections.abc import Callable from dataclasses import dataclass from functools import wraps from typing import TYPE_CHECKING, Any, Concatenate, NoReturn from jinja2 import pass_context from jinja2.ext import ...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/helpers/template/extensions/base.py", "license": "Apache License 2.0", "lines": 109, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/helpers/template/extensions/base64.py
"""Base64 encoding and decoding functions for Home Assistant templates.""" from __future__ import annotations import base64 from typing import TYPE_CHECKING from .base import BaseTemplateExtension, TemplateFunction if TYPE_CHECKING: from homeassistant.helpers.template import TemplateEnvironment class Base64Ex...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/helpers/template/extensions/base64.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/helpers/template/extensions/collection.py
"""Collection and data structure functions for Home Assistant templates.""" from __future__ import annotations from collections.abc import Iterable, MutableSequence import random from typing import TYPE_CHECKING, Any from .base import BaseTemplateExtension, TemplateFunction if TYPE_CHECKING: from homeassistant....
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/helpers/template/extensions/collection.py", "license": "Apache License 2.0", "lines": 166, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/helpers/template/extensions/crypto.py
"""Cryptographic hash functions for Home Assistant templates.""" from __future__ import annotations import hashlib from typing import TYPE_CHECKING from .base import BaseTemplateExtension, TemplateFunction if TYPE_CHECKING: from homeassistant.helpers.template import TemplateEnvironment class CryptoExtension(B...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/helpers/template/extensions/crypto.py", "license": "Apache License 2.0", "lines": 53, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/helpers/template/extensions/math.py
"""Mathematical and statistical functions for Home Assistant templates.""" from __future__ import annotations from collections.abc import Iterable from functools import wraps import math import statistics from typing import TYPE_CHECKING, Any, Literal import jinja2 from jinja2 import pass_environment from homeassis...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/helpers/template/extensions/math.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/helpers/template/extensions/regex.py
"""Jinja2 extension for regular expression functions.""" from __future__ import annotations from functools import lru_cache import re from typing import TYPE_CHECKING, Any from .base import BaseTemplateExtension, TemplateFunction if TYPE_CHECKING: from homeassistant.helpers.template import TemplateEnvironment ...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/helpers/template/extensions/regex.py", "license": "Apache License 2.0", "lines": 95, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:homeassistant/helpers/template/extensions/string.py
"""Jinja2 extension for string processing functions.""" from __future__ import annotations from typing import TYPE_CHECKING, Any from urllib.parse import urlencode as urllib_urlencode from homeassistant.util import slugify as slugify_util from .base import BaseTemplateExtension, TemplateFunction if TYPE_CHECKING: ...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/helpers/template/extensions/string.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/helpers/template/helpers.py
"""Template helper functions for Home Assistant.""" from __future__ import annotations from typing import TYPE_CHECKING, Any, NoReturn import voluptuous as vol from homeassistant.helpers import ( area_registry as ar, device_registry as dr, entity_registry as er, ) from .context import template_cv if T...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/helpers/template/helpers.py", "license": "Apache License 2.0", "lines": 54, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:homeassistant/helpers/template/render_info.py
"""Template render information tracking for Home Assistant.""" from __future__ import annotations import collections.abc from collections.abc import Callable from contextvars import ContextVar from typing import TYPE_CHECKING, cast from homeassistant.core import split_entity_id if TYPE_CHECKING: from homeassist...
{ "repo_id": "home-assistant/core", "file_path": "homeassistant/helpers/template/render_info.py", "license": "Apache License 2.0", "lines": 124, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_complex
home-assistant/core:script/hassfest/integration_info.py
"""Write integration constants.""" from __future__ import annotations from .model import Config, Integration from .serializer import format_python def validate(integrations: dict[str, Integration], config: Config) -> None: """Validate integrations file.""" if config.specific_integrations: return ...
{ "repo_id": "home-assistant/core", "file_path": "script/hassfest/integration_info.py", "license": "Apache License 2.0", "lines": 31, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
function_simple
home-assistant/core:tests/components/airos/test_init.py
"""Test for airOS integration setup.""" from __future__ import annotations from unittest.mock import ANY, AsyncMock, MagicMock from airos.exceptions import ( AirOSConnectionAuthenticationError, AirOSConnectionSetupError, AirOSDeviceConnectionError, AirOSKeyDataMissingError, ) import pytest from home...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/airos/test_init.py", "license": "Apache License 2.0", "lines": 236, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/alexa_devices/test_coordinator.py
"""Tests for the Alexa Devices coordinator.""" from unittest.mock import AsyncMock from freezegun.api import FrozenDateTimeFactory from homeassistant.components.alexa_devices.coordinator import SCAN_INTERVAL from homeassistant.const import STATE_ON from homeassistant.core import HomeAssistant from . import setup_in...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/alexa_devices/test_coordinator.py", "license": "Apache License 2.0", "lines": 37, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/aosmith/test_select.py
"""Tests for the select platform of the A. O. Smith integration.""" from collections.abc import AsyncGenerator from unittest.mock import MagicMock, patch from py_aosmith.models import OperationMode import pytest from syrupy.assertion import SnapshotAssertion from homeassistant.components.select import ( DOMAIN a...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/aosmith/test_select.py", "license": "Apache License 2.0", "lines": 66, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/camera/test_prefs.py
"""Test camera helper functions.""" import pytest from homeassistant.components.camera.const import DATA_CAMERA_PREFS from homeassistant.components.camera.prefs import ( CameraPreferences, DynamicStreamSettings, get_dynamic_camera_stream_settings, ) from homeassistant.components.stream import Orientation ...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/camera/test_prefs.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/compit/consts.py
"""Constants for the Compit component tests.""" from homeassistant.const import CONF_EMAIL, CONF_PASSWORD CONFIG_INPUT = { CONF_EMAIL: "test@example.com", CONF_PASSWORD: "password", }
{ "repo_id": "home-assistant/core", "file_path": "tests/components/compit/consts.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/compit/test_config_flow.py
"""Test the Compit config flow.""" from unittest.mock import AsyncMock import pytest from homeassistant import config_entries from homeassistant.components.compit.config_flow import CannotConnect, InvalidAuth from homeassistant.components.compit.const import DOMAIN from homeassistant.const import CONF_EMAIL, CONF_PA...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/compit/test_config_flow.py", "license": "Apache License 2.0", "lines": 130, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/cync/const.py
"""Test constants used in Cync tests.""" import time import pycync MOCKED_USER = pycync.User( "test_token", "test_refresh_token", "test_authorize_string", 123456789, expires_at=(time.time() * 1000) + 3600000, ) SECOND_MOCKED_USER = pycync.User( "test_token_2", "test_refresh_token_2", ...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/cync/const.py", "license": "Apache License 2.0", "lines": 18, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/cync/test_config_flow.py
"""Test the Cync config flow.""" from unittest.mock import ANY, AsyncMock, MagicMock from pycync.exceptions import AuthFailedError, CyncError, TwoFactorRequiredError import pytest from homeassistant.components.cync.const import ( CONF_AUTHORIZE_STRING, CONF_EXPIRES_AT, CONF_REFRESH_TOKEN, CONF_TWO_FA...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/cync/test_config_flow.py", "license": "Apache License 2.0", "lines": 335, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/cync/test_light.py
"""Tests for the Cync integration light platform.""" from unittest.mock import AsyncMock import pytest from syrupy.assertion import SnapshotAssertion from homeassistant.core import HomeAssistant from homeassistant.helpers import entity_registry as er from . import setup_integration from tests.common import MockCon...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/cync/test_light.py", "license": "Apache License 2.0", "lines": 56, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/deluge/test_coordinator.py
"""Test Deluge coordinator.py methods.""" from homeassistant.components.deluge.const import DelugeSensorType from homeassistant.components.deluge.coordinator import count_states from . import GET_TORRENT_STATES_RESPONSE def test_get_count() -> None: """Tests count_states().""" states = count_states(GET_TOR...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/deluge/test_coordinator.py", "license": "Apache License 2.0", "lines": 9, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/derivative/test_diagnostics.py
"""Tests for derivative diagnostics.""" from homeassistant.core import HomeAssistant from tests.components.diagnostics import get_diagnostics_for_config_entry from tests.typing import ClientSessionGenerator async def test_diagnostics( hass: HomeAssistant, hass_client: ClientSessionGenerator, derivative_config_e...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/derivative/test_diagnostics.py", "license": "Apache License 2.0", "lines": 17, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/droplet/test_config_flow.py
"""Test Droplet config flow.""" from ipaddress import IPv4Address from unittest.mock import AsyncMock import pytest from homeassistant.components.droplet.const import DOMAIN from homeassistant.config_entries import SOURCE_USER, SOURCE_ZEROCONF from homeassistant.const import ( ATTR_CODE, CONF_CODE, CONF_...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/droplet/test_config_flow.py", "license": "Apache License 2.0", "lines": 266, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/droplet/test_init.py
"""Test Droplet initialization.""" from unittest.mock import AsyncMock import pytest from homeassistant.config_entries import ConfigEntryState from homeassistant.core import HomeAssistant from . import setup_integration from tests.common import MockConfigEntry async def test_setup_no_version_info( hass: Home...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/droplet/test_init.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/droplet/test_sensor.py
"""Test Droplet sensors.""" from unittest.mock import AsyncMock from syrupy.assertion import SnapshotAssertion from homeassistant.core import HomeAssistant from homeassistant.helpers import entity_registry as er from . import setup_integration from tests.common import MockConfigEntry, snapshot_platform async def...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/droplet/test_sensor.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/ekeybionyx/test_config_flow.py
"""Test the ekey bionyx config flow.""" from unittest.mock import patch import pytest from homeassistant import config_entries from homeassistant.components.application_credentials import ( DOMAIN as APPLICATION_CREDENTIALS_DOMAIN, ClientCredential, async_import_client_credential, ) from homeassistant.co...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/ekeybionyx/test_config_flow.py", "license": "Apache License 2.0", "lines": 308, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/ekeybionyx/test_init.py
"""Module contains tests for the ekeybionyx component's initialization. Functions: test_async_setup_entry(hass: HomeAssistant, config_entry: MockConfigEntry) -> None: Test a successful setup entry and unload of entry. """ from homeassistant.components.ekeybionyx.const import DOMAIN from homeassistant.conf...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/ekeybionyx/test_init.py", "license": "Apache License 2.0", "lines": 21, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/esphome/test_analytics.py
"""Tests for analytics platform.""" from homeassistant.components.analytics import async_devices_payload from homeassistant.components.esphome import DOMAIN from homeassistant.core import HomeAssistant from homeassistant.helpers import device_registry as dr from homeassistant.setup import async_setup_component from t...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/esphome/test_analytics.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/file/test_services.py
"""The tests for the notify file platform.""" from unittest.mock import MagicMock import pytest from syrupy.assertion import SnapshotAssertion from homeassistant.components.file import DOMAIN from homeassistant.components.file.services import ( ATTR_FILE_ENCODING, ATTR_FILE_NAME, SERVICE_READ_FILE, ) fro...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/file/test_services.py", "license": "Apache License 2.0", "lines": 131, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/foscam/test_number.py
"""Test the Foscam number platform.""" from unittest.mock import patch from syrupy.assertion import SnapshotAssertion from homeassistant.components.foscam.const import DOMAIN from homeassistant.components.number import ( ATTR_VALUE, DOMAIN as NUMBER_DOMAIN, SERVICE_SET_VALUE, ) from homeassistant.const i...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/foscam/test_number.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/hassio/test_switch.py
"""The tests for the hassio switch.""" from collections.abc import AsyncGenerator import os from unittest.mock import AsyncMock, patch import pytest from homeassistant.components.hassio import DOMAIN from homeassistant.core import HomeAssistant from homeassistant.helpers import entity_registry as er from homeassista...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/hassio/test_switch.py", "license": "Apache License 2.0", "lines": 271, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/history_stats/test_diagnostics.py
"""Tests for derivative diagnostics.""" import pytest from homeassistant.components.history_stats.const import DEFAULT_NAME, DOMAIN from homeassistant.const import CONF_ENTITY_ID, CONF_NAME from homeassistant.core import HomeAssistant from tests.components.diagnostics import get_diagnostics_for_config_entry from tes...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/history_stats/test_diagnostics.py", "license": "Apache License 2.0", "lines": 21, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test
home-assistant/core:tests/components/homeassistant_connect_zbt2/common.py
"""Common constants for the Connect ZBT-2 integration tests.""" from homeassistant.helpers.service_info.usb import UsbServiceInfo USB_DATA_ZBT2 = UsbServiceInfo( device="/dev/serial/by-id/usb-Nabu_Casa_ZBT-2_80B54EEFAE18-if01-port0", vid="303A", pid="4001", serial_number="80B54EEFAE18", manufactur...
{ "repo_id": "home-assistant/core", "file_path": "tests/components/homeassistant_connect_zbt2/common.py", "license": "Apache License 2.0", "lines": 10, "canary_id": -1, "canary_value": "", "pii_type": "", "provider": "", "regex_pattern": "", "repetition": -1, "template": "" }
test