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
ZwaveDimmer.supported_features
(self)
Flag supported features.
Flag supported features.
def supported_features(self): """Flag supported features.""" return self._supported_features
[ "def", "supported_features", "(", "self", ")", ":", "return", "self", ".", "_supported_features" ]
[ 196, 4 ]
[ 198, 39 ]
python
en
['da', 'en', 'en']
True
ZwaveDimmer._set_duration
(self, **kwargs)
Set the transition time for the brightness value. Zwave Dimming Duration values: 0x00 = instant 0x01-0x7F = 1 second to 127 seconds 0x80-0xFE = 1 minute to 127 minutes 0xFF = factory default
Set the transition time for the brightness value.
def _set_duration(self, **kwargs): """Set the transition time for the brightness value. Zwave Dimming Duration values: 0x00 = instant 0x01-0x7F = 1 second to 127 seconds 0x80-0xFE = 1 minute to 127 minutes 0xFF = factory default """ if self.valu...
[ "def", "_set_duration", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "values", ".", "dimming_duration", "is", "None", ":", "if", "ATTR_TRANSITION", "in", "kwargs", ":", "_LOGGER", ".", "debug", "(", "\"Dimming not supported by %s\"", ",...
[ 200, 4 ]
[ 229, 62 ]
python
en
['en', 'en', 'en']
True
ZwaveDimmer.turn_on
(self, **kwargs)
Turn the device on.
Turn the device on.
def turn_on(self, **kwargs): """Turn the device on.""" self._set_duration(**kwargs) # Zwave multilevel switches use a range of [0, 99] to control # brightness. Level 255 means to set it to previous value. if ATTR_BRIGHTNESS in kwargs: self._brightness = kwargs[ATTR_B...
[ "def", "turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_set_duration", "(", "*", "*", "kwargs", ")", "# Zwave multilevel switches use a range of [0, 99] to control", "# brightness. Level 255 means to set it to previous value.", "if", "ATTR_BRIGHTNES...
[ 231, 4 ]
[ 244, 34 ]
python
en
['en', 'en', 'en']
True
ZwaveDimmer.turn_off
(self, **kwargs)
Turn the device off.
Turn the device off.
def turn_off(self, **kwargs): """Turn the device off.""" self._set_duration(**kwargs) if self.node.set_dimmer(self.values.primary.value_id, 0): self._state = STATE_OFF
[ "def", "turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_set_duration", "(", "*", "*", "kwargs", ")", "if", "self", ".", "node", ".", "set_dimmer", "(", "self", ".", "values", ".", "primary", ".", "value_id", ",", "0", ")",...
[ 246, 4 ]
[ 251, 35 ]
python
en
['en', 'en', 'en']
True
ZwaveColorLight.__init__
(self, values, refresh, delay)
Initialize the light.
Initialize the light.
def __init__(self, values, refresh, delay): """Initialize the light.""" self._color_channels = None self._hs = None self._ct = None self._white = None super().__init__(values, refresh, delay)
[ "def", "__init__", "(", "self", ",", "values", ",", "refresh", ",", "delay", ")", ":", "self", ".", "_color_channels", "=", "None", "self", ".", "_hs", "=", "None", "self", ".", "_ct", "=", "None", "self", ".", "_white", "=", "None", "super", "(", ...
[ 257, 4 ]
[ 264, 48 ]
python
en
['en', 'en', 'en']
True
ZwaveColorLight.value_added
(self)
Call when a new value is added to this entity.
Call when a new value is added to this entity.
def value_added(self): """Call when a new value is added to this entity.""" super().value_added() self._supported_features |= SUPPORT_COLOR if self._zw098: self._supported_features |= SUPPORT_COLOR_TEMP elif self._color_channels is not None and self._color_channels &...
[ "def", "value_added", "(", "self", ")", ":", "super", "(", ")", ".", "value_added", "(", ")", "self", ".", "_supported_features", "|=", "SUPPORT_COLOR", "if", "self", ".", "_zw098", ":", "self", ".", "_supported_features", "|=", "SUPPORT_COLOR_TEMP", "elif", ...
[ 266, 4 ]
[ 276, 59 ]
python
en
['en', 'en', 'en']
True
ZwaveColorLight.update_properties
(self)
Update internal properties based on zwave values.
Update internal properties based on zwave values.
def update_properties(self): """Update internal properties based on zwave values.""" super().update_properties() if self.values.color is None: return if self.values.color_channels is None: return # Color Channels self._color_channels = self.value...
[ "def", "update_properties", "(", "self", ")", ":", "super", "(", ")", ".", "update_properties", "(", ")", "if", "self", ".", "values", ".", "color", "is", "None", ":", "return", "if", "self", ".", "values", ".", "color_channels", "is", "None", ":", "re...
[ 278, 4 ]
[ 341, 27 ]
python
en
['en', 'af', 'en']
True
ZwaveColorLight.hs_color
(self)
Return the hs color.
Return the hs color.
def hs_color(self): """Return the hs color.""" return self._hs
[ "def", "hs_color", "(", "self", ")", ":", "return", "self", ".", "_hs" ]
[ 344, 4 ]
[ 346, 23 ]
python
en
['en', 'fr', 'en']
True
ZwaveColorLight.white_value
(self)
Return the white value of this light between 0..255.
Return the white value of this light between 0..255.
def white_value(self): """Return the white value of this light between 0..255.""" return self._white
[ "def", "white_value", "(", "self", ")", ":", "return", "self", ".", "_white" ]
[ 349, 4 ]
[ 351, 26 ]
python
en
['en', 'en', 'en']
True
ZwaveColorLight.color_temp
(self)
Return the color temperature.
Return the color temperature.
def color_temp(self): """Return the color temperature.""" return self._ct
[ "def", "color_temp", "(", "self", ")", ":", "return", "self", ".", "_ct" ]
[ 354, 4 ]
[ 356, 23 ]
python
en
['en', 'la', 'en']
True
ZwaveColorLight.turn_on
(self, **kwargs)
Turn the device on.
Turn the device on.
def turn_on(self, **kwargs): """Turn the device on.""" rgbw = None if ATTR_WHITE_VALUE in kwargs: self._white = kwargs[ATTR_WHITE_VALUE] if ATTR_COLOR_TEMP in kwargs: # Color temperature. With the AEOTEC ZW098 bulb, only two color # temperatures are ...
[ "def", "turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "rgbw", "=", "None", "if", "ATTR_WHITE_VALUE", "in", "kwargs", ":", "self", ".", "_white", "=", "kwargs", "[", "ATTR_WHITE_VALUE", "]", "if", "ATTR_COLOR_TEMP", "in", "kwargs", ":", "# Col...
[ 358, 4 ]
[ 396, 33 ]
python
en
['en', 'en', 'en']
True
_hass_domain_validator
(config)
Validate platform in config for homeassistant domain.
Validate platform in config for homeassistant domain.
def _hass_domain_validator(config): """Validate platform in config for homeassistant domain.""" if CONF_PLATFORM not in config: config = {CONF_PLATFORM: HA_DOMAIN, STATES: config} return config
[ "def", "_hass_domain_validator", "(", "config", ")", ":", "if", "CONF_PLATFORM", "not", "in", "config", ":", "config", "=", "{", "CONF_PLATFORM", ":", "HA_DOMAIN", ",", "STATES", ":", "config", "}", "return", "config" ]
[ 21, 0 ]
[ 26, 17 ]
python
en
['en', 'en', 'en']
True
_platform_validator
(config)
Validate it is a valid platform.
Validate it is a valid platform.
def _platform_validator(config): """Validate it is a valid platform.""" try: platform = importlib.import_module( ".{}".format(config[CONF_PLATFORM]), __name__ ) except ImportError: try: platform = importlib.import_module( "homeassistant.compon...
[ "def", "_platform_validator", "(", "config", ")", ":", "try", ":", "platform", "=", "importlib", ".", "import_module", "(", "\".{}\"", ".", "format", "(", "config", "[", "CONF_PLATFORM", "]", ")", ",", "__name__", ")", "except", "ImportError", ":", "try", ...
[ 29, 0 ]
[ 46, 43 ]
python
en
['en', 'et', 'en']
True
async_setup
(hass, config)
Set up the scenes.
Set up the scenes.
async def async_setup(hass, config): """Set up the scenes.""" component = hass.data[DOMAIN] = EntityComponent( logging.getLogger(__name__), DOMAIN, hass ) await component.async_setup(config) # Ensure Home Assistant platform always loaded. await component.async_setup_platform(HA_DOMAIN, ...
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "component", "=", "hass", ".", "data", "[", "DOMAIN", "]", "=", "EntityComponent", "(", "logging", ".", "getLogger", "(", "__name__", ")", ",", "DOMAIN", ",", "hass", ")", "await", "c...
[ 59, 0 ]
[ 74, 15 ]
python
en
['en', 'sr', 'en']
True
async_setup_entry
(hass, entry)
Set up a config entry.
Set up a config entry.
async def async_setup_entry(hass, entry): """Set up a config entry.""" return await hass.data[DOMAIN].async_setup_entry(entry)
[ "async", "def", "async_setup_entry", "(", "hass", ",", "entry", ")", ":", "return", "await", "hass", ".", "data", "[", "DOMAIN", "]", ".", "async_setup_entry", "(", "entry", ")" ]
[ 77, 0 ]
[ 79, 59 ]
python
en
['en', 'en', 'en']
True
async_unload_entry
(hass, entry)
Unload a config entry.
Unload a config entry.
async def async_unload_entry(hass, entry): """Unload a config entry.""" return await hass.data[DOMAIN].async_unload_entry(entry)
[ "async", "def", "async_unload_entry", "(", "hass", ",", "entry", ")", ":", "return", "await", "hass", ".", "data", "[", "DOMAIN", "]", ".", "async_unload_entry", "(", "entry", ")" ]
[ 82, 0 ]
[ 84, 60 ]
python
en
['en', 'es', 'en']
True
Scene.should_poll
(self)
No polling needed.
No polling needed.
def should_poll(self) -> bool: """No polling needed.""" return False
[ "def", "should_poll", "(", "self", ")", "->", "bool", ":", "return", "False" ]
[ 91, 4 ]
[ 93, 20 ]
python
en
['en', 'en', 'en']
True
Scene.state
(self)
Return the state of the scene.
Return the state of the scene.
def state(self) -> Optional[str]: """Return the state of the scene.""" return STATE
[ "def", "state", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "return", "STATE" ]
[ 96, 4 ]
[ 98, 20 ]
python
en
['en', 'en', 'en']
True
Scene.activate
(self, **kwargs: Any)
Activate scene. Try to get entities into requested state.
Activate scene. Try to get entities into requested state.
def activate(self, **kwargs: Any) -> None: """Activate scene. Try to get entities into requested state.""" raise NotImplementedError()
[ "def", "activate", "(", "self", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "raise", "NotImplementedError", "(", ")" ]
[ 100, 4 ]
[ 102, 35 ]
python
en
['en', 'en', 'en']
True
Scene.async_activate
(self, **kwargs: Any)
Activate scene. Try to get entities into requested state.
Activate scene. Try to get entities into requested state.
async def async_activate(self, **kwargs: Any) -> None: """Activate scene. Try to get entities into requested state.""" assert self.hass task = self.hass.async_add_job(ft.partial(self.activate, **kwargs)) if task: await task
[ "async", "def", "async_activate", "(", "self", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "assert", "self", ".", "hass", "task", "=", "self", ".", "hass", ".", "async_add_job", "(", "ft", ".", "partial", "(", "self", ".", "activate"...
[ 104, 4 ]
[ 109, 22 ]
python
en
['en', 'en', 'en']
True
test_reproducing_states
(hass, caplog)
Test reproducing Alert states.
Test reproducing Alert states.
async def test_reproducing_states(hass, caplog): """Test reproducing Alert states.""" hass.states.async_set("alert.entity_off", "off", {}) hass.states.async_set("alert.entity_on", "on", {}) turn_on_calls = async_mock_service(hass, "alert", "turn_on") turn_off_calls = async_mock_service(hass, "alert...
[ "async", "def", "test_reproducing_states", "(", "hass", ",", "caplog", ")", ":", "hass", ".", "states", ".", "async_set", "(", "\"alert.entity_off\"", ",", "\"off\"", ",", "{", "}", ")", "hass", ".", "states", ".", "async_set", "(", "\"alert.entity_on\"", ",...
[ 6, 0 ]
[ 49, 69 ]
python
en
['en', 'en', 'en']
True
data_transforms_cifar10
(args)
data_transforms for cifar10 dataset
data_transforms for cifar10 dataset
def data_transforms_cifar10(args): """ data_transforms for cifar10 dataset """ cifar_mean = [0.49139968, 0.48215827, 0.44653124] cifar_std = [0.24703233, 0.24348505, 0.26158768] train_transform = transforms.Compose( [ transforms.RandomCrop(32, padding=4), transforms...
[ "def", "data_transforms_cifar10", "(", "args", ")", ":", "cifar_mean", "=", "[", "0.49139968", ",", "0.48215827", ",", "0.44653124", "]", "cifar_std", "=", "[", "0.24703233", ",", "0.24348505", ",", "0.26158768", "]", "train_transform", "=", "transforms", ".", ...
[ 115, 0 ]
[ 136, 43 ]
python
en
['en', 'no', 'en']
True
data_transforms_mnist
(args, mnist_mean=None, mnist_std=None)
data_transforms for mnist dataset
data_transforms for mnist dataset
def data_transforms_mnist(args, mnist_mean=None, mnist_std=None): """ data_transforms for mnist dataset """ if mnist_mean is None: mnist_mean = [0.5] if mnist_std is None: mnist_std = [0.5] train_transform = transforms.Compose( [ transforms.RandomCrop(28, paddin...
[ "def", "data_transforms_mnist", "(", "args", ",", "mnist_mean", "=", "None", ",", "mnist_std", "=", "None", ")", ":", "if", "mnist_mean", "is", "None", ":", "mnist_mean", "=", "[", "0.5", "]", "if", "mnist_std", "is", "None", ":", "mnist_std", "=", "[", ...
[ 139, 0 ]
[ 162, 43 ]
python
en
['en', 'no', 'en']
True
get_mean_and_std
(dataset)
Compute the mean and std value of dataset.
Compute the mean and std value of dataset.
def get_mean_and_std(dataset): """Compute the mean and std value of dataset.""" dataloader = torch.utils.data.DataLoader( dataset, batch_size=1, shuffle=True, num_workers=2 ) mean = torch.zeros(3) std = torch.zeros(3) print("==> Computing mean and std..") for inputs, _ in dataloader:...
[ "def", "get_mean_and_std", "(", "dataset", ")", ":", "dataloader", "=", "torch", ".", "utils", ".", "data", ".", "DataLoader", "(", "dataset", ",", "batch_size", "=", "1", ",", "shuffle", "=", "True", ",", "num_workers", "=", "2", ")", "mean", "=", "to...
[ 165, 0 ]
[ 179, 20 ]
python
en
['en', 'en', 'en']
True
init_params
(net)
Init layer parameters.
Init layer parameters.
def init_params(net): """Init layer parameters.""" for module in net.modules(): if isinstance(module, nn.Conv2d): init.kaiming_normal(module.weight, mode="fan_out") if module.bias: init.constant(module.bias, 0) elif isinstance(module, nn.BatchNorm2d): ...
[ "def", "init_params", "(", "net", ")", ":", "for", "module", "in", "net", ".", "modules", "(", ")", ":", "if", "isinstance", "(", "module", ",", "nn", ".", "Conv2d", ")", ":", "init", ".", "kaiming_normal", "(", "module", ".", "weight", ",", "mode", ...
[ 182, 0 ]
[ 195, 45 ]
python
en
['en', 'id', 'en']
True
EarlyStopping.step
(self, metrics)
EarlyStopping step on each epoch Arguments: metrics {float} -- metric value
EarlyStopping step on each epoch Arguments: metrics {float} -- metric value
def step(self, metrics): """ EarlyStopping step on each epoch Arguments: metrics {float} -- metric value """ if self.best is None: self.best = metrics return False if np.isnan(metrics): return True if self.is_better(metri...
[ "def", "step", "(", "self", ",", "metrics", ")", ":", "if", "self", ".", "best", "is", "None", ":", "self", ".", "best", "=", "metrics", "return", "False", "if", "np", ".", "isnan", "(", "metrics", ")", ":", "return", "True", "if", "self", ".", "...
[ 42, 4 ]
[ 64, 20 ]
python
en
['en', 'en', 'en']
True
Cutout.__call__
(self, img)
Args: img (Tensor): Tensor image of size (C, H, W). Returns: Tensor: Image with n_holes of dimension length x length cut out of it.
Args: img (Tensor): Tensor image of size (C, H, W). Returns: Tensor: Image with n_holes of dimension length x length cut out of it.
def __call__(self, img): """ Args: img (Tensor): Tensor image of size (C, H, W). Returns: Tensor: Image with n_holes of dimension length x length cut out of it. """ h_img, w_img = img.size(1), img.size(2) mask = np.ones((h_img, w_img), np.float32) ...
[ "def", "__call__", "(", "self", ",", "img", ")", ":", "h_img", ",", "w_img", "=", "img", ".", "size", "(", "1", ")", ",", "img", ".", "size", "(", "2", ")", "mask", "=", "np", ".", "ones", "(", "(", "h_img", ",", "w_img", ")", ",", "np", "....
[ 91, 4 ]
[ 112, 18 ]
python
en
['en', 'error', 'th']
False
test_form
(hass, aioclient_mock)
Test that form shows up.
Test that form shows up.
async def test_form(hass, aioclient_mock): """Test that form shows up.""" aioclient_mock.get( TEST_SYSTEM_URL, text=TEST_SYSTEM_DATA, ) result1 = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) assert result1["type"] =...
[ "async", "def", "test_form", "(", "hass", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "get", "(", "TEST_SYSTEM_URL", ",", "text", "=", "TEST_SYSTEM_DATA", ",", ")", "result1", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_...
[ 9, 0 ]
[ 48, 63 ]
python
en
['en', 'en', 'en']
True
test_form_cannot_connect
(hass, aioclient_mock)
Test we handle cannot connect error.
Test we handle cannot connect error.
async def test_form_cannot_connect(hass, aioclient_mock): """Test we handle cannot connect error.""" aioclient_mock.get( TEST_SYSTEM_URL, exc=SyntaxError, ) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) resu...
[ "async", "def", "test_form_cannot_connect", "(", "hass", ",", "aioclient_mock", ")", ":", "aioclient_mock", ".", "get", "(", "TEST_SYSTEM_URL", ",", "exc", "=", "SyntaxError", ",", ")", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", ...
[ 51, 0 ]
[ 70, 46 ]
python
en
['en', 'en', 'en']
True
patch_cluster
(cluster)
Patch a cluster for testing.
Patch a cluster for testing.
def patch_cluster(cluster): """Patch a cluster for testing.""" cluster.PLUGGED_ATTR_READS = {} async def _read_attribute_raw(attributes, *args, **kwargs): result = [] for attr_id in attributes: value = cluster.PLUGGED_ATTR_READS.get(attr_id) if value is None: ...
[ "def", "patch_cluster", "(", "cluster", ")", ":", "cluster", ".", "PLUGGED_ATTR_READS", "=", "{", "}", "async", "def", "_read_attribute_raw", "(", "attributes", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "result", "=", "[", "]", "for", "attr_id...
[ 70, 0 ]
[ 105, 49 ]
python
en
['en', 'en', 'en']
True
get_zha_gateway
(hass)
Return ZHA gateway from hass.data.
Return ZHA gateway from hass.data.
def get_zha_gateway(hass): """Return ZHA gateway from hass.data.""" try: return hass.data[zha_const.DATA_ZHA][zha_const.DATA_ZHA_GATEWAY] except KeyError: return None
[ "def", "get_zha_gateway", "(", "hass", ")", ":", "try", ":", "return", "hass", ".", "data", "[", "zha_const", ".", "DATA_ZHA", "]", "[", "zha_const", ".", "DATA_ZHA_GATEWAY", "]", "except", "KeyError", ":", "return", "None" ]
[ 138, 0 ]
[ 143, 19 ]
python
en
['en', 'sn', 'en']
True
make_attribute
(attrid, value, status=0)
Make an attribute.
Make an attribute.
def make_attribute(attrid, value, status=0): """Make an attribute.""" attr = zcl_f.Attribute() attr.attrid = attrid attr.value = zcl_f.TypeValue() attr.value.value = value return attr
[ "def", "make_attribute", "(", "attrid", ",", "value", ",", "status", "=", "0", ")", ":", "attr", "=", "zcl_f", ".", "Attribute", "(", ")", "attr", ".", "attrid", "=", "attrid", "attr", ".", "value", "=", "zcl_f", ".", "TypeValue", "(", ")", "attr", ...
[ 146, 0 ]
[ 152, 15 ]
python
en
['en', 'gd', 'en']
True
send_attribute_report
(hass, cluster, attrid, value)
Send a single attribute report.
Send a single attribute report.
def send_attribute_report(hass, cluster, attrid, value): """Send a single attribute report.""" return send_attributes_report(hass, cluster, {attrid: value})
[ "def", "send_attribute_report", "(", "hass", ",", "cluster", ",", "attrid", ",", "value", ")", ":", "return", "send_attributes_report", "(", "hass", ",", "cluster", ",", "{", "attrid", ":", "value", "}", ")" ]
[ 155, 0 ]
[ 157, 65 ]
python
en
['en', 'it', 'en']
True
send_attributes_report
(hass, cluster: int, attributes: dict)
Cause the sensor to receive an attribute report from the network. This is to simulate the normal device communication that happens when a device is paired to the zigbee network.
Cause the sensor to receive an attribute report from the network.
async def send_attributes_report(hass, cluster: int, attributes: dict): """Cause the sensor to receive an attribute report from the network. This is to simulate the normal device communication that happens when a device is paired to the zigbee network. """ attrs = [make_attribute(attrid, value) for...
[ "async", "def", "send_attributes_report", "(", "hass", ",", "cluster", ":", "int", ",", "attributes", ":", "dict", ")", ":", "attrs", "=", "[", "make_attribute", "(", "attrid", ",", "value", ")", "for", "attrid", ",", "value", "in", "attributes", ".", "i...
[ 160, 0 ]
[ 170, 38 ]
python
en
['en', 'en', 'en']
True
find_entity_id
(domain, zha_device, hass)
Find the entity id under the testing. This is used to get the entity id in order to get the state from the state machine so that we can test state changes.
Find the entity id under the testing.
async def find_entity_id(domain, zha_device, hass): """Find the entity id under the testing. This is used to get the entity id in order to get the state from the state machine so that we can test state changes. """ ieeetail = "".join([f"{o:02x}" for o in zha_device.ieee[:4]]) head = f"{domain}....
[ "async", "def", "find_entity_id", "(", "domain", ",", "zha_device", ",", "hass", ")", ":", "ieeetail", "=", "\"\"", ".", "join", "(", "[", "f\"{o:02x}\"", "for", "o", "in", "zha_device", ".", "ieee", "[", ":", "4", "]", "]", ")", "head", "=", "f\"{do...
[ 173, 0 ]
[ 188, 15 ]
python
en
['en', 'en', 'en']
True
async_find_group_entity_id
(hass, domain, group)
Find the group entity id under test.
Find the group entity id under test.
def async_find_group_entity_id(hass, domain, group): """Find the group entity id under test.""" entity_id = f"{domain}.{group.name.lower().replace(' ','_')}_zha_group_0x{group.group_id:04x}" entity_ids = hass.states.async_entity_ids(domain) if entity_id in entity_ids: return entity_id retu...
[ "def", "async_find_group_entity_id", "(", "hass", ",", "domain", ",", "group", ")", ":", "entity_id", "=", "f\"{domain}.{group.name.lower().replace(' ','_')}_zha_group_0x{group.group_id:04x}\"", "entity_ids", "=", "hass", ".", "states", ".", "async_entity_ids", "(", "domain...
[ 191, 0 ]
[ 199, 15 ]
python
en
['en', 'en', 'en']
True
async_enable_traffic
(hass, zha_devices, enabled=True)
Allow traffic to flow through the gateway and the zha device.
Allow traffic to flow through the gateway and the zha device.
async def async_enable_traffic(hass, zha_devices, enabled=True): """Allow traffic to flow through the gateway and the zha device.""" for zha_device in zha_devices: zha_device.update_available(enabled) await hass.async_block_till_done()
[ "async", "def", "async_enable_traffic", "(", "hass", ",", "zha_devices", ",", "enabled", "=", "True", ")", ":", "for", "zha_device", "in", "zha_devices", ":", "zha_device", ".", "update_available", "(", "enabled", ")", "await", "hass", ".", "async_block_till_don...
[ 202, 0 ]
[ 206, 38 ]
python
en
['en', 'en', 'en']
True
make_zcl_header
( command_id: int, global_command: bool = True, tsn: int = 1 )
Cluster.handle_message() ZCL Header helper.
Cluster.handle_message() ZCL Header helper.
def make_zcl_header( command_id: int, global_command: bool = True, tsn: int = 1 ) -> zcl_f.ZCLHeader: """Cluster.handle_message() ZCL Header helper.""" if global_command: frc = zcl_f.FrameControl(zcl_f.FrameType.GLOBAL_COMMAND) else: frc = zcl_f.FrameControl(zcl_f.FrameType.CLUSTER_COMMA...
[ "def", "make_zcl_header", "(", "command_id", ":", "int", ",", "global_command", ":", "bool", "=", "True", ",", "tsn", ":", "int", "=", "1", ")", "->", "zcl_f", ".", "ZCLHeader", ":", "if", "global_command", ":", "frc", "=", "zcl_f", ".", "FrameControl", ...
[ 209, 0 ]
[ 217, 63 ]
python
en
['en', 'nl', 'en']
True
reset_clusters
(clusters)
Reset mocks on cluster.
Reset mocks on cluster.
def reset_clusters(clusters): """Reset mocks on cluster.""" for cluster in clusters: cluster.bind.reset_mock() cluster.configure_reporting.reset_mock() cluster.write_attributes.reset_mock()
[ "def", "reset_clusters", "(", "clusters", ")", ":", "for", "cluster", "in", "clusters", ":", "cluster", ".", "bind", ".", "reset_mock", "(", ")", "cluster", ".", "configure_reporting", ".", "reset_mock", "(", ")", "cluster", ".", "write_attributes", ".", "re...
[ 220, 0 ]
[ 225, 45 ]
python
da
['et', 'da', 'en']
False
async_test_rejoin
(hass, zigpy_device, clusters, report_counts, ep_id=1)
Test device rejoins.
Test device rejoins.
async def async_test_rejoin(hass, zigpy_device, clusters, report_counts, ep_id=1): """Test device rejoins.""" reset_clusters(clusters) zha_gateway = get_zha_gateway(hass) await zha_gateway.async_device_initialized(zigpy_device) await hass.async_block_till_done() for cluster, reports in zip(clus...
[ "async", "def", "async_test_rejoin", "(", "hass", ",", "zigpy_device", ",", "clusters", ",", "report_counts", ",", "ep_id", "=", "1", ")", ":", "reset_clusters", "(", "clusters", ")", "zha_gateway", "=", "get_zha_gateway", "(", "hass", ")", "await", "zha_gatew...
[ 228, 0 ]
[ 239, 65 ]
python
da
['fr', 'da', 'en']
False
FakeEndpoint.__init__
(self, manufacturer, model, epid=1)
Init fake endpoint.
Init fake endpoint.
def __init__(self, manufacturer, model, epid=1): """Init fake endpoint.""" self.device = None self.endpoint_id = epid self.in_clusters = {} self.out_clusters = {} self._cluster_attr = {} self.member_of = {} self.status = 1 self.manufacturer = manuf...
[ "def", "__init__", "(", "self", ",", "manufacturer", ",", "model", ",", "epid", "=", "1", ")", ":", "self", ".", "device", "=", "None", "self", ".", "endpoint_id", "=", "epid", "self", ".", "in_clusters", "=", "{", "}", "self", ".", "out_clusters", "...
[ 21, 4 ]
[ 34, 50 ]
python
en
['en', 'en', 'en']
True
FakeEndpoint.add_input_cluster
(self, cluster_id, _patch_cluster=True)
Add an input cluster.
Add an input cluster.
def add_input_cluster(self, cluster_id, _patch_cluster=True): """Add an input cluster.""" cluster = zigpy.zcl.Cluster.from_id(self, cluster_id, is_server=True) if _patch_cluster: patch_cluster(cluster) self.in_clusters[cluster_id] = cluster if hasattr(cluster, "ep_att...
[ "def", "add_input_cluster", "(", "self", ",", "cluster_id", ",", "_patch_cluster", "=", "True", ")", ":", "cluster", "=", "zigpy", ".", "zcl", ".", "Cluster", ".", "from_id", "(", "self", ",", "cluster_id", ",", "is_server", "=", "True", ")", "if", "_pat...
[ 36, 4 ]
[ 43, 56 ]
python
en
['en', 'lb', 'en']
True
FakeEndpoint.add_output_cluster
(self, cluster_id, _patch_cluster=True)
Add an output cluster.
Add an output cluster.
def add_output_cluster(self, cluster_id, _patch_cluster=True): """Add an output cluster.""" cluster = zigpy.zcl.Cluster.from_id(self, cluster_id, is_server=False) if _patch_cluster: patch_cluster(cluster) self.out_clusters[cluster_id] = cluster
[ "def", "add_output_cluster", "(", "self", ",", "cluster_id", ",", "_patch_cluster", "=", "True", ")", ":", "cluster", "=", "zigpy", ".", "zcl", ".", "Cluster", ".", "from_id", "(", "self", ",", "cluster_id", ",", "is_server", "=", "False", ")", "if", "_p...
[ 45, 4 ]
[ 50, 47 ]
python
en
['en', 'en', 'en']
True
FakeEndpoint.__class__
(self)
Fake being Zigpy endpoint.
Fake being Zigpy endpoint.
def __class__(self): """Fake being Zigpy endpoint.""" return zigpy_ep
[ "def", "__class__", "(", "self", ")", ":", "return", "zigpy_ep" ]
[ 56, 4 ]
[ 58, 23 ]
python
en
['de', 'en', 'en']
True
FakeEndpoint.unique_id
(self)
Return the unique id for the endpoint.
Return the unique id for the endpoint.
def unique_id(self): """Return the unique id for the endpoint.""" return self.device.ieee, self.endpoint_id
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "device", ".", "ieee", ",", "self", ".", "endpoint_id" ]
[ 61, 4 ]
[ 63, 49 ]
python
en
['en', 'en', 'en']
True
FakeDevice.__init__
(self, app, ieee, manufacturer, model, node_desc=None, nwk=0xB79C)
Init fake device.
Init fake device.
def __init__(self, app, ieee, manufacturer, model, node_desc=None, nwk=0xB79C): """Init fake device.""" self._application = app self.application = app self.ieee = zigpy.types.EUI64.convert(ieee) self.nwk = nwk self.zdo = Mock() self.endpoints = {0: self.zdo} ...
[ "def", "__init__", "(", "self", ",", "app", ",", "ieee", ",", "manufacturer", ",", "model", ",", "node_desc", "=", "None", ",", "nwk", "=", "0xB79C", ")", ":", "self", ".", "_application", "=", "app", "self", ".", "application", "=", "app", "self", "...
[ 111, 4 ]
[ 132, 27 ]
python
en
['fr', 'en', 'en']
True
test_show_form
(hass)
Test that the form is served with no input.
Test that the form is served with no input.
async def test_show_form(hass): """Test that the form is served with no input.""" flow = config_flow.GiosFlowHandler() flow.hass = hass result = await flow.async_step_user(user_input=None) assert result["type"] == data_entry_flow.RESULT_TYPE_FORM assert result["step_id"] == "user"
[ "async", "def", "test_show_form", "(", "hass", ")", ":", "flow", "=", "config_flow", ".", "GiosFlowHandler", "(", ")", "flow", ".", "hass", "=", "hass", "result", "=", "await", "flow", ".", "async_step_user", "(", "user_input", "=", "None", ")", "assert", ...
[ 20, 0 ]
[ 28, 38 ]
python
en
['en', 'en', 'en']
True
test_invalid_station_id
(hass)
Test that errors are shown when measuring station ID is invalid.
Test that errors are shown when measuring station ID is invalid.
async def test_invalid_station_id(hass): """Test that errors are shown when measuring station ID is invalid.""" with patch( "homeassistant.components.gios.Gios._get_stations", return_value=STATIONS ): flow = config_flow.GiosFlowHandler() flow.hass = hass flow.context = {} ...
[ "async", "def", "test_invalid_station_id", "(", "hass", ")", ":", "with", "patch", "(", "\"homeassistant.components.gios.Gios._get_stations\"", ",", "return_value", "=", "STATIONS", ")", ":", "flow", "=", "config_flow", ".", "GiosFlowHandler", "(", ")", "flow", ".",...
[ 31, 0 ]
[ 44, 72 ]
python
en
['en', 'en', 'en']
True
test_invalid_sensor_data
(hass)
Test that errors are shown when sensor data is invalid.
Test that errors are shown when sensor data is invalid.
async def test_invalid_sensor_data(hass): """Test that errors are shown when sensor data is invalid.""" with patch( "homeassistant.components.gios.Gios._get_stations", return_value=STATIONS ), patch( "homeassistant.components.gios.Gios._get_station", return_value=json.loads(load_fixt...
[ "async", "def", "test_invalid_sensor_data", "(", "hass", ")", ":", "with", "patch", "(", "\"homeassistant.components.gios.Gios._get_stations\"", ",", "return_value", "=", "STATIONS", ")", ",", "patch", "(", "\"homeassistant.components.gios.Gios._get_station\"", ",", "return...
[ 47, 0 ]
[ 63, 76 ]
python
en
['en', 'en', 'en']
True
test_cannot_connect
(hass)
Test that errors are shown when cannot connect to GIOS server.
Test that errors are shown when cannot connect to GIOS server.
async def test_cannot_connect(hass): """Test that errors are shown when cannot connect to GIOS server.""" with patch( "homeassistant.components.gios.Gios._async_get", side_effect=ApiError("error") ): flow = config_flow.GiosFlowHandler() flow.hass = hass flow.context = {} ...
[ "async", "def", "test_cannot_connect", "(", "hass", ")", ":", "with", "patch", "(", "\"homeassistant.components.gios.Gios._async_get\"", ",", "side_effect", "=", "ApiError", "(", "\"error\"", ")", ")", ":", "flow", "=", "config_flow", ".", "GiosFlowHandler", "(", ...
[ 66, 0 ]
[ 77, 61 ]
python
en
['en', 'en', 'en']
True
test_create_entry
(hass)
Test that the user step works.
Test that the user step works.
async def test_create_entry(hass): """Test that the user step works.""" with patch( "homeassistant.components.gios.Gios._get_stations", return_value=STATIONS ), patch( "homeassistant.components.gios.Gios._get_station", return_value=json.loads(load_fixture("gios/station.json")), )...
[ "async", "def", "test_create_entry", "(", "hass", ")", ":", "with", "patch", "(", "\"homeassistant.components.gios.Gios._get_stations\"", ",", "return_value", "=", "STATIONS", ")", ",", "patch", "(", "\"homeassistant.components.gios.Gios._get_station\"", ",", "return_value"...
[ 80, 0 ]
[ 104, 67 ]
python
en
['en', 'en', 'en']
True
test_creating_entry_sets_up_media_player
(hass)
Test setting up Cast loads the media player.
Test setting up Cast loads the media player.
async def test_creating_entry_sets_up_media_player(hass): """Test setting up Cast loads the media player.""" with patch( "homeassistant.components.cast.media_player.async_setup_entry", return_value=True, ) as mock_setup, patch( "pychromecast.discovery.discover_chromecasts", return_va...
[ "async", "def", "test_creating_entry_sets_up_media_player", "(", "hass", ")", ":", "with", "patch", "(", "\"homeassistant.components.cast.media_player.async_setup_entry\"", ",", "return_value", "=", "True", ",", ")", "as", "mock_setup", ",", "patch", "(", "\"pychromecast....
[ 9, 0 ]
[ 31, 42 ]
python
en
['en', 'en', 'en']
True
test_configuring_cast_creates_entry
(hass)
Test that specifying config will create an entry.
Test that specifying config will create an entry.
async def test_configuring_cast_creates_entry(hass): """Test that specifying config will create an entry.""" with patch( "homeassistant.components.cast.async_setup_entry", return_value=True ) as mock_setup: await async_setup_component( hass, cast.DOMAIN, {"cast": {"some_config": ...
[ "async", "def", "test_configuring_cast_creates_entry", "(", "hass", ")", ":", "with", "patch", "(", "\"homeassistant.components.cast.async_setup_entry\"", ",", "return_value", "=", "True", ")", "as", "mock_setup", ":", "await", "async_setup_component", "(", "hass", ",",...
[ 34, 0 ]
[ 44, 42 ]
python
en
['en', 'en', 'en']
True
test_not_configuring_cast_not_creates_entry
(hass)
Test that no config will not create an entry.
Test that no config will not create an entry.
async def test_not_configuring_cast_not_creates_entry(hass): """Test that no config will not create an entry.""" with patch( "homeassistant.components.cast.async_setup_entry", return_value=True ) as mock_setup: await async_setup_component(hass, cast.DOMAIN, {}) await hass.async_block...
[ "async", "def", "test_not_configuring_cast_not_creates_entry", "(", "hass", ")", ":", "with", "patch", "(", "\"homeassistant.components.cast.async_setup_entry\"", ",", "return_value", "=", "True", ")", "as", "mock_setup", ":", "await", "async_setup_component", "(", "hass"...
[ 47, 0 ]
[ 55, 42 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass, config)
Set up an Utility Meter.
Set up an Utility Meter.
async def async_setup(hass, config): """Set up an Utility Meter.""" component = EntityComponent(_LOGGER, DOMAIN, hass) hass.data[DATA_UTILITY] = {} register_services = False for meter, conf in config.get(DOMAIN).items(): _LOGGER.debug("Setup %s.%s", DOMAIN, meter) hass.data[DATA_UT...
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "component", "=", "EntityComponent", "(", "_LOGGER", ",", "DOMAIN", ",", "hass", ")", "hass", ".", "data", "[", "DATA_UTILITY", "]", "=", "{", "}", "register_services", "=", "False", "f...
[ 60, 0 ]
[ 121, 15 ]
python
en
['en', 'en', 'en']
True
TariffSelect.__init__
(self, name, tariffs)
Initialize a tariff selector.
Initialize a tariff selector.
def __init__(self, name, tariffs): """Initialize a tariff selector.""" self._name = name self._current_tariff = None self._tariffs = tariffs self._icon = TARIFF_ICON
[ "def", "__init__", "(", "self", ",", "name", ",", "tariffs", ")", ":", "self", ".", "_name", "=", "name", "self", ".", "_current_tariff", "=", "None", "self", ".", "_tariffs", "=", "tariffs", "self", ".", "_icon", "=", "TARIFF_ICON" ]
[ 127, 4 ]
[ 132, 32 ]
python
en
['en', 'en', 'it']
True
TariffSelect.async_added_to_hass
(self)
Run when entity about to be added.
Run when entity about to be added.
async def async_added_to_hass(self): """Run when entity about to be added.""" await super().async_added_to_hass() if self._current_tariff is not None: return state = await self.async_get_last_state() if not state or state.state not in self._tariffs: self....
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "await", "super", "(", ")", ".", "async_added_to_hass", "(", ")", "if", "self", ".", "_current_tariff", "is", "not", "None", ":", "return", "state", "=", "await", "self", ".", "async_get_last_stat...
[ 134, 4 ]
[ 144, 46 ]
python
en
['en', 'en', 'en']
True
TariffSelect.should_poll
(self)
If entity should be polled.
If entity should be polled.
def should_poll(self): """If entity should be polled.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 147, 4 ]
[ 149, 20 ]
python
en
['en', 'en', 'en']
True
TariffSelect.name
(self)
Return the name of the select input.
Return the name of the select input.
def name(self): """Return the name of the select input.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 152, 4 ]
[ 154, 25 ]
python
en
['en', 'en', 'en']
True
TariffSelect.icon
(self)
Return the icon to be used for this entity.
Return the icon to be used for this entity.
def icon(self): """Return the icon to be used for this entity.""" return self._icon
[ "def", "icon", "(", "self", ")", ":", "return", "self", ".", "_icon" ]
[ 157, 4 ]
[ 159, 25 ]
python
en
['en', 'en', 'en']
True
TariffSelect.state
(self)
Return the state of the component.
Return the state of the component.
def state(self): """Return the state of the component.""" return self._current_tariff
[ "def", "state", "(", "self", ")", ":", "return", "self", ".", "_current_tariff" ]
[ 162, 4 ]
[ 164, 35 ]
python
en
['en', 'en', 'en']
True
TariffSelect.state_attributes
(self)
Return the state attributes.
Return the state attributes.
def state_attributes(self): """Return the state attributes.""" return {ATTR_TARIFFS: self._tariffs}
[ "def", "state_attributes", "(", "self", ")", ":", "return", "{", "ATTR_TARIFFS", ":", "self", ".", "_tariffs", "}" ]
[ 167, 4 ]
[ 169, 44 ]
python
en
['en', 'en', 'en']
True
TariffSelect.async_reset_meters
(self)
Reset all sensors of this meter.
Reset all sensors of this meter.
async def async_reset_meters(self): """Reset all sensors of this meter.""" _LOGGER.debug("reset meter %s", self.entity_id) async_dispatcher_send(self.hass, SIGNAL_RESET_METER, self.entity_id)
[ "async", "def", "async_reset_meters", "(", "self", ")", ":", "_LOGGER", ".", "debug", "(", "\"reset meter %s\"", ",", "self", ".", "entity_id", ")", "async_dispatcher_send", "(", "self", ".", "hass", ",", "SIGNAL_RESET_METER", ",", "self", ".", "entity_id", ")...
[ 171, 4 ]
[ 174, 76 ]
python
en
['en', 'id', 'en']
True
TariffSelect.async_select_tariff
(self, tariff)
Select new option.
Select new option.
async def async_select_tariff(self, tariff): """Select new option.""" if tariff not in self._tariffs: _LOGGER.warning( "Invalid tariff: %s (possible tariffs: %s)", tariff, ", ".join(self._tariffs), ) return self....
[ "async", "def", "async_select_tariff", "(", "self", ",", "tariff", ")", ":", "if", "tariff", "not", "in", "self", ".", "_tariffs", ":", "_LOGGER", ".", "warning", "(", "\"Invalid tariff: %s (possible tariffs: %s)\"", ",", "tariff", ",", "\", \"", ".", "join", ...
[ 176, 4 ]
[ 186, 35 ]
python
en
['en', 'ceb', 'en']
True
TariffSelect.async_next_tariff
(self)
Offset current index.
Offset current index.
async def async_next_tariff(self): """Offset current index.""" current_index = self._tariffs.index(self._current_tariff) new_index = (current_index + 1) % len(self._tariffs) self._current_tariff = self._tariffs[new_index] self.async_write_ha_state()
[ "async", "def", "async_next_tariff", "(", "self", ")", ":", "current_index", "=", "self", ".", "_tariffs", ".", "index", "(", "self", ".", "_current_tariff", ")", "new_index", "=", "(", "current_index", "+", "1", ")", "%", "len", "(", "self", ".", "_tari...
[ 188, 4 ]
[ 193, 35 ]
python
en
['en', 'da', 'en']
True
async_subscribe_topics
( hass: HomeAssistantType, new_state: Optional[Dict[str, EntitySubscription]], topics: Dict[str, Any], )
(Re)Subscribe to a set of MQTT topics. State is kept in sub_state and a dictionary mapping from the subscription key to the subscription state. Please note that the sub state must not be shared between multiple sets of topics. Every call to async_subscribe_topics must always contain _all_ the topi...
(Re)Subscribe to a set of MQTT topics.
async def async_subscribe_topics( hass: HomeAssistantType, new_state: Optional[Dict[str, EntitySubscription]], topics: Dict[str, Any], ): """(Re)Subscribe to a set of MQTT topics. State is kept in sub_state and a dictionary mapping from the subscription key to the subscription state. Pleas...
[ "async", "def", "async_subscribe_topics", "(", "hass", ":", "HomeAssistantType", ",", "new_state", ":", "Optional", "[", "Dict", "[", "str", ",", "EntitySubscription", "]", "]", ",", "topics", ":", "Dict", "[", "str", ",", "Any", "]", ",", ")", ":", "cur...
[ 65, 0 ]
[ 105, 20 ]
python
en
['en', 'en', 'en']
True
async_unsubscribe_topics
(hass: HomeAssistantType, sub_state: dict)
Unsubscribe from all MQTT topics managed by async_subscribe_topics.
Unsubscribe from all MQTT topics managed by async_subscribe_topics.
async def async_unsubscribe_topics(hass: HomeAssistantType, sub_state: dict): """Unsubscribe from all MQTT topics managed by async_subscribe_topics.""" return await async_subscribe_topics(hass, sub_state, {})
[ "async", "def", "async_unsubscribe_topics", "(", "hass", ":", "HomeAssistantType", ",", "sub_state", ":", "dict", ")", ":", "return", "await", "async_subscribe_topics", "(", "hass", ",", "sub_state", ",", "{", "}", ")" ]
[ 109, 0 ]
[ 111, 60 ]
python
en
['en', 'en', 'en']
True
format_unique_id
(app_id: str, location_id: str)
Format the unique id for a config entry.
Format the unique id for a config entry.
def format_unique_id(app_id: str, location_id: str) -> str: """Format the unique id for a config entry.""" return f"{app_id}_{location_id}"
[ "def", "format_unique_id", "(", "app_id", ":", "str", ",", "location_id", ":", "str", ")", "->", "str", ":", "return", "f\"{app_id}_{location_id}\"" ]
[ 57, 0 ]
[ 59, 36 ]
python
en
['en', 'en', 'en']
True
find_app
(hass: HomeAssistantType, api)
Find an existing SmartApp for this installation of hass.
Find an existing SmartApp for this installation of hass.
async def find_app(hass: HomeAssistantType, api): """Find an existing SmartApp for this installation of hass.""" apps = await api.apps() for app in [app for app in apps if app.app_name.startswith(APP_NAME_PREFIX)]: # Load settings to compare instance id settings = await app.settings() ...
[ "async", "def", "find_app", "(", "hass", ":", "HomeAssistantType", ",", "api", ")", ":", "apps", "=", "await", "api", ".", "apps", "(", ")", "for", "app", "in", "[", "app", "for", "app", "in", "apps", "if", "app", ".", "app_name", ".", "startswith", ...
[ 62, 0 ]
[ 72, 22 ]
python
en
['en', 'en', 'en']
True
validate_installed_app
(api, installed_app_id: str)
Ensure the specified installed SmartApp is valid and functioning. Query the API for the installed SmartApp and validate that it is tied to the specified app_id and is in an authorized state.
Ensure the specified installed SmartApp is valid and functioning.
async def validate_installed_app(api, installed_app_id: str): """ Ensure the specified installed SmartApp is valid and functioning. Query the API for the installed SmartApp and validate that it is tied to the specified app_id and is in an authorized state. """ installed_app = await api.installe...
[ "async", "def", "validate_installed_app", "(", "api", ",", "installed_app_id", ":", "str", ")", ":", "installed_app", "=", "await", "api", ".", "installed_app", "(", "installed_app_id", ")", "if", "installed_app", ".", "installed_app_status", "!=", "InstalledAppStat...
[ 75, 0 ]
[ 91, 24 ]
python
en
['en', 'error', 'th']
False
validate_webhook_requirements
(hass: HomeAssistantType)
Ensure Home Assistant is setup properly to receive webhooks.
Ensure Home Assistant is setup properly to receive webhooks.
def validate_webhook_requirements(hass: HomeAssistantType) -> bool: """Ensure Home Assistant is setup properly to receive webhooks.""" if hass.components.cloud.async_active_subscription(): return True if hass.data[DOMAIN][CONF_CLOUDHOOK_URL] is not None: return True return get_webhook_ur...
[ "def", "validate_webhook_requirements", "(", "hass", ":", "HomeAssistantType", ")", "->", "bool", ":", "if", "hass", ".", "components", ".", "cloud", ".", "async_active_subscription", "(", ")", ":", "return", "True", "if", "hass", ".", "data", "[", "DOMAIN", ...
[ 94, 0 ]
[ 100, 63 ]
python
en
['en', 'en', 'en']
True
get_webhook_url
(hass: HomeAssistantType)
Get the URL of the webhook. Return the cloudhook if available, otherwise local webhook.
Get the URL of the webhook.
def get_webhook_url(hass: HomeAssistantType) -> str: """ Get the URL of the webhook. Return the cloudhook if available, otherwise local webhook. """ cloudhook_url = hass.data[DOMAIN][CONF_CLOUDHOOK_URL] if hass.components.cloud.async_active_subscription() and cloudhook_url is not None: ...
[ "def", "get_webhook_url", "(", "hass", ":", "HomeAssistantType", ")", "->", "str", ":", "cloudhook_url", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "CONF_CLOUDHOOK_URL", "]", "if", "hass", ".", "components", ".", "cloud", ".", "async_active_subscriptio...
[ 103, 0 ]
[ 112, 79 ]
python
en
['en', 'error', 'th']
False
create_app
(hass: HomeAssistantType, api)
Create a SmartApp for this instance of hass.
Create a SmartApp for this instance of hass.
async def create_app(hass: HomeAssistantType, api): """Create a SmartApp for this instance of hass.""" # Create app from template attributes template = _get_app_template(hass) app = App() for key, value in template.items(): setattr(app, key, value) app, client = await api.create_app(app)...
[ "async", "def", "create_app", "(", "hass", ":", "HomeAssistantType", ",", "api", ")", ":", "# Create app from template attributes", "template", "=", "_get_app_template", "(", "hass", ")", "app", "=", "App", "(", ")", "for", "key", ",", "value", "in", "template...
[ 137, 0 ]
[ 162, 22 ]
python
en
['en', 'en', 'en']
True
update_app
(hass: HomeAssistantType, app)
Ensure the SmartApp is up-to-date and update if necessary.
Ensure the SmartApp is up-to-date and update if necessary.
async def update_app(hass: HomeAssistantType, app): """Ensure the SmartApp is up-to-date and update if necessary.""" template = _get_app_template(hass) template.pop("app_name") # don't update this update_required = False for key, value in template.items(): if getattr(app, key) != value: ...
[ "async", "def", "update_app", "(", "hass", ":", "HomeAssistantType", ",", "app", ")", ":", "template", "=", "_get_app_template", "(", "hass", ")", "template", ".", "pop", "(", "\"app_name\"", ")", "# don't update this", "update_required", "=", "False", "for", ...
[ 165, 0 ]
[ 178, 9 ]
python
en
['en', 'en', 'en']
True
setup_smartapp
(hass, app)
Configure an individual SmartApp in hass. Register the SmartApp with the SmartAppManager so that hass will service lifecycle events (install, event, etc...). A unique SmartApp is created for each SmartThings account that is configured in hass.
Configure an individual SmartApp in hass.
def setup_smartapp(hass, app): """ Configure an individual SmartApp in hass. Register the SmartApp with the SmartAppManager so that hass will service lifecycle events (install, event, etc...). A unique SmartApp is created for each SmartThings account that is configured in hass. """ manager...
[ "def", "setup_smartapp", "(", "hass", ",", "app", ")", ":", "manager", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "DATA_MANAGER", "]", "smartapp", "=", "manager", ".", "smartapps", ".", "get", "(", "app", ".", "app_id", ")", "if", "smartapp", ...
[ 181, 0 ]
[ 198, 19 ]
python
en
['en', 'error', 'th']
False
setup_smartapp_endpoint
(hass: HomeAssistantType)
Configure the SmartApp webhook in hass. SmartApps are an extension point within the SmartThings ecosystem and is used to receive push updates (i.e. device updates) from the cloud.
Configure the SmartApp webhook in hass.
async def setup_smartapp_endpoint(hass: HomeAssistantType): """ Configure the SmartApp webhook in hass. SmartApps are an extension point within the SmartThings ecosystem and is used to receive push updates (i.e. device updates) from the cloud. """ data = hass.data.get(DOMAIN) if data: ...
[ "async", "def", "setup_smartapp_endpoint", "(", "hass", ":", "HomeAssistantType", ")", ":", "data", "=", "hass", ".", "data", ".", "get", "(", "DOMAIN", ")", "if", "data", ":", "# already setup", "return", "# Get/create config to store a unique id for this hass instan...
[ 201, 0 ]
[ 275, 5 ]
python
en
['en', 'error', 'th']
False
unload_smartapp_endpoint
(hass: HomeAssistantType)
Tear down the component configuration.
Tear down the component configuration.
async def unload_smartapp_endpoint(hass: HomeAssistantType): """Tear down the component configuration.""" if DOMAIN not in hass.data: return # Remove the cloudhook if it was created cloudhook_url = hass.data[DOMAIN][CONF_CLOUDHOOK_URL] if cloudhook_url and hass.components.cloud.async_is_logg...
[ "async", "def", "unload_smartapp_endpoint", "(", "hass", ":", "HomeAssistantType", ")", ":", "if", "DOMAIN", "not", "in", "hass", ".", "data", ":", "return", "# Remove the cloudhook if it was created", "cloudhook_url", "=", "hass", ".", "data", "[", "DOMAIN", "]",...
[ 278, 0 ]
[ 306, 25 ]
python
en
['en', 'en', 'en']
True
smartapp_sync_subscriptions
( hass: HomeAssistantType, auth_token: str, location_id: str, installed_app_id: str, devices, )
Synchronize subscriptions of an installed up.
Synchronize subscriptions of an installed up.
async def smartapp_sync_subscriptions( hass: HomeAssistantType, auth_token: str, location_id: str, installed_app_id: str, devices, ): """Synchronize subscriptions of an installed up.""" api = SmartThings(async_get_clientsession(hass), auth_token) tasks = [] async def create_subscrip...
[ "async", "def", "smartapp_sync_subscriptions", "(", "hass", ":", "HomeAssistantType", ",", "auth_token", ":", "str", ",", "location_id", ":", "str", ",", "installed_app_id", ":", "str", ",", "devices", ",", ")", ":", "api", "=", "SmartThings", "(", "async_get_...
[ 309, 0 ]
[ 395, 84 ]
python
en
['en', 'en', 'en']
True
_continue_flow
( hass: HomeAssistantType, app_id: str, location_id: str, installed_app_id: str, refresh_token: str, )
Continue a config flow if one is in progress for the specific installed app.
Continue a config flow if one is in progress for the specific installed app.
async def _continue_flow( hass: HomeAssistantType, app_id: str, location_id: str, installed_app_id: str, refresh_token: str, ): """Continue a config flow if one is in progress for the specific installed app.""" unique_id = format_unique_id(app_id, location_id) flow = next( ( ...
[ "async", "def", "_continue_flow", "(", "hass", ":", "HomeAssistantType", ",", "app_id", ":", "str", ",", "location_id", ":", "str", ",", "installed_app_id", ":", "str", ",", "refresh_token", ":", "str", ",", ")", ":", "unique_id", "=", "format_unique_id", "(...
[ 398, 0 ]
[ 428, 9 ]
python
en
['en', 'en', 'en']
True
smartapp_install
(hass: HomeAssistantType, req, resp, app)
Handle a SmartApp installation and continue the config flow.
Handle a SmartApp installation and continue the config flow.
async def smartapp_install(hass: HomeAssistantType, req, resp, app): """Handle a SmartApp installation and continue the config flow.""" await _continue_flow( hass, app.app_id, req.location_id, req.installed_app_id, req.refresh_token ) _LOGGER.debug( "Installed SmartApp '%s' under parent ...
[ "async", "def", "smartapp_install", "(", "hass", ":", "HomeAssistantType", ",", "req", ",", "resp", ",", "app", ")", ":", "await", "_continue_flow", "(", "hass", ",", "app", ".", "app_id", ",", "req", ".", "location_id", ",", "req", ".", "installed_app_id"...
[ 431, 0 ]
[ 440, 5 ]
python
en
['en', 'en', 'en']
True
smartapp_update
(hass: HomeAssistantType, req, resp, app)
Handle a SmartApp update and either update the entry or continue the flow.
Handle a SmartApp update and either update the entry or continue the flow.
async def smartapp_update(hass: HomeAssistantType, req, resp, app): """Handle a SmartApp update and either update the entry or continue the flow.""" entry = next( ( entry for entry in hass.config_entries.async_entries(DOMAIN) if entry.data.get(CONF_INSTALLED_APP_ID) =...
[ "async", "def", "smartapp_update", "(", "hass", ":", "HomeAssistantType", ",", "req", ",", "resp", ",", "app", ")", ":", "entry", "=", "next", "(", "(", "entry", "for", "entry", "in", "hass", ".", "config_entries", ".", "async_entries", "(", "DOMAIN", ")...
[ 443, 0 ]
[ 469, 5 ]
python
en
['en', 'en', 'en']
True
smartapp_uninstall
(hass: HomeAssistantType, req, resp, app)
Handle when a SmartApp is removed from a location by the user. Find and delete the config entry representing the integration.
Handle when a SmartApp is removed from a location by the user.
async def smartapp_uninstall(hass: HomeAssistantType, req, resp, app): """ Handle when a SmartApp is removed from a location by the user. Find and delete the config entry representing the integration. """ entry = next( ( entry for entry in hass.config_entries.async_e...
[ "async", "def", "smartapp_uninstall", "(", "hass", ":", "HomeAssistantType", ",", "req", ",", "resp", ",", "app", ")", ":", "entry", "=", "next", "(", "(", "entry", "for", "entry", "in", "hass", ".", "config_entries", ".", "async_entries", "(", "DOMAIN", ...
[ 472, 0 ]
[ 495, 5 ]
python
en
['en', 'error', 'th']
False
smartapp_webhook
(hass: HomeAssistantType, webhook_id: str, request)
Handle a smartapp lifecycle event callback from SmartThings. Requests from SmartThings are digitally signed and the SmartAppManager validates the signature for authenticity.
Handle a smartapp lifecycle event callback from SmartThings.
async def smartapp_webhook(hass: HomeAssistantType, webhook_id: str, request): """ Handle a smartapp lifecycle event callback from SmartThings. Requests from SmartThings are digitally signed and the SmartAppManager validates the signature for authenticity. """ manager = hass.data[DOMAIN][DATA_M...
[ "async", "def", "smartapp_webhook", "(", "hass", ":", "HomeAssistantType", ",", "webhook_id", ":", "str", ",", "request", ")", ":", "manager", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "DATA_MANAGER", "]", "data", "=", "await", "request", ".", "...
[ 498, 0 ]
[ 508, 36 ]
python
en
['en', 'error', 'th']
False
PickledCorpusReader.__init__
(self, root, fileids=PKL_PATTERN, **kwargs)
Initialize the corpus reader. Categorization arguments (``cat_pattern``, ``cat_map``, and ``cat_file``) are passed to the ``CategorizedCorpusReader`` constructor. The remaining arguments are passed to the ``CorpusReader`` constructor.
Initialize the corpus reader. Categorization arguments (``cat_pattern``, ``cat_map``, and ``cat_file``) are passed to the ``CategorizedCorpusReader`` constructor. The remaining arguments are passed to the ``CorpusReader`` constructor.
def __init__(self, root, fileids=PKL_PATTERN, **kwargs): """ Initialize the corpus reader. Categorization arguments (``cat_pattern``, ``cat_map``, and ``cat_file``) are passed to the ``CategorizedCorpusReader`` constructor. The remaining arguments are passed to the ``CorpusRead...
[ "def", "__init__", "(", "self", ",", "root", ",", "fileids", "=", "PKL_PATTERN", ",", "*", "*", "kwargs", ")", ":", "# Add the default category pattern if not passed into the class.", "if", "not", "any", "(", "key", ".", "startswith", "(", "'cat_'", ")", "for", ...
[ 18, 4 ]
[ 34, 46 ]
python
en
['en', 'error', 'th']
False
PickledCorpusReader._resolve
(self, fileids, categories)
Returns a list of fileids or categories depending on what is passed to each internal corpus reader function. This primarily bubbles up to the high level ``docs`` method, but is implemented here similar to the nltk ``CategorizedPlaintextCorpusReader``.
Returns a list of fileids or categories depending on what is passed to each internal corpus reader function. This primarily bubbles up to the high level ``docs`` method, but is implemented here similar to the nltk ``CategorizedPlaintextCorpusReader``.
def _resolve(self, fileids, categories): """ Returns a list of fileids or categories depending on what is passed to each internal corpus reader function. This primarily bubbles up to the high level ``docs`` method, but is implemented here similar to the nltk ``CategorizedPlaintex...
[ "def", "_resolve", "(", "self", ",", "fileids", ",", "categories", ")", ":", "if", "fileids", "is", "not", "None", "and", "categories", "is", "not", "None", ":", "raise", "ValueError", "(", "\"Specify fileids or categories, not both\"", ")", "if", "categories", ...
[ 36, 4 ]
[ 48, 22 ]
python
en
['en', 'error', 'th']
False
PickledCorpusReader.docs
(self, fileids=None, categories=None)
Returns the document loaded from a pickled object for every file in the corpus. Similar to the BaleenCorpusReader, this uses a generator to acheive memory safe iteration.
Returns the document loaded from a pickled object for every file in the corpus. Similar to the BaleenCorpusReader, this uses a generator to acheive memory safe iteration.
def docs(self, fileids=None, categories=None): """ Returns the document loaded from a pickled object for every file in the corpus. Similar to the BaleenCorpusReader, this uses a generator to acheive memory safe iteration. """ # Resolve the fileids and the categories ...
[ "def", "docs", "(", "self", ",", "fileids", "=", "None", ",", "categories", "=", "None", ")", ":", "# Resolve the fileids and the categories", "fileids", "=", "self", ".", "_resolve", "(", "fileids", ",", "categories", ")", "# Create a generator, loading one documen...
[ 54, 4 ]
[ 66, 36 ]
python
en
['en', 'error', 'th']
False
PickledCorpusReader.paras
(self, fileids=None, categories=None)
Returns a generator of paragraphs where each paragraph is a list of sentences, which is in turn a list of (token, tag) tuples.
Returns a generator of paragraphs where each paragraph is a list of sentences, which is in turn a list of (token, tag) tuples.
def paras(self, fileids=None, categories=None): """ Returns a generator of paragraphs where each paragraph is a list of sentences, which is in turn a list of (token, tag) tuples. """ for doc in self.docs(fileids, categories): for paragraph in doc: yiel...
[ "def", "paras", "(", "self", ",", "fileids", "=", "None", ",", "categories", "=", "None", ")", ":", "for", "doc", "in", "self", ".", "docs", "(", "fileids", ",", "categories", ")", ":", "for", "paragraph", "in", "doc", ":", "yield", "paragraph" ]
[ 68, 4 ]
[ 75, 31 ]
python
en
['en', 'error', 'th']
False
PickledCorpusReader.sents
(self, fileids=None, categories=None)
Returns a generator of sentences where each sentence is a list of (token, tag) tuples.
Returns a generator of sentences where each sentence is a list of (token, tag) tuples.
def sents(self, fileids=None, categories=None): """ Returns a generator of sentences where each sentence is a list of (token, tag) tuples. """ for paragraph in self.paras(fileids, categories): for sentence in paragraph: yield sentence
[ "def", "sents", "(", "self", ",", "fileids", "=", "None", ",", "categories", "=", "None", ")", ":", "for", "paragraph", "in", "self", ".", "paras", "(", "fileids", ",", "categories", ")", ":", "for", "sentence", "in", "paragraph", ":", "yield", "senten...
[ 77, 4 ]
[ 84, 30 ]
python
en
['en', 'error', 'th']
False
PickledCorpusReader.words
(self, fileids=None, categories=None)
Returns a generator of (token, tag) tuples.
Returns a generator of (token, tag) tuples.
def words(self, fileids=None, categories=None): """ Returns a generator of (token, tag) tuples. """ for token in self.tagged(fileids, categories): yield token[0]
[ "def", "words", "(", "self", ",", "fileids", "=", "None", ",", "categories", "=", "None", ")", ":", "for", "token", "in", "self", ".", "tagged", "(", "fileids", ",", "categories", ")", ":", "yield", "token", "[", "0", "]" ]
[ 91, 4 ]
[ 96, 26 ]
python
en
['en', 'error', 'th']
False
test_show_user_form
(hass: HomeAssistant)
Test that the user set up form is served.
Test that the user set up form is served.
async def test_show_user_form(hass: HomeAssistant) -> None: """Test that the user set up form is served.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, ) assert result["step_id"] == "user" assert result["type"] == RESULT_TYPE_FORM
[ "async", "def", "test_show_user_form", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "SOURCE_USER"...
[ 23, 0 ]
[ 31, 45 ]
python
en
['en', 'en', 'en']
True
test_show_zeroconf_form
( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker )
Test that the zeroconf confirmation form is served.
Test that the zeroconf confirmation form is served.
async def test_show_zeroconf_form( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker ) -> None: """Test that the zeroconf confirmation form is served.""" mock_connection(aioclient_mock) discovery_info = MOCK_ZEROCONF_IPP_SERVICE_INFO.copy() result = await hass.config_entries.flow.async_init(...
[ "async", "def", "test_show_zeroconf_form", "(", "hass", ":", "HomeAssistant", ",", "aioclient_mock", ":", "AiohttpClientMocker", ")", "->", "None", ":", "mock_connection", "(", "aioclient_mock", ")", "discovery_info", "=", "MOCK_ZEROCONF_IPP_SERVICE_INFO", ".", "copy", ...
[ 34, 0 ]
[ 49, 84 ]
python
en
['en', 'en', 'en']
True
test_connection_error
( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker )
Test we show user form on IPP connection error.
Test we show user form on IPP connection error.
async def test_connection_error( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker ) -> None: """Test we show user form on IPP connection error.""" mock_connection(aioclient_mock, conn_error=True) user_input = MOCK_USER_INPUT.copy() result = await hass.config_entries.flow.async_init( ...
[ "async", "def", "test_connection_error", "(", "hass", ":", "HomeAssistant", ",", "aioclient_mock", ":", "AiohttpClientMocker", ")", "->", "None", ":", "mock_connection", "(", "aioclient_mock", ",", "conn_error", "=", "True", ")", "user_input", "=", "MOCK_USER_INPUT"...
[ 52, 0 ]
[ 67, 57 ]
python
en
['en', 'en', 'en']
True
test_zeroconf_connection_error
( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker )
Test we abort zeroconf flow on IPP connection error.
Test we abort zeroconf flow on IPP connection error.
async def test_zeroconf_connection_error( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker ) -> None: """Test we abort zeroconf flow on IPP connection error.""" mock_connection(aioclient_mock, conn_error=True) discovery_info = MOCK_ZEROCONF_IPP_SERVICE_INFO.copy() result = await hass.config...
[ "async", "def", "test_zeroconf_connection_error", "(", "hass", ":", "HomeAssistant", ",", "aioclient_mock", ":", "AiohttpClientMocker", ")", "->", "None", ":", "mock_connection", "(", "aioclient_mock", ",", "conn_error", "=", "True", ")", "discovery_info", "=", "MOC...
[ 70, 0 ]
[ 84, 47 ]
python
en
['en', 'de', 'en']
True
test_zeroconf_confirm_connection_error
( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker )
Test we abort zeroconf flow on IPP connection error.
Test we abort zeroconf flow on IPP connection error.
async def test_zeroconf_confirm_connection_error( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker ) -> None: """Test we abort zeroconf flow on IPP connection error.""" mock_connection(aioclient_mock, conn_error=True) discovery_info = MOCK_ZEROCONF_IPP_SERVICE_INFO.copy() result = await has...
[ "async", "def", "test_zeroconf_confirm_connection_error", "(", "hass", ":", "HomeAssistant", ",", "aioclient_mock", ":", "AiohttpClientMocker", ")", "->", "None", ":", "mock_connection", "(", "aioclient_mock", ",", "conn_error", "=", "True", ")", "discovery_info", "="...
[ 87, 0 ]
[ 99, 47 ]
python
en
['en', 'de', 'en']
True
test_user_connection_upgrade_required
( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker )
Test we show the user form if connection upgrade required by server.
Test we show the user form if connection upgrade required by server.
async def test_user_connection_upgrade_required( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker ) -> None: """Test we show the user form if connection upgrade required by server.""" mock_connection(aioclient_mock, conn_upgrade_error=True) user_input = MOCK_USER_INPUT.copy() result = await...
[ "async", "def", "test_user_connection_upgrade_required", "(", "hass", ":", "HomeAssistant", ",", "aioclient_mock", ":", "AiohttpClientMocker", ")", "->", "None", ":", "mock_connection", "(", "aioclient_mock", ",", "conn_upgrade_error", "=", "True", ")", "user_input", ...
[ 102, 0 ]
[ 117, 61 ]
python
en
['en', 'en', 'en']
True
test_zeroconf_connection_upgrade_required
( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker )
Test we abort zeroconf flow on IPP connection error.
Test we abort zeroconf flow on IPP connection error.
async def test_zeroconf_connection_upgrade_required( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker ) -> None: """Test we abort zeroconf flow on IPP connection error.""" mock_connection(aioclient_mock, conn_upgrade_error=True) discovery_info = MOCK_ZEROCONF_IPP_SERVICE_INFO.copy() result ...
[ "async", "def", "test_zeroconf_connection_upgrade_required", "(", "hass", ":", "HomeAssistant", ",", "aioclient_mock", ":", "AiohttpClientMocker", ")", "->", "None", ":", "mock_connection", "(", "aioclient_mock", ",", "conn_upgrade_error", "=", "True", ")", "discovery_i...
[ 120, 0 ]
[ 134, 51 ]
python
en
['en', 'de', 'en']
True
test_user_parse_error
( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker )
Test we abort user flow on IPP parse error.
Test we abort user flow on IPP parse error.
async def test_user_parse_error( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker ) -> None: """Test we abort user flow on IPP parse error.""" mock_connection(aioclient_mock, parse_error=True) user_input = MOCK_USER_INPUT.copy() result = await hass.config_entries.flow.async_init( DO...
[ "async", "def", "test_user_parse_error", "(", "hass", ":", "HomeAssistant", ",", "aioclient_mock", ":", "AiohttpClientMocker", ")", "->", "None", ":", "mock_connection", "(", "aioclient_mock", ",", "parse_error", "=", "True", ")", "user_input", "=", "MOCK_USER_INPUT...
[ 137, 0 ]
[ 151, 44 ]
python
en
['en', 'de', 'en']
True
test_zeroconf_parse_error
( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker )
Test we abort zeroconf flow on IPP parse error.
Test we abort zeroconf flow on IPP parse error.
async def test_zeroconf_parse_error( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker ) -> None: """Test we abort zeroconf flow on IPP parse error.""" mock_connection(aioclient_mock, parse_error=True) discovery_info = MOCK_ZEROCONF_IPP_SERVICE_INFO.copy() result = await hass.config_entries....
[ "async", "def", "test_zeroconf_parse_error", "(", "hass", ":", "HomeAssistant", ",", "aioclient_mock", ":", "AiohttpClientMocker", ")", "->", "None", ":", "mock_connection", "(", "aioclient_mock", ",", "parse_error", "=", "True", ")", "discovery_info", "=", "MOCK_ZE...
[ 154, 0 ]
[ 168, 44 ]
python
de
['de', 'de', 'en']
True
test_user_ipp_error
( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker )
Test we abort the user flow on IPP error.
Test we abort the user flow on IPP error.
async def test_user_ipp_error( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker ) -> None: """Test we abort the user flow on IPP error.""" mock_connection(aioclient_mock, ipp_error=True) user_input = MOCK_USER_INPUT.copy() result = await hass.config_entries.flow.async_init( DOMAIN, ...
[ "async", "def", "test_user_ipp_error", "(", "hass", ":", "HomeAssistant", ",", "aioclient_mock", ":", "AiohttpClientMocker", ")", "->", "None", ":", "mock_connection", "(", "aioclient_mock", ",", "ipp_error", "=", "True", ")", "user_input", "=", "MOCK_USER_INPUT", ...
[ 171, 0 ]
[ 185, 42 ]
python
en
['en', 'nl', 'en']
True
test_zeroconf_ipp_error
( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker )
Test we abort zeroconf flow on IPP error.
Test we abort zeroconf flow on IPP error.
async def test_zeroconf_ipp_error( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker ) -> None: """Test we abort zeroconf flow on IPP error.""" mock_connection(aioclient_mock, ipp_error=True) discovery_info = MOCK_ZEROCONF_IPP_SERVICE_INFO.copy() result = await hass.config_entries.flow.async...
[ "async", "def", "test_zeroconf_ipp_error", "(", "hass", ":", "HomeAssistant", ",", "aioclient_mock", ":", "AiohttpClientMocker", ")", "->", "None", ":", "mock_connection", "(", "aioclient_mock", ",", "ipp_error", "=", "True", ")", "discovery_info", "=", "MOCK_ZEROCO...
[ 188, 0 ]
[ 202, 42 ]
python
en
['en', 'nl', 'en']
True