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
async_unload_entry
(hass: HomeAssistant, entry: ConfigEntry)
Unload a config entry.
Unload a config entry.
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Unload a config entry.""" if DATA_SDM not in entry.data: # Legacy API return True _LOGGER.debug("Stopping nest subscriber") subscriber = hass.data[DOMAIN][DATA_SUBSCRIBER] subscriber.stop_async() un...
[ "async", "def", "async_unload_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", "->", "bool", ":", "if", "DATA_SDM", "not", "in", "entry", ".", "data", ":", "# Legacy API", "return", "True", "_LOGGER", ".", "debug", "(", "\"...
[ 197, 0 ]
[ 210, 20 ]
python
en
['en', 'es', 'en']
True
SignalUpdateCallback.__init__
(self, hass: HomeAssistant)
Initialize EventCallback.
Initialize EventCallback.
def __init__(self, hass: HomeAssistant) -> None: """Initialize EventCallback.""" self._hass = hass
[ "def", "__init__", "(", "self", ",", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "self", ".", "_hass", "=", "hass" ]
[ 108, 4 ]
[ 110, 25 ]
python
en
['en', 'zu', 'en']
False
SignalUpdateCallback.async_handle_event
(self, event_message: EventMessage)
Process an incoming EventMessage.
Process an incoming EventMessage.
async def async_handle_event(self, event_message: EventMessage) -> None: """Process an incoming EventMessage.""" if not event_message.resource_update_name: return device_id = event_message.resource_update_name events = event_message.resource_update_events if not event...
[ "async", "def", "async_handle_event", "(", "self", ",", "event_message", ":", "EventMessage", ")", "->", "None", ":", "if", "not", "event_message", ".", "resource_update_name", ":", "return", "device_id", "=", "event_message", ".", "resource_update_name", "events", ...
[ 112, 4 ]
[ 134, 58 ]
python
en
['en', 'en', 'en']
True
show_actual_vendor_versions
(vendor_txt_versions)
Log the actual version and print extra info if there is a conflict or if the actual version could not be imported.
Log the actual version and print extra info if there is a conflict or if the actual version could not be imported.
def show_actual_vendor_versions(vendor_txt_versions): # type: (Dict[str, str]) -> None """Log the actual version and print extra info if there is a conflict or if the actual version could not be imported. """ for module_name, expected_version in vendor_txt_versions.items(): extra_message = '...
[ "def", "show_actual_vendor_versions", "(", "vendor_txt_versions", ")", ":", "# type: (Dict[str, str]) -> None", "for", "module_name", ",", "expected_version", "in", "vendor_txt_versions", ".", "items", "(", ")", ":", "extra_message", "=", "''", "actual_version", "=", "g...
[ 102, 0 ]
[ 117, 75 ]
python
en
['en', 'en', 'en']
True
validate_http
(hass: core.HomeAssistant, data)
Validate the user input allows us to connect over HTTP.
Validate the user input allows us to connect over HTTP.
async def validate_http(hass: core.HomeAssistant, data): """Validate the user input allows us to connect over HTTP.""" host = data[CONF_HOST] port = data[CONF_PORT] username = data.get(CONF_USERNAME) password = data.get(CONF_PASSWORD) ssl = data.get(CONF_SSL) session = async_get_clientsessi...
[ "async", "def", "validate_http", "(", "hass", ":", "core", ".", "HomeAssistant", ",", "data", ")", ":", "host", "=", "data", "[", "CONF_HOST", "]", "port", "=", "data", "[", "CONF_PORT", "]", "username", "=", "data", ".", "get", "(", "CONF_USERNAME", "...
[ 34, 0 ]
[ 54, 36 ]
python
en
['en', 'en', 'en']
True
validate_ws
(hass: core.HomeAssistant, data)
Validate the user input allows us to connect over WS.
Validate the user input allows us to connect over WS.
async def validate_ws(hass: core.HomeAssistant, data): """Validate the user input allows us to connect over WS.""" ws_port = data.get(CONF_WS_PORT) if not ws_port: return host = data[CONF_HOST] port = data[CONF_PORT] username = data.get(CONF_USERNAME) password = data.get(CONF_PASSWO...
[ "async", "def", "validate_ws", "(", "hass", ":", "core", ".", "HomeAssistant", ",", "data", ")", ":", "ws_port", "=", "data", ".", "get", "(", "CONF_WS_PORT", ")", "if", "not", "ws_port", ":", "return", "host", "=", "data", "[", "CONF_HOST", "]", "port...
[ 57, 0 ]
[ 83, 40 ]
python
en
['en', 'en', 'en']
True
KodiConfigFlow.__init__
(self)
Initialize flow.
Initialize flow.
def __init__(self): """Initialize flow.""" self._host: str | None = None self._port: int | None = DEFAULT_PORT self._ws_port: int | None = DEFAULT_WS_PORT self._name: str | None = None self._username: str | None = None self._password: str | None = None sel...
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "_host", ":", "str", "|", "None", "=", "None", "self", ".", "_port", ":", "int", "|", "None", "=", "DEFAULT_PORT", "self", ".", "_ws_port", ":", "int", "|", "None", "=", "DEFAULT_WS_PORT", "self"...
[ 91, 4 ]
[ 100, 47 ]
python
en
['en', 'pl', 'en']
False
KodiConfigFlow.async_step_zeroconf
(self, discovery_info: DiscoveryInfoType)
Handle zeroconf discovery.
Handle zeroconf discovery.
async def async_step_zeroconf(self, discovery_info: DiscoveryInfoType): """Handle zeroconf discovery.""" self._host = discovery_info["host"] self._port = int(discovery_info["port"]) self._name = discovery_info["hostname"][: -len(".local.")] uuid = discovery_info["properties"].get...
[ "async", "def", "async_step_zeroconf", "(", "self", ",", "discovery_info", ":", "DiscoveryInfoType", ")", ":", "self", ".", "_host", "=", "discovery_info", "[", "\"host\"", "]", "self", ".", "_port", "=", "int", "(", "discovery_info", "[", "\"port\"", "]", "...
[ 102, 4 ]
[ 137, 56 ]
python
de
['de', 'sr', 'en']
False
KodiConfigFlow.async_step_discovery_confirm
(self, user_input=None)
Handle user-confirmation of discovered node.
Handle user-confirmation of discovered node.
async def async_step_discovery_confirm(self, user_input=None): """Handle user-confirmation of discovered node.""" if user_input is None: return self.async_show_form( step_id="discovery_confirm", description_placeholders={"name": self._name}, ) ...
[ "async", "def", "async_step_discovery_confirm", "(", "self", ",", "user_input", "=", "None", ")", ":", "if", "user_input", "is", "None", ":", "return", "self", ".", "async_show_form", "(", "step_id", "=", "\"discovery_confirm\"", ",", "description_placeholders", "...
[ 139, 4 ]
[ 147, 35 ]
python
en
['en', 'en', 'en']
True
KodiConfigFlow.async_step_user
(self, user_input=None)
Handle the initial step.
Handle the initial step.
async def async_step_user(self, user_input=None): """Handle the initial step.""" errors = {} if user_input is not None: self._host = user_input[CONF_HOST] self._port = user_input[CONF_PORT] self._ssl = user_input[CONF_SSL] try: aw...
[ "async", "def", "async_step_user", "(", "self", ",", "user_input", "=", "None", ")", ":", "errors", "=", "{", "}", "if", "user_input", "is", "not", "None", ":", "self", ".", "_host", "=", "user_input", "[", "CONF_HOST", "]", "self", ".", "_port", "=", ...
[ 149, 4 ]
[ 173, 43 ]
python
en
['en', 'en', 'en']
True
KodiConfigFlow.async_step_credentials
(self, user_input=None)
Handle username and password input.
Handle username and password input.
async def async_step_credentials(self, user_input=None): """Handle username and password input.""" errors = {} if user_input is not None: self._username = user_input.get(CONF_USERNAME) self._password = user_input.get(CONF_PASSWORD) try: await...
[ "async", "def", "async_step_credentials", "(", "self", ",", "user_input", "=", "None", ")", ":", "errors", "=", "{", "}", "if", "user_input", "is", "not", "None", ":", "self", ".", "_username", "=", "user_input", ".", "get", "(", "CONF_USERNAME", ")", "s...
[ 175, 4 ]
[ 198, 50 ]
python
en
['en', 'en', 'en']
True
KodiConfigFlow.async_step_ws_port
(self, user_input=None)
Handle websocket port of discovered node.
Handle websocket port of discovered node.
async def async_step_ws_port(self, user_input=None): """Handle websocket port of discovered node.""" errors = {} if user_input is not None: self._ws_port = user_input.get(CONF_WS_PORT) # optional ints return 0 rather than None when empty if self._ws_port == ...
[ "async", "def", "async_step_ws_port", "(", "self", ",", "user_input", "=", "None", ")", ":", "errors", "=", "{", "}", "if", "user_input", "is", "not", "None", ":", "self", ".", "_ws_port", "=", "user_input", ".", "get", "(", "CONF_WS_PORT", ")", "# optio...
[ 200, 4 ]
[ 221, 46 ]
python
en
['en', 'da', 'en']
True
KodiConfigFlow.async_step_import
(self, data)
Handle import from YAML.
Handle import from YAML.
async def async_step_import(self, data): """Handle import from YAML.""" reason = None try: await validate_http(self.hass, data) await validate_ws(self.hass, data) except InvalidAuth: _LOGGER.exception("Invalid Kodi credentials") reason = "i...
[ "async", "def", "async_step_import", "(", "self", ",", "data", ")", ":", "reason", "=", "None", "try", ":", "await", "validate_http", "(", "self", ".", "hass", ",", "data", ")", "await", "validate_ws", "(", "self", ".", "hass", ",", "data", ")", "excep...
[ 223, 4 ]
[ 241, 46 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the HomeMatic switch platform.
Set up the HomeMatic switch platform.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the HomeMatic switch platform.""" if discovery_info is None: return devices = [] for conf in discovery_info[ATTR_DISCOVER_DEVICES]: new_device = HMSwitch(conf) devices.append(new_device) add_enti...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "if", "discovery_info", "is", "None", ":", "return", "devices", "=", "[", "]", "for", "conf", "in", "discovery_info", "[", "ATTR_DISCOVER_...
[ 7, 0 ]
[ 17, 31 ]
python
en
['en', 'en', 'en']
True
HMSwitch.is_on
(self)
Return True if switch is on.
Return True if switch is on.
def is_on(self): """Return True if switch is on.""" try: return self._hm_get_state() > 0 except TypeError: return False
[ "def", "is_on", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_hm_get_state", "(", ")", ">", "0", "except", "TypeError", ":", "return", "False" ]
[ 24, 4 ]
[ 29, 24 ]
python
en
['en', 'fy', 'en']
True
HMSwitch.today_energy_kwh
(self)
Return the current power usage in kWh.
Return the current power usage in kWh.
def today_energy_kwh(self): """Return the current power usage in kWh.""" if "ENERGY_COUNTER" in self._data: try: return self._data["ENERGY_COUNTER"] / 1000 except ZeroDivisionError: return 0 return None
[ "def", "today_energy_kwh", "(", "self", ")", ":", "if", "\"ENERGY_COUNTER\"", "in", "self", ".", "_data", ":", "try", ":", "return", "self", ".", "_data", "[", "\"ENERGY_COUNTER\"", "]", "/", "1000", "except", "ZeroDivisionError", ":", "return", "0", "return...
[ 32, 4 ]
[ 40, 19 ]
python
en
['en', 'en', 'en']
True
HMSwitch.turn_on
(self, **kwargs)
Turn the switch on.
Turn the switch on.
def turn_on(self, **kwargs): """Turn the switch on.""" self._hmdevice.on(self._channel)
[ "def", "turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_hmdevice", ".", "on", "(", "self", ".", "_channel", ")" ]
[ 42, 4 ]
[ 44, 40 ]
python
en
['en', 'en', 'en']
True
HMSwitch.turn_off
(self, **kwargs)
Turn the switch off.
Turn the switch off.
def turn_off(self, **kwargs): """Turn the switch off.""" self._hmdevice.off(self._channel)
[ "def", "turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_hmdevice", ".", "off", "(", "self", ".", "_channel", ")" ]
[ 46, 4 ]
[ 48, 41 ]
python
en
['en', 'en', 'en']
True
HMSwitch._init_data_struct
(self)
Generate the data dictionary (self._data) from metadata.
Generate the data dictionary (self._data) from metadata.
def _init_data_struct(self): """Generate the data dictionary (self._data) from metadata.""" self._state = "STATE" self._data.update({self._state: None}) # Need sensor values for SwitchPowermeter for node in self._hmdevice.SENSORNODE: self._data.update({node: None})
[ "def", "_init_data_struct", "(", "self", ")", ":", "self", ".", "_state", "=", "\"STATE\"", "self", ".", "_data", ".", "update", "(", "{", "self", ".", "_state", ":", "None", "}", ")", "# Need sensor values for SwitchPowermeter", "for", "node", "in", "self",...
[ 50, 4 ]
[ 57, 43 ]
python
en
['en', 'en', 'en']
True
GiosFlowHandler.async_step_user
( self, user_input: dict[str, Any] | None = None )
Handle a flow initialized by the user.
Handle a flow initialized by the user.
async def async_step_user( self, user_input: dict[str, Any] | None = None ) -> FlowResult: """Handle a flow initialized by the user.""" errors = {} if user_input is not None: try: await self.async_set_unique_id( str(user_input[CONF_STA...
[ "async", "def", "async_step_user", "(", "self", ",", "user_input", ":", "dict", "[", "str", ",", "Any", "]", "|", "None", "=", "None", ")", "->", "FlowResult", ":", "errors", "=", "{", "}", "if", "user_input", "is", "not", "None", ":", "try", ":", ...
[ 24, 4 ]
[ 66, 9 ]
python
en
['en', 'en', 'en']
True
bdist_wininst.reinitialize_command
(self, command, reinit_subcommands=0)
Supplement reinitialize_command to work around http://bugs.python.org/issue20819
Supplement reinitialize_command to work around http://bugs.python.org/issue20819
def reinitialize_command(self, command, reinit_subcommands=0): """ Supplement reinitialize_command to work around http://bugs.python.org/issue20819 """ cmd = self.distribution.reinitialize_command( command, reinit_subcommands) if command in ('install', 'instal...
[ "def", "reinitialize_command", "(", "self", ",", "command", ",", "reinit_subcommands", "=", "0", ")", ":", "cmd", "=", "self", ".", "distribution", ".", "reinitialize_command", "(", "command", ",", "reinit_subcommands", ")", "if", "command", "in", "(", "'insta...
[ 7, 4 ]
[ 16, 18 ]
python
en
['en', 'error', 'th']
False
Category.__init__
(self, id=None, name=None)
Category - a model defined in OpenAPI :param id: The id of this Category. # noqa: E501 :type id: long :param name: The name of this Category. # noqa: E501 :type name: str
Category - a model defined in OpenAPI
def __init__(self, id=None, name=None): # noqa: E501 """Category - a model defined in OpenAPI :param id: The id of this Category. # noqa: E501 :type id: long :param name: The name of this Category. # noqa: E501 :type name: str """ self.openapi_types = { ...
[ "def", "__init__", "(", "self", ",", "id", "=", "None", ",", "name", "=", "None", ")", ":", "# noqa: E501", "self", ".", "openapi_types", "=", "{", "'id'", ":", "long", ",", "'name'", ":", "str", "}", "self", ".", "attribute_map", "=", "{", "'id'", ...
[ 19, 4 ]
[ 38, 25 ]
python
en
['en', 'en', 'en']
True
Category.from_dict
(cls, dikt)
Returns the dict as a model :param dikt: A dict. :type: dict :return: The Category of this Category. # noqa: E501 :rtype: Category
Returns the dict as a model
def from_dict(cls, dikt): """Returns the dict as a model :param dikt: A dict. :type: dict :return: The Category of this Category. # noqa: E501 :rtype: Category """ return util.deserialize_model(dikt, cls)
[ "def", "from_dict", "(", "cls", ",", "dikt", ")", ":", "return", "util", ".", "deserialize_model", "(", "dikt", ",", "cls", ")" ]
[ 41, 4 ]
[ 49, 48 ]
python
en
['en', 'en', 'en']
True
Category.id
(self)
Gets the id of this Category. :return: The id of this Category. :rtype: long
Gets the id of this Category.
def id(self): """Gets the id of this Category. :return: The id of this Category. :rtype: long """ return self._id
[ "def", "id", "(", "self", ")", ":", "return", "self", ".", "_id" ]
[ 52, 4 ]
[ 59, 23 ]
python
en
['en', 'en', 'en']
True
Category.id
(self, id)
Sets the id of this Category. :param id: The id of this Category. :type id: long
Sets the id of this Category.
def id(self, id): """Sets the id of this Category. :param id: The id of this Category. :type id: long """ self._id = id
[ "def", "id", "(", "self", ",", "id", ")", ":", "self", ".", "_id", "=", "id" ]
[ 62, 4 ]
[ 70, 21 ]
python
en
['en', 'en', 'en']
True
Category.name
(self)
Gets the name of this Category. :return: The name of this Category. :rtype: str
Gets the name of this Category.
def name(self): """Gets the name of this Category. :return: The name of this Category. :rtype: str """ return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 73, 4 ]
[ 80, 25 ]
python
en
['en', 'en', 'en']
True
Category.name
(self, name)
Sets the name of this Category. :param name: The name of this Category. :type name: str
Sets the name of this Category.
def name(self, name): """Sets the name of this Category. :param name: The name of this Category. :type name: str """ if name is not None and not re.search(r'^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$', name): # noqa: E501 raise ValueError("Invalid value for `name`...
[ "def", "name", "(", "self", ",", "name", ")", ":", "if", "name", "is", "not", "None", "and", "not", "re", ".", "search", "(", "r'^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$'", ",", "name", ")", ":", "# noqa: E501", "raise", "ValueError", "(", "\"Invalid valu...
[ 83, 4 ]
[ 93, 25 ]
python
en
['en', 'en', 'en']
True
met_setup_fixture
()
Patch met setup entry.
Patch met setup entry.
def met_setup_fixture(): """Patch met setup entry.""" with patch("homeassistant.components.met.async_setup_entry", return_value=True): yield
[ "def", "met_setup_fixture", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.met.async_setup_entry\"", ",", "return_value", "=", "True", ")", ":", "yield" ]
[ 14, 0 ]
[ 17, 13 ]
python
en
['en', 'en', 'en']
True
test_show_config_form
(hass)
Test show configuration form.
Test show configuration form.
async def test_show_config_form(hass): """Test show configuration form.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result["type"] == "form" assert result["step_id"] == "user"
[ "async", "def", "test_show_config_form", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "config_entries", ".", "SOURCE_USER", "}", ")",...
[ 20, 0 ]
[ 27, 38 ]
python
en
['en', 'fr', 'en']
True
test_flow_with_home_location
(hass)
Test config flow. Test the flow when a default location is configured. Then it should return a form with default values.
Test config flow.
async def test_flow_with_home_location(hass): """Test config flow. Test the flow when a default location is configured. Then it should return a form with default values. """ hass.config.latitude = 1 hass.config.longitude = 2 hass.config.elevation = 3 result = await hass.config_entries....
[ "async", "def", "test_flow_with_home_location", "(", "hass", ")", ":", "hass", ".", "config", ".", "latitude", "=", "1", "hass", ".", "config", ".", "longitude", "=", "2", "hass", ".", "config", ".", "elevation", "=", "3", "result", "=", "await", "hass",...
[ 30, 0 ]
[ 51, 41 ]
python
da
['de', 'da', 'en']
False
test_create_entry
(hass)
Test create entry from user input.
Test create entry from user input.
async def test_create_entry(hass): """Test create entry from user input.""" test_data = { "name": "home", CONF_LONGITUDE: 0, CONF_LATITUDE: 0, CONF_ELEVATION: 0, } result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURC...
[ "async", "def", "test_create_entry", "(", "hass", ")", ":", "test_data", "=", "{", "\"name\"", ":", "\"home\"", ",", "CONF_LONGITUDE", ":", "0", ",", "CONF_LATITUDE", ":", "0", ",", "CONF_ELEVATION", ":", "0", ",", "}", "result", "=", "await", "hass", "....
[ 54, 0 ]
[ 69, 38 ]
python
en
['en', 'en', 'en']
True
test_flow_entry_already_exists
(hass)
Test user input for config_entry that already exists. Test when the form should show when user puts existing location in the config gui. Then the form should show with error.
Test user input for config_entry that already exists.
async def test_flow_entry_already_exists(hass): """Test user input for config_entry that already exists. Test when the form should show when user puts existing location in the config gui. Then the form should show with error. """ first_entry = MockConfigEntry( domain="met", data={"n...
[ "async", "def", "test_flow_entry_already_exists", "(", "hass", ")", ":", "first_entry", "=", "MockConfigEntry", "(", "domain", "=", "\"met\"", ",", "data", "=", "{", "\"name\"", ":", "\"home\"", ",", "CONF_LATITUDE", ":", "0", ",", "CONF_LONGITUDE", ":", "0", ...
[ 72, 0 ]
[ 96, 59 ]
python
en
['en', 'en', 'en']
True
test_onboarding_step
(hass)
Test initializing via onboarding step.
Test initializing via onboarding step.
async def test_onboarding_step(hass): """Test initializing via onboarding step.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": "onboarding"}, data={} ) assert result["type"] == "create_entry" assert result["title"] == HOME_LOCATION_NAME assert result["...
[ "async", "def", "test_onboarding_step", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "\"onboarding\"", "}", ",", "data", "=", "{", ...
[ 99, 0 ]
[ 107, 49 ]
python
en
['nl', 'en', 'en']
True
test_onboarding_step_abort_no_home
(hass, latitude, longitude)
Test entry not created when default step fails.
Test entry not created when default step fails.
async def test_onboarding_step_abort_no_home(hass, latitude, longitude): """Test entry not created when default step fails.""" await async_process_ha_core_config( hass, {"latitude": latitude, "longitude": longitude}, ) assert hass.config.latitude == latitude assert hass.config.longi...
[ "async", "def", "test_onboarding_step_abort_no_home", "(", "hass", ",", "latitude", ",", "longitude", ")", ":", "await", "async_process_ha_core_config", "(", "hass", ",", "{", "\"latitude\"", ":", "latitude", ",", "\"longitude\"", ":", "longitude", "}", ",", ")", ...
[ 111, 0 ]
[ 126, 40 ]
python
en
['en', 'en', 'en']
True
test_import_step
(hass)
Test initializing via import step.
Test initializing via import step.
async def test_import_step(hass): """Test initializing via import step.""" test_data = { "name": "home", CONF_LONGITUDE: None, CONF_LATITUDE: None, CONF_ELEVATION: 0, "track_home": True, } result = await hass.config_entries.flow.async_init( DOMAIN, context...
[ "async", "def", "test_import_step", "(", "hass", ")", ":", "test_data", "=", "{", "\"name\"", ":", "\"home\"", ",", "CONF_LONGITUDE", ":", "None", ",", "CONF_LATITUDE", ":", "None", ",", "CONF_ELEVATION", ":", "0", ",", "\"track_home\"", ":", "True", ",", ...
[ 129, 0 ]
[ 144, 38 ]
python
en
['nl', 'zu', 'en']
False
config_data
()
Provide configuration data for tests.
Provide configuration data for tests.
def config_data(): """Provide configuration data for tests.""" return {CONF_USERNAME: "fake", CONF_PASSWORD: "user"}
[ "def", "config_data", "(", ")", ":", "return", "{", "CONF_USERNAME", ":", "\"fake\"", ",", "CONF_PASSWORD", ":", "\"user\"", "}" ]
[ 14, 0 ]
[ 16, 57 ]
python
en
['en', 'en', 'en']
True
config_entry
(config_data)
Create a mock config entry.
Create a mock config entry.
def config_entry(config_data): """Create a mock config entry.""" return MockConfigEntry( domain=DOMAIN, data=config_data, options={}, )
[ "def", "config_entry", "(", "config_data", ")", ":", "return", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "data", "=", "config_data", ",", "options", "=", "{", "}", ",", ")" ]
[ 20, 0 ]
[ 26, 5 ]
python
en
['en', 'gl', 'en']
True
device
()
Mock a somecomfort.Device.
Mock a somecomfort.Device.
def device(): """Mock a somecomfort.Device.""" mock_device = create_autospec(somecomfort.Device, instance=True) mock_device.deviceid = 1234567 mock_device._data = { "canControlHumidification": False, "hasFan": False, } mock_device.system_mode = "off" mock_device.name = "devic...
[ "def", "device", "(", ")", ":", "mock_device", "=", "create_autospec", "(", "somecomfort", ".", "Device", ",", "instance", "=", "True", ")", "mock_device", ".", "deviceid", "=", "1234567", "mock_device", ".", "_data", "=", "{", "\"canControlHumidification\"", ...
[ 30, 0 ]
[ 42, 22 ]
python
en
['en', 'en', 'en']
True
another_device
()
Mock a somecomfort.Device.
Mock a somecomfort.Device.
def another_device(): """Mock a somecomfort.Device.""" mock_device = create_autospec(somecomfort.Device, instance=True) mock_device.deviceid = 7654321 mock_device._data = { "canControlHumidification": False, "hasFan": False, } mock_device.system_mode = "off" mock_device.name ...
[ "def", "another_device", "(", ")", ":", "mock_device", "=", "create_autospec", "(", "somecomfort", ".", "Device", ",", "instance", "=", "True", ")", "mock_device", ".", "deviceid", "=", "7654321", "mock_device", ".", "_data", "=", "{", "\"canControlHumidificatio...
[ 46, 0 ]
[ 58, 22 ]
python
en
['en', 'en', 'en']
True
location
(device)
Mock a somecomfort.Location.
Mock a somecomfort.Location.
def location(device): """Mock a somecomfort.Location.""" mock_location = create_autospec(somecomfort.Location, instance=True) mock_location.locationid.return_value = "location1" mock_location.devices_by_id = {device.deviceid: device} return mock_location
[ "def", "location", "(", "device", ")", ":", "mock_location", "=", "create_autospec", "(", "somecomfort", ".", "Location", ",", "instance", "=", "True", ")", "mock_location", ".", "locationid", ".", "return_value", "=", "\"location1\"", "mock_location", ".", "dev...
[ 62, 0 ]
[ 67, 24 ]
python
en
['en', 'en', 'en']
True
client
(location)
Mock a somecomfort.SomeComfort client.
Mock a somecomfort.SomeComfort client.
def client(location): """Mock a somecomfort.SomeComfort client.""" client_mock = create_autospec(somecomfort.SomeComfort, instance=True) client_mock.locations_by_id = {location.locationid: location} with patch( "homeassistant.components.honeywell.somecomfort.SomeComfort" ) as sc_class_mock:...
[ "def", "client", "(", "location", ")", ":", "client_mock", "=", "create_autospec", "(", "somecomfort", ".", "SomeComfort", ",", "instance", "=", "True", ")", "client_mock", ".", "locations_by_id", "=", "{", "location", ".", "locationid", ":", "location", "}", ...
[ 71, 0 ]
[ 80, 25 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up entry.
Set up entry.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up entry.""" entities = [] coordinator = hass.data[DOMAIN][config_entry.entry_id]["coordinator"] for circuit_num, circuit in coordinator.data[SL_DATA.KEY_CIRCUITS].items(): enabled = circuit["name"] not in GENERIC_CIRCU...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "entities", "=", "[", "]", "coordinator", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "config_entry", ".", "entry_id", "]", "[", "\"coordinator...
[ 13, 0 ]
[ 22, 32 ]
python
en
['en', 'en', 'en']
True
ScreenLogicSwitch.name
(self)
Get the name of the switch.
Get the name of the switch.
def name(self): """Get the name of the switch.""" return f"{self.gateway_name} {self.circuit['name']}"
[ "def", "name", "(", "self", ")", ":", "return", "f\"{self.gateway_name} {self.circuit['name']}\"" ]
[ 29, 4 ]
[ 31, 60 ]
python
en
['en', 'en', 'en']
True
ScreenLogicSwitch.is_on
(self)
Get whether the switch is in on state.
Get whether the switch is in on state.
def is_on(self) -> bool: """Get whether the switch is in on state.""" return self.circuit["value"] == 1
[ "def", "is_on", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "circuit", "[", "\"value\"", "]", "==", "1" ]
[ 34, 4 ]
[ 36, 41 ]
python
en
['en', 'en', 'en']
True
ScreenLogicSwitch.async_turn_on
(self, **kwargs)
Send the ON command.
Send the ON command.
async def async_turn_on(self, **kwargs) -> None: """Send the ON command.""" return await self._async_set_circuit(ON_OFF.ON)
[ "async", "def", "async_turn_on", "(", "self", ",", "*", "*", "kwargs", ")", "->", "None", ":", "return", "await", "self", ".", "_async_set_circuit", "(", "ON_OFF", ".", "ON", ")" ]
[ 38, 4 ]
[ 40, 55 ]
python
en
['en', 'en', 'en']
True
ScreenLogicSwitch.async_turn_off
(self, **kwargs)
Send the OFF command.
Send the OFF command.
async def async_turn_off(self, **kwargs) -> None: """Send the OFF command.""" return await self._async_set_circuit(ON_OFF.OFF)
[ "async", "def", "async_turn_off", "(", "self", ",", "*", "*", "kwargs", ")", "->", "None", ":", "return", "await", "self", ".", "_async_set_circuit", "(", "ON_OFF", ".", "OFF", ")" ]
[ 42, 4 ]
[ 44, 56 ]
python
en
['en', 'en', 'en']
True
ScreenLogicSwitch.circuit
(self)
Shortcut to access the circuit.
Shortcut to access the circuit.
def circuit(self): """Shortcut to access the circuit.""" return self.coordinator.data[SL_DATA.KEY_CIRCUITS][self._data_key]
[ "def", "circuit", "(", "self", ")", ":", "return", "self", ".", "coordinator", ".", "data", "[", "SL_DATA", ".", "KEY_CIRCUITS", "]", "[", "self", ".", "_data_key", "]" ]
[ 61, 4 ]
[ 63, 74 ]
python
en
['en', 'en', 'en']
True
CoreCollector.run_collection
(self, conf, rm_conf, branch_info, blacklist_report)
Initialize core collection here and generate the output directory with collected data.
Initialize core collection here and generate the output directory with collected data.
def run_collection(self, conf, rm_conf, branch_info, blacklist_report): ''' Initialize core collection here and generate the output directory with collected data. ''' # initialize systemd-notify thread systemd_notify_init_thread() if rm_conf is None: ...
[ "def", "run_collection", "(", "self", ",", "conf", ",", "rm_conf", ",", "branch_info", ",", "blacklist_report", ")", ":", "# initialize systemd-notify thread", "systemd_notify_init_thread", "(", ")", "if", "rm_conf", "is", "None", ":", "rm_conf", "=", "{", "}", ...
[ 21, 4 ]
[ 83, 53 ]
python
en
['en', 'error', 'th']
False
async_get_conditions
( hass: HomeAssistant, device_id: str )
List device conditions.
List device conditions.
async def async_get_conditions( hass: HomeAssistant, device_id: str ) -> list[dict[str, str]]: """List device conditions.""" conditions: list[dict[str, str]] = [] entity_registry = await async_get_registry(hass) entries = [ entry for entry in async_entries_for_device(entity_registry,...
[ "async", "def", "async_get_conditions", "(", "hass", ":", "HomeAssistant", ",", "device_id", ":", "str", ")", "->", "list", "[", "dict", "[", "str", ",", "str", "]", "]", ":", "conditions", ":", "list", "[", "dict", "[", "str", ",", "str", "]", "]", ...
[ 146, 0 ]
[ 180, 21 ]
python
en
['fr', 'en', 'en']
True
async_condition_from_config
( config: ConfigType, config_validation: bool )
Evaluate state based on configuration.
Evaluate state based on configuration.
def async_condition_from_config( config: ConfigType, config_validation: bool ) -> condition.ConditionCheckerType: """Evaluate state based on configuration.""" if config_validation: config = CONDITION_SCHEMA(config) numeric_state_config = { condition.CONF_CONDITION: "numeric_state", ...
[ "def", "async_condition_from_config", "(", "config", ":", "ConfigType", ",", "config_validation", ":", "bool", ")", "->", "condition", ".", "ConditionCheckerType", ":", "if", "config_validation", ":", "config", "=", "CONDITION_SCHEMA", "(", "config", ")", "numeric_s...
[ 184, 0 ]
[ 199, 74 ]
python
en
['en', 'en', 'en']
True
async_get_condition_capabilities
(hass, config)
List condition capabilities.
List condition capabilities.
async def async_get_condition_capabilities(hass, config): """List condition capabilities.""" try: unit_of_measurement = get_unit_of_measurement(hass, config[CONF_ENTITY_ID]) except HomeAssistantError: unit_of_measurement = None if not unit_of_measurement: raise InvalidDeviceAuto...
[ "async", "def", "async_get_condition_capabilities", "(", "hass", ",", "config", ")", ":", "try", ":", "unit_of_measurement", "=", "get_unit_of_measurement", "(", "hass", ",", "config", "[", "CONF_ENTITY_ID", "]", ")", "except", "HomeAssistantError", ":", "unit_of_me...
[ 202, 0 ]
[ 225, 5 ]
python
en
['ro', 'sr', 'en']
False
HaZeroconf.close
(self)
Fake method to avoid integrations closing it.
Fake method to avoid integrations closing it.
def close(self) -> None: """Fake method to avoid integrations closing it."""
[ "def", "close", "(", "self", ")", "->", "None", ":" ]
[ 13, 4 ]
[ 14, 59 ]
python
en
['en', 'en', 'en']
True
HaAsyncZeroconf.async_close
(self)
Fake method to avoid integrations closing it.
Fake method to avoid integrations closing it.
async def async_close(self) -> None: """Fake method to avoid integrations closing it."""
[ "async", "def", "async_close", "(", "self", ")", "->", "None", ":" ]
[ 22, 4 ]
[ 23, 59 ]
python
en
['en', 'en', 'en']
True
HaAsyncServiceBrowser.__init__
(self, ipv6: bool, *args: Any, **kwargs: Any)
Create service browser that filters ipv6 if it is disabled.
Create service browser that filters ipv6 if it is disabled.
def __init__(self, ipv6: bool, *args: Any, **kwargs: Any) -> None: """Create service browser that filters ipv6 if it is disabled.""" self.ipv6 = ipv6 super().__init__(*args, **kwargs)
[ "def", "__init__", "(", "self", ",", "ipv6", ":", "bool", ",", "*", "args", ":", "Any", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "self", ".", "ipv6", "=", "ipv6", "super", "(", ")", ".", "__init__", "(", "*", "args", ",", ...
[ 31, 4 ]
[ 34, 41 ]
python
en
['en', 'en', 'en']
True
HaAsyncServiceBrowser.update_record
(self, zc: Zeroconf, now: float, record: DNSRecord)
Pre-Filter AAAA records if IPv6 is not enabled.
Pre-Filter AAAA records if IPv6 is not enabled.
def update_record(self, zc: Zeroconf, now: float, record: DNSRecord) -> None: """Pre-Filter AAAA records if IPv6 is not enabled.""" if ( not self.ipv6 and isinstance(record, DNSAddress) and record.type == TYPE_AAAA ): return super().update_...
[ "def", "update_record", "(", "self", ",", "zc", ":", "Zeroconf", ",", "now", ":", "float", ",", "record", ":", "DNSRecord", ")", "->", "None", ":", "if", "(", "not", "self", ".", "ipv6", "and", "isinstance", "(", "record", ",", "DNSAddress", ")", "an...
[ 36, 4 ]
[ 44, 46 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass, config)
Activate Alexa component.
Activate Alexa component.
async def async_setup(hass, config): """Activate Alexa component.""" intents = copy.deepcopy(config[DOMAIN]) template.attach(hass, intents) for intent_type, conf in intents.items(): if CONF_ACTION in conf: conf[CONF_ACTION] = script.Script( hass, conf[CONF_ACTION], f...
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "intents", "=", "copy", ".", "deepcopy", "(", "config", "[", "DOMAIN", "]", ")", "template", ".", "attach", "(", "hass", ",", "intents", ")", "for", "intent_type", ",", "conf", "in", ...
[ 46, 0 ]
[ 58, 15 ]
python
ca
['ro', 'ca', 'en']
False
ScriptIntentHandler.__init__
(self, intent_type, config)
Initialize the script intent handler.
Initialize the script intent handler.
def __init__(self, intent_type, config): """Initialize the script intent handler.""" self.intent_type = intent_type self.config = config
[ "def", "__init__", "(", "self", ",", "intent_type", ",", "config", ")", ":", "self", ".", "intent_type", "=", "intent_type", "self", ".", "config", "=", "config" ]
[ 64, 4 ]
[ 67, 28 ]
python
en
['en', 'en', 'en']
True
ScriptIntentHandler.async_handle
(self, intent_obj)
Handle the intent.
Handle the intent.
async def async_handle(self, intent_obj): """Handle the intent.""" speech = self.config.get(CONF_SPEECH) card = self.config.get(CONF_CARD) action = self.config.get(CONF_ACTION) is_async_action = self.config.get(CONF_ASYNC_ACTION) slots = {key: value["value"] for key, valu...
[ "async", "def", "async_handle", "(", "self", ",", "intent_obj", ")", ":", "speech", "=", "self", ".", "config", ".", "get", "(", "CONF_SPEECH", ")", "card", "=", "self", ".", "config", ".", "get", "(", "CONF_CARD", ")", "action", "=", "self", ".", "c...
[ 69, 4 ]
[ 100, 23 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass: HomeAssistant, config: ConfigType)
Set up the Legrand Home+ Control component from configuration.yaml.
Set up the Legrand Home+ Control component from configuration.yaml.
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: """Set up the Legrand Home+ Control component from configuration.yaml.""" hass.data[DOMAIN] = {} if DOMAIN not in config: return True # Register the implementation from the config information config_flow.HomePlusContro...
[ "async", "def", "async_setup", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "ConfigType", ")", "->", "bool", ":", "hass", ".", "data", "[", "DOMAIN", "]", "=", "{", "}", "if", "DOMAIN", "not", "in", "config", ":", "return", "True", "# Registe...
[ 53, 0 ]
[ 66, 15 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass: HomeAssistant, entry: ConfigEntry)
Set up Legrand Home+ Control from a config entry.
Set up Legrand Home+ Control from a config entry.
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Set up Legrand Home+ Control from a config entry.""" hass_entry_data = hass.data[DOMAIN].setdefault(entry.entry_id, {}) # Retrieve the registered implementation implementation = ( await config_entry_oauth2_flow.asy...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ")", "->", "bool", ":", "hass_entry_data", "=", "hass", ".", "data", "[", "DOMAIN", "]", ".", "setdefault", "(", "entry", ".", "entry_id", ",", "{", ...
[ 69, 0 ]
[ 153, 15 ]
python
en
['en', 'en', 'en']
True
async_unload_entry
(hass: HomeAssistant, config_entry: ConfigEntry)
Unload the Legrand Home+ Control config entry.
Unload the Legrand Home+ Control config entry.
async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool: """Unload the Legrand Home+ Control config entry.""" unload_ok = await hass.config_entries.async_unload_platforms( config_entry, PLATFORMS ) if unload_ok: # Unsubscribe the config_entry signal dispatche...
[ "async", "def", "async_unload_entry", "(", "hass", ":", "HomeAssistant", ",", "config_entry", ":", "ConfigEntry", ")", "->", "bool", ":", "unload_ok", "=", "await", "hass", ".", "config_entries", ".", "async_unload_platforms", "(", "config_entry", ",", "PLATFORMS"...
[ 156, 0 ]
[ 172, 20 ]
python
en
['en', 'en', 'en']
True
prepare_log
(log)
Strips some stuff from outside logs so we can parse
Strips some stuff from outside logs so we can parse
def prepare_log(log): '''Strips some stuff from outside logs so we can parse''' # TODO: convert other timestamps into seconds since boot return log
[ "def", "prepare_log", "(", "log", ")", ":", "# TODO: convert other timestamps into seconds since boot", "return", "log" ]
[ 17, 0 ]
[ 20, 14 ]
python
en
['en', 'en', 'en']
True
Analysis.make_graph
(self, data, ylabel, fname, ts=None, xlabel="seconds since boot (probably)", output_dir=None)
Helper function to make a PNG graph
Helper function to make a PNG graph
def make_graph(self, data, ylabel, fname, ts=None, xlabel="seconds since boot (probably)", output_dir=None): '''Helper function to make a PNG graph''' if not output_dir: return import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt plt.gca()...
[ "def", "make_graph", "(", "self", ",", "data", ",", "ylabel", ",", "fname", ",", "ts", "=", "None", ",", "xlabel", "=", "\"seconds since boot (probably)\"", ",", "output_dir", "=", "None", ")", ":", "if", "not", "output_dir", ":", "return", "import", "matp...
[ 37, 4 ]
[ 55, 17 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up the Zigbee Home Automation device tracker from config entry.
Set up the Zigbee Home Automation device tracker from config entry.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up the Zigbee Home Automation device tracker from config entry.""" entities_to_create = hass.data[DATA_ZHA][DOMAIN] unsub = async_dispatcher_connect( hass, SIGNAL_ADD_ENTITIES, functools.partial( ...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "entities_to_create", "=", "hass", ".", "data", "[", "DATA_ZHA", "]", "[", "DOMAIN", "]", "unsub", "=", "async_dispatcher_connect", "(", "hass", ",", "S...
[ 24, 0 ]
[ 35, 59 ]
python
en
['en', 'en', 'en']
True
AdvantageAirEntity.__init__
(self, instance, ac_key, zone_key=None)
Initialize common aspects of an Advantage Air sensor.
Initialize common aspects of an Advantage Air sensor.
def __init__(self, instance, ac_key, zone_key=None): """Initialize common aspects of an Advantage Air sensor.""" super().__init__(instance["coordinator"]) self.async_change = instance["async_change"] self.ac_key = ac_key self.zone_key = zone_key self._attr_device_info = {...
[ "def", "__init__", "(", "self", ",", "instance", ",", "ac_key", ",", "zone_key", "=", "None", ")", ":", "super", "(", ")", ".", "__init__", "(", "instance", "[", "\"coordinator\"", "]", ")", "self", ".", "async_change", "=", "instance", "[", "\"async_cha...
[ 10, 4 ]
[ 22, 9 ]
python
en
['en', 'en', 'en']
True
EntityMapStorage.__init__
(self, hass)
Create a new entity map store.
Create a new entity map store.
def __init__(self, hass): """Create a new entity map store.""" self.hass = hass self.store = Store(hass, ENTITY_MAP_STORAGE_VERSION, ENTITY_MAP_STORAGE_KEY) self.storage_data = {}
[ "def", "__init__", "(", "self", ",", "hass", ")", ":", "self", ".", "hass", "=", "hass", "self", ".", "store", "=", "Store", "(", "hass", ",", "ENTITY_MAP_STORAGE_VERSION", ",", "ENTITY_MAP_STORAGE_KEY", ")", "self", ".", "storage_data", "=", "{", "}" ]
[ 28, 4 ]
[ 32, 30 ]
python
en
['en', 'en', 'en']
True
EntityMapStorage.async_initialize
(self)
Get the pairing cache data.
Get the pairing cache data.
async def async_initialize(self): """Get the pairing cache data.""" raw_storage = await self.store.async_load() if not raw_storage: # There is no cached data about HomeKit devices yet return self.storage_data = raw_storage.get("pairings", {})
[ "async", "def", "async_initialize", "(", "self", ")", ":", "raw_storage", "=", "await", "self", ".", "store", ".", "async_load", "(", ")", "if", "not", "raw_storage", ":", "# There is no cached data about HomeKit devices yet", "return", "self", ".", "storage_data", ...
[ 34, 4 ]
[ 41, 59 ]
python
en
['en', 'en', 'en']
True
EntityMapStorage.get_map
(self, homekit_id)
Get a pairing cache item.
Get a pairing cache item.
def get_map(self, homekit_id): """Get a pairing cache item.""" return self.storage_data.get(homekit_id)
[ "def", "get_map", "(", "self", ",", "homekit_id", ")", ":", "return", "self", ".", "storage_data", ".", "get", "(", "homekit_id", ")" ]
[ 43, 4 ]
[ 45, 48 ]
python
en
['en', 'en', 'en']
True
EntityMapStorage.async_create_or_update_map
(self, homekit_id, config_num, accessories)
Create a new pairing cache.
Create a new pairing cache.
def async_create_or_update_map(self, homekit_id, config_num, accessories): """Create a new pairing cache.""" data = {"config_num": config_num, "accessories": accessories} self.storage_data[homekit_id] = data self._async_schedule_save() return data
[ "def", "async_create_or_update_map", "(", "self", ",", "homekit_id", ",", "config_num", ",", "accessories", ")", ":", "data", "=", "{", "\"config_num\"", ":", "config_num", ",", "\"accessories\"", ":", "accessories", "}", "self", ".", "storage_data", "[", "homek...
[ 48, 4 ]
[ 53, 19 ]
python
en
['en', 'en', 'en']
True
EntityMapStorage.async_delete_map
(self, homekit_id)
Delete pairing cache.
Delete pairing cache.
def async_delete_map(self, homekit_id): """Delete pairing cache.""" if homekit_id not in self.storage_data: return self.storage_data.pop(homekit_id) self._async_schedule_save()
[ "def", "async_delete_map", "(", "self", ",", "homekit_id", ")", ":", "if", "homekit_id", "not", "in", "self", ".", "storage_data", ":", "return", "self", ".", "storage_data", ".", "pop", "(", "homekit_id", ")", "self", ".", "_async_schedule_save", "(", ")" ]
[ 56, 4 ]
[ 62, 35 ]
python
en
['en', 'sr', 'en']
True
EntityMapStorage._async_schedule_save
(self)
Schedule saving the entity map cache.
Schedule saving the entity map cache.
def _async_schedule_save(self): """Schedule saving the entity map cache.""" self.store.async_delay_save(self._data_to_save, ENTITY_MAP_SAVE_DELAY)
[ "def", "_async_schedule_save", "(", "self", ")", ":", "self", ".", "store", ".", "async_delay_save", "(", "self", ".", "_data_to_save", ",", "ENTITY_MAP_SAVE_DELAY", ")" ]
[ 65, 4 ]
[ 67, 78 ]
python
en
['en', 'en', 'en']
True
EntityMapStorage._data_to_save
(self)
Return data of entity map to store in a file.
Return data of entity map to store in a file.
def _data_to_save(self): """Return data of entity map to store in a file.""" return {"pairings": self.storage_data}
[ "def", "_data_to_save", "(", "self", ")", ":", "return", "{", "\"pairings\"", ":", "self", ".", "storage_data", "}" ]
[ 70, 4 ]
[ 72, 46 ]
python
en
['en', 'en', 'en']
True
TestPetApi.test_add_pet
(self)
Test case for add_pet Add a new pet to the store # noqa: E501
Test case for add_pet
def test_add_pet(self): """Test case for add_pet Add a new pet to the store # noqa: E501 """ pass
[ "def", "test_add_pet", "(", "self", ")", ":", "pass" ]
[ 30, 4 ]
[ 35, 12 ]
python
en
['en', 'en', 'en']
True
TestPetApi.test_delete_pet
(self)
Test case for delete_pet Deletes a pet # noqa: E501
Test case for delete_pet
def test_delete_pet(self): """Test case for delete_pet Deletes a pet # noqa: E501 """ pass
[ "def", "test_delete_pet", "(", "self", ")", ":", "pass" ]
[ 37, 4 ]
[ 42, 12 ]
python
da
['da', 'fr', 'en']
False
TestPetApi.test_find_pets_by_status
(self)
Test case for find_pets_by_status Finds Pets by status # noqa: E501
Test case for find_pets_by_status
def test_find_pets_by_status(self): """Test case for find_pets_by_status Finds Pets by status # noqa: E501 """ pass
[ "def", "test_find_pets_by_status", "(", "self", ")", ":", "pass" ]
[ 44, 4 ]
[ 49, 12 ]
python
en
['en', 'en', 'en']
True
TestPetApi.test_find_pets_by_tags
(self)
Test case for find_pets_by_tags Finds Pets by tags # noqa: E501
Test case for find_pets_by_tags
def test_find_pets_by_tags(self): """Test case for find_pets_by_tags Finds Pets by tags # noqa: E501 """ pass
[ "def", "test_find_pets_by_tags", "(", "self", ")", ":", "pass" ]
[ 51, 4 ]
[ 56, 12 ]
python
en
['en', 'en', 'en']
True
TestPetApi.test_get_pet_by_id
(self)
Test case for get_pet_by_id Find pet by ID # noqa: E501
Test case for get_pet_by_id
def test_get_pet_by_id(self): """Test case for get_pet_by_id Find pet by ID # noqa: E501 """ pass
[ "def", "test_get_pet_by_id", "(", "self", ")", ":", "pass" ]
[ 58, 4 ]
[ 63, 12 ]
python
en
['da', 'en', 'en']
True
TestPetApi.test_update_pet
(self)
Test case for update_pet Update an existing pet # noqa: E501
Test case for update_pet
def test_update_pet(self): """Test case for update_pet Update an existing pet # noqa: E501 """ pass
[ "def", "test_update_pet", "(", "self", ")", ":", "pass" ]
[ 65, 4 ]
[ 70, 12 ]
python
en
['en', 'en', 'en']
True
TestPetApi.test_update_pet_with_form
(self)
Test case for update_pet_with_form Updates a pet in the store with form data # noqa: E501
Test case for update_pet_with_form
def test_update_pet_with_form(self): """Test case for update_pet_with_form Updates a pet in the store with form data # noqa: E501 """ pass
[ "def", "test_update_pet_with_form", "(", "self", ")", ":", "pass" ]
[ 72, 4 ]
[ 77, 12 ]
python
en
['en', 'en', 'en']
True
TestPetApi.test_upload_file
(self)
Test case for upload_file uploads an image # noqa: E501
Test case for upload_file
def test_upload_file(self): """Test case for upload_file uploads an image # noqa: E501 """ pass
[ "def", "test_upload_file", "(", "self", ")", ":", "pass" ]
[ 79, 4 ]
[ 84, 12 ]
python
en
['en', 'da', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up OpenWeatherMap weather entity based on a config entry.
Set up OpenWeatherMap weather entity based on a config entry.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up OpenWeatherMap weather entity based on a config entry.""" domain_data = hass.data[DOMAIN][config_entry.entry_id] name = domain_data[ENTRY_NAME] weather_coordinator = domain_data[ENTRY_WEATHER_COORDINATOR] unique_id = f"{...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "domain_data", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "config_entry", ".", "entry_id", "]", "name", "=", "domain_data", "[", "ENTRY_NAME", ...
[ 23, 0 ]
[ 32, 44 ]
python
en
['en', 'en', 'en']
True
OpenWeatherMapWeather.__init__
( self, name, unique_id, weather_coordinator: WeatherUpdateCoordinator, )
Initialize the sensor.
Initialize the sensor.
def __init__( self, name, unique_id, weather_coordinator: WeatherUpdateCoordinator, ): """Initialize the sensor.""" self._name = name self._unique_id = unique_id self._weather_coordinator = weather_coordinator
[ "def", "__init__", "(", "self", ",", "name", ",", "unique_id", ",", "weather_coordinator", ":", "WeatherUpdateCoordinator", ",", ")", ":", "self", ".", "_name", "=", "name", "self", ".", "_unique_id", "=", "unique_id", "self", ".", "_weather_coordinator", "=",...
[ 38, 4 ]
[ 47, 55 ]
python
en
['en', 'en', 'en']
True
OpenWeatherMapWeather.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self): """Return the name of the sensor.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 50, 4 ]
[ 52, 25 ]
python
en
['en', 'mi', 'en']
True
OpenWeatherMapWeather.unique_id
(self)
Return a unique_id for this entity.
Return a unique_id for this entity.
def unique_id(self): """Return a unique_id for this entity.""" return self._unique_id
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "_unique_id" ]
[ 55, 4 ]
[ 57, 30 ]
python
en
['en', 'en', 'en']
True
OpenWeatherMapWeather.device_info
(self)
Return the device info.
Return the device info.
def device_info(self): """Return the device info.""" return { "identifiers": {(DOMAIN, self._unique_id)}, "name": DEFAULT_NAME, "manufacturer": MANUFACTURER, "entry_type": "service", }
[ "def", "device_info", "(", "self", ")", ":", "return", "{", "\"identifiers\"", ":", "{", "(", "DOMAIN", ",", "self", ".", "_unique_id", ")", "}", ",", "\"name\"", ":", "DEFAULT_NAME", ",", "\"manufacturer\"", ":", "MANUFACTURER", ",", "\"entry_type\"", ":", ...
[ 60, 4 ]
[ 67, 9 ]
python
en
['en', 'en', 'en']
True
OpenWeatherMapWeather.should_poll
(self)
Return the polling requirement of the entity.
Return the polling requirement of the entity.
def should_poll(self): """Return the polling requirement of the entity.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 70, 4 ]
[ 72, 20 ]
python
en
['en', 'en', 'en']
True
OpenWeatherMapWeather.attribution
(self)
Return the attribution.
Return the attribution.
def attribution(self): """Return the attribution.""" return ATTRIBUTION
[ "def", "attribution", "(", "self", ")", ":", "return", "ATTRIBUTION" ]
[ 75, 4 ]
[ 77, 26 ]
python
en
['en', 'ja', 'en']
True
OpenWeatherMapWeather.condition
(self)
Return the current condition.
Return the current condition.
def condition(self): """Return the current condition.""" return self._weather_coordinator.data[ATTR_API_CONDITION]
[ "def", "condition", "(", "self", ")", ":", "return", "self", ".", "_weather_coordinator", ".", "data", "[", "ATTR_API_CONDITION", "]" ]
[ 80, 4 ]
[ 82, 65 ]
python
en
['en', 'en', 'en']
True
OpenWeatherMapWeather.temperature
(self)
Return the temperature.
Return the temperature.
def temperature(self): """Return the temperature.""" return self._weather_coordinator.data[ATTR_API_TEMPERATURE]
[ "def", "temperature", "(", "self", ")", ":", "return", "self", ".", "_weather_coordinator", ".", "data", "[", "ATTR_API_TEMPERATURE", "]" ]
[ 85, 4 ]
[ 87, 67 ]
python
en
['en', 'la', 'en']
True
OpenWeatherMapWeather.temperature_unit
(self)
Return the unit of measurement.
Return the unit of measurement.
def temperature_unit(self): """Return the unit of measurement.""" return TEMP_CELSIUS
[ "def", "temperature_unit", "(", "self", ")", ":", "return", "TEMP_CELSIUS" ]
[ 90, 4 ]
[ 92, 27 ]
python
en
['en', 'la', 'en']
True
OpenWeatherMapWeather.pressure
(self)
Return the pressure.
Return the pressure.
def pressure(self): """Return the pressure.""" pressure = self._weather_coordinator.data[ATTR_API_PRESSURE] # OpenWeatherMap returns pressure in hPA, so convert to # inHg if we aren't using metric. if not self.hass.config.units.is_metric and pressure: return pressure_...
[ "def", "pressure", "(", "self", ")", ":", "pressure", "=", "self", ".", "_weather_coordinator", ".", "data", "[", "ATTR_API_PRESSURE", "]", "# OpenWeatherMap returns pressure in hPA, so convert to", "# inHg if we aren't using metric.", "if", "not", "self", ".", "hass", ...
[ 95, 4 ]
[ 102, 23 ]
python
en
['en', 'ig', 'en']
True
OpenWeatherMapWeather.humidity
(self)
Return the humidity.
Return the humidity.
def humidity(self): """Return the humidity.""" return self._weather_coordinator.data[ATTR_API_HUMIDITY]
[ "def", "humidity", "(", "self", ")", ":", "return", "self", ".", "_weather_coordinator", ".", "data", "[", "ATTR_API_HUMIDITY", "]" ]
[ 105, 4 ]
[ 107, 64 ]
python
en
['en', 'sw', 'en']
True
OpenWeatherMapWeather.wind_speed
(self)
Return the wind speed.
Return the wind speed.
def wind_speed(self): """Return the wind speed.""" wind_speed = self._weather_coordinator.data[ATTR_API_WIND_SPEED] if self.hass.config.units.name == "imperial": return round(wind_speed * 2.24, 2) return round(wind_speed * 3.6, 2)
[ "def", "wind_speed", "(", "self", ")", ":", "wind_speed", "=", "self", ".", "_weather_coordinator", ".", "data", "[", "ATTR_API_WIND_SPEED", "]", "if", "self", ".", "hass", ".", "config", ".", "units", ".", "name", "==", "\"imperial\"", ":", "return", "rou...
[ 110, 4 ]
[ 115, 41 ]
python
en
['en', 'zh', 'en']
True
OpenWeatherMapWeather.wind_bearing
(self)
Return the wind bearing.
Return the wind bearing.
def wind_bearing(self): """Return the wind bearing.""" return self._weather_coordinator.data[ATTR_API_WIND_BEARING]
[ "def", "wind_bearing", "(", "self", ")", ":", "return", "self", ".", "_weather_coordinator", ".", "data", "[", "ATTR_API_WIND_BEARING", "]" ]
[ 118, 4 ]
[ 120, 68 ]
python
en
['en', 'ig', 'en']
True
OpenWeatherMapWeather.forecast
(self)
Return the forecast array.
Return the forecast array.
def forecast(self): """Return the forecast array.""" return self._weather_coordinator.data[ATTR_API_FORECAST]
[ "def", "forecast", "(", "self", ")", ":", "return", "self", ".", "_weather_coordinator", ".", "data", "[", "ATTR_API_FORECAST", "]" ]
[ 123, 4 ]
[ 125, 64 ]
python
en
['en', 'ga', 'en']
True
OpenWeatherMapWeather.available
(self)
Return True if entity is available.
Return True if entity is available.
def available(self): """Return True if entity is available.""" return self._weather_coordinator.last_update_success
[ "def", "available", "(", "self", ")", ":", "return", "self", ".", "_weather_coordinator", ".", "last_update_success" ]
[ 128, 4 ]
[ 130, 60 ]
python
en
['en', 'en', 'en']
True
OpenWeatherMapWeather.async_added_to_hass
(self)
Connect to dispatcher listening for entity data notifications.
Connect to dispatcher listening for entity data notifications.
async def async_added_to_hass(self): """Connect to dispatcher listening for entity data notifications.""" self.async_on_remove( self._weather_coordinator.async_add_listener(self.async_write_ha_state) )
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "self", ".", "async_on_remove", "(", "self", ".", "_weather_coordinator", ".", "async_add_listener", "(", "self", ".", "async_write_ha_state", ")", ")" ]
[ 132, 4 ]
[ 136, 9 ]
python
en
['en', 'en', 'en']
True
OpenWeatherMapWeather.async_update
(self)
Get the latest data from OWM and updates the states.
Get the latest data from OWM and updates the states.
async def async_update(self): """Get the latest data from OWM and updates the states.""" await self._weather_coordinator.async_request_refresh()
[ "async", "def", "async_update", "(", "self", ")", ":", "await", "self", ".", "_weather_coordinator", ".", "async_request_refresh", "(", ")" ]
[ 138, 4 ]
[ 140, 63 ]
python
en
['en', 'en', 'en']
True
Runner.__init__
(self, args)
|args| parsed command line args.
|args| parsed command line args.
def __init__(self, args): """ |args| parsed command line args. """ self.args = args self.deployment_yaml = yaml.safe_load(open(self.args.deployment_yaml, 'r')) self.configmap_yaml = yaml.safe_load(open(self.args.configmap_yaml, 'r')) if \ self.args.configmap_yaml else None self.service...
[ "def", "__init__", "(", "self", ",", "args", ")", ":", "self", ".", "args", "=", "args", "self", ".", "deployment_yaml", "=", "yaml", ".", "safe_load", "(", "open", "(", "self", ".", "args", ".", "deployment_yaml", ",", "'r'", ")", ")", "self", ".", ...
[ 51, 2 ]
[ 86, 50 ]
python
en
['en', 'error', 'th']
False
Runner.go
(self)
Run the performance tests.
Run the performance tests.
def go(self): """ Run the performance tests. """ self._select_nodes() test_cases = self.test_params.generate(self.attributes) if len(test_cases) == 0: _log.warning('No test cases') return 0 try: self._ensure_out_dir(test_cases[0].run_id) client_pods=self._reset_clie...
[ "def", "go", "(", "self", ")", ":", "self", ".", "_select_nodes", "(", ")", "test_cases", "=", "self", ".", "test_params", ".", "generate", "(", "self", ".", "attributes", ")", "if", "len", "(", "test_cases", ")", "==", "0", ":", "_log", ".", "warnin...
[ 88, 2 ]
[ 156, 12 ]
python
en
['en', 'error', 'th']
False