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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
GrassAzureExecutor.clean | (self) | Delete running jobs, schedule and containers of the MARO Cluster.
Returns:
None.
| Delete running jobs, schedule and containers of the MARO Cluster. | def clean(self) -> None:
"""Delete running jobs, schedule and containers of the MARO Cluster.
Returns:
None.
"""
# Remote clean jobs
self.master_api_client.clean_jobs() | [
"def",
"clean",
"(",
"self",
")",
"->",
"None",
":",
"# Remote clean jobs",
"self",
".",
"master_api_client",
".",
"clean_jobs",
"(",
")"
] | [
846,
4
] | [
853,
43
] | python | en | ['en', 'en', 'en'] | True |
GrassAzureExecutor._delete_resources | (resource_group: str, cluster_id: int, resource_name: str) | Delete resources in the resource group.
Args:
resource_group (str): name of the resource group.
cluster_id (id): id of the MARO Cluster.
resource_name (str): name of the MARO Resource. e.g. node_name
Returns:
None.
| Delete resources in the resource group. | def _delete_resources(resource_group: str, cluster_id: int, resource_name: str) -> None:
"""Delete resources in the resource group.
Args:
resource_group (str): name of the resource group.
cluster_id (id): id of the MARO Cluster.
resource_name (str): name of the MARO ... | [
"def",
"_delete_resources",
"(",
"resource_group",
":",
"str",
",",
"cluster_id",
":",
"int",
",",
"resource_name",
":",
"str",
")",
"->",
"None",
":",
"# Get resource list",
"resource_list",
"=",
"AzureController",
".",
"list_resources",
"(",
"resource_group",
"=... | [
858,
4
] | [
880,
72
] | python | en | ['en', 'en', 'en'] | True |
ArmTemplateParameterBuilder.create_vnet | (cluster_details: dict, export_path: str) | Create parameters file for vnet.
Args:
cluster_details (dict): details of the MARO Cluster.
export_path (str): location to export the parameter file.
Returns:
dict: parameter dict, should be exported to json.
| Create parameters file for vnet. | def create_vnet(cluster_details: dict, export_path: str) -> dict:
"""Create parameters file for vnet.
Args:
cluster_details (dict): details of the MARO Cluster.
export_path (str): location to export the parameter file.
Returns:
dict: parameter dict, should b... | [
"def",
"create_vnet",
"(",
"cluster_details",
":",
"dict",
",",
"export_path",
":",
"str",
")",
"->",
"dict",
":",
"# Load and update parameters",
"with",
"open",
"(",
"file",
"=",
"f\"{GrassPaths.ABS_MARO_GRASS_LIB}/modes/azure/create_vnet/parameters.json\"",
",",
"mode"... | [
890,
4
] | [
913,
30
] | python | en | ['da', 'en', 'en'] | True |
ArmTemplateParameterBuilder.create_master | (cluster_details: dict, node_size: str, export_path: str) | Create parameters file for MARO Master VM.
Args:
cluster_details (dict): details of the MARO Cluster.
node_size (str): node_size of the MARO Master VM.
export_path (str): path to export the parameter file.
Returns:
dict: parameter dict, should be exporte... | Create parameters file for MARO Master VM. | def create_master(cluster_details: dict, node_size: str, export_path: str) -> dict:
"""Create parameters file for MARO Master VM.
Args:
cluster_details (dict): details of the MARO Cluster.
node_size (str): node_size of the MARO Master VM.
export_path (str): path to e... | [
"def",
"create_master",
"(",
"cluster_details",
":",
"dict",
",",
"node_size",
":",
"str",
",",
"export_path",
":",
"str",
")",
"->",
"dict",
":",
"# Load and update parameters",
"with",
"open",
"(",
"file",
"=",
"f\"{GrassPaths.ABS_MARO_GRASS_LIB}/modes/azure/create_... | [
916,
4
] | [
949,
30
] | python | en | ['en', 'en', 'en'] | True |
ArmTemplateParameterBuilder.create_build_node_image_vm | (cluster_details: dict, node_size: str, export_path: str) | Create parameters file for Build Image Node VM.
Args:
cluster_details (dict): details of the MARO Cluster.
node_size (str): node_size of the Build Image Node VM.
export_path (str): path to export the parameter file.
Returns:
dict: parameter dict, should ... | Create parameters file for Build Image Node VM. | def create_build_node_image_vm(cluster_details: dict, node_size: str, export_path: str) -> dict:
"""Create parameters file for Build Image Node VM.
Args:
cluster_details (dict): details of the MARO Cluster.
node_size (str): node_size of the Build Image Node VM.
expor... | [
"def",
"create_build_node_image_vm",
"(",
"cluster_details",
":",
"dict",
",",
"node_size",
":",
"str",
",",
"export_path",
":",
"str",
")",
"->",
"dict",
":",
"# Load and update parameters",
"with",
"open",
"(",
"file",
"=",
"f\"{GrassPaths.ABS_MARO_GRASS_LIB}/modes/... | [
952,
4
] | [
987,
30
] | python | en | ['en', 'da', 'en'] | True |
ArmTemplateParameterBuilder.create_node | (node_name: str, cluster_details: dict, node_size: str, export_path: str) | Create parameters file for MARO Node VM.
Args:
cluster_details (dict): details of the MARO Cluster.
node_name (str): name of the MARO Node.
node_size (str): node_size of the MARO Node VM.
export_path (str): path to export the parameter file.
Returns:
... | Create parameters file for MARO Node VM. | def create_node(node_name: str, cluster_details: dict, node_size: str, export_path: str) -> dict:
"""Create parameters file for MARO Node VM.
Args:
cluster_details (dict): details of the MARO Cluster.
node_name (str): name of the MARO Node.
node_size (str): node_size... | [
"def",
"create_node",
"(",
"node_name",
":",
"str",
",",
"cluster_details",
":",
"dict",
",",
"node_size",
":",
"str",
",",
"export_path",
":",
"str",
")",
"->",
"dict",
":",
"# Load and update parameters",
"with",
"open",
"(",
"file",
"=",
"f\"{GrassPaths.ABS... | [
990,
4
] | [
1027,
30
] | python | en | ['en', 'en', 'en'] | True |
test_deprecated_base_class | (caplog) | Test deprecated base class. | Test deprecated base class. | def test_deprecated_base_class(caplog):
"""Test deprecated base class."""
class CustomCover(cover.CoverDevice):
pass
CustomCover()
assert "CoverDevice is deprecated, modify CustomCover" in caplog.text | [
"def",
"test_deprecated_base_class",
"(",
"caplog",
")",
":",
"class",
"CustomCover",
"(",
"cover",
".",
"CoverDevice",
")",
":",
"pass",
"CustomCover",
"(",
")",
"assert",
"\"CoverDevice is deprecated, modify CustomCover\"",
"in",
"caplog",
".",
"text"
] | [
4,
0
] | [
11,
73
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass, entry, async_add_entities) | Set up the StarLine sensors. | Set up the StarLine sensors. | async def async_setup_entry(hass, entry, async_add_entities):
"""Set up the StarLine sensors."""
account: StarlineAccount = hass.data[DOMAIN][entry.entry_id]
entities = []
for device in account.api.devices.values():
for key, value in SENSOR_TYPES.items():
if key in device.car_state:
... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"entry",
",",
"async_add_entities",
")",
":",
"account",
":",
"StarlineAccount",
"=",
"hass",
".",
"data",
"[",
"DOMAIN",
"]",
"[",
"entry",
".",
"entry_id",
"]",
"entities",
"=",
"[",
"]",
"for",
"d... | [
22,
0
] | [
32,
32
] | python | en | ['en', 'bs', 'en'] | True |
StarlineSensor.__init__ | (
self,
account: StarlineAccount,
device: StarlineDevice,
key: str,
name: str,
device_class: str,
) | Initialize sensor. | Initialize sensor. | def __init__(
self,
account: StarlineAccount,
device: StarlineDevice,
key: str,
name: str,
device_class: str,
):
"""Initialize sensor."""
super().__init__(account, device, key, name)
self._device_class = device_class | [
"def",
"__init__",
"(",
"self",
",",
"account",
":",
"StarlineAccount",
",",
"device",
":",
"StarlineDevice",
",",
"key",
":",
"str",
",",
"name",
":",
"str",
",",
"device_class",
":",
"str",
",",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"a... | [
38,
4
] | [
48,
41
] | python | en | ['en', 'ro', 'it'] | False |
StarlineSensor.device_class | (self) | Return the class of the binary sensor. | Return the class of the binary sensor. | def device_class(self):
"""Return the class of the binary sensor."""
return self._device_class | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device_class"
] | [
51,
4
] | [
53,
33
] | python | en | ['en', 'tg', 'en'] | True |
StarlineSensor.is_on | (self) | Return the state of the binary sensor. | Return the state of the binary sensor. | def is_on(self):
"""Return the state of the binary sensor."""
return self._device.car_state.get(self._key) | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device",
".",
"car_state",
".",
"get",
"(",
"self",
".",
"_key",
")"
] | [
56,
4
] | [
58,
52
] | python | en | ['en', 'ig', 'en'] | True |
async_setup_entry | (
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
) | Set up the cameras. | Set up the cameras. | async def async_setup_entry(
hass: HomeAssistantType, entry: ConfigEntry, async_add_entities
) -> None:
"""Set up the cameras."""
if DATA_SDM not in entry.data:
await async_setup_legacy_entry(hass, entry, async_add_entities)
return
await async_setup_sdm_entry(hass, entry, async_add_entit... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entry",
":",
"ConfigEntry",
",",
"async_add_entities",
")",
"->",
"None",
":",
"if",
"DATA_SDM",
"not",
"in",
"entry",
".",
"data",
":",
"await",
"async_setup_legacy_entry",
"(",
... | [
10,
0
] | [
17,
64
] | python | en | ['en', 'pt', 'en'] | True |
test_user_owserver | (hass) | Test OWServer user flow. | Test OWServer user flow. | async def test_user_owserver(hass):
"""Test OWServer user flow."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_USER}
)
assert result["type"] == RESULT_TYPE_FORM
assert not result["errors"]
result = await hass.config_entries.flow.async_configure(... | [
"async",
"def",
"test_user_owserver",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"SOURCE_USER",
"}",
")",
"assert",
"result",
"["... | [
24,
0
] | [
76,
48
] | python | da | ['da', 'da', 'en'] | True |
test_user_owserver_duplicate | (hass) | Test OWServer flow. | Test OWServer flow. | async def test_user_owserver_duplicate(hass):
"""Test OWServer flow."""
with patch(
"homeassistant.components.onewire.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.onewire.async_setup_entry",
return_value=True,
) as mock_setup_entry:
aw... | [
"async",
"def",
"test_user_owserver_duplicate",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.onewire.async_setup\"",
",",
"return_value",
"=",
"True",
")",
"as",
"mock_setup",
",",
"patch",
"(",
"\"homeassistant.components.onewire.async_setup_ent... | [
79,
0
] | [
114,
48
] | python | en | ['en', 'da', 'en'] | True |
test_user_sysbus | (hass) | Test SysBus flow. | Test SysBus flow. | async def test_user_sysbus(hass):
"""Test SysBus flow."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_USER}
)
assert result["type"] == RESULT_TYPE_FORM
assert not result["errors"]
result = await hass.config_entries.flow.async_configure(
... | [
"async",
"def",
"test_user_sysbus",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"SOURCE_USER",
"}",
")",
"assert",
"result",
"[",
... | [
117,
0
] | [
171,
48
] | python | en | ['en', 'el-Latn', 'en'] | True |
test_user_sysbus_duplicate | (hass) | Test SysBus duplicate flow. | Test SysBus duplicate flow. | async def test_user_sysbus_duplicate(hass):
"""Test SysBus duplicate flow."""
with patch(
"homeassistant.components.onewire.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.onewire.async_setup_entry",
return_value=True,
) as mock_setup_entry:
... | [
"async",
"def",
"test_user_sysbus_duplicate",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.onewire.async_setup\"",
",",
"return_value",
"=",
"True",
")",
"as",
"mock_setup",
",",
"patch",
"(",
"\"homeassistant.components.onewire.async_setup_entry... | [
174,
0
] | [
214,
48
] | python | en | ['fr', 'jv', 'en'] | False |
test_import_sysbus | (hass) | Test import step. | Test import step. | async def test_import_sysbus(hass):
"""Test import step."""
with patch(
"homeassistant.components.onewire.onewirehub.os.path.isdir",
return_value=True,
), patch(
"homeassistant.components.onewire.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.comp... | [
"async",
"def",
"test_import_sysbus",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.onewire.onewirehub.os.path.isdir\"",
",",
"return_value",
"=",
"True",
",",
")",
",",
"patch",
"(",
"\"homeassistant.components.onewire.async_setup\"",
",",
"ret... | [
217,
0
] | [
242,
48
] | python | de | ['de', 'sd', 'en'] | False |
test_import_sysbus_with_mount_dir | (hass) | Test import step. | Test import step. | async def test_import_sysbus_with_mount_dir(hass):
"""Test import step."""
with patch(
"homeassistant.components.onewire.onewirehub.os.path.isdir",
return_value=True,
), patch(
"homeassistant.components.onewire.async_setup", return_value=True
) as mock_setup, patch(
"hom... | [
"async",
"def",
"test_import_sysbus_with_mount_dir",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.onewire.onewirehub.os.path.isdir\"",
",",
"return_value",
"=",
"True",
",",
")",
",",
"patch",
"(",
"\"homeassistant.components.onewire.async_setup\""... | [
245,
0
] | [
273,
48
] | python | de | ['de', 'sd', 'en'] | False |
test_import_owserver | (hass) | Test import step. | Test import step. | async def test_import_owserver(hass):
"""Test import step."""
with patch("homeassistant.components.onewire.onewirehub.protocol.proxy",), patch(
"homeassistant.components.onewire.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.onewire.async_setup_entry",
... | [
"async",
"def",
"test_import_owserver",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.onewire.onewirehub.protocol.proxy\"",
",",
")",
",",
"patch",
"(",
"\"homeassistant.components.onewire.async_setup\"",
",",
"return_value",
"=",
"True",
")",
"... | [
276,
0
] | [
302,
48
] | python | de | ['de', 'sd', 'en'] | False |
test_import_owserver_with_port | (hass) | Test import step. | Test import step. | async def test_import_owserver_with_port(hass):
"""Test import step."""
with patch("homeassistant.components.onewire.onewirehub.protocol.proxy",), patch(
"homeassistant.components.onewire.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.onewire.async_setup_e... | [
"async",
"def",
"test_import_owserver_with_port",
"(",
"hass",
")",
":",
"with",
"patch",
"(",
"\"homeassistant.components.onewire.onewirehub.protocol.proxy\"",
",",
")",
",",
"patch",
"(",
"\"homeassistant.components.onewire.async_setup\"",
",",
"return_value",
"=",
"True",
... | [
305,
0
] | [
332,
48
] | python | de | ['de', 'sd', 'en'] | False |
setup_platform | (hass, config, add_entities, discovery_info=None) | Set up the Waterfurnace sensor. | Set up the Waterfurnace sensor. | def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Waterfurnace sensor."""
if discovery_info is None:
return
sensors = []
client = hass.data[WF_DOMAIN]
for sconfig in SENSORS:
sensors.append(WaterFurnaceSensor(client, sconfig))
add_entities(senso... | [
"def",
"setup_platform",
"(",
"hass",
",",
"config",
",",
"add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"None",
":",
"return",
"sensors",
"=",
"[",
"]",
"client",
"=",
"hass",
".",
"data",
"[",
"WF_DOMAIN",
"... | [
50,
0
] | [
60,
25
] | python | en | ['en', 'su', 'en'] | True |
WFSensorConfig.__init__ | (
self, friendly_name, field, icon="mdi:gauge", unit_of_measurement=None
) | Initialize configuration. | Initialize configuration. | def __init__(
self, friendly_name, field, icon="mdi:gauge", unit_of_measurement=None
):
"""Initialize configuration."""
self.friendly_name = friendly_name
self.field = field
self.icon = icon
self.unit_of_measurement = unit_of_measurement | [
"def",
"__init__",
"(",
"self",
",",
"friendly_name",
",",
"field",
",",
"icon",
"=",
"\"mdi:gauge\"",
",",
"unit_of_measurement",
"=",
"None",
")",
":",
"self",
".",
"friendly_name",
"=",
"friendly_name",
"self",
".",
"field",
"=",
"field",
"self",
".",
"... | [
14,
4
] | [
21,
54
] | python | en | ['en', 'en', 'en'] | False |
WaterFurnaceSensor.__init__ | (self, client, config) | Initialize the sensor. | Initialize the sensor. | def __init__(self, client, config):
"""Initialize the sensor."""
self.client = client
self._name = config.friendly_name
self._attr = config.field
self._state = None
self._icon = config.icon
self._unit_of_measurement = config.unit_of_measurement
# This ens... | [
"def",
"__init__",
"(",
"self",
",",
"client",
",",
"config",
")",
":",
"self",
".",
"client",
"=",
"client",
"self",
".",
"_name",
"=",
"config",
".",
"friendly_name",
"self",
".",
"_attr",
"=",
"config",
".",
"field",
"self",
".",
"_state",
"=",
"N... | [
66,
4
] | [
78,
9
] | python | en | ['en', 'en', 'en'] | True |
WaterFurnaceSensor.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"
] | [
81,
4
] | [
83,
25
] | python | en | ['en', 'mi', 'en'] | True |
WaterFurnaceSensor.state | (self) | Return the state of the sensor. | Return the state of the sensor. | def state(self):
"""Return the state of the sensor."""
return self._state | [
"def",
"state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | [
86,
4
] | [
88,
26
] | python | en | ['en', 'en', 'en'] | True |
WaterFurnaceSensor.icon | (self) | Return icon. | Return icon. | def icon(self):
"""Return icon."""
return self._icon | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"self",
".",
"_icon"
] | [
91,
4
] | [
93,
25
] | python | en | ['en', 'la', 'en'] | False |
WaterFurnaceSensor.unit_of_measurement | (self) | Return the units of measurement. | Return the units of measurement. | def unit_of_measurement(self):
"""Return the units of measurement."""
return self._unit_of_measurement | [
"def",
"unit_of_measurement",
"(",
"self",
")",
":",
"return",
"self",
".",
"_unit_of_measurement"
] | [
96,
4
] | [
98,
40
] | python | en | ['en', 'bg', 'en'] | True |
WaterFurnaceSensor.should_poll | (self) | Return the polling state. | Return the polling state. | def should_poll(self):
"""Return the polling state."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
101,
4
] | [
103,
20
] | python | en | ['en', 'en', 'en'] | True |
WaterFurnaceSensor.async_added_to_hass | (self) | Register callbacks. | Register callbacks. | async def async_added_to_hass(self):
"""Register callbacks."""
self.async_on_remove(
self.hass.helpers.dispatcher.async_dispatcher_connect(
UPDATE_TOPIC, self.async_update_callback
)
) | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"self",
".",
"async_on_remove",
"(",
"self",
".",
"hass",
".",
"helpers",
".",
"dispatcher",
".",
"async_dispatcher_connect",
"(",
"UPDATE_TOPIC",
",",
"self",
".",
"async_update_callback",
")",
")"
] | [
105,
4
] | [
111,
9
] | python | en | ['en', 'no', 'en'] | False |
WaterFurnaceSensor.async_update_callback | (self) | Update state. | Update state. | def async_update_callback(self):
"""Update state."""
if self.client.data is not None:
self._state = getattr(self.client.data, self._attr, None)
self.async_write_ha_state() | [
"def",
"async_update_callback",
"(",
"self",
")",
":",
"if",
"self",
".",
"client",
".",
"data",
"is",
"not",
"None",
":",
"self",
".",
"_state",
"=",
"getattr",
"(",
"self",
".",
"client",
".",
"data",
",",
"self",
".",
"_attr",
",",
"None",
")",
... | [
114,
4
] | [
118,
39
] | python | en | ['en', 'co', 'en'] | False |
supported | (event) | Return whether an event supports cover. | Return whether an event supports cover. | def supported(event):
"""Return whether an event supports cover."""
return event.device.known_to_be_rollershutter | [
"def",
"supported",
"(",
"event",
")",
":",
"return",
"event",
".",
"device",
".",
"known_to_be_rollershutter"
] | [
21,
0
] | [
23,
49
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (
hass,
config_entry,
async_add_entities,
) | Set up config entry. | Set up config entry. | async def async_setup_entry(
hass,
config_entry,
async_add_entities,
):
"""Set up config entry."""
discovery_info = config_entry.data
device_ids = set()
entities = []
for packet_id, entity_info in discovery_info[CONF_DEVICES].items():
event = get_rfx_object(packet_id)
if... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
",",
"config_entry",
",",
"async_add_entities",
",",
")",
":",
"discovery_info",
"=",
"config_entry",
".",
"data",
"device_ids",
"=",
"set",
"(",
")",
"entities",
"=",
"[",
"]",
"for",
"packet_id",
",",
"enti... | [
26,
0
] | [
82,
56
] | python | en | ['en', 'en', 'en'] | True |
RfxtrxCover.async_added_to_hass | (self) | Restore device state. | Restore device state. | async def async_added_to_hass(self):
"""Restore device state."""
await super().async_added_to_hass()
if self._event is None:
old_state = await self.async_get_last_state()
if old_state is not None:
self._state = old_state.state == STATE_OPEN | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"await",
"super",
"(",
")",
".",
"async_added_to_hass",
"(",
")",
"if",
"self",
".",
"_event",
"is",
"None",
":",
"old_state",
"=",
"await",
"self",
".",
"async_get_last_state",
"(",
")",
"if",
... | [
88,
4
] | [
95,
59
] | python | it | ['it', 'it', 'en'] | True |
RfxtrxCover.is_closed | (self) | Return if the cover is closed. | Return if the cover is closed. | def is_closed(self):
"""Return if the cover is closed."""
return not self._state | [
"def",
"is_closed",
"(",
"self",
")",
":",
"return",
"not",
"self",
".",
"_state"
] | [
98,
4
] | [
100,
30
] | python | en | ['en', 'en', 'en'] | True |
RfxtrxCover.async_open_cover | (self, **kwargs) | Move the cover up. | Move the cover up. | async def async_open_cover(self, **kwargs):
"""Move the cover up."""
await self._async_send(self._device.send_open)
self._state = True
self.async_write_ha_state() | [
"async",
"def",
"async_open_cover",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"await",
"self",
".",
"_async_send",
"(",
"self",
".",
"_device",
".",
"send_open",
")",
"self",
".",
"_state",
"=",
"True",
"self",
".",
"async_write_ha_state",
"(",
")"... | [
102,
4
] | [
106,
35
] | python | en | ['en', 'en', 'en'] | True |
RfxtrxCover.async_close_cover | (self, **kwargs) | Move the cover down. | Move the cover down. | async def async_close_cover(self, **kwargs):
"""Move the cover down."""
await self._async_send(self._device.send_close)
self._state = False
self.async_write_ha_state() | [
"async",
"def",
"async_close_cover",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"await",
"self",
".",
"_async_send",
"(",
"self",
".",
"_device",
".",
"send_close",
")",
"self",
".",
"_state",
"=",
"False",
"self",
".",
"async_write_ha_state",
"(",
... | [
108,
4
] | [
112,
35
] | python | en | ['en', 'en', 'en'] | True |
RfxtrxCover.async_stop_cover | (self, **kwargs) | Stop the cover. | Stop the cover. | async def async_stop_cover(self, **kwargs):
"""Stop the cover."""
await self._async_send(self._device.send_stop)
self._state = True
self.async_write_ha_state() | [
"async",
"def",
"async_stop_cover",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"await",
"self",
".",
"_async_send",
"(",
"self",
".",
"_device",
".",
"send_stop",
")",
"self",
".",
"_state",
"=",
"True",
"self",
".",
"async_write_ha_state",
"(",
")"... | [
114,
4
] | [
118,
35
] | python | en | ['en', 'en', 'en'] | True |
RfxtrxCover._apply_event | (self, event) | Apply command from rfxtrx. | Apply command from rfxtrx. | def _apply_event(self, event):
"""Apply command from rfxtrx."""
super()._apply_event(event)
if event.values["Command"] in COMMAND_ON_LIST:
self._state = True
elif event.values["Command"] in COMMAND_OFF_LIST:
self._state = False | [
"def",
"_apply_event",
"(",
"self",
",",
"event",
")",
":",
"super",
"(",
")",
".",
"_apply_event",
"(",
"event",
")",
"if",
"event",
".",
"values",
"[",
"\"Command\"",
"]",
"in",
"COMMAND_ON_LIST",
":",
"self",
".",
"_state",
"=",
"True",
"elif",
"eve... | [
120,
4
] | [
126,
31
] | python | en | ['en', 'en', 'en'] | True |
RfxtrxCover._handle_event | (self, event, device_id) | Check if event applies to me and update. | Check if event applies to me and update. | def _handle_event(self, event, device_id):
"""Check if event applies to me and update."""
if device_id != self._device_id:
return
self._apply_event(event)
self.async_write_ha_state() | [
"def",
"_handle_event",
"(",
"self",
",",
"event",
",",
"device_id",
")",
":",
"if",
"device_id",
"!=",
"self",
".",
"_device_id",
":",
"return",
"self",
".",
"_apply_event",
"(",
"event",
")",
"self",
".",
"async_write_ha_state",
"(",
")"
] | [
129,
4
] | [
136,
35
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass, config) | Set up the Melissa Climate component. | Set up the Melissa Climate component. | async def async_setup(hass, config):
"""Set up the Melissa Climate component."""
conf = config[DOMAIN]
username = conf.get(CONF_USERNAME)
password = conf.get(CONF_PASSWORD)
api = melissa.AsyncMelissa(username=username, password=password)
await api.async_connect()
hass.data[DATA_MELISSA] = ap... | [
"async",
"def",
"async_setup",
"(",
"hass",
",",
"config",
")",
":",
"conf",
"=",
"config",
"[",
"DOMAIN",
"]",
"username",
"=",
"conf",
".",
"get",
"(",
"CONF_USERNAME",
")",
"password",
"=",
"conf",
".",
"get",
"(",
"CONF_PASSWORD",
")",
"api",
"=",
... | [
25,
0
] | [
35,
15
] | python | en | ['en', 'en', 'en'] | True |
test_import | (hass) | Test entry will be imported. | Test entry will be imported. | async def test_import(hass):
"""Test entry will be imported."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_IMPORT}, data={}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY | [
"async",
"def",
"test_import",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"SOURCE_IMPORT",
"}",
",",
"data",
"=",
"{",
"}",
"... | [
7,
0
] | [
13,
69
] | python | en | ['en', 'en', 'en'] | True |
test_user | (hass) | Test we can start a config flow. | Test we can start a config flow. | async def test_user(hass):
"""Test we can start a config flow."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_USER}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["step_id"] == "user" | [
"async",
"def",
"test_user",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"SOURCE_USER",
"}",
")",
"assert",
"result",
"[",
"\"ty... | [
16,
0
] | [
24,
38
] | python | en | ['en', 'en', 'en'] | True |
test_user_confirm | (hass) | Test we can finish a config flow. | Test we can finish a config flow. | async def test_user_confirm(hass):
"""Test we can finish a config flow."""
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_USER}, data={}
)
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert result["result"].data == {} | [
"async",
"def",
"test_user_confirm",
"(",
"hass",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"SOURCE_USER",
"}",
",",
"data",
"=",
"{",
"}",... | [
27,
0
] | [
35,
38
] | python | en | ['en', 'en', 'en'] | True |
browse_top_level | (media_library) | Browse the top-level of a Volumio media hierarchy. | Browse the top-level of a Volumio media hierarchy. | async def browse_top_level(media_library):
"""Browse the top-level of a Volumio media hierarchy."""
navigation = await media_library.browse()
children = [_list_payload(media_library, item) for item in navigation["lists"]]
return BrowseMedia(
media_class=MEDIA_CLASS_DIRECTORY,
media_conte... | [
"async",
"def",
"browse_top_level",
"(",
"media_library",
")",
":",
"navigation",
"=",
"await",
"media_library",
".",
"browse",
"(",
")",
"children",
"=",
"[",
"_list_payload",
"(",
"media_library",
",",
"item",
")",
"for",
"item",
"in",
"navigation",
"[",
"... | [
129,
0
] | [
141,
5
] | python | en | ['en', 'en', 'en'] | True |
browse_node | (media_library, media_content_type, media_content_id) | Browse a node of a Volumio media hierarchy. | Browse a node of a Volumio media hierarchy. | async def browse_node(media_library, media_content_type, media_content_id):
"""Browse a node of a Volumio media hierarchy."""
json_item = json.loads(media_content_id)
navigation = await media_library.browse(json_item["uri"])
if "lists" not in navigation:
raise BrowseError(f"Media not found: {med... | [
"async",
"def",
"browse_node",
"(",
"media_library",
",",
"media_content_type",
",",
"media_content_id",
")",
":",
"json_item",
"=",
"json",
".",
"loads",
"(",
"media_content_id",
")",
"navigation",
"=",
"await",
"media_library",
".",
"browse",
"(",
"json_item",
... | [
144,
0
] | [
166,
52
] | python | en | ['en', 'gl', 'en'] | True |
mock_panel_fixture | () | Mock a Konnected Panel bridge. | Mock a Konnected Panel bridge. | async def mock_panel_fixture():
"""Mock a Konnected Panel bridge."""
with patch("konnected.Client", autospec=True) as konn_client:
def mock_constructor(host, port, websession):
"""Fake the panel constructor."""
konn_client.host = host
konn_client.port = port
... | [
"async",
"def",
"mock_panel_fixture",
"(",
")",
":",
"with",
"patch",
"(",
"\"konnected.Client\"",
",",
"autospec",
"=",
"True",
")",
"as",
"konn_client",
":",
"def",
"mock_constructor",
"(",
"host",
",",
"port",
",",
"websession",
")",
":",
"\"\"\"Fake the pa... | [
11,
0
] | [
23,
25
] | python | en | ['it', 'st', 'en'] | False |
test_flow_works | (hass, mock_panel) | Test config flow . | Test config flow . | async def test_flow_works(hass, mock_panel):
"""Test config flow ."""
result = await hass.config_entries.flow.async_init(
config_flow.DOMAIN, context={"source": "user"}
)
assert result["type"] == "form"
assert result["step_id"] == "user"
mock_panel.get_status.return_value = {
"m... | [
"async",
"def",
"test_flow_works",
"(",
"hass",
",",
"mock_panel",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"config_flow",
".",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"\"user\"",
... | [
26,
0
] | [
60,
5
] | python | en | ['en', 'da', 'en'] | True |
test_pro_flow_works | (hass, mock_panel) | Test config flow . | Test config flow . | async def test_pro_flow_works(hass, mock_panel):
"""Test config flow ."""
result = await hass.config_entries.flow.async_init(
config_flow.DOMAIN, context={"source": "user"}
)
assert result["type"] == "form"
assert result["step_id"] == "user"
# pro uses chipId instead of MAC as unique id... | [
"async",
"def",
"test_pro_flow_works",
"(",
"hass",
",",
"mock_panel",
")",
":",
"result",
"=",
"await",
"hass",
".",
"config_entries",
".",
"flow",
".",
"async_init",
"(",
"config_flow",
".",
"DOMAIN",
",",
"context",
"=",
"{",
"\"source\"",
":",
"\"user\""... | [
63,
0
] | [
99,
5
] | python | en | ['en', 'da', 'en'] | True |
test_ssdp | (hass, mock_panel) | Test a panel being discovered. | Test a panel being discovered. | async def test_ssdp(hass, mock_panel):
"""Test a panel being discovered."""
mock_panel.get_status.return_value = {
"mac": "11:22:33:44:55:66",
"model": "Konnected",
}
result = await hass.config_entries.flow.async_init(
config_flow.DOMAIN,
context={"source": "ssdp"},
... | [
"async",
"def",
"test_ssdp",
"(",
"hass",
",",
"mock_panel",
")",
":",
"mock_panel",
".",
"get_status",
".",
"return_value",
"=",
"{",
"\"mac\"",
":",
"\"11:22:33:44:55:66\"",
",",
"\"model\"",
":",
"\"Konnected\"",
",",
"}",
"result",
"=",
"await",
"hass",
... | [
102,
0
] | [
126,
5
] | python | en | ['id', 'en', 'en'] | True |
test_import_no_host_user_finish | (hass, mock_panel) | Test importing a panel with no host info. | Test importing a panel with no host info. | async def test_import_no_host_user_finish(hass, mock_panel):
"""Test importing a panel with no host info."""
mock_panel.get_status.return_value = {
"mac": "aa:bb:cc:dd:ee:ff",
"model": "Konnected Pro",
}
result = await hass.config_entries.flow.async_init(
config_flow.DOMAIN,
... | [
"async",
"def",
"test_import_no_host_user_finish",
"(",
"hass",
",",
"mock_panel",
")",
":",
"mock_panel",
".",
"get_status",
".",
"return_value",
"=",
"{",
"\"mac\"",
":",
"\"aa:bb:cc:dd:ee:ff\"",
",",
"\"model\"",
":",
"\"Konnected Pro\"",
",",
"}",
"result",
"=... | [
129,
0
] | [
192,
43
] | python | en | ['en', 'en', 'en'] | True |
test_import_ssdp_host_user_finish | (hass, mock_panel) | Test importing a pro panel with no host info which ssdp discovers. | Test importing a pro panel with no host info which ssdp discovers. | async def test_import_ssdp_host_user_finish(hass, mock_panel):
"""Test importing a pro panel with no host info which ssdp discovers."""
mock_panel.get_status.return_value = {
"chipId": "somechipid",
"mac": "11:22:33:44:55:66",
"model": "Konnected Pro",
}
result = await hass.conf... | [
"async",
"def",
"test_import_ssdp_host_user_finish",
"(",
"hass",
",",
"mock_panel",
")",
":",
"mock_panel",
".",
"get_status",
".",
"return_value",
"=",
"{",
"\"chipId\"",
":",
"\"somechipid\"",
",",
"\"mac\"",
":",
"\"11:22:33:44:55:66\"",
",",
"\"model\"",
":",
... | [
195,
0
] | [
265,
43
] | python | en | ['en', 'en', 'en'] | True |
test_ssdp_already_configured | (hass, mock_panel) | Test if a discovered panel has already been configured. | Test if a discovered panel has already been configured. | async def test_ssdp_already_configured(hass, mock_panel):
"""Test if a discovered panel has already been configured."""
MockConfigEntry(
domain="konnected",
data={"host": "0.0.0.0", "port": 1234},
unique_id="112233445566",
).add_to_hass(hass)
mock_panel.get_status.return_value = ... | [
"async",
"def",
"test_ssdp_already_configured",
"(",
"hass",
",",
"mock_panel",
")",
":",
"MockConfigEntry",
"(",
"domain",
"=",
"\"konnected\"",
",",
"data",
"=",
"{",
"\"host\"",
":",
"\"0.0.0.0\"",
",",
"\"port\"",
":",
"1234",
"}",
",",
"unique_id",
"=",
... | [
268,
0
] | [
290,
51
] | python | en | ['en', 'en', 'en'] | True |
test_ssdp_host_update | (hass, mock_panel) | Test if a discovered panel has already been configured but changed host. | Test if a discovered panel has already been configured but changed host. | async def test_ssdp_host_update(hass, mock_panel):
"""Test if a discovered panel has already been configured but changed host."""
device_config = config_flow.CONFIG_ENTRY_SCHEMA(
{
"host": "1.2.3.4",
"port": 1234,
"id": "112233445566",
"model": "Konnected ... | [
"async",
"def",
"test_ssdp_host_update",
"(",
"hass",
",",
"mock_panel",
")",
":",
"device_config",
"=",
"config_flow",
".",
"CONFIG_ENTRY_SCHEMA",
"(",
"{",
"\"host\"",
":",
"\"1.2.3.4\"",
",",
"\"port\"",
":",
"1234",
",",
"\"id\"",
":",
"\"112233445566\"",
",... | [
293,
0
] | [
371,
63
] | python | en | ['en', 'en', 'en'] | True |
test_import_existing_config | (hass, mock_panel) | Test importing a host with an existing config file. | Test importing a host with an existing config file. | async def test_import_existing_config(hass, mock_panel):
"""Test importing a host with an existing config file."""
mock_panel.get_status.return_value = {
"mac": "11:22:33:44:55:66",
"model": "Konnected Pro",
}
result = await hass.config_entries.flow.async_init(
config_flow.DOMAI... | [
"async",
"def",
"test_import_existing_config",
"(",
"hass",
",",
"mock_panel",
")",
":",
"mock_panel",
".",
"get_status",
".",
"return_value",
"=",
"{",
"\"mac\"",
":",
"\"11:22:33:44:55:66\"",
",",
"\"model\"",
":",
"\"Konnected Pro\"",
",",
"}",
"result",
"=",
... | [
374,
0
] | [
490,
5
] | python | en | ['en', 'en', 'en'] | True |
test_import_existing_config_entry | (hass, mock_panel) | Test importing a host that has an existing config entry. | Test importing a host that has an existing config entry. | async def test_import_existing_config_entry(hass, mock_panel):
"""Test importing a host that has an existing config entry."""
MockConfigEntry(
domain="konnected",
data={
"host": "0.0.0.0",
"port": 1111,
"access_token": "ORIGINALTOKEN",
"id": "11223... | [
"async",
"def",
"test_import_existing_config_entry",
"(",
"hass",
",",
"mock_panel",
")",
":",
"MockConfigEntry",
"(",
"domain",
"=",
"\"konnected\"",
",",
"data",
"=",
"{",
"\"host\"",
":",
"\"0.0.0.0\"",
",",
"\"port\"",
":",
"1111",
",",
"\"access_token\"",
"... | [
493,
0
] | [
562,
5
] | python | en | ['en', 'en', 'en'] | True |
test_import_pin_config | (hass, mock_panel) | Test importing a host with an existing config file that specifies pin configs. | Test importing a host with an existing config file that specifies pin configs. | async def test_import_pin_config(hass, mock_panel):
"""Test importing a host with an existing config file that specifies pin configs."""
mock_panel.get_status.return_value = {
"mac": "11:22:33:44:55:66",
"model": "Konnected Pro",
}
result = await hass.config_entries.flow.async_init(
... | [
"async",
"def",
"test_import_pin_config",
"(",
"hass",
",",
"mock_panel",
")",
":",
"mock_panel",
".",
"get_status",
".",
"return_value",
"=",
"{",
"\"mac\"",
":",
"\"11:22:33:44:55:66\"",
",",
"\"model\"",
":",
"\"Konnected Pro\"",
",",
"}",
"result",
"=",
"awa... | [
565,
0
] | [
659,
5
] | python | en | ['en', 'en', 'en'] | True |
test_option_flow | (hass, mock_panel) | Test config flow options. | Test config flow options. | async def test_option_flow(hass, mock_panel):
"""Test config flow options."""
device_config = config_flow.CONFIG_ENTRY_SCHEMA(
{
"host": "1.2.3.4",
"port": 1234,
"id": "112233445566",
"model": "Konnected",
"access_token": "11223344556677889900"... | [
"async",
"def",
"test_option_flow",
"(",
"hass",
",",
"mock_panel",
")",
":",
"device_config",
"=",
"config_flow",
".",
"CONFIG_ENTRY_SCHEMA",
"(",
"{",
"\"host\"",
":",
"\"1.2.3.4\"",
",",
"\"port\"",
":",
"1234",
",",
"\"id\"",
":",
"\"112233445566\"",
",",
... | [
662,
0
] | [
845,
5
] | python | en | ['en', 'fr', 'en'] | True |
test_option_flow_pro | (hass, mock_panel) | Test config flow options for pro board. | Test config flow options for pro board. | async def test_option_flow_pro(hass, mock_panel):
"""Test config flow options for pro board."""
device_config = config_flow.CONFIG_ENTRY_SCHEMA(
{
"host": "1.2.3.4",
"port": 1234,
"id": "112233445566",
"model": "Konnected Pro",
"access_token": ... | [
"async",
"def",
"test_option_flow_pro",
"(",
"hass",
",",
"mock_panel",
")",
":",
"device_config",
"=",
"config_flow",
".",
"CONFIG_ENTRY_SCHEMA",
"(",
"{",
"\"host\"",
":",
"\"1.2.3.4\"",
",",
"\"port\"",
":",
"1234",
",",
"\"id\"",
":",
"\"112233445566\"",
","... | [
848,
0
] | [
1031,
5
] | python | en | ['en', 'en', 'en'] | True |
test_option_flow_import | (hass, mock_panel) | Test config flow options imported from configuration.yaml. | Test config flow options imported from configuration.yaml. | async def test_option_flow_import(hass, mock_panel):
"""Test config flow options imported from configuration.yaml."""
device_options = config_flow.OPTIONS_SCHEMA(
{
"io": {
"1": "Binary Sensor",
"2": "Digital Sensor",
"3": "Switchable Output",
... | [
"async",
"def",
"test_option_flow_import",
"(",
"hass",
",",
"mock_panel",
")",
":",
"device_options",
"=",
"config_flow",
".",
"OPTIONS_SCHEMA",
"(",
"{",
"\"io\"",
":",
"{",
"\"1\"",
":",
"\"Binary Sensor\"",
",",
"\"2\"",
":",
"\"Digital Sensor\"",
",",
"\"3\... | [
1034,
0
] | [
1183,
5
] | python | en | ['en', 'en', 'en'] | True |
test_option_flow_existing | (hass, mock_panel) | Test config flow options with existing already in place. | Test config flow options with existing already in place. | async def test_option_flow_existing(hass, mock_panel):
"""Test config flow options with existing already in place."""
device_options = config_flow.OPTIONS_SCHEMA(
{
"io": {
"1": "Binary Sensor",
"2": "Digital Sensor",
"3": "Switchable Output",
... | [
"async",
"def",
"test_option_flow_existing",
"(",
"hass",
",",
"mock_panel",
")",
":",
"device_options",
"=",
"config_flow",
".",
"OPTIONS_SCHEMA",
"(",
"{",
"\"io\"",
":",
"{",
"\"1\"",
":",
"\"Binary Sensor\"",
",",
"\"2\"",
":",
"\"Digital Sensor\"",
",",
"\"... | [
1186,
0
] | [
1241,
45
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (
hass: HomeAssistantType,
entry: ConfigEntry,
async_add_entities: Callable[[List, bool], None],
) | Set up the DirecTV config entry. | Set up the DirecTV config entry. | async def async_setup_entry(
hass: HomeAssistantType,
entry: ConfigEntry,
async_add_entities: Callable[[List, bool], None],
) -> bool:
"""Set up the DirecTV config entry."""
dtv = hass.data[DOMAIN][entry.entry_id]
entities = []
for location in dtv.device.locations:
entities.append(
... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistantType",
",",
"entry",
":",
"ConfigEntry",
",",
"async_add_entities",
":",
"Callable",
"[",
"[",
"List",
",",
"bool",
"]",
",",
"None",
"]",
",",
")",
"->",
"bool",
":",
"dtv",
"=",
"hass... | [
63,
0
] | [
81,
38
] | python | en | ['en', 'en', 'en'] | True |
DIRECTVMediaPlayer.__init__ | (self, *, dtv: DIRECTV, name: str, address: str = "0") | Initialize DirecTV media player. | Initialize DirecTV media player. | def __init__(self, *, dtv: DIRECTV, name: str, address: str = "0") -> None:
"""Initialize DirecTV media player."""
super().__init__(
dtv=dtv,
name=name,
address=address,
)
self._assumed_state = None
self._available = False
self._is_rec... | [
"def",
"__init__",
"(",
"self",
",",
"*",
",",
"dtv",
":",
"DIRECTV",
",",
"name",
":",
"str",
",",
"address",
":",
"str",
"=",
"\"0\"",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"dtv",
"=",
"dtv",
",",
"name",
"=",
"name... | [
87,
4
] | [
103,
26
] | python | en | ['fr', 'en', 'it'] | False |
DIRECTVMediaPlayer.async_update | (self) | Retrieve latest state. | Retrieve latest state. | async def async_update(self):
"""Retrieve latest state."""
self._state = await self.dtv.state(self._address)
self._available = self._state.available
self._is_standby = self._state.standby
self._program = self._state.program
if self._is_standby:
self._assumed_... | [
"async",
"def",
"async_update",
"(",
"self",
")",
":",
"self",
".",
"_state",
"=",
"await",
"self",
".",
"dtv",
".",
"state",
"(",
"self",
".",
"_address",
")",
"self",
".",
"_available",
"=",
"self",
".",
"_state",
".",
"available",
"self",
".",
"_i... | [
105,
4
] | [
123,
51
] | python | en | ['es', 'sk', 'en'] | False |
DIRECTVMediaPlayer.device_state_attributes | (self) | Return device specific state attributes. | Return device specific state attributes. | def device_state_attributes(self):
"""Return device specific state attributes."""
if self._is_standby:
return {}
return {
ATTR_MEDIA_CURRENTLY_RECORDING: self.media_currently_recording,
ATTR_MEDIA_RATING: self.media_rating,
ATTR_MEDIA_RECORDED: sel... | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_standby",
":",
"return",
"{",
"}",
"return",
"{",
"ATTR_MEDIA_CURRENTLY_RECORDING",
":",
"self",
".",
"media_currently_recording",
",",
"ATTR_MEDIA_RATING",
":",
"self",
".",
"media_r... | [
126,
4
] | [
135,
9
] | python | en | ['fr', 'en', 'en'] | True |
DIRECTVMediaPlayer.name | (self) | Return the name of the device. | Return the name of the device. | def name(self):
"""Return the name of the device."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
138,
4
] | [
140,
25
] | python | en | ['en', 'en', 'en'] | True |
DIRECTVMediaPlayer.device_class | (self) | Return the class of this device. | Return the class of this device. | def device_class(self) -> Optional[str]:
"""Return the class of this device."""
return DEVICE_CLASS_RECEIVER | [
"def",
"device_class",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"return",
"DEVICE_CLASS_RECEIVER"
] | [
143,
4
] | [
145,
36
] | python | en | ['en', 'en', 'en'] | True |
DIRECTVMediaPlayer.unique_id | (self) | Return a unique ID to use for this media player. | Return a unique ID to use for this media player. | def unique_id(self):
"""Return a unique ID to use for this media player."""
if self._address == "0":
return self.dtv.device.info.receiver_id
return self._address | [
"def",
"unique_id",
"(",
"self",
")",
":",
"if",
"self",
".",
"_address",
"==",
"\"0\"",
":",
"return",
"self",
".",
"dtv",
".",
"device",
".",
"info",
".",
"receiver_id",
"return",
"self",
".",
"_address"
] | [
148,
4
] | [
153,
28
] | python | en | ['en', 'en', 'en'] | True |
DIRECTVMediaPlayer.state | (self) | Return the state of the device. | Return the state of the device. | def state(self):
"""Return the state of the device."""
if self._is_standby:
return STATE_OFF
# For recorded media we can determine if it is paused or not.
# For live media we're unable to determine and will always return
# playing instead.
if self._paused:
... | [
"def",
"state",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_standby",
":",
"return",
"STATE_OFF",
"# For recorded media we can determine if it is paused or not.",
"# For live media we're unable to determine and will always return",
"# playing instead.",
"if",
"self",
".",
"_... | [
157,
4
] | [
168,
28
] | python | en | ['en', 'en', 'en'] | True |
DIRECTVMediaPlayer.available | (self) | Return if able to retrieve information from DVR or not. | Return if able to retrieve information from DVR or not. | def available(self):
"""Return if able to retrieve information from DVR or not."""
return self._available | [
"def",
"available",
"(",
"self",
")",
":",
"return",
"self",
".",
"_available"
] | [
171,
4
] | [
173,
30
] | python | en | ['en', 'en', 'en'] | True |
DIRECTVMediaPlayer.assumed_state | (self) | Return if we assume the state or not. | Return if we assume the state or not. | def assumed_state(self):
"""Return if we assume the state or not."""
return self._assumed_state | [
"def",
"assumed_state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_assumed_state"
] | [
176,
4
] | [
178,
34
] | python | en | ['en', 'en', 'en'] | True |
DIRECTVMediaPlayer.media_content_id | (self) | Return the content ID of current playing media. | Return the content ID of current playing media. | def media_content_id(self):
"""Return the content ID of current playing media."""
if self._is_standby or self._program is None:
return None
return self._program.program_id | [
"def",
"media_content_id",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_standby",
"or",
"self",
".",
"_program",
"is",
"None",
":",
"return",
"None",
"return",
"self",
".",
"_program",
".",
"program_id"
] | [
181,
4
] | [
186,
39
] | python | en | ['en', 'en', 'en'] | True |
DIRECTVMediaPlayer.media_content_type | (self) | Return the content type of current playing media. | Return the content type of current playing media. | def media_content_type(self):
"""Return the content type of current playing media."""
if self._is_standby or self._program is None:
return None
if self._program.program_type in KNOWN_MEDIA_TYPES:
return self._program.program_type
return MEDIA_TYPE_MOVIE | [
"def",
"media_content_type",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_standby",
"or",
"self",
".",
"_program",
"is",
"None",
":",
"return",
"None",
"if",
"self",
".",
"_program",
".",
"program_type",
"in",
"KNOWN_MEDIA_TYPES",
":",
"return",
"self",
... | [
189,
4
] | [
197,
31
] | python | en | ['en', 'en', 'en'] | True |
DIRECTVMediaPlayer.media_duration | (self) | Return the duration of current playing media in seconds. | Return the duration of current playing media in seconds. | def media_duration(self):
"""Return the duration of current playing media in seconds."""
if self._is_standby or self._program is None:
return None
return self._program.duration | [
"def",
"media_duration",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_standby",
"or",
"self",
".",
"_program",
"is",
"None",
":",
"return",
"None",
"return",
"self",
".",
"_program",
".",
"duration"
] | [
200,
4
] | [
205,
37
] | python | en | ['en', 'en', 'en'] | True |
DIRECTVMediaPlayer.media_position | (self) | Position of current playing media in seconds. | Position of current playing media in seconds. | def media_position(self):
"""Position of current playing media in seconds."""
if self._is_standby:
return None
return self._last_position | [
"def",
"media_position",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_standby",
":",
"return",
"None",
"return",
"self",
".",
"_last_position"
] | [
208,
4
] | [
213,
34
] | python | en | ['en', 'en', 'en'] | True |
DIRECTVMediaPlayer.media_position_updated_at | (self) | When was the position of the current playing media valid. | When was the position of the current playing media valid. | def media_position_updated_at(self):
"""When was the position of the current playing media valid."""
if self._is_standby:
return None
return self._last_update | [
"def",
"media_position_updated_at",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_standby",
":",
"return",
"None",
"return",
"self",
".",
"_last_update"
] | [
216,
4
] | [
221,
32
] | python | en | ['en', 'en', 'en'] | True |
DIRECTVMediaPlayer.media_title | (self) | Return the title of current playing media. | Return the title of current playing media. | def media_title(self):
"""Return the title of current playing media."""
if self._is_standby or self._program is None:
return None
if self.media_content_type == MEDIA_TYPE_MUSIC:
return self._program.music_title
return self._program.title | [
"def",
"media_title",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_standby",
"or",
"self",
".",
"_program",
"is",
"None",
":",
"return",
"None",
"if",
"self",
".",
"media_content_type",
"==",
"MEDIA_TYPE_MUSIC",
":",
"return",
"self",
".",
"_program",
".... | [
224,
4
] | [
232,
34
] | python | en | ['en', 'en', 'en'] | True |
DIRECTVMediaPlayer.media_artist | (self) | Artist of current playing media, music track only. | Artist of current playing media, music track only. | def media_artist(self):
"""Artist of current playing media, music track only."""
if self._is_standby or self._program is None:
return None
return self._program.music_artist | [
"def",
"media_artist",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_standby",
"or",
"self",
".",
"_program",
"is",
"None",
":",
"return",
"None",
"return",
"self",
".",
"_program",
".",
"music_artist"
] | [
235,
4
] | [
240,
41
] | python | en | ['en', 'en', 'en'] | True |
DIRECTVMediaPlayer.media_album_name | (self) | Album name of current playing media, music track only. | Album name of current playing media, music track only. | def media_album_name(self):
"""Album name of current playing media, music track only."""
if self._is_standby or self._program is None:
return None
return self._program.music_album | [
"def",
"media_album_name",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_standby",
"or",
"self",
".",
"_program",
"is",
"None",
":",
"return",
"None",
"return",
"self",
".",
"_program",
".",
"music_album"
] | [
243,
4
] | [
248,
40
] | python | en | ['en', 'en', 'en'] | True |
DIRECTVMediaPlayer.media_series_title | (self) | Return the title of current episode of TV show. | Return the title of current episode of TV show. | def media_series_title(self):
"""Return the title of current episode of TV show."""
if self._is_standby or self._program is None:
return None
return self._program.episode_title | [
"def",
"media_series_title",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_standby",
"or",
"self",
".",
"_program",
"is",
"None",
":",
"return",
"None",
"return",
"self",
".",
"_program",
".",
"episode_title"
] | [
251,
4
] | [
256,
42
] | python | en | ['en', 'en', 'en'] | True |
DIRECTVMediaPlayer.media_channel | (self) | Return the channel current playing media. | Return the channel current playing media. | def media_channel(self):
"""Return the channel current playing media."""
if self._is_standby or self._program is None:
return None
return f"{self._program.channel_name} ({self._program.channel})" | [
"def",
"media_channel",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_standby",
"or",
"self",
".",
"_program",
"is",
"None",
":",
"return",
"None",
"return",
"f\"{self._program.channel_name} ({self._program.channel})\""
] | [
259,
4
] | [
264,
72
] | python | en | ['en', 'en', 'en'] | True |
DIRECTVMediaPlayer.source | (self) | Name of the current input source. | Name of the current input source. | def source(self):
"""Name of the current input source."""
if self._is_standby or self._program is None:
return None
return self._program.channel | [
"def",
"source",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_standby",
"or",
"self",
".",
"_program",
"is",
"None",
":",
"return",
"None",
"return",
"self",
".",
"_program",
".",
"channel"
] | [
267,
4
] | [
272,
36
] | python | en | ['en', 'en', 'en'] | True |
DIRECTVMediaPlayer.supported_features | (self) | Flag media player features that are supported. | Flag media player features that are supported. | def supported_features(self):
"""Flag media player features that are supported."""
return SUPPORT_DTV_CLIENT if self._is_client else SUPPORT_DTV | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORT_DTV_CLIENT",
"if",
"self",
".",
"_is_client",
"else",
"SUPPORT_DTV"
] | [
275,
4
] | [
277,
69
] | python | en | ['en', 'en', 'en'] | True |
DIRECTVMediaPlayer.media_currently_recording | (self) | If the media is currently being recorded or not. | If the media is currently being recorded or not. | def media_currently_recording(self):
"""If the media is currently being recorded or not."""
if self._is_standby or self._program is None:
return None
return self._program.recording | [
"def",
"media_currently_recording",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_standby",
"or",
"self",
".",
"_program",
"is",
"None",
":",
"return",
"None",
"return",
"self",
".",
"_program",
".",
"recording"
] | [
280,
4
] | [
285,
38
] | python | en | ['en', 'en', 'en'] | True |
DIRECTVMediaPlayer.media_rating | (self) | TV Rating of the current playing media. | TV Rating of the current playing media. | def media_rating(self):
"""TV Rating of the current playing media."""
if self._is_standby or self._program is None:
return None
return self._program.rating | [
"def",
"media_rating",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_standby",
"or",
"self",
".",
"_program",
"is",
"None",
":",
"return",
"None",
"return",
"self",
".",
"_program",
".",
"rating"
] | [
288,
4
] | [
293,
35
] | python | en | ['en', 'en', 'en'] | True |
DIRECTVMediaPlayer.media_recorded | (self) | If the media was recorded or live. | If the media was recorded or live. | def media_recorded(self):
"""If the media was recorded or live."""
if self._is_standby:
return None
return self._is_recorded | [
"def",
"media_recorded",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_standby",
":",
"return",
"None",
"return",
"self",
".",
"_is_recorded"
] | [
296,
4
] | [
301,
32
] | python | en | ['en', 'en', 'en'] | True |
DIRECTVMediaPlayer.media_start_time | (self) | Start time the program aired. | Start time the program aired. | def media_start_time(self):
"""Start time the program aired."""
if self._is_standby or self._program is None:
return None
return dt_util.as_local(self._program.start_time) | [
"def",
"media_start_time",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_standby",
"or",
"self",
".",
"_program",
"is",
"None",
":",
"return",
"None",
"return",
"dt_util",
".",
"as_local",
"(",
"self",
".",
"_program",
".",
"start_time",
")"
] | [
304,
4
] | [
309,
57
] | python | en | ['en', 'en', 'en'] | True |
DIRECTVMediaPlayer.async_turn_on | (self) | Turn on the receiver. | Turn on the receiver. | async def async_turn_on(self):
"""Turn on the receiver."""
if self._is_client:
raise NotImplementedError()
_LOGGER.debug("Turn on %s", self._name)
await self.dtv.remote("poweron", self._address) | [
"async",
"def",
"async_turn_on",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_client",
":",
"raise",
"NotImplementedError",
"(",
")",
"_LOGGER",
".",
"debug",
"(",
"\"Turn on %s\"",
",",
"self",
".",
"_name",
")",
"await",
"self",
".",
"dtv",
".",
"rem... | [
311,
4
] | [
317,
55
] | python | en | ['en', 'en', 'en'] | True |
DIRECTVMediaPlayer.async_turn_off | (self) | Turn off the receiver. | Turn off the receiver. | async def async_turn_off(self):
"""Turn off the receiver."""
if self._is_client:
raise NotImplementedError()
_LOGGER.debug("Turn off %s", self._name)
await self.dtv.remote("poweroff", self._address) | [
"async",
"def",
"async_turn_off",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_client",
":",
"raise",
"NotImplementedError",
"(",
")",
"_LOGGER",
".",
"debug",
"(",
"\"Turn off %s\"",
",",
"self",
".",
"_name",
")",
"await",
"self",
".",
"dtv",
".",
"r... | [
319,
4
] | [
325,
56
] | python | en | ['en', 'en', 'en'] | True |
DIRECTVMediaPlayer.async_media_play | (self) | Send play command. | Send play command. | async def async_media_play(self):
"""Send play command."""
_LOGGER.debug("Play on %s", self._name)
await self.dtv.remote("play", self._address) | [
"async",
"def",
"async_media_play",
"(",
"self",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Play on %s\"",
",",
"self",
".",
"_name",
")",
"await",
"self",
".",
"dtv",
".",
"remote",
"(",
"\"play\"",
",",
"self",
".",
"_address",
")"
] | [
327,
4
] | [
330,
52
] | python | en | ['en', 'en', 'en'] | True |
DIRECTVMediaPlayer.async_media_pause | (self) | Send pause command. | Send pause command. | async def async_media_pause(self):
"""Send pause command."""
_LOGGER.debug("Pause on %s", self._name)
await self.dtv.remote("pause", self._address) | [
"async",
"def",
"async_media_pause",
"(",
"self",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Pause on %s\"",
",",
"self",
".",
"_name",
")",
"await",
"self",
".",
"dtv",
".",
"remote",
"(",
"\"pause\"",
",",
"self",
".",
"_address",
")"
] | [
332,
4
] | [
335,
53
] | python | en | ['en', 'en', 'en'] | True |
DIRECTVMediaPlayer.async_media_stop | (self) | Send stop command. | Send stop command. | async def async_media_stop(self):
"""Send stop command."""
_LOGGER.debug("Stop on %s", self._name)
await self.dtv.remote("stop", self._address) | [
"async",
"def",
"async_media_stop",
"(",
"self",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Stop on %s\"",
",",
"self",
".",
"_name",
")",
"await",
"self",
".",
"dtv",
".",
"remote",
"(",
"\"stop\"",
",",
"self",
".",
"_address",
")"
] | [
337,
4
] | [
340,
52
] | python | en | ['en', 'en', 'en'] | True |
DIRECTVMediaPlayer.async_media_previous_track | (self) | Send rewind command. | Send rewind command. | async def async_media_previous_track(self):
"""Send rewind command."""
_LOGGER.debug("Rewind on %s", self._name)
await self.dtv.remote("rew", self._address) | [
"async",
"def",
"async_media_previous_track",
"(",
"self",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Rewind on %s\"",
",",
"self",
".",
"_name",
")",
"await",
"self",
".",
"dtv",
".",
"remote",
"(",
"\"rew\"",
",",
"self",
".",
"_address",
")"
] | [
342,
4
] | [
345,
51
] | python | en | ['en', 'co', 'en'] | True |
DIRECTVMediaPlayer.async_media_next_track | (self) | Send fast forward command. | Send fast forward command. | async def async_media_next_track(self):
"""Send fast forward command."""
_LOGGER.debug("Fast forward on %s", self._name)
await self.dtv.remote("ffwd", self._address) | [
"async",
"def",
"async_media_next_track",
"(",
"self",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Fast forward on %s\"",
",",
"self",
".",
"_name",
")",
"await",
"self",
".",
"dtv",
".",
"remote",
"(",
"\"ffwd\"",
",",
"self",
".",
"_address",
")"
] | [
347,
4
] | [
350,
52
] | python | en | ['en', 'cy', 'en'] | True |
DIRECTVMediaPlayer.async_play_media | (self, media_type, media_id, **kwargs) | Select input source. | Select input source. | async def async_play_media(self, media_type, media_id, **kwargs):
"""Select input source."""
if media_type != MEDIA_TYPE_CHANNEL:
_LOGGER.error(
"Invalid media type %s. Only %s is supported",
media_type,
MEDIA_TYPE_CHANNEL,
)
... | [
"async",
"def",
"async_play_media",
"(",
"self",
",",
"media_type",
",",
"media_id",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"media_type",
"!=",
"MEDIA_TYPE_CHANNEL",
":",
"_LOGGER",
".",
"error",
"(",
"\"Invalid media type %s. Only %s is supported\"",
",",
"medi... | [
352,
4
] | [
363,
52
] | python | en | ['fr', 'su', 'en'] | False |
client_fixture | () | Get a mocked client. | Get a mocked client. | def client_fixture():
"""Get a mocked client."""
client = Mock(Client)
client.host = MOCK_HOST
client.port = MOCK_PORT
return client | [
"def",
"client_fixture",
"(",
")",
":",
"client",
"=",
"Mock",
"(",
"Client",
")",
"client",
".",
"host",
"=",
"MOCK_HOST",
"client",
".",
"port",
"=",
"MOCK_PORT",
"return",
"client"
] | [
26,
0
] | [
31,
17
] | python | en | ['en', 'en', 'en'] | True |
state_1_fixture | (client) | Get a mocked state. | Get a mocked state. | def state_1_fixture(client):
"""Get a mocked state."""
state = Mock(State)
state.client = client
state.zn = 1
state.get_power.return_value = True
state.get_volume.return_value = 0.0
state.get_source_list.return_value = []
state.get_incoming_audio_format.return_value = (0, 0)
state.ge... | [
"def",
"state_1_fixture",
"(",
"client",
")",
":",
"state",
"=",
"Mock",
"(",
"State",
")",
"state",
".",
"client",
"=",
"client",
"state",
".",
"zn",
"=",
"1",
"state",
".",
"get_power",
".",
"return_value",
"=",
"True",
"state",
".",
"get_volume",
".... | [
35,
0
] | [
45,
16
] | python | en | ['en', 'en', 'en'] | True |
state_2_fixture | (client) | Get a mocked state. | Get a mocked state. | def state_2_fixture(client):
"""Get a mocked state."""
state = Mock(State)
state.client = client
state.zn = 2
state.get_power.return_value = True
state.get_volume.return_value = 0.0
state.get_source_list.return_value = []
state.get_incoming_audio_format.return_value = (0, 0)
state.ge... | [
"def",
"state_2_fixture",
"(",
"client",
")",
":",
"state",
"=",
"Mock",
"(",
"State",
")",
"state",
".",
"client",
"=",
"client",
"state",
".",
"zn",
"=",
"2",
"state",
".",
"get_power",
".",
"return_value",
"=",
"True",
"state",
".",
"get_volume",
".... | [
49,
0
] | [
59,
16
] | python | en | ['en', 'en', 'en'] | True |
state_fixture | (state_1) | Get a mocked state. | Get a mocked state. | def state_fixture(state_1):
"""Get a mocked state."""
return state_1 | [
"def",
"state_fixture",
"(",
"state_1",
")",
":",
"return",
"state_1"
] | [
63,
0
] | [
65,
18
] | python | en | ['en', 'en', 'en'] | True |
player_fixture | (hass, state) | Get standard player. | Get standard player. | def player_fixture(hass, state):
"""Get standard player."""
player = ArcamFmj(MOCK_NAME, state, MOCK_UUID)
player.entity_id = MOCK_ENTITY_ID
player.hass = hass
player.async_write_ha_state = Mock()
return player | [
"def",
"player_fixture",
"(",
"hass",
",",
"state",
")",
":",
"player",
"=",
"ArcamFmj",
"(",
"MOCK_NAME",
",",
"state",
",",
"MOCK_UUID",
")",
"player",
".",
"entity_id",
"=",
"MOCK_ENTITY_ID",
"player",
".",
"hass",
"=",
"hass",
"player",
".",
"async_wri... | [
69,
0
] | [
75,
17
] | python | en | ['en', 'lb', 'en'] | True |
player_setup_fixture | (hass, state_1, state_2, client) | Get standard player. | Get standard player. | async def player_setup_fixture(hass, state_1, state_2, client):
"""Get standard player."""
config_entry = MockConfigEntry(
domain="arcam_fmj", data=MOCK_CONFIG_ENTRY, title=MOCK_NAME
)
config_entry.add_to_hass(hass)
def state_mock(cli, zone):
if zone == 1:
return state_1... | [
"async",
"def",
"player_setup_fixture",
"(",
"hass",
",",
"state_1",
",",
"state_2",
",",
"client",
")",
":",
"config_entry",
"=",
"MockConfigEntry",
"(",
"domain",
"=",
"\"arcam_fmj\"",
",",
"data",
"=",
"MOCK_CONFIG_ENTRY",
",",
"title",
"=",
"MOCK_NAME",
")... | [
79,
0
] | [
97,
28
] | python | en | ['en', 'lb', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.