Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
TestVultrBinarySensorSetup.test_invalid_sensor_config
(self)
Test config type failures.
Test config type failures.
def test_invalid_sensor_config(self): """Test config type failures.""" with pytest.raises(vol.Invalid): # No subs vultr.PLATFORM_SCHEMA({CONF_PLATFORM: base_vultr.DOMAIN})
[ "def", "test_invalid_sensor_config", "(", "self", ")", ":", "with", "pytest", ".", "raises", "(", "vol", ".", "Invalid", ")", ":", "# No subs", "vultr", ".", "PLATFORM_SCHEMA", "(", "{", "CONF_PLATFORM", ":", "base_vultr", ".", "DOMAIN", "}", ")" ]
[ 105, 4 ]
[ 108, 69 ]
python
en
['en', 'en', 'en']
True
TestVultrBinarySensorSetup.test_invalid_sensors
(self, mock)
Test the VultrBinarySensor fails.
Test the VultrBinarySensor fails.
def test_invalid_sensors(self, mock): """Test the VultrBinarySensor fails.""" mock.get( "https://api.vultr.com/v1/account/info?api_key=ABCDEFG1234567", text=load_fixture("vultr_account_info.json"), ) with patch( "vultr.Vultr.server_list", ...
[ "def", "test_invalid_sensors", "(", "self", ",", "mock", ")", ":", "mock", ".", "get", "(", "\"https://api.vultr.com/v1/account/info?api_key=ABCDEFG1234567\"", ",", "text", "=", "load_fixture", "(", "\"vultr_account_info.json\"", ")", ",", ")", "with", "patch", "(", ...
[ 111, 4 ]
[ 142, 35 ]
python
en
['en', 'ga', 'en']
True
display_temp
( hass: HomeAssistant, temperature: float | None, unit: str, precision: float )
Convert temperature into preferred units/precision for display.
Convert temperature into preferred units/precision for display.
def display_temp( hass: HomeAssistant, temperature: float | None, unit: str, precision: float ) -> float | None: """Convert temperature into preferred units/precision for display.""" temperature_unit = unit ha_unit = hass.config.units.temperature_unit if temperature is None: return temperat...
[ "def", "display_temp", "(", "hass", ":", "HomeAssistant", ",", "temperature", ":", "float", "|", "None", ",", "unit", ":", "str", ",", "precision", ":", "float", ")", "->", "float", "|", "None", ":", "temperature_unit", "=", "unit", "ha_unit", "=", "hass...
[ 10, 0 ]
[ 37, 22 ]
python
en
['en', 'it', 'en']
True
KaiterraApiData.__init__
(self, hass, config, session)
Initialize the API data object.
Initialize the API data object.
def __init__(self, hass, config, session): """Initialize the API data object.""" api_key = config[CONF_API_KEY] aqi_standard = config[CONF_AQI_STANDARD] devices = config[CONF_DEVICES] units = config[CONF_PREFERRED_UNITS] self._hass = hass self._api = KaiterraAPI...
[ "def", "__init__", "(", "self", ",", "hass", ",", "config", ",", "session", ")", ":", "api_key", "=", "config", "[", "CONF_API_KEY", "]", "aqi_standard", "=", "config", "[", "CONF_AQI_STANDARD", "]", "devices", "=", "config", "[", "CONF_DEVICES", "]", "uni...
[ 27, 4 ]
[ 49, 22 ]
python
en
['en', 'en', 'en']
True
KaiterraApiData.async_update
(self)
Get the data from Kaiterra API.
Get the data from Kaiterra API.
async def async_update(self) -> None: """Get the data from Kaiterra API.""" try: with async_timeout.timeout(10): data = await self._api.get_latest_sensor_readings(self._devices) except (ClientResponseError, asyncio.TimeoutError): _LOGGER.debug("Couldn't f...
[ "async", "def", "async_update", "(", "self", ")", "->", "None", ":", "try", ":", "with", "async_timeout", ".", "timeout", "(", "10", ")", ":", "data", "=", "await", "self", ".", "_api", ".", "get_latest_sensor_readings", "(", "self", ".", "_devices", ")"...
[ 51, 4 ]
[ 104, 62 ]
python
en
['en', 'no', 'en']
True
cli
()
Access to the chado features
Access to the chado features
def cli(): """ Access to the chado features """ pass
[ "def", "cli", "(", ")", ":", "pass" ]
[ 12, 0 ]
[ 16, 8 ]
python
en
['en', 'error', 'th']
False
recursive_flatten
(prefix: Any, data: dict[str, Any])
Return a flattened representation of dict data.
Return a flattened representation of dict data.
def recursive_flatten(prefix: Any, data: dict[str, Any]) -> dict[str, Any]: """Return a flattened representation of dict data.""" output = {} for key, value in data.items(): if isinstance(value, dict): output.update(recursive_flatten(f"{prefix}{key}.", value)) else: o...
[ "def", "recursive_flatten", "(", "prefix", ":", "Any", ",", "data", ":", "dict", "[", "str", ",", "Any", "]", ")", "->", "dict", "[", "str", ",", "Any", "]", ":", "output", "=", "{", "}", "for", "key", ",", "value", "in", "data", ".", "items", ...
[ 28, 0 ]
[ 36, 17 ]
python
en
['en', 'id', 'en']
True
component_translation_path
( component: str, language: str, integration: Integration )
Return the translation json file location for a component. For component: - components/hue/translations/nl.json For platform: - components/hue/translations/light.nl.json If component is just a single file, will return None.
Return the translation json file location for a component.
def component_translation_path( component: str, language: str, integration: Integration ) -> str | None: """Return the translation json file location for a component. For component: - components/hue/translations/nl.json For platform: - components/hue/translations/light.nl.json If compon...
[ "def", "component_translation_path", "(", "component", ":", "str", ",", "language", ":", "str", ",", "integration", ":", "Integration", ")", "->", "str", "|", "None", ":", "parts", "=", "component", ".", "split", "(", "\".\"", ")", "domain", "=", "parts", ...
[ 40, 0 ]
[ 69, 43 ]
python
en
['en', 'en', 'en']
True
load_translations_files
( translation_files: dict[str, str] )
Load and parse translation.json files.
Load and parse translation.json files.
def load_translations_files( translation_files: dict[str, str] ) -> dict[str, dict[str, Any]]: """Load and parse translation.json files.""" loaded = {} for component, translation_file in translation_files.items(): loaded_json = load_json(translation_file) if not isinstance(loaded_json, ...
[ "def", "load_translations_files", "(", "translation_files", ":", "dict", "[", "str", ",", "str", "]", ")", "->", "dict", "[", "str", ",", "dict", "[", "str", ",", "Any", "]", "]", ":", "loaded", "=", "{", "}", "for", "component", ",", "translation_file...
[ 72, 0 ]
[ 90, 17 ]
python
en
['en', 'en', 'en']
True
_merge_resources
( translation_strings: dict[str, dict[str, Any]], components: set[str], category: str, )
Build and merge the resources response for the given components and platforms.
Build and merge the resources response for the given components and platforms.
def _merge_resources( translation_strings: dict[str, dict[str, Any]], components: set[str], category: str, ) -> dict[str, dict[str, Any]]: """Build and merge the resources response for the given components and platforms.""" # Build response resources: dict[str, dict[str, Any]] = {} for compo...
[ "def", "_merge_resources", "(", "translation_strings", ":", "dict", "[", "str", ",", "dict", "[", "str", ",", "Any", "]", "]", ",", "components", ":", "set", "[", "str", "]", ",", "category", ":", "str", ",", ")", "->", "dict", "[", "str", ",", "di...
[ 93, 0 ]
[ 131, 20 ]
python
en
['en', 'en', 'en']
True
_build_resources
( translation_strings: dict[str, dict[str, Any]], components: set[str], category: str, )
Build the resources response for the given components.
Build the resources response for the given components.
def _build_resources( translation_strings: dict[str, dict[str, Any]], components: set[str], category: str, ) -> dict[str, dict[str, Any]]: """Build the resources response for the given components.""" # Build response return { component: translation_strings[component][category] fo...
[ "def", "_build_resources", "(", "translation_strings", ":", "dict", "[", "str", ",", "dict", "[", "str", ",", "Any", "]", "]", ",", "components", ":", "set", "[", "str", "]", ",", "category", ":", "str", ",", ")", "->", "dict", "[", "str", ",", "di...
[ 134, 0 ]
[ 146, 5 ]
python
en
['en', 'en', 'en']
True
async_get_component_strings
( hass: HomeAssistant, language: str, components: set[str] )
Load translations.
Load translations.
async def async_get_component_strings( hass: HomeAssistant, language: str, components: set[str] ) -> dict[str, Any]: """Load translations.""" domains = list({loaded.split(".")[-1] for loaded in components}) integrations = dict( zip( domains, await gather_with_concurrency(...
[ "async", "def", "async_get_component_strings", "(", "hass", ":", "HomeAssistant", ",", "language", ":", "str", ",", "components", ":", "set", "[", "str", "]", ")", "->", "dict", "[", "str", ",", "Any", "]", ":", "domains", "=", "list", "(", "{", "loade...
[ 149, 0 ]
[ 200, 23 ]
python
en
['en', 'bg', 'en']
False
async_get_translations
( hass: HomeAssistant, language: str, category: str, integration: str | None = None, config_flow: bool | None = None, )
Return all backend translations. If integration specified, load it for that one. Otherwise default to loaded intgrations combined with config flow integrations if config_flow is true.
Return all backend translations.
async def async_get_translations( hass: HomeAssistant, language: str, category: str, integration: str | None = None, config_flow: bool | None = None, ) -> dict[str, Any]: """Return all backend translations. If integration specified, load it for that one. Otherwise default to loaded intg...
[ "async", "def", "async_get_translations", "(", "hass", ":", "HomeAssistant", ",", "language", ":", "str", ",", "category", ":", "str", ",", "integration", ":", "str", "|", "None", "=", "None", ",", "config_flow", ":", "bool", "|", "None", "=", "None", ",...
[ 283, 0 ]
[ 314, 34 ]
python
en
['en', 'cy', 'en']
True
_TranslationCache.__init__
(self, hass: HomeAssistant)
Initialize the cache.
Initialize the cache.
def __init__(self, hass: HomeAssistant) -> None: """Initialize the cache.""" self.hass = hass self.loaded: dict[str, set[str]] = {} self.cache: dict[str, dict[str, dict[str, Any]]] = {}
[ "def", "__init__", "(", "self", ",", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "self", ".", "hass", "=", "hass", "self", ".", "loaded", ":", "dict", "[", "str", ",", "set", "[", "str", "]", "]", "=", "{", "}", "self", ".", "cache", ...
[ 206, 4 ]
[ 210, 61 ]
python
en
['en', 'en', 'en']
True
_TranslationCache.async_fetch
( self, language: str, category: str, components: set[str], )
Load resources into the cache.
Load resources into the cache.
async def async_fetch( self, language: str, category: str, components: set[str], ) -> list[dict[str, dict[str, Any]]]: """Load resources into the cache.""" components_to_load = components - self.loaded.setdefault(language, set()) if components_to_load: ...
[ "async", "def", "async_fetch", "(", "self", ",", "language", ":", "str", ",", "category", ":", "str", ",", "components", ":", "set", "[", "str", "]", ",", ")", "->", "list", "[", "dict", "[", "str", ",", "dict", "[", "str", ",", "Any", "]", "]", ...
[ 212, 4 ]
[ 226, 88 ]
python
en
['en', 'en', 'en']
True
_TranslationCache._async_load
(self, language: str, components: set[str])
Populate the cache for a given set of components.
Populate the cache for a given set of components.
async def _async_load(self, language: str, components: set[str]) -> None: """Populate the cache for a given set of components.""" _LOGGER.debug( "Cache miss for %s: %s", language, ", ".join(components), ) # Fetch the English resources, as a fallback fo...
[ "async", "def", "_async_load", "(", "self", ",", "language", ":", "str", ",", "components", ":", "set", "[", "str", "]", ")", "->", "None", ":", "_LOGGER", ".", "debug", "(", "\"Cache miss for %s: %s\"", ",", "language", ",", "\", \"", ".", "join", "(", ...
[ 228, 4 ]
[ 245, 48 ]
python
en
['en', 'en', 'en']
True
_TranslationCache._build_category_cache
( self, language: str, components: set[str], translation_strings: dict[str, dict[str, Any]], )
Extract resources into the cache.
Extract resources into the cache.
def _build_category_cache( self, language: str, components: set[str], translation_strings: dict[str, dict[str, Any]], ) -> None: """Extract resources into the cache.""" cached = self.cache.setdefault(language, {}) categories: set[str] = set() for resou...
[ "def", "_build_category_cache", "(", "self", ",", "language", ":", "str", ",", "components", ":", "set", "[", "str", "]", ",", "translation_strings", ":", "dict", "[", "str", ",", "dict", "[", "str", ",", "Any", "]", "]", ",", ")", "->", "None", ":",...
[ 248, 4 ]
[ 279, 82 ]
python
en
['en', 'en', 'en']
True
_deserialize
(data, klass)
Deserializes dict, list, str into an object. :param data: dict, list or str. :param klass: class literal, or string of class name. :return: object.
Deserializes dict, list, str into an object.
def _deserialize(data, klass): """Deserializes dict, list, str into an object. :param data: dict, list or str. :param klass: class literal, or string of class name. :return: object. """ if data is None: return None if klass in six.integer_types or klass in (float, str, bool, bytea...
[ "def", "_deserialize", "(", "data", ",", "klass", ")", ":", "if", "data", "is", "None", ":", "return", "None", "if", "klass", "in", "six", ".", "integer_types", "or", "klass", "in", "(", "float", ",", "str", ",", "bool", ",", "bytearray", ")", ":", ...
[ 7, 0 ]
[ 32, 45 ]
python
en
['en', 'en', 'en']
True
_deserialize_primitive
(data, klass)
Deserializes to primitive type. :param data: data to deserialize. :param klass: class literal. :return: int, long, float, str, bool. :rtype: int | long | float | str | bool
Deserializes to primitive type.
def _deserialize_primitive(data, klass): """Deserializes to primitive type. :param data: data to deserialize. :param klass: class literal. :return: int, long, float, str, bool. :rtype: int | long | float | str | bool """ try: value = klass(data) except UnicodeEncodeError: ...
[ "def", "_deserialize_primitive", "(", "data", ",", "klass", ")", ":", "try", ":", "value", "=", "klass", "(", "data", ")", "except", "UnicodeEncodeError", ":", "value", "=", "six", ".", "u", "(", "data", ")", "except", "TypeError", ":", "value", "=", "...
[ 35, 0 ]
[ 50, 16 ]
python
en
['en', 'en', 'en']
True
_deserialize_object
(value)
Return an original value. :return: object.
Return an original value.
def _deserialize_object(value): """Return an original value. :return: object. """ return value
[ "def", "_deserialize_object", "(", "value", ")", ":", "return", "value" ]
[ 53, 0 ]
[ 58, 16 ]
python
en
['en', 'pt', 'en']
True
deserialize_date
(string)
Deserializes string to date. :param string: str. :type string: str :return: date. :rtype: date
Deserializes string to date.
def deserialize_date(string): """Deserializes string to date. :param string: str. :type string: str :return: date. :rtype: date """ try: from dateutil.parser import parse return parse(string).date() except ImportError: return string
[ "def", "deserialize_date", "(", "string", ")", ":", "try", ":", "from", "dateutil", ".", "parser", "import", "parse", "return", "parse", "(", "string", ")", ".", "date", "(", ")", "except", "ImportError", ":", "return", "string" ]
[ 61, 0 ]
[ 73, 21 ]
python
en
['en', 'en', 'en']
True
deserialize_datetime
(string)
Deserializes string to datetime. The string should be in iso8601 datetime format. :param string: str. :type string: str :return: datetime. :rtype: datetime
Deserializes string to datetime.
def deserialize_datetime(string): """Deserializes string to datetime. The string should be in iso8601 datetime format. :param string: str. :type string: str :return: datetime. :rtype: datetime """ try: from dateutil.parser import parse return parse(string) except Im...
[ "def", "deserialize_datetime", "(", "string", ")", ":", "try", ":", "from", "dateutil", ".", "parser", "import", "parse", "return", "parse", "(", "string", ")", "except", "ImportError", ":", "return", "string" ]
[ 76, 0 ]
[ 90, 21 ]
python
en
['en', 'en', 'en']
True
deserialize_model
(data, klass)
Deserializes list or dict to model. :param data: dict, list. :type data: dict | list :param klass: class literal. :return: model object.
Deserializes list or dict to model.
def deserialize_model(data, klass): """Deserializes list or dict to model. :param data: dict, list. :type data: dict | list :param klass: class literal. :return: model object. """ instance = klass() if not instance.openapi_types: return data for attr, attr_type in six.iter...
[ "def", "deserialize_model", "(", "data", ",", "klass", ")", ":", "instance", "=", "klass", "(", ")", "if", "not", "instance", ".", "openapi_types", ":", "return", "data", "for", "attr", ",", "attr_type", "in", "six", ".", "iteritems", "(", "instance", "....
[ 93, 0 ]
[ 113, 19 ]
python
en
['en', 'en', 'en']
True
_deserialize_list
(data, boxed_type)
Deserializes a list and its elements. :param data: list to deserialize. :type data: list :param boxed_type: class literal. :return: deserialized list. :rtype: list
Deserializes a list and its elements.
def _deserialize_list(data, boxed_type): """Deserializes a list and its elements. :param data: list to deserialize. :type data: list :param boxed_type: class literal. :return: deserialized list. :rtype: list """ return [_deserialize(sub_data, boxed_type) for sub_data in dat...
[ "def", "_deserialize_list", "(", "data", ",", "boxed_type", ")", ":", "return", "[", "_deserialize", "(", "sub_data", ",", "boxed_type", ")", "for", "sub_data", "in", "data", "]" ]
[ 116, 0 ]
[ 127, 33 ]
python
en
['en', 'en', 'en']
True
_deserialize_dict
(data, boxed_type)
Deserializes a dict and its elements. :param data: dict to deserialize. :type data: dict :param boxed_type: class literal. :return: deserialized dict. :rtype: dict
Deserializes a dict and its elements.
def _deserialize_dict(data, boxed_type): """Deserializes a dict and its elements. :param data: dict to deserialize. :type data: dict :param boxed_type: class literal. :return: deserialized dict. :rtype: dict """ return {k: _deserialize(v, boxed_type) for k, v in six.iterite...
[ "def", "_deserialize_dict", "(", "data", ",", "boxed_type", ")", ":", "return", "{", "k", ":", "_deserialize", "(", "v", ",", "boxed_type", ")", "for", "k", ",", "v", "in", "six", ".", "iteritems", "(", "data", ")", "}" ]
[ 130, 0 ]
[ 141, 44 ]
python
en
['en', 'en', 'en']
True
AsyncConfigEntryNetatmoAuth.__init__
( self, websession: ClientSession, oauth_session: config_entry_oauth2_flow.OAuth2Session, )
Initialize the auth.
Initialize the auth.
def __init__( self, websession: ClientSession, oauth_session: config_entry_oauth2_flow.OAuth2Session, ) -> None: """Initialize the auth.""" super().__init__(websession) self._oauth_session = oauth_session
[ "def", "__init__", "(", "self", ",", "websession", ":", "ClientSession", ",", "oauth_session", ":", "config_entry_oauth2_flow", ".", "OAuth2Session", ",", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "websession", ")", "self", ".", "_oaut...
[ 12, 4 ]
[ 19, 43 ]
python
en
['en', 'en', 'en']
True
AsyncConfigEntryNetatmoAuth.async_get_access_token
(self)
Return a valid access token for Netatmo API.
Return a valid access token for Netatmo API.
async def async_get_access_token(self) -> str: """Return a valid access token for Netatmo API.""" if not self._oauth_session.valid_token: await self._oauth_session.async_ensure_token_valid() return cast(str, self._oauth_session.token["access_token"])
[ "async", "def", "async_get_access_token", "(", "self", ")", "->", "str", ":", "if", "not", "self", ".", "_oauth_session", ".", "valid_token", ":", "await", "self", ".", "_oauth_session", ".", "async_ensure_token_valid", "(", ")", "return", "cast", "(", "str", ...
[ 21, 4 ]
[ 25, 67 ]
python
en
['en', 'no', 'en']
True
test_humanify_automation_trigger_event
(hass)
Test humanifying Shelly click event.
Test humanifying Shelly click event.
async def test_humanify_automation_trigger_event(hass): """Test humanifying Shelly click event.""" hass.config.components.add("recorder") assert await async_setup_component(hass, "automation", {}) assert await async_setup_component(hass, "logbook", {}) entity_attr_cache = logbook.EntityAttributeCach...
[ "async", "def", "test_humanify_automation_trigger_event", "(", "hass", ")", ":", "hass", ".", "config", ".", "components", ".", "add", "(", "\"recorder\"", ")", "assert", "await", "async_setup_component", "(", "hass", ",", "\"automation\"", ",", "{", "}", ")", ...
[ 8, 0 ]
[ 53, 50 ]
python
en
['en', 'en', 'en']
True
PulseHub.__init__
(self, hass, config_entry)
Initialize the system.
Initialize the system.
def __init__(self, hass, config_entry): """Initialize the system.""" self.config_entry = config_entry self.hass = hass self.api: aiopulse.Hub | None = None self.tasks = [] self.current_rollers = {} self.cleanup_callbacks = []
[ "def", "__init__", "(", "self", ",", "hass", ",", "config_entry", ")", ":", "self", ".", "config_entry", "=", "config_entry", "self", ".", "hass", "=", "hass", "self", ".", "api", ":", "aiopulse", ".", "Hub", "|", "None", "=", "None", "self", ".", "t...
[ 16, 4 ]
[ 23, 35 ]
python
en
['en', 'en', 'en']
True
PulseHub.title
(self)
Return the title of the hub shown in the integrations list.
Return the title of the hub shown in the integrations list.
def title(self): """Return the title of the hub shown in the integrations list.""" return f"{self.api.id} ({self.api.host})"
[ "def", "title", "(", "self", ")", ":", "return", "f\"{self.api.id} ({self.api.host})\"" ]
[ 26, 4 ]
[ 28, 49 ]
python
en
['en', 'en', 'en']
True
PulseHub.host
(self)
Return the host of this hub.
Return the host of this hub.
def host(self): """Return the host of this hub.""" return self.config_entry.data["host"]
[ "def", "host", "(", "self", ")", ":", "return", "self", ".", "config_entry", ".", "data", "[", "\"host\"", "]" ]
[ 31, 4 ]
[ 33, 45 ]
python
en
['en', 'en', 'en']
True
PulseHub.async_setup
(self, tries=0)
Set up a hub based on host parameter.
Set up a hub based on host parameter.
async def async_setup(self, tries=0): """Set up a hub based on host parameter.""" host = self.host hub = aiopulse.Hub(host) self.api = hub hub.callback_subscribe(self.async_notify_update) self.tasks.append(asyncio.create_task(hub.run())) LOGGER.debug("Hub setup...
[ "async", "def", "async_setup", "(", "self", ",", "tries", "=", "0", ")", ":", "host", "=", "self", ".", "host", "hub", "=", "aiopulse", ".", "Hub", "(", "host", ")", "self", ".", "api", "=", "hub", "hub", ".", "callback_subscribe", "(", "self", "."...
[ 35, 4 ]
[ 46, 19 ]
python
en
['en', 'da', 'en']
True
PulseHub.async_reset
(self)
Reset this hub to default state.
Reset this hub to default state.
async def async_reset(self): """Reset this hub to default state.""" for cleanup_callback in self.cleanup_callbacks: cleanup_callback() # If not setup if self.api is None: return False self.api.callback_unsubscribe(self.async_notify_update) await...
[ "async", "def", "async_reset", "(", "self", ")", ":", "for", "cleanup_callback", "in", "self", ".", "cleanup_callbacks", ":", "cleanup_callback", "(", ")", "# If not setup", "if", "self", ".", "api", "is", "None", ":", "return", "False", "self", ".", "api", ...
[ 48, 4 ]
[ 66, 19 ]
python
en
['en', 'en', 'en']
True
PulseHub.async_notify_update
(self, update_type)
Evaluate entities when hub reports that update has occurred.
Evaluate entities when hub reports that update has occurred.
async def async_notify_update(self, update_type): """Evaluate entities when hub reports that update has occurred.""" LOGGER.debug("Hub {update_type.name} updated") if update_type == aiopulse.UpdateType.rollers: await update_devices(self.hass, self.config_entry, self.api.rollers) ...
[ "async", "def", "async_notify_update", "(", "self", ",", "update_type", ")", ":", "LOGGER", ".", "debug", "(", "\"Hub {update_type.name} updated\"", ")", "if", "update_type", "==", "aiopulse", ".", "UpdateType", ".", "rollers", ":", "await", "update_devices", "(",...
[ 68, 4 ]
[ 88, 21 ]
python
en
['en', 'en', 'en']
True
async_start
(hass, entity_id=None)
Start a FFmpeg process on entity. This is a legacy helper method. Do not use it for new tests.
Start a FFmpeg process on entity.
def async_start(hass, entity_id=None): """Start a FFmpeg process on entity. This is a legacy helper method. Do not use it for new tests. """ data = {ATTR_ENTITY_ID: entity_id} if entity_id else {} hass.async_add_job(hass.services.async_call(DOMAIN, SERVICE_START, data))
[ "def", "async_start", "(", "hass", ",", "entity_id", "=", "None", ")", ":", "data", "=", "{", "ATTR_ENTITY_ID", ":", "entity_id", "}", "if", "entity_id", "else", "{", "}", "hass", ".", "async_add_job", "(", "hass", ".", "services", ".", "async_call", "("...
[ 18, 0 ]
[ 24, 77 ]
python
en
['en', 'en', 'en']
True
async_stop
(hass, entity_id=None)
Stop a FFmpeg process on entity. This is a legacy helper method. Do not use it for new tests.
Stop a FFmpeg process on entity.
def async_stop(hass, entity_id=None): """Stop a FFmpeg process on entity. This is a legacy helper method. Do not use it for new tests. """ data = {ATTR_ENTITY_ID: entity_id} if entity_id else {} hass.async_add_job(hass.services.async_call(DOMAIN, SERVICE_STOP, data))
[ "def", "async_stop", "(", "hass", ",", "entity_id", "=", "None", ")", ":", "data", "=", "{", "ATTR_ENTITY_ID", ":", "entity_id", "}", "if", "entity_id", "else", "{", "}", "hass", ".", "async_add_job", "(", "hass", ".", "services", ".", "async_call", "(",...
[ 28, 0 ]
[ 34, 76 ]
python
en
['en', 'en', 'en']
True
async_restart
(hass, entity_id=None)
Restart a FFmpeg process on entity. This is a legacy helper method. Do not use it for new tests.
Restart a FFmpeg process on entity.
def async_restart(hass, entity_id=None): """Restart a FFmpeg process on entity. This is a legacy helper method. Do not use it for new tests. """ data = {ATTR_ENTITY_ID: entity_id} if entity_id else {} hass.async_add_job(hass.services.async_call(DOMAIN, SERVICE_RESTART, data))
[ "def", "async_restart", "(", "hass", ",", "entity_id", "=", "None", ")", ":", "data", "=", "{", "ATTR_ENTITY_ID", ":", "entity_id", "}", "if", "entity_id", "else", "{", "}", "hass", ".", "async_add_job", "(", "hass", ".", "services", ".", "async_call", "...
[ 38, 0 ]
[ 44, 79 ]
python
en
['en', 'hu', 'en']
True
test_setup_component_test_register
(hass)
Set up ffmpeg component test register.
Set up ffmpeg component test register.
async def test_setup_component_test_register(hass): """Set up ffmpeg component test register.""" with assert_setup_component(1): await async_setup_component(hass, ffmpeg.DOMAIN, {ffmpeg.DOMAIN: {}}) hass.bus.async_listen_once = MagicMock() ffmpeg_dev = MockFFmpegDev(hass) await ffmpeg_dev.a...
[ "async", "def", "test_setup_component_test_register", "(", "hass", ")", ":", "with", "assert_setup_component", "(", "1", ")", ":", "await", "async_setup_component", "(", "hass", ",", "ffmpeg", ".", "DOMAIN", ",", "{", "ffmpeg", ".", "DOMAIN", ":", "{", "}", ...
[ 101, 0 ]
[ 111, 53 ]
python
en
['en', 'da', 'en']
True
test_setup_component_test_register_no_startup
(hass)
Set up ffmpeg component test register without startup.
Set up ffmpeg component test register without startup.
async def test_setup_component_test_register_no_startup(hass): """Set up ffmpeg component test register without startup.""" with assert_setup_component(1): await async_setup_component(hass, ffmpeg.DOMAIN, {ffmpeg.DOMAIN: {}}) hass.bus.async_listen_once = MagicMock() ffmpeg_dev = MockFFmpegDev(h...
[ "async", "def", "test_setup_component_test_register_no_startup", "(", "hass", ")", ":", "with", "assert_setup_component", "(", "1", ")", ":", "await", "async_setup_component", "(", "hass", ",", "ffmpeg", ".", "DOMAIN", ",", "{", "ffmpeg", ".", "DOMAIN", ":", "{"...
[ 114, 0 ]
[ 124, 53 ]
python
en
['en', 'da', 'en']
True
test_setup_component_test_service_start
(hass)
Set up ffmpeg component test service start.
Set up ffmpeg component test service start.
async def test_setup_component_test_service_start(hass): """Set up ffmpeg component test service start.""" with assert_setup_component(1): await async_setup_component(hass, ffmpeg.DOMAIN, {ffmpeg.DOMAIN: {}}) ffmpeg_dev = MockFFmpegDev(hass, False) await ffmpeg_dev.async_added_to_hass() as...
[ "async", "def", "test_setup_component_test_service_start", "(", "hass", ")", ":", "with", "assert_setup_component", "(", "1", ")", ":", "await", "async_setup_component", "(", "hass", ",", "ffmpeg", ".", "DOMAIN", ",", "{", "ffmpeg", ".", "DOMAIN", ":", "{", "}...
[ 127, 0 ]
[ 138, 34 ]
python
en
['en', 'da', 'en']
True
test_setup_component_test_service_stop
(hass)
Set up ffmpeg component test service stop.
Set up ffmpeg component test service stop.
async def test_setup_component_test_service_stop(hass): """Set up ffmpeg component test service stop.""" with assert_setup_component(1): await async_setup_component(hass, ffmpeg.DOMAIN, {ffmpeg.DOMAIN: {}}) ffmpeg_dev = MockFFmpegDev(hass, False) await ffmpeg_dev.async_added_to_hass() asyn...
[ "async", "def", "test_setup_component_test_service_stop", "(", "hass", ")", ":", "with", "assert_setup_component", "(", "1", ")", ":", "await", "async_setup_component", "(", "hass", ",", "ffmpeg", ".", "DOMAIN", ",", "{", "ffmpeg", ".", "DOMAIN", ":", "{", "}"...
[ 141, 0 ]
[ 152, 33 ]
python
en
['en', 'en', 'en']
True
test_setup_component_test_service_restart
(hass)
Set up ffmpeg component test service restart.
Set up ffmpeg component test service restart.
async def test_setup_component_test_service_restart(hass): """Set up ffmpeg component test service restart.""" with assert_setup_component(1): await async_setup_component(hass, ffmpeg.DOMAIN, {ffmpeg.DOMAIN: {}}) ffmpeg_dev = MockFFmpegDev(hass, False) await ffmpeg_dev.async_added_to_hass() ...
[ "async", "def", "test_setup_component_test_service_restart", "(", "hass", ")", ":", "with", "assert_setup_component", "(", "1", ")", ":", "await", "async_setup_component", "(", "hass", ",", "ffmpeg", ".", "DOMAIN", ",", "{", "ffmpeg", ".", "DOMAIN", ":", "{", ...
[ 155, 0 ]
[ 167, 34 ]
python
en
['en', 'da', 'en']
True
test_setup_component_test_service_start_with_entity
(hass)
Set up ffmpeg component test service start.
Set up ffmpeg component test service start.
async def test_setup_component_test_service_start_with_entity(hass): """Set up ffmpeg component test service start.""" with assert_setup_component(1): await async_setup_component(hass, ffmpeg.DOMAIN, {ffmpeg.DOMAIN: {}}) ffmpeg_dev = MockFFmpegDev(hass, False) await ffmpeg_dev.async_added_to_ha...
[ "async", "def", "test_setup_component_test_service_start_with_entity", "(", "hass", ")", ":", "with", "assert_setup_component", "(", "1", ")", ":", "await", "async_setup_component", "(", "hass", ",", "ffmpeg", ".", "DOMAIN", ",", "{", "ffmpeg", ".", "DOMAIN", ":",...
[ 170, 0 ]
[ 182, 63 ]
python
en
['en', 'da', 'en']
True
test_async_get_image_with_width_height
(hass)
Test fetching an image with a specific width and height.
Test fetching an image with a specific width and height.
async def test_async_get_image_with_width_height(hass): """Test fetching an image with a specific width and height.""" with assert_setup_component(1): await async_setup_component(hass, ffmpeg.DOMAIN, {ffmpeg.DOMAIN: {}}) get_image_mock = AsyncMock() with patch( "homeassistant.components...
[ "async", "def", "test_async_get_image_with_width_height", "(", "hass", ")", ":", "with", "assert_setup_component", "(", "1", ")", ":", "await", "async_setup_component", "(", "hass", ",", "ffmpeg", ".", "DOMAIN", ",", "{", "ffmpeg", ".", "DOMAIN", ":", "{", "}"...
[ 185, 0 ]
[ 199, 5 ]
python
en
['en', 'en', 'en']
True
test_async_get_image_with_extra_cmd_overlapping_width_height
(hass)
Test fetching an image with and extra_cmd with width and height and a specific width and height.
Test fetching an image with and extra_cmd with width and height and a specific width and height.
async def test_async_get_image_with_extra_cmd_overlapping_width_height(hass): """Test fetching an image with and extra_cmd with width and height and a specific width and height.""" with assert_setup_component(1): await async_setup_component(hass, ffmpeg.DOMAIN, {ffmpeg.DOMAIN: {}}) get_image_mock =...
[ "async", "def", "test_async_get_image_with_extra_cmd_overlapping_width_height", "(", "hass", ")", ":", "with", "assert_setup_component", "(", "1", ")", ":", "await", "async_setup_component", "(", "hass", ",", "ffmpeg", ".", "DOMAIN", ",", "{", "ffmpeg", ".", "DOMAIN...
[ 202, 0 ]
[ 218, 5 ]
python
en
['en', 'en', 'en']
True
test_async_get_image_with_extra_cmd_width_height
(hass)
Test fetching an image with and extra_cmd and a specific width and height.
Test fetching an image with and extra_cmd and a specific width and height.
async def test_async_get_image_with_extra_cmd_width_height(hass): """Test fetching an image with and extra_cmd and a specific width and height.""" with assert_setup_component(1): await async_setup_component(hass, ffmpeg.DOMAIN, {ffmpeg.DOMAIN: {}}) get_image_mock = AsyncMock() with patch( ...
[ "async", "def", "test_async_get_image_with_extra_cmd_width_height", "(", "hass", ")", ":", "with", "assert_setup_component", "(", "1", ")", ":", "await", "async_setup_component", "(", "hass", ",", "ffmpeg", ".", "DOMAIN", ",", "{", "ffmpeg", ".", "DOMAIN", ":", ...
[ 221, 0 ]
[ 237, 5 ]
python
en
['en', 'en', 'en']
True
MockFFmpegDev.__init__
(self, hass, initial_state=True, entity_id="test.ffmpeg_device")
Initialize mock.
Initialize mock.
def __init__(self, hass, initial_state=True, entity_id="test.ffmpeg_device"): """Initialize mock.""" super().__init__(initial_state) self.hass = hass self.entity_id = entity_id self.ffmpeg = MagicMock self.called_stop = False self.called_start = False sel...
[ "def", "__init__", "(", "self", ",", "hass", ",", "initial_state", "=", "True", ",", "entity_id", "=", "\"test.ffmpeg_device\"", ")", ":", "super", "(", ")", ".", "__init__", "(", "initial_state", ")", "self", ".", "hass", "=", "hass", "self", ".", "enti...
[ 50, 4 ]
[ 60, 35 ]
python
en
['pl', 'en', 'it']
False
MockFFmpegDev._async_start_ffmpeg
(self, entity_ids)
Mock start.
Mock start.
async def _async_start_ffmpeg(self, entity_ids): """Mock start.""" self.called_start = True self.called_entities = entity_ids
[ "async", "def", "_async_start_ffmpeg", "(", "self", ",", "entity_ids", ")", ":", "self", ".", "called_start", "=", "True", "self", ".", "called_entities", "=", "entity_ids" ]
[ 62, 4 ]
[ 65, 41 ]
python
en
['en', 'no', 'en']
False
TestFFmpegSetup.setup_method
(self)
Set up things to be run when tests are started.
Set up things to be run when tests are started.
def setup_method(self): """Set up things to be run when tests are started.""" self.hass = get_test_home_assistant()
[ "def", "setup_method", "(", "self", ")", ":", "self", ".", "hass", "=", "get_test_home_assistant", "(", ")" ]
[ 76, 4 ]
[ 78, 45 ]
python
en
['en', 'en', 'en']
True
TestFFmpegSetup.teardown_method
(self)
Stop everything that was started.
Stop everything that was started.
def teardown_method(self): """Stop everything that was started.""" self.hass.stop()
[ "def", "teardown_method", "(", "self", ")", ":", "self", ".", "hass", ".", "stop", "(", ")" ]
[ 80, 4 ]
[ 82, 24 ]
python
en
['en', 'en', 'en']
True
TestFFmpegSetup.test_setup_component
(self)
Set up ffmpeg component.
Set up ffmpeg component.
def test_setup_component(self): """Set up ffmpeg component.""" with assert_setup_component(1): setup_component(self.hass, ffmpeg.DOMAIN, {ffmpeg.DOMAIN: {}}) assert self.hass.data[ffmpeg.DATA_FFMPEG].binary == "ffmpeg"
[ "def", "test_setup_component", "(", "self", ")", ":", "with", "assert_setup_component", "(", "1", ")", ":", "setup_component", "(", "self", ".", "hass", ",", "ffmpeg", ".", "DOMAIN", ",", "{", "ffmpeg", ".", "DOMAIN", ":", "{", "}", "}", ")", "assert", ...
[ 84, 4 ]
[ 89, 68 ]
python
en
['en', 'da', 'en']
True
TestFFmpegSetup.test_setup_component_test_service
(self)
Set up ffmpeg component test services.
Set up ffmpeg component test services.
def test_setup_component_test_service(self): """Set up ffmpeg component test services.""" with assert_setup_component(1): setup_component(self.hass, ffmpeg.DOMAIN, {ffmpeg.DOMAIN: {}}) assert self.hass.services.has_service(ffmpeg.DOMAIN, "start") assert self.hass.services.ha...
[ "def", "test_setup_component_test_service", "(", "self", ")", ":", "with", "assert_setup_component", "(", "1", ")", ":", "setup_component", "(", "self", ".", "hass", ",", "ffmpeg", ".", "DOMAIN", ",", "{", "ffmpeg", ".", "DOMAIN", ":", "{", "}", "}", ")", ...
[ 91, 4 ]
[ 98, 71 ]
python
en
['en', 'fr', 'en']
True
async_setup
(hass, config)
Set up the Ness Alarm platform.
Set up the Ness Alarm platform.
async def async_setup(hass, config): """Set up the Ness Alarm platform.""" conf = config[DOMAIN] zones = conf[CONF_ZONES] host = conf[CONF_HOST] port = conf[CONF_DEVICE_PORT] scan_interval = conf[CONF_SCAN_INTERVAL] infer_arming_state = conf[CONF_INFER_ARMING_STATE] client = Client( ...
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "conf", "=", "config", "[", "DOMAIN", "]", "zones", "=", "conf", "[", "CONF_ZONES", "]", "host", "=", "conf", "[", "CONF_HOST", "]", "port", "=", "conf", "[", "CONF_DEVICE_PORT", "]",...
[ 80, 0 ]
[ 142, 15 ]
python
en
['en', 'lv', 'en']
True
config_file
(kind="local")
Get the filename of the distutils, local, global, or per-user config `kind` must be one of "local", "global", or "user"
Get the filename of the distutils, local, global, or per-user config
def config_file(kind="local"): """Get the filename of the distutils, local, global, or per-user config `kind` must be one of "local", "global", or "user" """ if kind == 'local': return 'setup.cfg' if kind == 'global': return os.path.join( os.path.dirname(distutils.__file...
[ "def", "config_file", "(", "kind", "=", "\"local\"", ")", ":", "if", "kind", "==", "'local'", ":", "return", "'setup.cfg'", "if", "kind", "==", "'global'", ":", "return", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "d...
[ 12, 0 ]
[ 28, 5 ]
python
en
['en', 'en', 'en']
True
edit_config
(filename, settings, dry_run=False)
Edit a configuration file to include `settings` `settings` is a dictionary of dictionaries or ``None`` values, keyed by command/section name. A ``None`` value means to delete the entire section, while a dictionary lists settings to be changed or deleted in that section. A setting of ``None`` means to ...
Edit a configuration file to include `settings`
def edit_config(filename, settings, dry_run=False): """Edit a configuration file to include `settings` `settings` is a dictionary of dictionaries or ``None`` values, keyed by command/section name. A ``None`` value means to delete the entire section, while a dictionary lists settings to be changed or d...
[ "def", "edit_config", "(", "filename", ",", "settings", ",", "dry_run", "=", "False", ")", ":", "log", ".", "debug", "(", "\"Reading configuration from %s\"", ",", "filename", ")", "opts", "=", "configparser", ".", "RawConfigParser", "(", ")", "opts", ".", "...
[ 31, 0 ]
[ 71, 25 ]
python
en
['en', 'en', 'en']
True
ChildCat.additional_properties_type
()
This must be a method because a model may have properties that are of type self, this must run after the class is loaded
This must be a method because a model may have properties that are of type self, this must run after the class is loaded
def additional_properties_type(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded """ lazy_import() return (bool, date, datetime, dict, float, int, list, str, none_type,)
[ "def", "additional_properties_type", "(", ")", ":", "lazy_import", "(", ")", "return", "(", "bool", ",", "date", ",", "datetime", ",", "dict", ",", "float", ",", "int", ",", "list", ",", "str", ",", "none_type", ",", ")" ]
[ 66, 4 ]
[ 72, 78 ]
python
en
['en', 'error', 'th']
False
ChildCat.openapi_types
()
This must be a method because a model may have properties that are of type self, this must run after the class is loaded Returns openapi_types (dict): The key is attribute name and the value is attribute type.
This must be a method because a model may have properties that are of type self, this must run after the class is loaded
def openapi_types(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded Returns openapi_types (dict): The key is attribute name and the value is attribute type. """ lazy...
[ "def", "openapi_types", "(", ")", ":", "lazy_import", "(", ")", "return", "{", "'pet_type'", ":", "(", "str", ",", ")", ",", "# noqa: E501", "'name'", ":", "(", "str", ",", ")", ",", "# noqa: E501", "}" ]
[ 77, 4 ]
[ 90, 9 ]
python
en
['en', 'error', 'th']
False
ChildCat.__init__
(self, pet_type, *args, **kwargs)
ChildCat - a model defined in OpenAPI Args: pet_type (str): Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is...
ChildCat - a model defined in OpenAPI
def __init__(self, pet_type, *args, **kwargs): # noqa: E501 """ChildCat - a model defined in OpenAPI Args: pet_type (str): Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeE...
[ "def", "__init__", "(", "self", ",", "pet_type", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "_check_type", "=", "kwargs", ".", "pop", "(", "'_check_type'", ",", "True", ")", "_spec_property_naming", "=", "kwargs", ".", "pop", "(...
[ 118, 4 ]
[ 210, 46 ]
python
en
['en', 'en', 'en']
True
manifest_from_legacy_module
(domain: str, module: ModuleType)
Generate a manifest from a legacy module.
Generate a manifest from a legacy module.
def manifest_from_legacy_module(domain: str, module: ModuleType) -> Manifest: """Generate a manifest from a legacy module.""" return { "domain": domain, "name": domain, "requirements": getattr(module, "REQUIREMENTS", []), "dependencies": getattr(module, "DEPENDENCIES", []), ...
[ "def", "manifest_from_legacy_module", "(", "domain", ":", "str", ",", "module", ":", "ModuleType", ")", "->", "Manifest", ":", "return", "{", "\"domain\"", ":", "domain", ",", "\"name\"", ":", "domain", ",", "\"requirements\"", ":", "getattr", "(", "module", ...
[ 91, 0 ]
[ 99, 5 ]
python
en
['en', 'en', 'en']
True
_async_get_custom_components
( hass: HomeAssistant, )
Return list of custom integrations.
Return list of custom integrations.
async def _async_get_custom_components( hass: HomeAssistant, ) -> dict[str, Integration]: """Return list of custom integrations.""" if hass.config.safe_mode: return {} try: import custom_components # pylint: disable=import-outside-toplevel except ImportError: return {} ...
[ "async", "def", "_async_get_custom_components", "(", "hass", ":", "HomeAssistant", ",", ")", "->", "dict", "[", "str", ",", "Integration", "]", ":", "if", "hass", ".", "config", ".", "safe_mode", ":", "return", "{", "}", "try", ":", "import", "custom_compo...
[ 102, 0 ]
[ 141, 5 ]
python
en
['en', 'et', 'en']
True
async_get_custom_components
( hass: HomeAssistant, )
Return cached list of custom integrations.
Return cached list of custom integrations.
async def async_get_custom_components( hass: HomeAssistant, ) -> dict[str, Integration]: """Return cached list of custom integrations.""" reg_or_evt = hass.data.get(DATA_CUSTOM_COMPONENTS) if reg_or_evt is None: evt = hass.data[DATA_CUSTOM_COMPONENTS] = asyncio.Event() reg = await _asy...
[ "async", "def", "async_get_custom_components", "(", "hass", ":", "HomeAssistant", ",", ")", "->", "dict", "[", "str", ",", "Integration", "]", ":", "reg_or_evt", "=", "hass", ".", "data", ".", "get", "(", "DATA_CUSTOM_COMPONENTS", ")", "if", "reg_or_evt", "i...
[ 144, 0 ]
[ 163, 53 ]
python
en
['en', 'en', 'en']
True
async_get_config_flows
(hass: HomeAssistant)
Return cached list of config flows.
Return cached list of config flows.
async def async_get_config_flows(hass: HomeAssistant) -> set[str]: """Return cached list of config flows.""" # pylint: disable=import-outside-toplevel from homeassistant.generated.config_flows import FLOWS flows: set[str] = set() flows.update(FLOWS) integrations = await async_get_custom_compon...
[ "async", "def", "async_get_config_flows", "(", "hass", ":", "HomeAssistant", ")", "->", "set", "[", "str", "]", ":", "# pylint: disable=import-outside-toplevel", "from", "homeassistant", ".", "generated", ".", "config_flows", "import", "FLOWS", "flows", ":", "set", ...
[ 166, 0 ]
[ 183, 16 ]
python
en
['en', 'en', 'en']
True
async_get_zeroconf
(hass: HomeAssistant)
Return cached list of zeroconf types.
Return cached list of zeroconf types.
async def async_get_zeroconf(hass: HomeAssistant) -> dict[str, list[dict[str, str]]]: """Return cached list of zeroconf types.""" zeroconf: dict[str, list[dict[str, str]]] = ZEROCONF.copy() integrations = await async_get_custom_components(hass) for integration in integrations.values(): if not i...
[ "async", "def", "async_get_zeroconf", "(", "hass", ":", "HomeAssistant", ")", "->", "dict", "[", "str", ",", "list", "[", "dict", "[", "str", ",", "str", "]", "]", "]", ":", "zeroconf", ":", "dict", "[", "str", ",", "list", "[", "dict", "[", "str",...
[ 186, 0 ]
[ 206, 19 ]
python
en
['en', 'en', 'en']
True
async_get_dhcp
(hass: HomeAssistant)
Return cached list of dhcp types.
Return cached list of dhcp types.
async def async_get_dhcp(hass: HomeAssistant) -> list[dict[str, str]]: """Return cached list of dhcp types.""" dhcp: list[dict[str, str]] = DHCP.copy() integrations = await async_get_custom_components(hass) for integration in integrations.values(): if not integration.dhcp: continue ...
[ "async", "def", "async_get_dhcp", "(", "hass", ":", "HomeAssistant", ")", "->", "list", "[", "dict", "[", "str", ",", "str", "]", "]", ":", "dhcp", ":", "list", "[", "dict", "[", "str", ",", "str", "]", "]", "=", "DHCP", ".", "copy", "(", ")", ...
[ 209, 0 ]
[ 220, 15 ]
python
en
['en', 'en', 'en']
True
async_get_usb
(hass: HomeAssistant)
Return cached list of usb types.
Return cached list of usb types.
async def async_get_usb(hass: HomeAssistant) -> list[dict[str, str]]: """Return cached list of usb types.""" usb: list[dict[str, str]] = USB.copy() integrations = await async_get_custom_components(hass) for integration in integrations.values(): if not integration.usb: continue ...
[ "async", "def", "async_get_usb", "(", "hass", ":", "HomeAssistant", ")", "->", "list", "[", "dict", "[", "str", ",", "str", "]", "]", ":", "usb", ":", "list", "[", "dict", "[", "str", ",", "str", "]", "]", "=", "USB", ".", "copy", "(", ")", "in...
[ 223, 0 ]
[ 239, 14 ]
python
en
['en', 'en', 'en']
True
async_get_homekit
(hass: HomeAssistant)
Return cached list of homekit models.
Return cached list of homekit models.
async def async_get_homekit(hass: HomeAssistant) -> dict[str, str]: """Return cached list of homekit models.""" homekit: dict[str, str] = HOMEKIT.copy() integrations = await async_get_custom_components(hass) for integration in integrations.values(): if ( not integration.homekit ...
[ "async", "def", "async_get_homekit", "(", "hass", ":", "HomeAssistant", ")", "->", "dict", "[", "str", ",", "str", "]", ":", "homekit", ":", "dict", "[", "str", ",", "str", "]", "=", "HOMEKIT", ".", "copy", "(", ")", "integrations", "=", "await", "as...
[ 242, 0 ]
[ 258, 18 ]
python
en
['en', 'en', 'en']
True
async_get_ssdp
(hass: HomeAssistant)
Return cached list of ssdp mappings.
Return cached list of ssdp mappings.
async def async_get_ssdp(hass: HomeAssistant) -> dict[str, list[dict[str, str]]]: """Return cached list of ssdp mappings.""" ssdp: dict[str, list[dict[str, str]]] = SSDP.copy() integrations = await async_get_custom_components(hass) for integration in integrations.values(): if not integration.s...
[ "async", "def", "async_get_ssdp", "(", "hass", ":", "HomeAssistant", ")", "->", "dict", "[", "str", ",", "list", "[", "dict", "[", "str", ",", "str", "]", "]", "]", ":", "ssdp", ":", "dict", "[", "str", ",", "list", "[", "dict", "[", "str", ",", ...
[ 261, 0 ]
[ 273, 15 ]
python
en
['en', 'en', 'en']
True
async_get_mqtt
(hass: HomeAssistant)
Return cached list of MQTT mappings.
Return cached list of MQTT mappings.
async def async_get_mqtt(hass: HomeAssistant) -> dict[str, list[str]]: """Return cached list of MQTT mappings.""" mqtt: dict[str, list[str]] = MQTT.copy() integrations = await async_get_custom_components(hass) for integration in integrations.values(): if not integration.mqtt: conti...
[ "async", "def", "async_get_mqtt", "(", "hass", ":", "HomeAssistant", ")", "->", "dict", "[", "str", ",", "list", "[", "str", "]", "]", ":", "mqtt", ":", "dict", "[", "str", ",", "list", "[", "str", "]", "]", "=", "MQTT", ".", "copy", "(", ")", ...
[ 276, 0 ]
[ 288, 15 ]
python
en
['en', 'en', 'en']
True
async_get_integration
(hass: HomeAssistant, domain: str)
Get an integration.
Get an integration.
async def async_get_integration(hass: HomeAssistant, domain: str) -> Integration: """Get an integration.""" cache = hass.data.get(DATA_INTEGRATIONS) if cache is None: if not _async_mount_config_dir(hass): raise IntegrationNotFound(domain) cache = hass.data[DATA_INTEGRATIONS] = {}...
[ "async", "def", "async_get_integration", "(", "hass", ":", "HomeAssistant", ",", "domain", ":", "str", ")", "->", "Integration", ":", "cache", "=", "hass", ".", "data", ".", "get", "(", "DATA_INTEGRATIONS", ")", "if", "cache", "is", "None", ":", "if", "n...
[ 535, 0 ]
[ 570, 22 ]
python
en
['en', 'lb', 'en']
True
_load_file
( hass: HomeAssistant, comp_or_platform: str, base_paths: list[str] )
Try to load specified file. Looks in config dir first, then built-in components. Only returns it if also found to be valid. Async friendly.
Try to load specified file.
def _load_file( hass: HomeAssistant, comp_or_platform: str, base_paths: list[str] ) -> ModuleType | None: """Try to load specified file. Looks in config dir first, then built-in components. Only returns it if also found to be valid. Async friendly. """ with suppress(KeyError): retur...
[ "def", "_load_file", "(", "hass", ":", "HomeAssistant", ",", "comp_or_platform", ":", "str", ",", "base_paths", ":", "list", "[", "str", "]", ")", "->", "ModuleType", "|", "None", ":", "with", "suppress", "(", "KeyError", ")", ":", "return", "hass", ".",...
[ 612, 0 ]
[ 666, 15 ]
python
en
['en', 'en', 'en']
True
bind_hass
(func: CALLABLE_T)
Decorate function to indicate that first argument is hass.
Decorate function to indicate that first argument is hass.
def bind_hass(func: CALLABLE_T) -> CALLABLE_T: """Decorate function to indicate that first argument is hass.""" setattr(func, "__bind_hass", True) return func
[ "def", "bind_hass", "(", "func", ":", "CALLABLE_T", ")", "->", "CALLABLE_T", ":", "setattr", "(", "func", ",", "\"__bind_hass\"", ",", "True", ")", "return", "func" ]
[ 729, 0 ]
[ 732, 15 ]
python
en
['en', 'en', 'en']
True
_async_component_dependencies
( hass: HomeAssistant, start_domain: str, integration: Integration, loaded: set[str], loading: set[str], )
Recursive function to get component dependencies. Async friendly.
Recursive function to get component dependencies.
async def _async_component_dependencies( hass: HomeAssistant, start_domain: str, integration: Integration, loaded: set[str], loading: set[str], ) -> set[str]: """Recursive function to get component dependencies. Async friendly. """ domain = integration.domain loading.add(domain)...
[ "async", "def", "_async_component_dependencies", "(", "hass", ":", "HomeAssistant", ",", "start_domain", ":", "str", ",", "integration", ":", "Integration", ",", "loaded", ":", "set", "[", "str", "]", ",", "loading", ":", "set", "[", "str", "]", ",", ")", ...
[ 735, 0 ]
[ 775, 17 ]
python
en
['en', 'nl', 'en']
True
_async_mount_config_dir
(hass: HomeAssistant)
Mount config dir in order to load custom_component. Async friendly but not a coroutine.
Mount config dir in order to load custom_component.
def _async_mount_config_dir(hass: HomeAssistant) -> bool: """Mount config dir in order to load custom_component. Async friendly but not a coroutine. """ if hass.config.config_dir is None: _LOGGER.error("Can't load integrations - configuration directory is not set") return False if h...
[ "def", "_async_mount_config_dir", "(", "hass", ":", "HomeAssistant", ")", "->", "bool", ":", "if", "hass", ".", "config", ".", "config_dir", "is", "None", ":", "_LOGGER", ".", "error", "(", "\"Can't load integrations - configuration directory is not set\"", ")", "re...
[ 778, 0 ]
[ 788, 15 ]
python
en
['en', 'en', 'en']
True
_lookup_path
(hass: HomeAssistant)
Return the lookup paths for legacy lookups.
Return the lookup paths for legacy lookups.
def _lookup_path(hass: HomeAssistant) -> list[str]: """Return the lookup paths for legacy lookups.""" if hass.config.safe_mode: return [PACKAGE_BUILTIN] return [PACKAGE_CUSTOM_COMPONENTS, PACKAGE_BUILTIN]
[ "def", "_lookup_path", "(", "hass", ":", "HomeAssistant", ")", "->", "list", "[", "str", "]", ":", "if", "hass", ".", "config", ".", "safe_mode", ":", "return", "[", "PACKAGE_BUILTIN", "]", "return", "[", "PACKAGE_CUSTOM_COMPONENTS", ",", "PACKAGE_BUILTIN", ...
[ 791, 0 ]
[ 795, 55 ]
python
en
['en', 'en', 'en']
True
Integration.resolve_from_root
( cls, hass: HomeAssistant, root_module: ModuleType, domain: str )
Resolve an integration from a root module.
Resolve an integration from a root module.
def resolve_from_root( cls, hass: HomeAssistant, root_module: ModuleType, domain: str ) -> Integration | None: """Resolve an integration from a root module.""" for base in root_module.__path__: # type: ignore manifest_path = pathlib.Path(base) / domain / "manifest.json" ...
[ "def", "resolve_from_root", "(", "cls", ",", "hass", ":", "HomeAssistant", ",", "root_module", ":", "ModuleType", ",", "domain", ":", "str", ")", "->", "Integration", "|", "None", ":", "for", "base", "in", "root_module", ".", "__path__", ":", "# type: ignore...
[ 295, 4 ]
[ 346, 19 ]
python
en
['en', 'en', 'en']
True
Integration.__init__
( self, hass: HomeAssistant, pkg_path: str, file_path: pathlib.Path, manifest: Manifest, )
Initialize an integration.
Initialize an integration.
def __init__( self, hass: HomeAssistant, pkg_path: str, file_path: pathlib.Path, manifest: Manifest, ) -> None: """Initialize an integration.""" self.hass = hass self.pkg_path = pkg_path self.file_path = file_path self.manifest = manife...
[ "def", "__init__", "(", "self", ",", "hass", ":", "HomeAssistant", ",", "pkg_path", ":", "str", ",", "file_path", ":", "pathlib", ".", "Path", ",", "manifest", ":", "Manifest", ",", ")", "->", "None", ":", "self", ".", "hass", "=", "hass", "self", "....
[ 348, 4 ]
[ 369, 64 ]
python
en
['en', 'en', 'nl']
True
Integration.name
(self)
Return name.
Return name.
def name(self) -> str: """Return name.""" return self.manifest["name"]
[ "def", "name", "(", "self", ")", "->", "str", ":", "return", "self", ".", "manifest", "[", "\"name\"", "]" ]
[ 372, 4 ]
[ 374, 36 ]
python
en
['en', 'ig', 'en']
False
Integration.disabled
(self)
Return reason integration is disabled.
Return reason integration is disabled.
def disabled(self) -> str | None: """Return reason integration is disabled.""" return self.manifest.get("disabled")
[ "def", "disabled", "(", "self", ")", "->", "str", "|", "None", ":", "return", "self", ".", "manifest", ".", "get", "(", "\"disabled\"", ")" ]
[ 377, 4 ]
[ 379, 44 ]
python
en
['en', 'en', 'en']
True
Integration.domain
(self)
Return domain.
Return domain.
def domain(self) -> str: """Return domain.""" return self.manifest["domain"]
[ "def", "domain", "(", "self", ")", "->", "str", ":", "return", "self", ".", "manifest", "[", "\"domain\"", "]" ]
[ 382, 4 ]
[ 384, 38 ]
python
de
['de', 'hi-Latn', 'en']
False
Integration.dependencies
(self)
Return dependencies.
Return dependencies.
def dependencies(self) -> list[str]: """Return dependencies.""" return self.manifest.get("dependencies", [])
[ "def", "dependencies", "(", "self", ")", "->", "list", "[", "str", "]", ":", "return", "self", ".", "manifest", ".", "get", "(", "\"dependencies\"", ",", "[", "]", ")" ]
[ 387, 4 ]
[ 389, 52 ]
python
af
['es', 'af', 'en']
False
Integration.after_dependencies
(self)
Return after_dependencies.
Return after_dependencies.
def after_dependencies(self) -> list[str]: """Return after_dependencies.""" return self.manifest.get("after_dependencies", [])
[ "def", "after_dependencies", "(", "self", ")", "->", "list", "[", "str", "]", ":", "return", "self", ".", "manifest", ".", "get", "(", "\"after_dependencies\"", ",", "[", "]", ")" ]
[ 392, 4 ]
[ 394, 58 ]
python
da
['da', 'nl', 'en']
False
Integration.requirements
(self)
Return requirements.
Return requirements.
def requirements(self) -> list[str]: """Return requirements.""" return self.manifest.get("requirements", [])
[ "def", "requirements", "(", "self", ")", "->", "list", "[", "str", "]", ":", "return", "self", ".", "manifest", ".", "get", "(", "\"requirements\"", ",", "[", "]", ")" ]
[ 397, 4 ]
[ 399, 52 ]
python
en
['en', 'en', 'en']
False
Integration.config_flow
(self)
Return config_flow.
Return config_flow.
def config_flow(self) -> bool: """Return config_flow.""" return self.manifest.get("config_flow") or False
[ "def", "config_flow", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "manifest", ".", "get", "(", "\"config_flow\"", ")", "or", "False" ]
[ 402, 4 ]
[ 404, 56 ]
python
en
['en', 'da', 'en']
False
Integration.documentation
(self)
Return documentation.
Return documentation.
def documentation(self) -> str | None: """Return documentation.""" return self.manifest.get("documentation")
[ "def", "documentation", "(", "self", ")", "->", "str", "|", "None", ":", "return", "self", ".", "manifest", ".", "get", "(", "\"documentation\"", ")" ]
[ 407, 4 ]
[ 409, 49 ]
python
cy
['de', 'cy', 'en']
False
Integration.issue_tracker
(self)
Return issue tracker link.
Return issue tracker link.
def issue_tracker(self) -> str | None: """Return issue tracker link.""" return self.manifest.get("issue_tracker")
[ "def", "issue_tracker", "(", "self", ")", "->", "str", "|", "None", ":", "return", "self", ".", "manifest", ".", "get", "(", "\"issue_tracker\"", ")" ]
[ 412, 4 ]
[ 414, 49 ]
python
en
['en', 'en', 'en']
True
Integration.quality_scale
(self)
Return Integration Quality Scale.
Return Integration Quality Scale.
def quality_scale(self) -> str | None: """Return Integration Quality Scale.""" return self.manifest.get("quality_scale")
[ "def", "quality_scale", "(", "self", ")", "->", "str", "|", "None", ":", "return", "self", ".", "manifest", ".", "get", "(", "\"quality_scale\"", ")" ]
[ 417, 4 ]
[ 419, 49 ]
python
en
['en', 'en', 'en']
True
Integration.iot_class
(self)
Return the integration IoT Class.
Return the integration IoT Class.
def iot_class(self) -> str | None: """Return the integration IoT Class.""" return self.manifest.get("iot_class")
[ "def", "iot_class", "(", "self", ")", "->", "str", "|", "None", ":", "return", "self", ".", "manifest", ".", "get", "(", "\"iot_class\"", ")" ]
[ 422, 4 ]
[ 424, 45 ]
python
en
['en', 'lb', 'en']
True
Integration.mqtt
(self)
Return Integration MQTT entries.
Return Integration MQTT entries.
def mqtt(self) -> list[str] | None: """Return Integration MQTT entries.""" return self.manifest.get("mqtt")
[ "def", "mqtt", "(", "self", ")", "->", "list", "[", "str", "]", "|", "None", ":", "return", "self", ".", "manifest", ".", "get", "(", "\"mqtt\"", ")" ]
[ 427, 4 ]
[ 429, 40 ]
python
en
['en', 'sv', 'en']
True
Integration.ssdp
(self)
Return Integration SSDP entries.
Return Integration SSDP entries.
def ssdp(self) -> list[dict[str, str]] | None: """Return Integration SSDP entries.""" return self.manifest.get("ssdp")
[ "def", "ssdp", "(", "self", ")", "->", "list", "[", "dict", "[", "str", ",", "str", "]", "]", "|", "None", ":", "return", "self", ".", "manifest", ".", "get", "(", "\"ssdp\"", ")" ]
[ 432, 4 ]
[ 434, 40 ]
python
en
['en', 'sv', 'en']
True
Integration.zeroconf
(self)
Return Integration zeroconf entries.
Return Integration zeroconf entries.
def zeroconf(self) -> list[str | dict[str, str]] | None: """Return Integration zeroconf entries.""" return self.manifest.get("zeroconf")
[ "def", "zeroconf", "(", "self", ")", "->", "list", "[", "str", "|", "dict", "[", "str", ",", "str", "]", "]", "|", "None", ":", "return", "self", ".", "manifest", ".", "get", "(", "\"zeroconf\"", ")" ]
[ 437, 4 ]
[ 439, 44 ]
python
de
['eu', 'de', 'en']
False
Integration.dhcp
(self)
Return Integration dhcp entries.
Return Integration dhcp entries.
def dhcp(self) -> list[dict[str, str]] | None: """Return Integration dhcp entries.""" return self.manifest.get("dhcp")
[ "def", "dhcp", "(", "self", ")", "->", "list", "[", "dict", "[", "str", ",", "str", "]", "]", "|", "None", ":", "return", "self", ".", "manifest", ".", "get", "(", "\"dhcp\"", ")" ]
[ 442, 4 ]
[ 444, 40 ]
python
da
['nl', 'da', 'en']
False
Integration.usb
(self)
Return Integration usb entries.
Return Integration usb entries.
def usb(self) -> list[dict[str, str]] | None: """Return Integration usb entries.""" return self.manifest.get("usb")
[ "def", "usb", "(", "self", ")", "->", "list", "[", "dict", "[", "str", ",", "str", "]", "]", "|", "None", ":", "return", "self", ".", "manifest", ".", "get", "(", "\"usb\"", ")" ]
[ 447, 4 ]
[ 449, 39 ]
python
da
['de', 'da', 'en']
False
Integration.homekit
(self)
Return Integration homekit entries.
Return Integration homekit entries.
def homekit(self) -> dict[str, list[str]] | None: """Return Integration homekit entries.""" return self.manifest.get("homekit")
[ "def", "homekit", "(", "self", ")", "->", "dict", "[", "str", ",", "list", "[", "str", "]", "]", "|", "None", ":", "return", "self", ".", "manifest", ".", "get", "(", "\"homekit\"", ")" ]
[ 452, 4 ]
[ 454, 43 ]
python
en
['nl', 'et', 'en']
False
Integration.is_built_in
(self)
Test if package is a built-in integration.
Test if package is a built-in integration.
def is_built_in(self) -> bool: """Test if package is a built-in integration.""" return self.pkg_path.startswith(PACKAGE_BUILTIN)
[ "def", "is_built_in", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "pkg_path", ".", "startswith", "(", "PACKAGE_BUILTIN", ")" ]
[ 457, 4 ]
[ 459, 56 ]
python
en
['en', 'en', 'en']
True
Integration.version
(self)
Return the version of the integration.
Return the version of the integration.
def version(self) -> AwesomeVersion | None: """Return the version of the integration.""" if "version" not in self.manifest: return None return AwesomeVersion(self.manifest["version"])
[ "def", "version", "(", "self", ")", "->", "AwesomeVersion", "|", "None", ":", "if", "\"version\"", "not", "in", "self", ".", "manifest", ":", "return", "None", "return", "AwesomeVersion", "(", "self", ".", "manifest", "[", "\"version\"", "]", ")" ]
[ 462, 4 ]
[ 466, 55 ]
python
en
['en', 'en', 'en']
True
Integration.all_dependencies
(self)
Return all dependencies including sub-dependencies.
Return all dependencies including sub-dependencies.
def all_dependencies(self) -> set[str]: """Return all dependencies including sub-dependencies.""" if self._all_dependencies is None: raise RuntimeError("Dependencies not resolved!") return self._all_dependencies
[ "def", "all_dependencies", "(", "self", ")", "->", "set", "[", "str", "]", ":", "if", "self", ".", "_all_dependencies", "is", "None", ":", "raise", "RuntimeError", "(", "\"Dependencies not resolved!\"", ")", "return", "self", ".", "_all_dependencies" ]
[ 469, 4 ]
[ 474, 37 ]
python
ca
['ca', 'ca', 'en']
True
Integration.all_dependencies_resolved
(self)
Return if all dependencies have been resolved.
Return if all dependencies have been resolved.
def all_dependencies_resolved(self) -> bool: """Return if all dependencies have been resolved.""" return self._all_dependencies_resolved is not None
[ "def", "all_dependencies_resolved", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_all_dependencies_resolved", "is", "not", "None" ]
[ 477, 4 ]
[ 479, 58 ]
python
en
['en', 'en', 'en']
True
Integration.resolve_dependencies
(self)
Resolve all dependencies.
Resolve all dependencies.
async def resolve_dependencies(self) -> bool: """Resolve all dependencies.""" if self._all_dependencies_resolved is not None: return self._all_dependencies_resolved try: dependencies = await _async_component_dependencies( self.hass, self.domain, self, set...
[ "async", "def", "resolve_dependencies", "(", "self", ")", "->", "bool", ":", "if", "self", ".", "_all_dependencies_resolved", "is", "not", "None", ":", "return", "self", ".", "_all_dependencies_resolved", "try", ":", "dependencies", "=", "await", "_async_component...
[ 481, 4 ]
[ 509, 46 ]
python
af
['ca', 'af', 'en']
False
Integration.get_component
(self)
Return the component.
Return the component.
def get_component(self) -> ModuleType: """Return the component.""" cache = self.hass.data.setdefault(DATA_COMPONENTS, {}) if self.domain not in cache: cache[self.domain] = importlib.import_module(self.pkg_path) return cache[self.domain]
[ "def", "get_component", "(", "self", ")", "->", "ModuleType", ":", "cache", "=", "self", ".", "hass", ".", "data", ".", "setdefault", "(", "DATA_COMPONENTS", ",", "{", "}", ")", "if", "self", ".", "domain", "not", "in", "cache", ":", "cache", "[", "s...
[ 511, 4 ]
[ 516, 33 ]
python
en
['en', 'en', 'en']
True
Integration.get_platform
(self, platform_name: str)
Return a platform for an integration.
Return a platform for an integration.
def get_platform(self, platform_name: str) -> ModuleType: """Return a platform for an integration.""" cache = self.hass.data.setdefault(DATA_COMPONENTS, {}) full_name = f"{self.domain}.{platform_name}" if full_name not in cache: cache[full_name] = self._import_platform(platfo...
[ "def", "get_platform", "(", "self", ",", "platform_name", ":", "str", ")", "->", "ModuleType", ":", "cache", "=", "self", ".", "hass", ".", "data", ".", "setdefault", "(", "DATA_COMPONENTS", ",", "{", "}", ")", "full_name", "=", "f\"{self.domain}.{platform_n...
[ 518, 4 ]
[ 524, 31 ]
python
en
['en', 'da', 'en']
True