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
CimDumpDataLoader._load_order_proportions
(self, dumps_folder: str)
Load target order proportions from file
Load target order proportions from file
def _load_order_proportions(self, dumps_folder: str) -> Dict[int, List[NoisedItem]]: """Load target order proportions from file""" target_proportions: Dict[int, List[NoisedItem]] = defaultdict(list) proportion_file_path = os.path.join(dumps_folder, "order_proportion.csv") for line in s...
[ "def", "_load_order_proportions", "(", "self", ",", "dumps_folder", ":", "str", ")", "->", "Dict", "[", "int", ",", "List", "[", "NoisedItem", "]", "]", ":", "target_proportions", ":", "Dict", "[", "int", ",", "List", "[", "NoisedItem", "]", "]", "=", ...
[ 94, 4 ]
[ 111, 33 ]
python
en
['en', 'en', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Import the device and discontinue platform. This is for backward compatibility. Do not use this method.
Import the device and discontinue platform.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Import the device and discontinue platform. This is for backward compatibility. Do not use this method. """ import_device(hass, config[CONF_HOST]) _LOGGER.warning( "The sensor platform is deprecate...
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "import_device", "(", "hass", ",", "config", "[", "CONF_HOST", "]", ")", "_LOGGER", ".", "warning", "(", "\"The sensor ...
[ 34, 0 ]
[ 43, 5 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up the Broadlink sensor.
Set up the Broadlink sensor.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up the Broadlink sensor.""" device = hass.data[DOMAIN].devices[config_entry.entry_id] sensor_data = device.update_manager.coordinator.data sensors = [ BroadlinkSensor(device, monitored_condition) for monitored_co...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "device", "=", "hass", ".", "data", "[", "DOMAIN", "]", ".", "devices", "[", "config_entry", ".", "entry_id", "]", "sensor_data", "=", "device", ".", ...
[ 46, 0 ]
[ 55, 31 ]
python
en
['en', 'bs', 'en']
True
BroadlinkSensor.__init__
(self, device, monitored_condition)
Initialize the sensor.
Initialize the sensor.
def __init__(self, device, monitored_condition): """Initialize the sensor.""" self._device = device self._coordinator = device.update_manager.coordinator self._monitored_condition = monitored_condition self._state = self._coordinator.data[monitored_condition]
[ "def", "__init__", "(", "self", ",", "device", ",", "monitored_condition", ")", ":", "self", ".", "_device", "=", "device", "self", ".", "_coordinator", "=", "device", ".", "update_manager", ".", "coordinator", "self", ".", "_monitored_condition", "=", "monito...
[ 61, 4 ]
[ 66, 65 ]
python
en
['en', 'en', 'en']
True
BroadlinkSensor.unique_id
(self)
Return the unique id of the sensor.
Return the unique id of the sensor.
def unique_id(self): """Return the unique id of the sensor.""" return f"{self._device.unique_id}-{self._monitored_condition}"
[ "def", "unique_id", "(", "self", ")", ":", "return", "f\"{self._device.unique_id}-{self._monitored_condition}\"" ]
[ 69, 4 ]
[ 71, 70 ]
python
en
['en', 'la', 'en']
True
BroadlinkSensor.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self): """Return the name of the sensor.""" return f"{self._device.name} {SENSOR_TYPES[self._monitored_condition][0]}"
[ "def", "name", "(", "self", ")", ":", "return", "f\"{self._device.name} {SENSOR_TYPES[self._monitored_condition][0]}\"" ]
[ 74, 4 ]
[ 76, 82 ]
python
en
['en', 'mi', 'en']
True
BroadlinkSensor.state
(self)
Return the state of the sensor.
Return the state of the sensor.
def state(self): """Return the state of the sensor.""" return self._state
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 79, 4 ]
[ 81, 26 ]
python
en
['en', 'en', 'en']
True
BroadlinkSensor.available
(self)
Return True if the sensor is available.
Return True if the sensor is available.
def available(self): """Return True if the sensor is available.""" return self._device.update_manager.available
[ "def", "available", "(", "self", ")", ":", "return", "self", ".", "_device", ".", "update_manager", ".", "available" ]
[ 84, 4 ]
[ 86, 52 ]
python
en
['en', 'en', 'en']
True
BroadlinkSensor.unit_of_measurement
(self)
Return the unit of measurement of the sensor.
Return the unit of measurement of the sensor.
def unit_of_measurement(self): """Return the unit of measurement of the sensor.""" return SENSOR_TYPES[self._monitored_condition][1]
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "SENSOR_TYPES", "[", "self", ".", "_monitored_condition", "]", "[", "1", "]" ]
[ 89, 4 ]
[ 91, 57 ]
python
en
['en', 'bg', 'en']
True
BroadlinkSensor.should_poll
(self)
Return True if the sensor has to be polled for state.
Return True if the sensor has to be polled for state.
def should_poll(self): """Return True if the sensor has to be polled for state.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 94, 4 ]
[ 96, 20 ]
python
en
['en', 'en', 'en']
True
BroadlinkSensor.device_class
(self)
Return device class.
Return device class.
def device_class(self): """Return device class.""" return SENSOR_TYPES[self._monitored_condition][2]
[ "def", "device_class", "(", "self", ")", ":", "return", "SENSOR_TYPES", "[", "self", ".", "_monitored_condition", "]", "[", "2", "]" ]
[ 99, 4 ]
[ 101, 57 ]
python
en
['es', 'zh', 'en']
False
BroadlinkSensor.device_info
(self)
Return device info.
Return device info.
def device_info(self): """Return device info.""" return { "identifiers": {(DOMAIN, self._device.unique_id)}, "manufacturer": self._device.api.manufacturer, "model": self._device.api.model, "name": self._device.name, "sw_version": self._device.f...
[ "def", "device_info", "(", "self", ")", ":", "return", "{", "\"identifiers\"", ":", "{", "(", "DOMAIN", ",", "self", ".", "_device", ".", "unique_id", ")", "}", ",", "\"manufacturer\"", ":", "self", ".", "_device", ".", "api", ".", "manufacturer", ",", ...
[ 104, 4 ]
[ 112, 9 ]
python
en
['es', 'hr', 'en']
False
BroadlinkSensor.update_data
(self)
Update data.
Update data.
def update_data(self): """Update data.""" if self._coordinator.last_update_success: self._state = self._coordinator.data[self._monitored_condition] self.async_write_ha_state()
[ "def", "update_data", "(", "self", ")", ":", "if", "self", ".", "_coordinator", ".", "last_update_success", ":", "self", ".", "_state", "=", "self", ".", "_coordinator", ".", "data", "[", "self", ".", "_monitored_condition", "]", "self", ".", "async_write_ha...
[ 115, 4 ]
[ 119, 35 ]
python
co
['fr', 'co', 'en']
False
BroadlinkSensor.async_added_to_hass
(self)
Call when the sensor is added to hass.
Call when the sensor is added to hass.
async def async_added_to_hass(self): """Call when the sensor is added to hass.""" self.async_on_remove(self._coordinator.async_add_listener(self.update_data))
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "self", ".", "async_on_remove", "(", "self", ".", "_coordinator", ".", "async_add_listener", "(", "self", ".", "update_data", ")", ")" ]
[ 121, 4 ]
[ 123, 84 ]
python
en
['en', 'en', 'en']
True
BroadlinkSensor.async_update
(self)
Update the sensor.
Update the sensor.
async def async_update(self): """Update the sensor.""" await self._coordinator.async_request_refresh()
[ "async", "def", "async_update", "(", "self", ")", ":", "await", "self", ".", "_coordinator", ".", "async_request_refresh", "(", ")" ]
[ 125, 4 ]
[ 127, 55 ]
python
en
['en', 'nl', 'en']
True
path
(value: Any)
Validate it's a safe path.
Validate it's a safe path.
def path(value: Any) -> str: """Validate it's a safe path.""" if not isinstance(value, str): raise vol.Invalid("Expected a string") if sanitize_path(value) != value: raise vol.Invalid("Invalid path") return value
[ "def", "path", "(", "value", ":", "Any", ")", "->", "str", ":", "if", "not", "isinstance", "(", "value", ",", "str", ")", ":", "raise", "vol", ".", "Invalid", "(", "\"Expected a string\"", ")", "if", "sanitize_path", "(", "value", ")", "!=", "value", ...
[ 115, 0 ]
[ 123, 16 ]
python
en
['en', 'en', 'en']
True
has_at_least_one_key
(*keys: str)
Validate that at least one key exists.
Validate that at least one key exists.
def has_at_least_one_key(*keys: str) -> Callable: """Validate that at least one key exists.""" def validate(obj: Dict) -> Dict: """Test keys exist in dict.""" if not isinstance(obj, dict): raise vol.Invalid("expected dictionary") for k in obj: if k in keys: ...
[ "def", "has_at_least_one_key", "(", "*", "keys", ":", "str", ")", "->", "Callable", ":", "def", "validate", "(", "obj", ":", "Dict", ")", "->", "Dict", ":", "\"\"\"Test keys exist in dict.\"\"\"", "if", "not", "isinstance", "(", "obj", ",", "dict", ")", ":...
[ 128, 0 ]
[ 141, 19 ]
python
en
['en', 'en', 'en']
True
has_at_most_one_key
(*keys: str)
Validate that zero keys exist or one key exists.
Validate that zero keys exist or one key exists.
def has_at_most_one_key(*keys: str) -> Callable[[Dict], Dict]: """Validate that zero keys exist or one key exists.""" def validate(obj: Dict) -> Dict: """Test zero keys exist or one key exists in dict.""" if not isinstance(obj, dict): raise vol.Invalid("expected dictionary") ...
[ "def", "has_at_most_one_key", "(", "*", "keys", ":", "str", ")", "->", "Callable", "[", "[", "Dict", "]", ",", "Dict", "]", ":", "def", "validate", "(", "obj", ":", "Dict", ")", "->", "Dict", ":", "\"\"\"Test zero keys exist or one key exists in dict.\"\"\"", ...
[ 144, 0 ]
[ 156, 19 ]
python
en
['en', 'en', 'en']
True
boolean
(value: Any)
Validate and coerce a boolean value.
Validate and coerce a boolean value.
def boolean(value: Any) -> bool: """Validate and coerce a boolean value.""" if isinstance(value, bool): return value if isinstance(value, str): value = value.lower().strip() if value in ("1", "true", "yes", "on", "enable"): return True if value in ("0", "false", "...
[ "def", "boolean", "(", "value", ":", "Any", ")", "->", "bool", ":", "if", "isinstance", "(", "value", ",", "bool", ")", ":", "return", "value", "if", "isinstance", "(", "value", ",", "str", ")", ":", "value", "=", "value", ".", "lower", "(", ")", ...
[ 159, 0 ]
[ 172, 55 ]
python
en
['en', 'en', 'en']
True
whitespace
(value: Any)
Validate result contains only whitespace.
Validate result contains only whitespace.
def whitespace(value: Any) -> str: """Validate result contains only whitespace.""" if isinstance(value, str) and _WS.fullmatch(value): return value raise vol.Invalid(f"contains non-whitespace: {value}")
[ "def", "whitespace", "(", "value", ":", "Any", ")", "->", "str", ":", "if", "isinstance", "(", "value", ",", "str", ")", "and", "_WS", ".", "fullmatch", "(", "value", ")", ":", "return", "value", "raise", "vol", ".", "Invalid", "(", "f\"contains non-wh...
[ 178, 0 ]
[ 183, 58 ]
python
en
['en', 'en', 'en']
True
isdevice
(value: Any)
Validate that value is a real device.
Validate that value is a real device.
def isdevice(value: Any) -> str: """Validate that value is a real device.""" try: os.stat(value) return str(value) except OSError as err: raise vol.Invalid(f"No device at {value} found") from err
[ "def", "isdevice", "(", "value", ":", "Any", ")", "->", "str", ":", "try", ":", "os", ".", "stat", "(", "value", ")", "return", "str", "(", "value", ")", "except", "OSError", "as", "err", ":", "raise", "vol", ".", "Invalid", "(", "f\"No device at {va...
[ 186, 0 ]
[ 192, 65 ]
python
en
['en', 'en', 'en']
True
matches_regex
(regex: str)
Validate that the value is a string that matches a regex.
Validate that the value is a string that matches a regex.
def matches_regex(regex: str) -> Callable[[Any], str]: """Validate that the value is a string that matches a regex.""" compiled = re.compile(regex) def validator(value: Any) -> str: """Validate that value matches the given regex.""" if not isinstance(value, str): raise vol.Inval...
[ "def", "matches_regex", "(", "regex", ":", "str", ")", "->", "Callable", "[", "[", "Any", "]", ",", "str", "]", ":", "compiled", "=", "re", ".", "compile", "(", "regex", ")", "def", "validator", "(", "value", ":", "Any", ")", "->", "str", ":", "\...
[ 195, 0 ]
[ 211, 20 ]
python
en
['en', 'en', 'en']
True
is_regex
(value: Any)
Validate that a string is a valid regular expression.
Validate that a string is a valid regular expression.
def is_regex(value: Any) -> Pattern[Any]: """Validate that a string is a valid regular expression.""" try: r = re.compile(value) return r except TypeError as err: raise vol.Invalid( f"value {value} is of the wrong type for a regular expression" ) from err exce...
[ "def", "is_regex", "(", "value", ":", "Any", ")", "->", "Pattern", "[", "Any", "]", ":", "try", ":", "r", "=", "re", ".", "compile", "(", "value", ")", "return", "r", "except", "TypeError", "as", "err", ":", "raise", "vol", ".", "Invalid", "(", "...
[ 214, 0 ]
[ 224, 86 ]
python
en
['en', 'en', 'en']
True
isfile
(value: Any)
Validate that the value is an existing file.
Validate that the value is an existing file.
def isfile(value: Any) -> str: """Validate that the value is an existing file.""" if value is None: raise vol.Invalid("None is not file") file_in = os.path.expanduser(str(value)) if not os.path.isfile(file_in): raise vol.Invalid("not a file") if not os.access(file_in, os.R_OK): ...
[ "def", "isfile", "(", "value", ":", "Any", ")", "->", "str", ":", "if", "value", "is", "None", ":", "raise", "vol", ".", "Invalid", "(", "\"None is not file\"", ")", "file_in", "=", "os", ".", "path", ".", "expanduser", "(", "str", "(", "value", ")",...
[ 227, 0 ]
[ 237, 18 ]
python
en
['en', 'en', 'en']
True
isdir
(value: Any)
Validate that the value is an existing dir.
Validate that the value is an existing dir.
def isdir(value: Any) -> str: """Validate that the value is an existing dir.""" if value is None: raise vol.Invalid("not a directory") dir_in = os.path.expanduser(str(value)) if not os.path.isdir(dir_in): raise vol.Invalid("not a directory") if not os.access(dir_in, os.R_OK): ...
[ "def", "isdir", "(", "value", ":", "Any", ")", "->", "str", ":", "if", "value", "is", "None", ":", "raise", "vol", ".", "Invalid", "(", "\"not a directory\"", ")", "dir_in", "=", "os", ".", "path", ".", "expanduser", "(", "str", "(", "value", ")", ...
[ 240, 0 ]
[ 250, 17 ]
python
en
['en', 'en', 'en']
True
ensure_list
(value: Union[T, List[T], None])
Wrap value in list if it is not one.
Wrap value in list if it is not one.
def ensure_list(value: Union[T, List[T], None]) -> List[T]: """Wrap value in list if it is not one.""" if value is None: return [] return value if isinstance(value, list) else [value]
[ "def", "ensure_list", "(", "value", ":", "Union", "[", "T", ",", "List", "[", "T", "]", ",", "None", "]", ")", "->", "List", "[", "T", "]", ":", "if", "value", "is", "None", ":", "return", "[", "]", "return", "value", "if", "isinstance", "(", "...
[ 253, 0 ]
[ 257, 56 ]
python
en
['en', 'en', 'en']
True
entity_id
(value: Any)
Validate Entity ID.
Validate Entity ID.
def entity_id(value: Any) -> str: """Validate Entity ID.""" str_value = string(value).lower() if valid_entity_id(str_value): return str_value raise vol.Invalid(f"Entity ID {value} is an invalid entity id")
[ "def", "entity_id", "(", "value", ":", "Any", ")", "->", "str", ":", "str_value", "=", "string", "(", "value", ")", ".", "lower", "(", ")", "if", "valid_entity_id", "(", "str_value", ")", ":", "return", "str_value", "raise", "vol", ".", "Invalid", "(",...
[ 260, 0 ]
[ 266, 67 ]
python
en
['en', 'et', 'sw']
False
entity_ids
(value: Union[str, List])
Validate Entity IDs.
Validate Entity IDs.
def entity_ids(value: Union[str, List]) -> List[str]: """Validate Entity IDs.""" if value is None: raise vol.Invalid("Entity IDs can not be None") if isinstance(value, str): value = [ent_id.strip() for ent_id in value.split(",")] return [entity_id(ent_id) for ent_id in value]
[ "def", "entity_ids", "(", "value", ":", "Union", "[", "str", ",", "List", "]", ")", "->", "List", "[", "str", "]", ":", "if", "value", "is", "None", ":", "raise", "vol", ".", "Invalid", "(", "\"Entity IDs can not be None\"", ")", "if", "isinstance", "(...
[ 269, 0 ]
[ 276, 50 ]
python
en
['en', 'et', 'en']
True
entity_domain
(domain: Union[str, List[str]])
Validate that entity belong to domain.
Validate that entity belong to domain.
def entity_domain(domain: Union[str, List[str]]) -> Callable[[Any], str]: """Validate that entity belong to domain.""" ent_domain = entities_domain(domain) def validate(value: str) -> str: """Test if entity domain is domain.""" validated = ent_domain(value) if len(validated) != 1: ...
[ "def", "entity_domain", "(", "domain", ":", "Union", "[", "str", ",", "List", "[", "str", "]", "]", ")", "->", "Callable", "[", "[", "Any", "]", ",", "str", "]", ":", "ent_domain", "=", "entities_domain", "(", "domain", ")", "def", "validate", "(", ...
[ 284, 0 ]
[ 295, 19 ]
python
en
['en', 'en', 'en']
True
entities_domain
( domain: Union[str, List[str]] )
Validate that entities belong to domain.
Validate that entities belong to domain.
def entities_domain( domain: Union[str, List[str]] ) -> Callable[[Union[str, List]], List[str]]: """Validate that entities belong to domain.""" if isinstance(domain, str): def check_invalid(val: str) -> bool: return val != domain else: def check_invalid(val: str) -> bool: ...
[ "def", "entities_domain", "(", "domain", ":", "Union", "[", "str", ",", "List", "[", "str", "]", "]", ")", "->", "Callable", "[", "[", "Union", "[", "str", ",", "List", "]", "]", ",", "List", "[", "str", "]", "]", ":", "if", "isinstance", "(", ...
[ 298, 0 ]
[ 322, 19 ]
python
en
['en', 'en', 'en']
True
enum
(enumClass: Type[Enum])
Create validator for specified enum.
Create validator for specified enum.
def enum(enumClass: Type[Enum]) -> vol.All: """Create validator for specified enum.""" return vol.All(vol.In(enumClass.__members__), enumClass.__getitem__)
[ "def", "enum", "(", "enumClass", ":", "Type", "[", "Enum", "]", ")", "->", "vol", ".", "All", ":", "return", "vol", ".", "All", "(", "vol", ".", "In", "(", "enumClass", ".", "__members__", ")", ",", "enumClass", ".", "__getitem__", ")" ]
[ 325, 0 ]
[ 327, 72 ]
python
af
['da', 'af', 'en']
False
icon
(value: Any)
Validate icon.
Validate icon.
def icon(value: Any) -> str: """Validate icon.""" str_value = str(value) if ":" in str_value: return str_value raise vol.Invalid('Icons should be specified in the form "prefix:name"')
[ "def", "icon", "(", "value", ":", "Any", ")", "->", "str", ":", "str_value", "=", "str", "(", "value", ")", "if", "\":\"", "in", "str_value", ":", "return", "str_value", "raise", "vol", ".", "Invalid", "(", "'Icons should be specified in the form \"prefix:name...
[ 330, 0 ]
[ 337, 76 ]
python
en
['en', 'et', 'it']
False
time
(value: Any)
Validate and transform a time.
Validate and transform a time.
def time(value: Any) -> time_sys: """Validate and transform a time.""" if isinstance(value, time_sys): return value try: time_val = dt_util.parse_time(value) except TypeError as err: raise vol.Invalid("Not a parseable type") from err if time_val is None: raise vol.I...
[ "def", "time", "(", "value", ":", "Any", ")", "->", "time_sys", ":", "if", "isinstance", "(", "value", ",", "time_sys", ")", ":", "return", "value", "try", ":", "time_val", "=", "dt_util", ".", "parse_time", "(", "value", ")", "except", "TypeError", "a...
[ 356, 0 ]
[ 369, 19 ]
python
en
['en', 'en', 'en']
True
date
(value: Any)
Validate and transform a date.
Validate and transform a date.
def date(value: Any) -> date_sys: """Validate and transform a date.""" if isinstance(value, date_sys): return value try: date_val = dt_util.parse_date(value) except TypeError as err: raise vol.Invalid("Not a parseable type") from err if date_val is None: raise vol.I...
[ "def", "date", "(", "value", ":", "Any", ")", "->", "date_sys", ":", "if", "isinstance", "(", "value", ",", "date_sys", ")", ":", "return", "value", "try", ":", "date_val", "=", "dt_util", ".", "parse_date", "(", "value", ")", "except", "TypeError", "a...
[ 372, 0 ]
[ 385, 19 ]
python
en
['en', 'en', 'en']
True
time_period_str
(value: str)
Validate and transform time offset.
Validate and transform time offset.
def time_period_str(value: str) -> timedelta: """Validate and transform time offset.""" if isinstance(value, int): # type: ignore raise vol.Invalid("Make sure you wrap time values in quotes") if not isinstance(value, str): raise vol.Invalid(TIME_PERIOD_ERROR.format(value)) negative_off...
[ "def", "time_period_str", "(", "value", ":", "str", ")", "->", "timedelta", ":", "if", "isinstance", "(", "value", ",", "int", ")", ":", "# type: ignore", "raise", "vol", ".", "Invalid", "(", "\"Make sure you wrap time values in quotes\"", ")", "if", "not", "i...
[ 388, 0 ]
[ 420, 17 ]
python
en
['en', 'en', 'en']
True
time_period_seconds
(value: Union[float, str])
Validate and transform seconds to a time offset.
Validate and transform seconds to a time offset.
def time_period_seconds(value: Union[float, str]) -> timedelta: """Validate and transform seconds to a time offset.""" try: return timedelta(seconds=float(value)) except (ValueError, TypeError) as err: raise vol.Invalid(f"Expected seconds, got {value}") from err
[ "def", "time_period_seconds", "(", "value", ":", "Union", "[", "float", ",", "str", "]", ")", "->", "timedelta", ":", "try", ":", "return", "timedelta", "(", "seconds", "=", "float", "(", "value", ")", ")", "except", "(", "ValueError", ",", "TypeError", ...
[ 423, 0 ]
[ 428, 68 ]
python
en
['en', 'en', 'en']
True
match_all
(value: T)
Validate that matches all values.
Validate that matches all values.
def match_all(value: T) -> T: """Validate that matches all values.""" return value
[ "def", "match_all", "(", "value", ":", "T", ")", "->", "T", ":", "return", "value" ]
[ 434, 0 ]
[ 436, 16 ]
python
en
['en', 'en', 'en']
True
positive_timedelta
(value: timedelta)
Validate timedelta is positive.
Validate timedelta is positive.
def positive_timedelta(value: timedelta) -> timedelta: """Validate timedelta is positive.""" if value < timedelta(0): raise vol.Invalid("Time period should be positive") return value
[ "def", "positive_timedelta", "(", "value", ":", "timedelta", ")", "->", "timedelta", ":", "if", "value", "<", "timedelta", "(", "0", ")", ":", "raise", "vol", ".", "Invalid", "(", "\"Time period should be positive\"", ")", "return", "value" ]
[ 439, 0 ]
[ 443, 16 ]
python
en
['en', 'en', 'en']
True
remove_falsy
(value: List[T])
Remove falsy values from a list.
Remove falsy values from a list.
def remove_falsy(value: List[T]) -> List[T]: """Remove falsy values from a list.""" return [v for v in value if v]
[ "def", "remove_falsy", "(", "value", ":", "List", "[", "T", "]", ")", "->", "List", "[", "T", "]", ":", "return", "[", "v", "for", "v", "in", "value", "if", "v", "]" ]
[ 450, 0 ]
[ 452, 34 ]
python
en
['en', 'en', 'en']
True
service
(value: Any)
Validate service.
Validate service.
def service(value: Any) -> str: """Validate service.""" # Services use same format as entities so we can use same helper. str_value = string(value).lower() if valid_entity_id(str_value): return str_value raise vol.Invalid(f"Service {value} does not match format <domain>.<name>")
[ "def", "service", "(", "value", ":", "Any", ")", "->", "str", ":", "# Services use same format as entities so we can use same helper.", "str_value", "=", "string", "(", "value", ")", ".", "lower", "(", ")", "if", "valid_entity_id", "(", "str_value", ")", ":", "r...
[ 455, 0 ]
[ 462, 79 ]
python
en
['en', 'zh', 'en']
False
slug
(value: Any)
Validate value is a valid slug.
Validate value is a valid slug.
def slug(value: Any) -> str: """Validate value is a valid slug.""" if value is None: raise vol.Invalid("Slug should not be None") str_value = str(value) slg = util_slugify(str_value) if str_value == slg: return str_value raise vol.Invalid(f"invalid slug {value} (try {slg})")
[ "def", "slug", "(", "value", ":", "Any", ")", "->", "str", ":", "if", "value", "is", "None", ":", "raise", "vol", ".", "Invalid", "(", "\"Slug should not be None\"", ")", "str_value", "=", "str", "(", "value", ")", "slg", "=", "util_slugify", "(", "str...
[ 465, 0 ]
[ 473, 58 ]
python
en
['en', 'et', 'en']
True
schema_with_slug_keys
( value_schema: Union[T, Callable], *, slug_validator: Callable[[Any], str] = slug )
Ensure dicts have slugs as keys. Replacement of vol.Schema({cv.slug: value_schema}) to prevent misleading "Extra keys" errors from voluptuous.
Ensure dicts have slugs as keys.
def schema_with_slug_keys( value_schema: Union[T, Callable], *, slug_validator: Callable[[Any], str] = slug ) -> Callable: """Ensure dicts have slugs as keys. Replacement of vol.Schema({cv.slug: value_schema}) to prevent misleading "Extra keys" errors from voluptuous. """ schema = vol.Schema({s...
[ "def", "schema_with_slug_keys", "(", "value_schema", ":", "Union", "[", "T", ",", "Callable", "]", ",", "*", ",", "slug_validator", ":", "Callable", "[", "[", "Any", "]", ",", "str", "]", "=", "slug", ")", "->", "Callable", ":", "schema", "=", "vol", ...
[ 476, 0 ]
[ 496, 17 ]
python
en
['en', 'af', 'en']
True
slugify
(value: Any)
Coerce a value to a slug.
Coerce a value to a slug.
def slugify(value: Any) -> str: """Coerce a value to a slug.""" if value is None: raise vol.Invalid("Slug should not be None") slg = util_slugify(str(value)) if slg: return slg raise vol.Invalid(f"Unable to slugify {value}")
[ "def", "slugify", "(", "value", ":", "Any", ")", "->", "str", ":", "if", "value", "is", "None", ":", "raise", "vol", ".", "Invalid", "(", "\"Slug should not be None\"", ")", "slg", "=", "util_slugify", "(", "str", "(", "value", ")", ")", "if", "slg", ...
[ 499, 0 ]
[ 506, 51 ]
python
en
['en', 'st', 'en']
True
string
(value: Any)
Coerce value to string, except for None.
Coerce value to string, except for None.
def string(value: Any) -> str: """Coerce value to string, except for None.""" if value is None: raise vol.Invalid("string value is None") if isinstance(value, template_helper.ResultWrapper): value = value.render_result elif isinstance(value, (list, dict)): raise vol.Invalid("va...
[ "def", "string", "(", "value", ":", "Any", ")", "->", "str", ":", "if", "value", "is", "None", ":", "raise", "vol", ".", "Invalid", "(", "\"string value is None\"", ")", "if", "isinstance", "(", "value", ",", "template_helper", ".", "ResultWrapper", ")", ...
[ 509, 0 ]
[ 520, 21 ]
python
en
['en', 'en', 'en']
True
string_with_no_html
(value: Any)
Validate that the value is a string without HTML.
Validate that the value is a string without HTML.
def string_with_no_html(value: Any) -> str: """Validate that the value is a string without HTML.""" value = string(value) regex = re.compile(r"<[a-z][\s\S]*>") if regex.search(value): raise vol.Invalid("the string should not contain HTML") return str(value)
[ "def", "string_with_no_html", "(", "value", ":", "Any", ")", "->", "str", ":", "value", "=", "string", "(", "value", ")", "regex", "=", "re", ".", "compile", "(", "r\"<[a-z][\\s\\S]*>\"", ")", "if", "regex", ".", "search", "(", "value", ")", ":", "rais...
[ 523, 0 ]
[ 529, 21 ]
python
en
['en', 'en', 'en']
True
temperature_unit
(value: Any)
Validate and transform temperature unit.
Validate and transform temperature unit.
def temperature_unit(value: Any) -> str: """Validate and transform temperature unit.""" value = str(value).upper() if value == "C": return TEMP_CELSIUS if value == "F": return TEMP_FAHRENHEIT raise vol.Invalid("invalid temperature unit (expected C or F)")
[ "def", "temperature_unit", "(", "value", ":", "Any", ")", "->", "str", ":", "value", "=", "str", "(", "value", ")", ".", "upper", "(", ")", "if", "value", "==", "\"C\"", ":", "return", "TEMP_CELSIUS", "if", "value", "==", "\"F\"", ":", "return", "TEM...
[ 532, 0 ]
[ 539, 67 ]
python
en
['en', 'la', 'en']
True
template
(value: Optional[Any])
Validate a jinja2 template.
Validate a jinja2 template.
def template(value: Optional[Any]) -> template_helper.Template: """Validate a jinja2 template.""" if value is None: raise vol.Invalid("template value is None") if isinstance(value, (list, dict, template_helper.Template)): raise vol.Invalid("template value should be a string") template_...
[ "def", "template", "(", "value", ":", "Optional", "[", "Any", "]", ")", "->", "template_helper", ".", "Template", ":", "if", "value", "is", "None", ":", "raise", "vol", ".", "Invalid", "(", "\"template value is None\"", ")", "if", "isinstance", "(", "value...
[ 547, 0 ]
[ 561, 61 ]
python
mt
['mt', 'mt', 'bg']
True
dynamic_template
(value: Optional[Any])
Validate a dynamic (non static) jinja2 template.
Validate a dynamic (non static) jinja2 template.
def dynamic_template(value: Optional[Any]) -> template_helper.Template: """Validate a dynamic (non static) jinja2 template.""" if value is None: raise vol.Invalid("template value is None") if isinstance(value, (list, dict, template_helper.Template)): raise vol.Invalid("template value should...
[ "def", "dynamic_template", "(", "value", ":", "Optional", "[", "Any", "]", ")", "->", "template_helper", ".", "Template", ":", "if", "value", "is", "None", ":", "raise", "vol", ".", "Invalid", "(", "\"template value is None\"", ")", "if", "isinstance", "(", ...
[ 564, 0 ]
[ 579, 61 ]
python
bg
['sl', 'en', 'bg']
False
template_complex
(value: Any)
Validate a complex jinja2 template.
Validate a complex jinja2 template.
def template_complex(value: Any) -> Any: """Validate a complex jinja2 template.""" if isinstance(value, list): return_list = value.copy() for idx, element in enumerate(return_list): return_list[idx] = template_complex(element) return return_list if isinstance(value, dict)...
[ "def", "template_complex", "(", "value", ":", "Any", ")", "->", "Any", ":", "if", "isinstance", "(", "value", ",", "list", ")", ":", "return_list", "=", "value", ".", "copy", "(", ")", "for", "idx", ",", "element", "in", "enumerate", "(", "return_list"...
[ 582, 0 ]
[ 597, 16 ]
python
mt
['mt', 'mt', 'bg']
True
datetime
(value: Any)
Validate datetime.
Validate datetime.
def datetime(value: Any) -> datetime_sys: """Validate datetime.""" if isinstance(value, datetime_sys): return value try: date_val = dt_util.parse_datetime(value) except TypeError: date_val = None if date_val is None: raise vol.Invalid(f"Invalid datetime specified: {...
[ "def", "datetime", "(", "value", ":", "Any", ")", "->", "datetime_sys", ":", "if", "isinstance", "(", "value", ",", "datetime_sys", ")", ":", "return", "value", "try", ":", "date_val", "=", "dt_util", ".", "parse_datetime", "(", "value", ")", "except", "...
[ 605, 0 ]
[ 618, 19 ]
python
et
['fr', 'et', 'it']
False
time_zone
(value: str)
Validate timezone.
Validate timezone.
def time_zone(value: str) -> str: """Validate timezone.""" if dt_util.get_time_zone(value) is not None: return value raise vol.Invalid( "Invalid time zone passed in. Valid options can be found here: " "http://en.wikipedia.org/wiki/List_of_tz_database_time_zones" )
[ "def", "time_zone", "(", "value", ":", "str", ")", "->", "str", ":", "if", "dt_util", ".", "get_time_zone", "(", "value", ")", "is", "not", "None", ":", "return", "value", "raise", "vol", ".", "Invalid", "(", "\"Invalid time zone passed in. Valid options can b...
[ 621, 0 ]
[ 628, 5 ]
python
cs
['cs', 'sr', 'en']
False
socket_timeout
(value: Optional[Any])
Validate timeout float > 0.0. None coerced to socket._GLOBAL_DEFAULT_TIMEOUT bare object.
Validate timeout float > 0.0.
def socket_timeout(value: Optional[Any]) -> object: """Validate timeout float > 0.0. None coerced to socket._GLOBAL_DEFAULT_TIMEOUT bare object. """ if value is None: return _GLOBAL_DEFAULT_TIMEOUT try: float_value = float(value) if float_value > 0.0: return floa...
[ "def", "socket_timeout", "(", "value", ":", "Optional", "[", "Any", "]", ")", "->", "object", ":", "if", "value", "is", "None", ":", "return", "_GLOBAL_DEFAULT_TIMEOUT", "try", ":", "float_value", "=", "float", "(", "value", ")", "if", "float_value", ">", ...
[ 634, 0 ]
[ 647, 59 ]
python
en
['en', 'en', 'en']
True
url
(value: Any)
Validate an URL.
Validate an URL.
def url(value: Any) -> str: """Validate an URL.""" url_in = str(value) if urlparse(url_in).scheme in ["http", "https"]: return cast(str, vol.Schema(vol.Url())(url_in)) raise vol.Invalid("invalid url")
[ "def", "url", "(", "value", ":", "Any", ")", "->", "str", ":", "url_in", "=", "str", "(", "value", ")", "if", "urlparse", "(", "url_in", ")", ".", "scheme", "in", "[", "\"http\"", ",", "\"https\"", "]", ":", "return", "cast", "(", "str", ",", "vo...
[ 651, 0 ]
[ 658, 36 ]
python
en
['en', 'lb', 'it']
False
x10_address
(value: str)
Validate an x10 address.
Validate an x10 address.
def x10_address(value: str) -> str: """Validate an x10 address.""" regex = re.compile(r"([A-Pa-p]{1})(?:[2-9]|1[0-6]?)$") if not regex.match(value): raise vol.Invalid("Invalid X10 Address") return str(value).lower()
[ "def", "x10_address", "(", "value", ":", "str", ")", "->", "str", ":", "regex", "=", "re", ".", "compile", "(", "r\"([A-Pa-p]{1})(?:[2-9]|1[0-6]?)$\"", ")", "if", "not", "regex", ".", "match", "(", "value", ")", ":", "raise", "vol", ".", "Invalid", "(", ...
[ 661, 0 ]
[ 666, 29 ]
python
en
['en', 'lb', 'en']
True
uuid4_hex
(value: Any)
Validate a v4 UUID in hex format.
Validate a v4 UUID in hex format.
def uuid4_hex(value: Any) -> str: """Validate a v4 UUID in hex format.""" try: result = UUID(value, version=4) except (ValueError, AttributeError, TypeError) as error: raise vol.Invalid("Invalid Version4 UUID", error_message=str(error)) if result.hex != value.lower(): # UUID() w...
[ "def", "uuid4_hex", "(", "value", ":", "Any", ")", "->", "str", ":", "try", ":", "result", "=", "UUID", "(", "value", ",", "version", "=", "4", ")", "except", "(", "ValueError", ",", "AttributeError", ",", "TypeError", ")", "as", "error", ":", "raise...
[ 669, 0 ]
[ 680, 21 ]
python
en
['en', 'en', 'it']
True
ensure_list_csv
(value: Any)
Ensure that input is a list or make one from comma-separated string.
Ensure that input is a list or make one from comma-separated string.
def ensure_list_csv(value: Any) -> List: """Ensure that input is a list or make one from comma-separated string.""" if isinstance(value, str): return [member.strip() for member in value.split(",")] return ensure_list(value)
[ "def", "ensure_list_csv", "(", "value", ":", "Any", ")", "->", "List", ":", "if", "isinstance", "(", "value", ",", "str", ")", ":", "return", "[", "member", ".", "strip", "(", ")", "for", "member", "in", "value", ".", "split", "(", "\",\"", ")", "]...
[ 683, 0 ]
[ 687, 29 ]
python
en
['en', 'en', 'en']
True
deprecated
( key: str, replacement_key: Optional[str] = None, invalidation_version: Optional[str] = None, default: Optional[Any] = None, )
Log key as deprecated and provide a replacement (if exists). Expected behavior: - Outputs the appropriate deprecation warning if key is detected - Processes schema moving the value from key to replacement_key - Processes schema changing nothing if only replacement_key provided ...
Log key as deprecated and provide a replacement (if exists).
def deprecated( key: str, replacement_key: Optional[str] = None, invalidation_version: Optional[str] = None, default: Optional[Any] = None, ) -> Callable[[Dict], Dict]: """ Log key as deprecated and provide a replacement (if exists). Expected behavior: - Outputs the appropriate depr...
[ "def", "deprecated", "(", "key", ":", "str", ",", "replacement_key", ":", "Optional", "[", "str", "]", "=", "None", ",", "invalidation_version", ":", "Optional", "[", "str", "]", "=", "None", ",", "default", ":", "Optional", "[", "Any", "]", "=", "None...
[ 709, 0 ]
[ 805, 20 ]
python
en
['en', 'error', 'th']
False
key_value_schemas
( key: str, value_schemas: Dict[str, vol.Schema] )
Create a validator that validates based on a value for specific key. This gives better error messages.
Create a validator that validates based on a value for specific key.
def key_value_schemas( key: str, value_schemas: Dict[str, vol.Schema] ) -> Callable[[Any], Dict[str, Any]]: """Create a validator that validates based on a value for specific key. This gives better error messages. """ def key_value_validator(value: Any) -> Dict[str, Any]: if not isinstance...
[ "def", "key_value_schemas", "(", "key", ":", "str", ",", "value_schemas", ":", "Dict", "[", "str", ",", "vol", ".", "Schema", "]", ")", "->", "Callable", "[", "[", "Any", "]", ",", "Dict", "[", "str", ",", "Any", "]", "]", ":", "def", "key_value_va...
[ 808, 0 ]
[ 829, 30 ]
python
en
['en', 'en', 'en']
True
key_dependency
( key: Hashable, dependency: Hashable )
Validate that all dependencies exist for key.
Validate that all dependencies exist for key.
def key_dependency( key: Hashable, dependency: Hashable ) -> Callable[[Dict[Hashable, Any]], Dict[Hashable, Any]]: """Validate that all dependencies exist for key.""" def validator(value: Dict[Hashable, Any]) -> Dict[Hashable, Any]: """Test dependencies.""" if not isinstance(value, dict): ...
[ "def", "key_dependency", "(", "key", ":", "Hashable", ",", "dependency", ":", "Hashable", ")", "->", "Callable", "[", "[", "Dict", "[", "Hashable", ",", "Any", "]", "]", ",", "Dict", "[", "Hashable", ",", "Any", "]", "]", ":", "def", "validator", "("...
[ 835, 0 ]
[ 852, 20 ]
python
en
['en', 'en', 'en']
True
custom_serializer
(schema: Any)
Serialize additional types for voluptuous_serialize.
Serialize additional types for voluptuous_serialize.
def custom_serializer(schema: Any) -> Any: """Serialize additional types for voluptuous_serialize.""" if schema is positive_time_period_dict: return {"type": "positive_time_period_dict"} if schema is string: return {"type": "string"} if schema is boolean: return {"type": "boole...
[ "def", "custom_serializer", "(", "schema", ":", "Any", ")", "->", "Any", ":", "if", "schema", "is", "positive_time_period_dict", ":", "return", "{", "\"type\"", ":", "\"positive_time_period_dict\"", "}", "if", "schema", "is", "string", ":", "return", "{", "\"t...
[ 855, 0 ]
[ 869, 43 ]
python
en
['en', 'en', 'en']
True
make_entity_service_schema
( schema: dict, *, extra: int = vol.PREVENT_EXTRA )
Create an entity service schema.
Create an entity service schema.
def make_entity_service_schema( schema: dict, *, extra: int = vol.PREVENT_EXTRA ) -> vol.All: """Create an entity service schema.""" return vol.All( vol.Schema( { **schema, vol.Optional(ATTR_ENTITY_ID): comp_entity_ids, vol.Optional(ATTR_AR...
[ "def", "make_entity_service_schema", "(", "schema", ":", "dict", ",", "*", ",", "extra", ":", "int", "=", "vol", ".", "PREVENT_EXTRA", ")", "->", "vol", ".", "All", ":", "return", "vol", ".", "All", "(", "vol", ".", "Schema", "(", "{", "*", "*", "s...
[ 886, 0 ]
[ 902, 5 ]
python
en
['en', 'de', 'en']
True
script_action
(value: Any)
Validate a script action.
Validate a script action.
def script_action(value: Any) -> dict: """Validate a script action.""" if not isinstance(value, dict): raise vol.Invalid("expected dictionary") return ACTION_TYPE_SCHEMAS[determine_script_action(value)](value)
[ "def", "script_action", "(", "value", ":", "Any", ")", "->", "dict", ":", "if", "not", "isinstance", "(", "value", ",", "dict", ")", ":", "raise", "vol", ".", "Invalid", "(", "\"expected dictionary\"", ")", "return", "ACTION_TYPE_SCHEMAS", "[", "determine_sc...
[ 912, 0 ]
[ 917, 69 ]
python
en
['en', 'en', 'en']
True
STATE_CONDITION_SCHEMA
(value: Any)
Validate a state condition.
Validate a state condition.
def STATE_CONDITION_SCHEMA(value: Any) -> dict: # pylint: disable=invalid-name """Validate a state condition.""" if not isinstance(value, dict): raise vol.Invalid("Expected a dictionary") if CONF_ATTRIBUTE in value: validated: dict = STATE_CONDITION_ATTRIBUTE_SCHEMA(value) else: ...
[ "def", "STATE_CONDITION_SCHEMA", "(", "value", ":", "Any", ")", "->", "dict", ":", "# pylint: disable=invalid-name", "if", "not", "isinstance", "(", "value", ",", "dict", ")", ":", "raise", "vol", ".", "Invalid", "(", "\"Expected a dictionary\"", ")", "if", "C...
[ 992, 0 ]
[ 1002, 52 ]
python
en
['ro', 'en', 'en']
True
determine_script_action
(action: dict)
Determine action type.
Determine action type.
def determine_script_action(action: dict) -> str: """Determine action type.""" if CONF_DELAY in action: return SCRIPT_ACTION_DELAY if CONF_WAIT_TEMPLATE in action: return SCRIPT_ACTION_WAIT_TEMPLATE if CONF_CONDITION in action: return SCRIPT_ACTION_CHECK_CONDITION if CONF_...
[ "def", "determine_script_action", "(", "action", ":", "dict", ")", "->", "str", ":", "if", "CONF_DELAY", "in", "action", ":", "return", "SCRIPT_ACTION_DELAY", "if", "CONF_WAIT_TEMPLATE", "in", "action", ":", "return", "SCRIPT_ACTION_WAIT_TEMPLATE", "if", "CONF_CONDI...
[ 1208, 0 ]
[ 1240, 37 ]
python
en
['en', 'sr', 'en']
True
multi_select.__init__
(self, options: dict)
Initialize multi select.
Initialize multi select.
def __init__(self, options: dict) -> None: """Initialize multi select.""" self.options = options
[ "def", "__init__", "(", "self", ",", "options", ":", "dict", ")", "->", "None", ":", "self", ".", "options", "=", "options" ]
[ 693, 4 ]
[ 695, 30 ]
python
en
['en', 'en', 'it']
True
multi_select.__call__
(self, selected: list)
Validate input.
Validate input.
def __call__(self, selected: list) -> list: """Validate input.""" if not isinstance(selected, list): raise vol.Invalid("Not a list") for value in selected: if value not in self.options: raise vol.Invalid(f"{value} is not a valid option") return s...
[ "def", "__call__", "(", "self", ",", "selected", ":", "list", ")", "->", "list", ":", "if", "not", "isinstance", "(", "selected", ",", "list", ")", ":", "raise", "vol", ".", "Invalid", "(", "\"Not a list\"", ")", "for", "value", "in", "selected", ":", ...
[ 697, 4 ]
[ 706, 23 ]
python
en
['en', 'et', 'en']
False
is_bluetooth_device
(device)
Check whether a device is a bluetooth device by its mac.
Check whether a device is a bluetooth device by its mac.
def is_bluetooth_device(device) -> bool: """Check whether a device is a bluetooth device by its mac.""" return device.mac and device.mac[:3].upper() == BT_PREFIX
[ "def", "is_bluetooth_device", "(", "device", ")", "->", "bool", ":", "return", "device", ".", "mac", "and", "device", ".", "mac", "[", ":", "3", "]", ".", "upper", "(", ")", "==", "BT_PREFIX" ]
[ 49, 0 ]
[ 51, 61 ]
python
en
['en', 'en', 'en']
True
discover_devices
(device_id: int)
Discover Bluetooth devices.
Discover Bluetooth devices.
def discover_devices(device_id: int) -> List[Tuple[str, str]]: """Discover Bluetooth devices.""" result = bluetooth.discover_devices( duration=8, lookup_names=True, flush_cache=True, lookup_class=False, device_id=device_id, ) _LOGGER.debug("Bluetooth devices disco...
[ "def", "discover_devices", "(", "device_id", ":", "int", ")", "->", "List", "[", "Tuple", "[", "str", ",", "str", "]", "]", ":", "result", "=", "bluetooth", ".", "discover_devices", "(", "duration", "=", "8", ",", "lookup_names", "=", "True", ",", "flu...
[ 54, 0 ]
[ 64, 17 ]
python
en
['de', 'en', 'en']
True
see_device
( hass: HomeAssistantType, async_see, mac: str, device_name: str, rssi=None )
Mark a device as seen.
Mark a device as seen.
async def see_device( hass: HomeAssistantType, async_see, mac: str, device_name: str, rssi=None ) -> None: """Mark a device as seen.""" attributes = {} if rssi is not None: attributes["rssi"] = rssi await async_see( mac=f"{BT_PREFIX}{mac}", host_name=device_name, att...
[ "async", "def", "see_device", "(", "hass", ":", "HomeAssistantType", ",", "async_see", ",", "mac", ":", "str", ",", "device_name", ":", "str", ",", "rssi", "=", "None", ")", "->", "None", ":", "attributes", "=", "{", "}", "if", "rssi", "is", "not", "...
[ 67, 0 ]
[ 80, 5 ]
python
en
['en', 'en', 'en']
True
get_tracking_devices
(hass: HomeAssistantType)
Load all known devices. We just need the devices so set consider_home and home range to 0
Load all known devices.
async def get_tracking_devices(hass: HomeAssistantType) -> Tuple[Set[str], Set[str]]: """ Load all known devices. We just need the devices so set consider_home and home range to 0 """ yaml_path: str = hass.config.path(YAML_DEVICES) devices = await async_load_config(yaml_path, hass, 0) blue...
[ "async", "def", "get_tracking_devices", "(", "hass", ":", "HomeAssistantType", ")", "->", "Tuple", "[", "Set", "[", "str", "]", ",", "Set", "[", "str", "]", "]", ":", "yaml_path", ":", "str", "=", "hass", ".", "config", ".", "path", "(", "YAML_DEVICES"...
[ 83, 0 ]
[ 101, 49 ]
python
en
['en', 'error', 'th']
False
lookup_name
(mac: str)
Lookup a Bluetooth device name.
Lookup a Bluetooth device name.
def lookup_name(mac: str) -> Optional[str]: """Lookup a Bluetooth device name.""" _LOGGER.debug("Scanning %s", mac) return bluetooth.lookup_name(mac, timeout=5)
[ "def", "lookup_name", "(", "mac", ":", "str", ")", "->", "Optional", "[", "str", "]", ":", "_LOGGER", ".", "debug", "(", "\"Scanning %s\"", ",", "mac", ")", "return", "bluetooth", ".", "lookup_name", "(", "mac", ",", "timeout", "=", "5", ")" ]
[ 104, 0 ]
[ 107, 48 ]
python
en
['en', 'en', 'en']
True
async_setup_scanner
( hass: HomeAssistantType, config: dict, async_see, discovery_info=None )
Set up the Bluetooth Scanner.
Set up the Bluetooth Scanner.
async def async_setup_scanner( hass: HomeAssistantType, config: dict, async_see, discovery_info=None ): """Set up the Bluetooth Scanner.""" device_id: int = config[CONF_DEVICE_ID] interval = config.get(CONF_SCAN_INTERVAL, SCAN_INTERVAL) request_rssi = config.get(CONF_REQUEST_RSSI, False) update_...
[ "async", "def", "async_setup_scanner", "(", "hass", ":", "HomeAssistantType", ",", "config", ":", "dict", ",", "async_see", ",", "discovery_info", "=", "None", ")", ":", "device_id", ":", "int", "=", "config", "[", "CONF_DEVICE_ID", "]", "interval", "=", "co...
[ 110, 0 ]
[ 188, 15 ]
python
en
['en', 'en', 'en']
True
test_preserve_new_tracked_device_name
(hass, mock_device_tracker_conf)
Test preserving tracked device name across new seens.
Test preserving tracked device name across new seens.
async def test_preserve_new_tracked_device_name(hass, mock_device_tracker_conf): """Test preserving tracked device name across new seens.""" address = "DE:AD:BE:EF:13:37" name = "Mock device name" entity_id = f"{DOMAIN}.{slugify(name)}" with patch( "homeassistant.components." "blue...
[ "async", "def", "test_preserve_new_tracked_device_name", "(", "hass", ",", "mock_device_tracker_conf", ")", ":", "address", "=", "\"DE:AD:BE:EF:13:37\"", "name", "=", "\"Mock device name\"", "entity_id", "=", "f\"{DOMAIN}.{slugify(name)}\"", "with", "patch", "(", "\"homeass...
[ 18, 0 ]
[ 55, 29 ]
python
en
['en', 'en', 'en']
True
Speech2TextProcessor.save_pretrained
(self, save_directory)
Save a Speech2Text feature extractor object and Speech2Text tokenizer object to the directory ``save_directory``, so that it can be re-loaded using the :func:`~transformers.Speech2TextProcessor.from_pretrained` class method. .. note:: This class method is simply calling :m...
Save a Speech2Text feature extractor object and Speech2Text tokenizer object to the directory ``save_directory``, so that it can be re-loaded using the :func:`~transformers.Speech2TextProcessor.from_pretrained` class method.
def save_pretrained(self, save_directory): """ Save a Speech2Text feature extractor object and Speech2Text tokenizer object to the directory ``save_directory``, so that it can be re-loaded using the :func:`~transformers.Speech2TextProcessor.from_pretrained` class method. .. note...
[ "def", "save_pretrained", "(", "self", ",", "save_directory", ")", ":", "self", ".", "feature_extractor", ".", "save_pretrained", "(", "save_directory", ")", "self", ".", "tokenizer", ".", "save_pretrained", "(", "save_directory", ")" ]
[ 55, 4 ]
[ 74, 54 ]
python
en
['en', 'error', 'th']
False
Speech2TextProcessor.from_pretrained
(cls, pretrained_model_name_or_path, **kwargs)
r""" Instantiate a :class:`~transformers.Speech2TextProcessor` from a pretrained Speech2Text processor. .. note:: This class method is simply calling Speech2TextFeatureExtractor's :meth:`~transformers.PreTrainedFeatureExtractor.from_pretrained` and Speech2TextTokenizer's ...
r""" Instantiate a :class:`~transformers.Speech2TextProcessor` from a pretrained Speech2Text processor.
def from_pretrained(cls, pretrained_model_name_or_path, **kwargs): r""" Instantiate a :class:`~transformers.Speech2TextProcessor` from a pretrained Speech2Text processor. .. note:: This class method is simply calling Speech2TextFeatureExtractor's :meth:`~transformers.Pr...
[ "def", "from_pretrained", "(", "cls", ",", "pretrained_model_name_or_path", ",", "*", "*", "kwargs", ")", ":", "feature_extractor", "=", "Speech2TextFeatureExtractor", ".", "from_pretrained", "(", "pretrained_model_name_or_path", ",", "*", "*", "kwargs", ")", "tokeniz...
[ 77, 4 ]
[ 107, 76 ]
python
cy
['en', 'cy', 'hi']
False
Speech2TextProcessor.__call__
(self, *args, **kwargs)
When used in normal mode, this method forwards all its arguments to Speech2TextFeatureExtractor's :meth:`~transformers.Speech2TextFeatureExtractor.__call__` and returns its output. If used in the context :meth:`~transformers.Speech2TextProcessor.as_target_processor` this method forwards all its...
When used in normal mode, this method forwards all its arguments to Speech2TextFeatureExtractor's :meth:`~transformers.Speech2TextFeatureExtractor.__call__` and returns its output. If used in the context :meth:`~transformers.Speech2TextProcessor.as_target_processor` this method forwards all its...
def __call__(self, *args, **kwargs): """ When used in normal mode, this method forwards all its arguments to Speech2TextFeatureExtractor's :meth:`~transformers.Speech2TextFeatureExtractor.__call__` and returns its output. If used in the context :meth:`~transformers.Speech2TextProcessor.a...
[ "def", "__call__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "current_processor", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
[ 109, 4 ]
[ 117, 54 ]
python
en
['en', 'error', 'th']
False
Speech2TextProcessor.batch_decode
(self, *args, **kwargs)
This method forwards all its arguments to Speech2TextTokenizer's :meth:`~transformers.PreTrainedTokenizer.batch_decode`. Please refer to the docstring of this method for more information.
This method forwards all its arguments to Speech2TextTokenizer's :meth:`~transformers.PreTrainedTokenizer.batch_decode`. Please refer to the docstring of this method for more information.
def batch_decode(self, *args, **kwargs): """ This method forwards all its arguments to Speech2TextTokenizer's :meth:`~transformers.PreTrainedTokenizer.batch_decode`. Please refer to the docstring of this method for more information. """ return self.tokenizer.batch_decode(...
[ "def", "batch_decode", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "tokenizer", ".", "batch_decode", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
[ 119, 4 ]
[ 125, 59 ]
python
en
['en', 'error', 'th']
False
Speech2TextProcessor.decode
(self, *args, **kwargs)
This method forwards all its arguments to Speech2TextTokenizer's :meth:`~transformers.PreTrainedTokenizer.decode`. Please refer to the docstring of this method for more information.
This method forwards all its arguments to Speech2TextTokenizer's :meth:`~transformers.PreTrainedTokenizer.decode`. Please refer to the docstring of this method for more information.
def decode(self, *args, **kwargs): """ This method forwards all its arguments to Speech2TextTokenizer's :meth:`~transformers.PreTrainedTokenizer.decode`. Please refer to the docstring of this method for more information. """ return self.tokenizer.decode(*args, **kwargs)
[ "def", "decode", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "tokenizer", ".", "decode", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
[ 127, 4 ]
[ 133, 53 ]
python
en
['en', 'error', 'th']
False
Speech2TextProcessor.as_target_processor
(self)
Temporarily sets the tokenizer for processing the input. Useful for encoding the labels when fine-tuning Speech2Text.
Temporarily sets the tokenizer for processing the input. Useful for encoding the labels when fine-tuning Speech2Text.
def as_target_processor(self): """ Temporarily sets the tokenizer for processing the input. Useful for encoding the labels when fine-tuning Speech2Text. """ self.current_processor = self.tokenizer yield self.current_processor = self.feature_extractor
[ "def", "as_target_processor", "(", "self", ")", ":", "self", ".", "current_processor", "=", "self", ".", "tokenizer", "yield", "self", ".", "current_processor", "=", "self", ".", "feature_extractor" ]
[ 136, 4 ]
[ 143, 55 ]
python
en
['en', 'error', 'th']
False
_old_conf_migrator
(old_config: Dict[str, Any])
Migrate the pre-0.73 config format to the latest version.
Migrate the pre-0.73 config format to the latest version.
async def _old_conf_migrator(old_config: Dict[str, Any]) -> Dict[str, Any]: """Migrate the pre-0.73 config format to the latest version.""" return {"entries": old_config}
[ "async", "def", "_old_conf_migrator", "(", "old_config", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "return", "{", "\"entries\"", ":", "old_config", "}" ]
[ 857, 0 ]
[ 859, 34 ]
python
en
['en', 'en', 'en']
True
support_entry_unload
(hass: HomeAssistant, domain: str)
Test if a domain supports entry unloading.
Test if a domain supports entry unloading.
async def support_entry_unload(hass: HomeAssistant, domain: str) -> bool: """Test if a domain supports entry unloading.""" integration = await loader.async_get_integration(hass, domain) component = integration.get_component() return hasattr(component, "async_unload_entry")
[ "async", "def", "support_entry_unload", "(", "hass", ":", "HomeAssistant", ",", "domain", ":", "str", ")", "->", "bool", ":", "integration", "=", "await", "loader", ".", "async_get_integration", "(", "hass", ",", "domain", ")", "component", "=", "integration",...
[ 1191, 0 ]
[ 1195, 51 ]
python
en
['en', 'en', 'en']
True
ConfigEntry.__init__
( self, version: int, domain: str, title: str, data: dict, source: str, connection_class: str, system_options: dict, options: Optional[dict] = None, unique_id: Optional[str] = None, entry_id: Optional[str] = None, state: str...
Initialize a config entry.
Initialize a config entry.
def __init__( self, version: int, domain: str, title: str, data: dict, source: str, connection_class: str, system_options: dict, options: Optional[dict] = None, unique_id: Optional[str] = None, entry_id: Optional[str] = None, ...
[ "def", "__init__", "(", "self", ",", "version", ":", "int", ",", "domain", ":", "str", ",", "title", ":", "str", ",", "data", ":", "dict", ",", "source", ":", "str", ",", "connection_class", ":", "str", ",", "system_options", ":", "dict", ",", "optio...
[ 130, 4 ]
[ 185, 74 ]
python
en
['en', 'en', 'en']
True
ConfigEntry.async_setup
( self, hass: HomeAssistant, *, integration: Optional[loader.Integration] = None, tries: int = 0, )
Set up an entry.
Set up an entry.
async def async_setup( self, hass: HomeAssistant, *, integration: Optional[loader.Integration] = None, tries: int = 0, ) -> None: """Set up an entry.""" if self.source == SOURCE_IGNORE: return if integration is None: integratio...
[ "async", "def", "async_setup", "(", "self", ",", "hass", ":", "HomeAssistant", ",", "*", ",", "integration", ":", "Optional", "[", "loader", ".", "Integration", "]", "=", "None", ",", "tries", ":", "int", "=", "0", ",", ")", "->", "None", ":", "if", ...
[ 187, 4 ]
[ 274, 48 ]
python
en
['en', 'en', 'en']
True
ConfigEntry.async_unload
( self, hass: HomeAssistant, *, integration: Optional[loader.Integration] = None )
Unload an entry. Returns if unload is possible and was successful.
Unload an entry.
async def async_unload( self, hass: HomeAssistant, *, integration: Optional[loader.Integration] = None ) -> bool: """Unload an entry. Returns if unload is possible and was successful. """ if self.source == SOURCE_IGNORE: self.state = ENTRY_STATE_NOT_LOADED ...
[ "async", "def", "async_unload", "(", "self", ",", "hass", ":", "HomeAssistant", ",", "*", ",", "integration", ":", "Optional", "[", "loader", ".", "Integration", "]", "=", "None", ")", "->", "bool", ":", "if", "self", ".", "source", "==", "SOURCE_IGNORE"...
[ 276, 4 ]
[ 335, 24 ]
python
en
['en', 'en', 'en']
True
ConfigEntry.async_remove
(self, hass: HomeAssistant)
Invoke remove callback on component.
Invoke remove callback on component.
async def async_remove(self, hass: HomeAssistant) -> None: """Invoke remove callback on component.""" if self.source == SOURCE_IGNORE: return try: integration = await loader.async_get_integration(hass, self.domain) except loader.IntegrationNotFound: #...
[ "async", "def", "async_remove", "(", "self", ",", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "if", "self", ".", "source", "==", "SOURCE_IGNORE", ":", "return", "try", ":", "integration", "=", "await", "loader", ".", "async_get_integration", "(", ...
[ 337, 4 ]
[ 361, 13 ]
python
en
['en', 'hr', 'en']
True
ConfigEntry.async_migrate
(self, hass: HomeAssistant)
Migrate an entry. Returns True if config entry is up-to-date or has been migrated.
Migrate an entry.
async def async_migrate(self, hass: HomeAssistant) -> bool: """Migrate an entry. Returns True if config entry is up-to-date or has been migrated. """ handler = HANDLERS.get(self.domain) if handler is None: _LOGGER.error( "Flow handler not found for en...
[ "async", "def", "async_migrate", "(", "self", ",", "hass", ":", "HomeAssistant", ")", "->", "bool", ":", "handler", "=", "HANDLERS", ".", "get", "(", "self", ".", "domain", ")", "if", "handler", "is", "None", ":", "_LOGGER", ".", "error", "(", "\"Flow ...
[ 363, 4 ]
[ 407, 24 ]
python
en
['br', 'en', 'en']
True
ConfigEntry.add_update_listener
(self, listener: UpdateListenerType)
Listen for when entry is updated. Returns function to unlisten.
Listen for when entry is updated.
def add_update_listener(self, listener: UpdateListenerType) -> CALLBACK_TYPE: """Listen for when entry is updated. Returns function to unlisten. """ weak_listener = weakref.ref(listener) self.update_listeners.append(weak_listener) return lambda: self.update_listeners.re...
[ "def", "add_update_listener", "(", "self", ",", "listener", ":", "UpdateListenerType", ")", "->", "CALLBACK_TYPE", ":", "weak_listener", "=", "weakref", ".", "ref", "(", "listener", ")", "self", ".", "update_listeners", ".", "append", "(", "weak_listener", ")", ...
[ 409, 4 ]
[ 417, 66 ]
python
en
['en', 'en', 'en']
True
ConfigEntry.as_dict
(self)
Return dictionary version of this entry.
Return dictionary version of this entry.
def as_dict(self) -> Dict[str, Any]: """Return dictionary version of this entry.""" return { "entry_id": self.entry_id, "version": self.version, "domain": self.domain, "title": self.title, "data": dict(self.data), "options": dict(se...
[ "def", "as_dict", "(", "self", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "return", "{", "\"entry_id\"", ":", "self", ".", "entry_id", ",", "\"version\"", ":", "self", ".", "version", ",", "\"domain\"", ":", "self", ".", "domain", ",", "\"t...
[ 419, 4 ]
[ 432, 9 ]
python
en
['en', 'en', 'en']
True
ConfigEntriesFlowManager.__init__
( self, hass: HomeAssistant, config_entries: "ConfigEntries", hass_config: dict )
Initialize the config entry flow manager.
Initialize the config entry flow manager.
def __init__( self, hass: HomeAssistant, config_entries: "ConfigEntries", hass_config: dict ): """Initialize the config entry flow manager.""" super().__init__(hass) self.config_entries = config_entries self._hass_config = hass_config
[ "def", "__init__", "(", "self", ",", "hass", ":", "HomeAssistant", ",", "config_entries", ":", "\"ConfigEntries\"", ",", "hass_config", ":", "dict", ")", ":", "super", "(", ")", ".", "__init__", "(", "hass", ")", "self", ".", "config_entries", "=", "config...
[ 438, 4 ]
[ 444, 39 ]
python
en
['en', 'en', 'en']
True
ConfigEntriesFlowManager.async_finish_flow
( self, flow: data_entry_flow.FlowHandler, result: Dict[str, Any] )
Finish a config flow and add an entry.
Finish a config flow and add an entry.
async def async_finish_flow( self, flow: data_entry_flow.FlowHandler, result: Dict[str, Any] ) -> Dict[str, Any]: """Finish a config flow and add an entry.""" flow = cast(ConfigFlow, flow) # Remove notification if no other discovery config entries in progress if not any( ...
[ "async", "def", "async_finish_flow", "(", "self", ",", "flow", ":", "data_entry_flow", ".", "FlowHandler", ",", "result", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "flow", "=", "cast", "(", "Config...
[ 446, 4 ]
[ 515, 21 ]
python
en
['en', 'en', 'en']
True
ConfigEntriesFlowManager.async_create_flow
( self, handler_key: Any, *, context: Optional[Dict] = None, data: Any = None )
Create a flow for specified handler. Handler key is the domain of the component that we want to set up.
Create a flow for specified handler.
async def async_create_flow( self, handler_key: Any, *, context: Optional[Dict] = None, data: Any = None ) -> "ConfigFlow": """Create a flow for specified handler. Handler key is the domain of the component that we want to set up. """ try: integration = await loa...
[ "async", "def", "async_create_flow", "(", "self", ",", "handler_key", ":", "Any", ",", "*", ",", "context", ":", "Optional", "[", "Dict", "]", "=", "None", ",", "data", ":", "Any", "=", "None", ")", "->", "\"ConfigFlow\"", ":", "try", ":", "integration...
[ 517, 4 ]
[ 553, 19 ]
python
en
['en', 'en', 'en']
True
ConfigEntriesFlowManager.async_post_init
( self, flow: data_entry_flow.FlowHandler, result: dict )
After a flow is initialised trigger new flow notifications.
After a flow is initialised trigger new flow notifications.
async def async_post_init( self, flow: data_entry_flow.FlowHandler, result: dict ) -> None: """After a flow is initialised trigger new flow notifications.""" source = flow.context["source"] # Create notification. if source in DISCOVERY_SOURCES: self.hass.bus.asyn...
[ "async", "def", "async_post_init", "(", "self", ",", "flow", ":", "data_entry_flow", ".", "FlowHandler", ",", "result", ":", "dict", ")", "->", "None", ":", "source", "=", "flow", ".", "context", "[", "\"source\"", "]", "# Create notification.", "if", "sourc...
[ 555, 4 ]
[ 580, 13 ]
python
en
['en', 'en', 'en']
True
ConfigEntries.__init__
(self, hass: HomeAssistant, hass_config: dict)
Initialize the entry manager.
Initialize the entry manager.
def __init__(self, hass: HomeAssistant, hass_config: dict) -> None: """Initialize the entry manager.""" self.hass = hass self.flow = ConfigEntriesFlowManager(hass, self, hass_config) self.options = OptionsFlowManager(hass) self._hass_config = hass_config self._entries: Li...
[ "def", "__init__", "(", "self", ",", "hass", ":", "HomeAssistant", ",", "hass_config", ":", "dict", ")", "->", "None", ":", "self", ".", "hass", "=", "hass", "self", ".", "flow", "=", "ConfigEntriesFlowManager", "(", "hass", ",", "self", ",", "hass_confi...
[ 589, 4 ]
[ 597, 57 ]
python
en
['en', 'en', 'en']
True
ConfigEntries.async_domains
(self)
Return domains for which we have entries.
Return domains for which we have entries.
def async_domains(self) -> List[str]: """Return domains for which we have entries.""" seen: Set[str] = set() result = [] for entry in self._entries: if entry.domain not in seen: seen.add(entry.domain) result.append(entry.domain) retur...
[ "def", "async_domains", "(", "self", ")", "->", "List", "[", "str", "]", ":", "seen", ":", "Set", "[", "str", "]", "=", "set", "(", ")", "result", "=", "[", "]", "for", "entry", "in", "self", ".", "_entries", ":", "if", "entry", ".", "domain", ...
[ 600, 4 ]
[ 610, 21 ]
python
en
['en', 'en', 'en']
True
ConfigEntries.async_get_entry
(self, entry_id: str)
Return entry with matching entry_id.
Return entry with matching entry_id.
def async_get_entry(self, entry_id: str) -> Optional[ConfigEntry]: """Return entry with matching entry_id.""" for entry in self._entries: if entry_id == entry.entry_id: return entry return None
[ "def", "async_get_entry", "(", "self", ",", "entry_id", ":", "str", ")", "->", "Optional", "[", "ConfigEntry", "]", ":", "for", "entry", "in", "self", ".", "_entries", ":", "if", "entry_id", "==", "entry", ".", "entry_id", ":", "return", "entry", "return...
[ 613, 4 ]
[ 618, 19 ]
python
en
['en', 'en', 'en']
True
ConfigEntries.async_entries
(self, domain: Optional[str] = None)
Return all entries or entries for a specific domain.
Return all entries or entries for a specific domain.
def async_entries(self, domain: Optional[str] = None) -> List[ConfigEntry]: """Return all entries or entries for a specific domain.""" if domain is None: return list(self._entries) return [entry for entry in self._entries if entry.domain == domain]
[ "def", "async_entries", "(", "self", ",", "domain", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "List", "[", "ConfigEntry", "]", ":", "if", "domain", "is", "None", ":", "return", "list", "(", "self", ".", "_entries", ")", "return", "[",...
[ 621, 4 ]
[ 625, 75 ]
python
en
['en', 'en', 'en']
True
ConfigEntries.async_add
(self, entry: ConfigEntry)
Add and setup an entry.
Add and setup an entry.
async def async_add(self, entry: ConfigEntry) -> None: """Add and setup an entry.""" self._entries.append(entry) await self.async_setup(entry.entry_id) self._async_schedule_save()
[ "async", "def", "async_add", "(", "self", ",", "entry", ":", "ConfigEntry", ")", "->", "None", ":", "self", ".", "_entries", ".", "append", "(", "entry", ")", "await", "self", ".", "async_setup", "(", "entry", ".", "entry_id", ")", "self", ".", "_async...
[ 627, 4 ]
[ 631, 35 ]
python
en
['en', 'en', 'en']
True
ConfigEntries.async_remove
(self, entry_id: str)
Remove an entry.
Remove an entry.
async def async_remove(self, entry_id: str) -> Dict[str, Any]: """Remove an entry.""" entry = self.async_get_entry(entry_id) if entry is None: raise UnknownEntry if entry.state in UNRECOVERABLE_STATES: unload_success = entry.state != ENTRY_STATE_FAILED_UNLOAD ...
[ "async", "def", "async_remove", "(", "self", ",", "entry_id", ":", "str", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "entry", "=", "self", ".", "async_get_entry", "(", "entry_id", ")", "if", "entry", "is", "None", ":", "raise", "UnknownEntry"...
[ 633, 4 ]
[ 671, 54 ]
python
en
['br', 'en', 'en']
True
ConfigEntries.async_initialize
(self)
Initialize config entry config.
Initialize config entry config.
async def async_initialize(self) -> None: """Initialize config entry config.""" # Migrating for config entries stored before 0.73 config = await self.hass.helpers.storage.async_migrator( self.hass.config.path(PATH_CONFIG), self._store, old_conf_migrate_func=_o...
[ "async", "def", "async_initialize", "(", "self", ")", "->", "None", ":", "# Migrating for config entries stored before 0.73", "config", "=", "await", "self", ".", "hass", ".", "helpers", ".", "storage", ".", "async_migrator", "(", "self", ".", "hass", ".", "conf...
[ 673, 4 ]
[ 704, 9 ]
python
en
['en', 'en', 'en']
True
ConfigEntries.async_setup
(self, entry_id: str)
Set up a config entry. Return True if entry has been successfully loaded.
Set up a config entry.
async def async_setup(self, entry_id: str) -> bool: """Set up a config entry. Return True if entry has been successfully loaded. """ entry = self.async_get_entry(entry_id) if entry is None: raise UnknownEntry if entry.state != ENTRY_STATE_NOT_LOADED: ...
[ "async", "def", "async_setup", "(", "self", ",", "entry_id", ":", "str", ")", "->", "bool", ":", "entry", "=", "self", ".", "async_get_entry", "(", "entry_id", ")", "if", "entry", "is", "None", ":", "raise", "UnknownEntry", "if", "entry", ".", "state", ...
[ 706, 4 ]
[ 731, 48 ]
python
en
['en', 'en', 'en']
True