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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
TestFFmpegNoiseSetup.test_setup_component_start_callback | (self, mock_ffmpeg) | Set up ffmpeg component. | Set up ffmpeg component. | def test_setup_component_start_callback(self, mock_ffmpeg):
"""Set up ffmpeg component."""
with assert_setup_component(1, "binary_sensor"):
setup_component(self.hass, "binary_sensor", self.config)
self.hass.block_till_done()
assert self.hass.data["ffmpeg"].binary == "ffmpeg"... | [
"def",
"test_setup_component_start_callback",
"(",
"self",
",",
"mock_ffmpeg",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"binary_sensor\"",
")",
":",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"binary_sensor\"",
",",
"self",
".",
"confi... | [
49,
4
] | [
67,
35
] | python | en | ['en', 'da', 'en'] | True |
TestFFmpegMotionSetup.setup_method | (self) | Set up things to be run when tests are started. | Set up things to be run when tests are started. | def setup_method(self):
"""Set up things to be run when tests are started."""
self.hass = get_test_home_assistant()
self.config = {
"binary_sensor": {"platform": "ffmpeg_motion", "input": "testinputvideo"}
} | [
"def",
"setup_method",
"(",
"self",
")",
":",
"self",
".",
"hass",
"=",
"get_test_home_assistant",
"(",
")",
"self",
".",
"config",
"=",
"{",
"\"binary_sensor\"",
":",
"{",
"\"platform\"",
":",
"\"ffmpeg_motion\"",
",",
"\"input\"",
":",
"\"testinputvideo\"",
... | [
73,
4
] | [
79,
9
] | python | en | ['en', 'en', 'en'] | True |
TestFFmpegMotionSetup.teardown_method | (self) | Stop everything that was started. | Stop everything that was started. | def teardown_method(self):
"""Stop everything that was started."""
self.hass.stop() | [
"def",
"teardown_method",
"(",
"self",
")",
":",
"self",
".",
"hass",
".",
"stop",
"(",
")"
] | [
81,
4
] | [
83,
24
] | python | en | ['en', 'en', 'en'] | True |
TestFFmpegMotionSetup.test_setup_component | (self) | Set up ffmpeg component. | Set up ffmpeg component. | def test_setup_component(self):
"""Set up ffmpeg component."""
with assert_setup_component(1, "binary_sensor"):
setup_component(self.hass, "binary_sensor", self.config)
self.hass.block_till_done()
assert self.hass.data["ffmpeg"].binary == "ffmpeg"
assert self.hass.st... | [
"def",
"test_setup_component",
"(",
"self",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"binary_sensor\"",
")",
":",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"binary_sensor\"",
",",
"self",
".",
"config",
")",
"self",
".",
"hass",
... | [
85,
4
] | [
92,
78
] | python | en | ['en', 'da', 'en'] | True |
TestFFmpegMotionSetup.test_setup_component_start | (self, mock_start) | Set up ffmpeg component. | Set up ffmpeg component. | def test_setup_component_start(self, mock_start):
"""Set up ffmpeg component."""
with assert_setup_component(1, "binary_sensor"):
setup_component(self.hass, "binary_sensor", self.config)
self.hass.block_till_done()
assert self.hass.data["ffmpeg"].binary == "ffmpeg"
a... | [
"def",
"test_setup_component_start",
"(",
"self",
",",
"mock_start",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"binary_sensor\"",
")",
":",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"binary_sensor\"",
",",
"self",
".",
"config",
")",... | [
95,
4
] | [
108,
44
] | python | en | ['en', 'da', 'en'] | True |
TestFFmpegMotionSetup.test_setup_component_start_callback | (self, mock_ffmpeg) | Set up ffmpeg component. | Set up ffmpeg component. | def test_setup_component_start_callback(self, mock_ffmpeg):
"""Set up ffmpeg component."""
with assert_setup_component(1, "binary_sensor"):
setup_component(self.hass, "binary_sensor", self.config)
self.hass.block_till_done()
assert self.hass.data["ffmpeg"].binary == "ffmpeg"... | [
"def",
"test_setup_component_start_callback",
"(",
"self",
",",
"mock_ffmpeg",
")",
":",
"with",
"assert_setup_component",
"(",
"1",
",",
"\"binary_sensor\"",
")",
":",
"setup_component",
"(",
"self",
".",
"hass",
",",
"\"binary_sensor\"",
",",
"self",
".",
"confi... | [
111,
4
] | [
129,
35
] | python | en | ['en', 'da', 'en'] | True |
BondDevice.__init__ | (self, device_id: str, attrs: dict, props: dict) | Create a helper device from ID and attributes returned by API. | Create a helper device from ID and attributes returned by API. | def __init__(self, device_id: str, attrs: dict, props: dict):
"""Create a helper device from ID and attributes returned by API."""
self.device_id = device_id
self.props = props
self._attrs = attrs | [
"def",
"__init__",
"(",
"self",
",",
"device_id",
":",
"str",
",",
"attrs",
":",
"dict",
",",
"props",
":",
"dict",
")",
":",
"self",
".",
"device_id",
"=",
"device_id",
"self",
".",
"props",
"=",
"props",
"self",
".",
"_attrs",
"=",
"attrs"
] | [
12,
4
] | [
16,
27
] | python | en | ['en', 'en', 'en'] | True |
BondDevice.__repr__ | (self) | Return readable representation of a bond device. | Return readable representation of a bond device. | def __repr__(self):
"""Return readable representation of a bond device."""
return {
"device_id": self.device_id,
"props": self.props,
"attrs": self._attrs,
}.__repr__() | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"{",
"\"device_id\"",
":",
"self",
".",
"device_id",
",",
"\"props\"",
":",
"self",
".",
"props",
",",
"\"attrs\"",
":",
"self",
".",
"_attrs",
",",
"}",
".",
"__repr__",
"(",
")"
] | [
18,
4
] | [
24,
20
] | python | en | ['en', 'en', 'en'] | True |
BondDevice.name | (self) | Get the name of this device. | Get the name of this device. | def name(self) -> str:
"""Get the name of this device."""
return self._attrs["name"] | [
"def",
"name",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_attrs",
"[",
"\"name\"",
"]"
] | [
27,
4
] | [
29,
34
] | python | en | ['en', 'en', 'en'] | True |
BondDevice.type | (self) | Get the type of this device. | Get the type of this device. | def type(self) -> str:
"""Get the type of this device."""
return self._attrs["type"] | [
"def",
"type",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_attrs",
"[",
"\"type\"",
"]"
] | [
32,
4
] | [
34,
34
] | python | en | ['en', 'en', 'en'] | True |
BondDevice.trust_state | (self) | Check if Trust State is turned on. | Check if Trust State is turned on. | def trust_state(self) -> bool:
"""Check if Trust State is turned on."""
return self.props.get("trust_state", False) | [
"def",
"trust_state",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"props",
".",
"get",
"(",
"\"trust_state\"",
",",
"False",
")"
] | [
37,
4
] | [
39,
51
] | python | en | ['en', 'en', 'en'] | True |
BondDevice.supports_speed | (self) | Return True if this device supports any of the speed related commands. | Return True if this device supports any of the speed related commands. | def supports_speed(self) -> bool:
"""Return True if this device supports any of the speed related commands."""
actions: List[str] = self._attrs["actions"]
return bool([action for action in actions if action in [Action.SET_SPEED]]) | [
"def",
"supports_speed",
"(",
"self",
")",
"->",
"bool",
":",
"actions",
":",
"List",
"[",
"str",
"]",
"=",
"self",
".",
"_attrs",
"[",
"\"actions\"",
"]",
"return",
"bool",
"(",
"[",
"action",
"for",
"action",
"in",
"actions",
"if",
"action",
"in",
... | [
41,
4
] | [
44,
83
] | python | en | ['en', 'en', 'en'] | True |
BondDevice.supports_direction | (self) | Return True if this device supports any of the direction related commands. | Return True if this device supports any of the direction related commands. | def supports_direction(self) -> bool:
"""Return True if this device supports any of the direction related commands."""
actions: List[str] = self._attrs["actions"]
return bool([action for action in actions if action in [Action.SET_DIRECTION]]) | [
"def",
"supports_direction",
"(",
"self",
")",
"->",
"bool",
":",
"actions",
":",
"List",
"[",
"str",
"]",
"=",
"self",
".",
"_attrs",
"[",
"\"actions\"",
"]",
"return",
"bool",
"(",
"[",
"action",
"for",
"action",
"in",
"actions",
"if",
"action",
"in"... | [
46,
4
] | [
49,
87
] | python | en | ['en', 'en', 'en'] | True |
BondDevice.supports_light | (self) | Return True if this device supports any of the light related commands. | Return True if this device supports any of the light related commands. | def supports_light(self) -> bool:
"""Return True if this device supports any of the light related commands."""
actions: List[str] = self._attrs["actions"]
return bool(
[
action
for action in actions
if action in [Action.TURN_LIGHT_ON, A... | [
"def",
"supports_light",
"(",
"self",
")",
"->",
"bool",
":",
"actions",
":",
"List",
"[",
"str",
"]",
"=",
"self",
".",
"_attrs",
"[",
"\"actions\"",
"]",
"return",
"bool",
"(",
"[",
"action",
"for",
"action",
"in",
"actions",
"if",
"action",
"in",
... | [
51,
4
] | [
60,
9
] | python | en | ['en', 'en', 'en'] | True |
BondDevice.supports_set_brightness | (self) | Return True if this device supports setting a light brightness. | Return True if this device supports setting a light brightness. | def supports_set_brightness(self) -> bool:
"""Return True if this device supports setting a light brightness."""
actions: List[str] = self._attrs["actions"]
return bool([action for action in actions if action in [Action.SET_BRIGHTNESS]]) | [
"def",
"supports_set_brightness",
"(",
"self",
")",
"->",
"bool",
":",
"actions",
":",
"List",
"[",
"str",
"]",
"=",
"self",
".",
"_attrs",
"[",
"\"actions\"",
"]",
"return",
"bool",
"(",
"[",
"action",
"for",
"action",
"in",
"actions",
"if",
"action",
... | [
62,
4
] | [
65,
88
] | python | en | ['en', 'en', 'en'] | True |
BondHub.__init__ | (self, bond: Bond) | Initialize Bond Hub. | Initialize Bond Hub. | def __init__(self, bond: Bond):
"""Initialize Bond Hub."""
self.bond: Bond = bond
self._version: Optional[dict] = None
self._devices: Optional[List[BondDevice]] = None | [
"def",
"__init__",
"(",
"self",
",",
"bond",
":",
"Bond",
")",
":",
"self",
".",
"bond",
":",
"Bond",
"=",
"bond",
"self",
".",
"_version",
":",
"Optional",
"[",
"dict",
"]",
"=",
"None",
"self",
".",
"_devices",
":",
"Optional",
"[",
"List",
"[",
... | [
71,
4
] | [
75,
56
] | python | en | ['en', 'pl', 'it'] | False |
BondHub.setup | (self) | Read hub version information. | Read hub version information. | async def setup(self):
"""Read hub version information."""
self._version = await self.bond.version()
_LOGGER.debug("Bond reported the following version info: %s", self._version)
# Fetch all available devices using Bond API.
device_ids = await self.bond.devices()
self._de... | [
"async",
"def",
"setup",
"(",
"self",
")",
":",
"self",
".",
"_version",
"=",
"await",
"self",
".",
"bond",
".",
"version",
"(",
")",
"_LOGGER",
".",
"debug",
"(",
"\"Bond reported the following version info: %s\"",
",",
"self",
".",
"_version",
")",
"# Fetc... | [
77,
4
] | [
93,
67
] | python | en | ['pl', 'sv', 'en'] | False |
BondHub.bond_id | (self) | Return unique Bond ID for this hub. | Return unique Bond ID for this hub. | def bond_id(self) -> str:
"""Return unique Bond ID for this hub."""
return self._version["bondid"] | [
"def",
"bond_id",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_version",
"[",
"\"bondid\"",
"]"
] | [
96,
4
] | [
98,
38
] | python | en | ['en', 'hmn', 'en'] | True |
BondHub.target | (self) | Return this hub model. | Return this hub model. | def target(self) -> str:
"""Return this hub model."""
return self._version.get("target") | [
"def",
"target",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_version",
".",
"get",
"(",
"\"target\"",
")"
] | [
101,
4
] | [
103,
42
] | python | en | ['en', 'hmn', 'en'] | True |
BondHub.fw_ver | (self) | Return this hub firmware version. | Return this hub firmware version. | def fw_ver(self) -> str:
"""Return this hub firmware version."""
return self._version.get("fw_ver") | [
"def",
"fw_ver",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_version",
".",
"get",
"(",
"\"fw_ver\"",
")"
] | [
106,
4
] | [
108,
42
] | python | en | ['en', 'vi', 'en'] | True |
BondHub.devices | (self) | Return a list of all devices controlled by this hub. | Return a list of all devices controlled by this hub. | def devices(self) -> List[BondDevice]:
"""Return a list of all devices controlled by this hub."""
return self._devices | [
"def",
"devices",
"(",
"self",
")",
"->",
"List",
"[",
"BondDevice",
"]",
":",
"return",
"self",
".",
"_devices"
] | [
111,
4
] | [
113,
28
] | python | en | ['en', 'en', 'en'] | True |
BondHub.is_bridge | (self) | Return if the Bond is a Bond Bridge. | Return if the Bond is a Bond Bridge. | def is_bridge(self) -> bool:
"""Return if the Bond is a Bond Bridge."""
# If False, it means that it is a Smart by Bond product. Assumes that it is if the model is not available.
return self._version.get("model", "BD-").startswith("BD-") | [
"def",
"is_bridge",
"(",
"self",
")",
"->",
"bool",
":",
"# If False, it means that it is a Smart by Bond product. Assumes that it is if the model is not available.",
"return",
"self",
".",
"_version",
".",
"get",
"(",
"\"model\"",
",",
"\"BD-\"",
")",
".",
"startswith",
... | [
116,
4
] | [
119,
66
] | python | en | ['en', 'hu', 'en'] | True |
test_failing_setups_no_entities | (hass, numato_fixture, monkeypatch) | When port setup fails, no entity shall be created. | When port setup fails, no entity shall be created. | async def test_failing_setups_no_entities(hass, numato_fixture, monkeypatch):
"""When port setup fails, no entity shall be created."""
monkeypatch.setattr(numato_fixture.NumatoDeviceMock, "setup", mockup_raise)
assert await async_setup_component(hass, "numato", NUMATO_CFG)
await hass.async_block_till_do... | [
"async",
"def",
"test_failing_setups_no_entities",
"(",
"hass",
",",
"numato_fixture",
",",
"monkeypatch",
")",
":",
"monkeypatch",
".",
"setattr",
"(",
"numato_fixture",
".",
"NumatoDeviceMock",
",",
"\"setup\"",
",",
"mockup_raise",
")",
"assert",
"await",
"async_... | [
13,
0
] | [
19,
62
] | python | en | ['en', 'haw', 'en'] | True |
test_setup_callbacks | (hass, numato_fixture, monkeypatch) | During setup a callback shall be registered. | During setup a callback shall be registered. | async def test_setup_callbacks(hass, numato_fixture, monkeypatch):
"""During setup a callback shall be registered."""
numato_fixture.discover()
def mock_add_event_detect(self, port, callback, direction):
assert self == numato_fixture.devices[0]
assert port == 1
assert callback is c... | [
"async",
"def",
"test_setup_callbacks",
"(",
"hass",
",",
"numato_fixture",
",",
"monkeypatch",
")",
":",
"numato_fixture",
".",
"discover",
"(",
")",
"def",
"mock_add_event_detect",
"(",
"self",
",",
"port",
",",
"callback",
",",
"direction",
")",
":",
"asser... | [
22,
0
] | [
36,
66
] | python | en | ['en', 'en', 'en'] | True |
test_hass_binary_sensor_notification | (hass, numato_fixture) | Test regular operations from within Home Assistant. | Test regular operations from within Home Assistant. | async def test_hass_binary_sensor_notification(hass, numato_fixture):
"""Test regular operations from within Home Assistant."""
assert await async_setup_component(hass, "numato", NUMATO_CFG)
await hass.async_block_till_done() # wait until services are registered
assert (
hass.states.get("binary... | [
"async",
"def",
"test_hass_binary_sensor_notification",
"(",
"hass",
",",
"numato_fixture",
")",
":",
"assert",
"await",
"async_setup_component",
"(",
"hass",
",",
"\"numato\"",
",",
"NUMATO_CFG",
")",
"await",
"hass",
".",
"async_block_till_done",
"(",
")",
"# wait... | [
39,
0
] | [
50,
5
] | python | en | ['en', 'en', 'en'] | True |
test_binary_sensor_setup_without_discovery_info | (hass, config, numato_fixture) | Test handling of empty discovery_info. | Test handling of empty discovery_info. | async def test_binary_sensor_setup_without_discovery_info(hass, config, numato_fixture):
"""Test handling of empty discovery_info."""
numato_fixture.discover()
await discovery.async_load_platform(hass, "binary_sensor", "numato", None, config)
for entity_id in MOCKUP_ENTITY_IDS:
assert entity_id ... | [
"async",
"def",
"test_binary_sensor_setup_without_discovery_info",
"(",
"hass",
",",
"config",
",",
"numato_fixture",
")",
":",
"numato_fixture",
".",
"discover",
"(",
")",
"await",
"discovery",
".",
"async_load_platform",
"(",
"hass",
",",
"\"binary_sensor\"",
",",
... | [
53,
0
] | [
61,
58
] | python | en | ['en', 'en', 'en'] | True |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up an Amcrest IP Camera. | Set up an Amcrest IP Camera. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up an Amcrest IP Camera."""
if discovery_info is None:
return
name = discovery_info[CONF_NAME]
device = hass.data[DATA_AMCREST][DEVICES][name]
async_add_entities([AmcrestCam(name, device, hass.data... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"discovery_info",
"is",
"None",
":",
"return",
"name",
"=",
"discovery_info",
"[",
"CONF_NAME",
"]",
"device",
"=... | [
118,
0
] | [
125,
80
] | python | en | ['en', 'lb', 'en'] | True |
AmcrestCam.__init__ | (self, name, device, ffmpeg) | Initialize an Amcrest camera. | Initialize an Amcrest camera. | def __init__(self, name, device, ffmpeg):
"""Initialize an Amcrest camera."""
super().__init__()
self._name = name
self._api = device.api
self._ffmpeg = ffmpeg
self._ffmpeg_arguments = device.ffmpeg_arguments
self._stream_source = device.stream_source
self... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"device",
",",
"ffmpeg",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"self",
".",
"_name",
"=",
"name",
"self",
".",
"_api",
"=",
"device",
".",
"api",
"self",
".",
"_ffmpeg",
"=",
"ff... | [
139,
4
] | [
160,
38
] | python | en | ['en', 'en', 'it'] | True |
AmcrestCam.async_camera_image | (self) | Return a still image response from the camera. | Return a still image response from the camera. | async def async_camera_image(self):
"""Return a still image response from the camera."""
_LOGGER.debug("Take snapshot from %s", self._name)
try:
# Amcrest cameras only support one snapshot command at a time.
# Hence need to wait if a previous snapshot has not yet finished... | [
"async",
"def",
"async_camera_image",
"(",
"self",
")",
":",
"_LOGGER",
".",
"debug",
"(",
"\"Take snapshot from %s\"",
",",
"self",
".",
"_name",
")",
"try",
":",
"# Amcrest cameras only support one snapshot command at a time.",
"# Hence need to wait if a previous snapshot h... | [
189,
4
] | [
209,
23
] | python | en | ['en', 'en', 'en'] | True |
AmcrestCam.handle_async_mjpeg_stream | (self, request) | Return an MJPEG stream. | Return an MJPEG stream. | async def handle_async_mjpeg_stream(self, request):
"""Return an MJPEG stream."""
# The snapshot implementation is handled by the parent class
if self._stream_source == "snapshot":
return await super().handle_async_mjpeg_stream(request)
if not self.available:
_LO... | [
"async",
"def",
"handle_async_mjpeg_stream",
"(",
"self",
",",
"request",
")",
":",
"# The snapshot implementation is handled by the parent class",
"if",
"self",
".",
"_stream_source",
"==",
"\"snapshot\"",
":",
"return",
"await",
"super",
"(",
")",
".",
"handle_async_m... | [
211,
4
] | [
250,
32
] | python | en | ['en', 'is', 'en'] | True |
AmcrestCam.should_poll | (self) | Return True if entity has to be polled for state.
False if entity pushes its state to HA.
| Return True if entity has to be polled for state. | def should_poll(self) -> bool:
"""Return True if entity has to be polled for state.
False if entity pushes its state to HA.
"""
return True | [
"def",
"should_poll",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"True"
] | [
255,
4
] | [
260,
19
] | python | en | ['en', 'en', 'en'] | True |
AmcrestCam.name | (self) | Return the name of this camera. | Return the name of this camera. | def name(self):
"""Return the name of this camera."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
263,
4
] | [
265,
25
] | python | en | ['en', 'en', 'en'] | True |
AmcrestCam.device_state_attributes | (self) | Return the Amcrest-specific camera state attributes. | Return the Amcrest-specific camera state attributes. | def device_state_attributes(self):
"""Return the Amcrest-specific camera state attributes."""
attr = {}
if self._audio_enabled is not None:
attr["audio"] = _BOOL_TO_STATE.get(self._audio_enabled)
if self._motion_recording_enabled is not None:
attr["motion_recordin... | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"attr",
"=",
"{",
"}",
"if",
"self",
".",
"_audio_enabled",
"is",
"not",
"None",
":",
"attr",
"[",
"\"audio\"",
"]",
"=",
"_BOOL_TO_STATE",
".",
"get",
"(",
"self",
".",
"_audio_enabled",
")",
"if"... | [
268,
4
] | [
279,
19
] | python | en | ['en', 'en', 'en'] | True |
AmcrestCam.available | (self) | Return True if entity is available. | Return True if entity is available. | def available(self):
"""Return True if entity is available."""
return self._api.available | [
"def",
"available",
"(",
"self",
")",
":",
"return",
"self",
".",
"_api",
".",
"available"
] | [
282,
4
] | [
284,
34
] | python | en | ['en', 'en', 'en'] | True |
AmcrestCam.supported_features | (self) | Return supported features. | Return supported features. | def supported_features(self):
"""Return supported features."""
return SUPPORT_ON_OFF | SUPPORT_STREAM | [
"def",
"supported_features",
"(",
"self",
")",
":",
"return",
"SUPPORT_ON_OFF",
"|",
"SUPPORT_STREAM"
] | [
287,
4
] | [
289,
46
] | python | en | ['en', 'en', 'en'] | True |
AmcrestCam.is_recording | (self) | Return true if the device is recording. | Return true if the device is recording. | def is_recording(self):
"""Return true if the device is recording."""
return self._is_recording | [
"def",
"is_recording",
"(",
"self",
")",
":",
"return",
"self",
".",
"_is_recording"
] | [
294,
4
] | [
296,
33
] | python | en | ['en', 'en', 'en'] | True |
AmcrestCam.brand | (self) | Return the camera brand. | Return the camera brand. | def brand(self):
"""Return the camera brand."""
return self._brand | [
"def",
"brand",
"(",
"self",
")",
":",
"return",
"self",
".",
"_brand"
] | [
299,
4
] | [
301,
26
] | python | en | ['en', 'bs', 'en'] | True |
AmcrestCam.motion_detection_enabled | (self) | Return the camera motion detection status. | Return the camera motion detection status. | def motion_detection_enabled(self):
"""Return the camera motion detection status."""
return self._motion_detection_enabled | [
"def",
"motion_detection_enabled",
"(",
"self",
")",
":",
"return",
"self",
".",
"_motion_detection_enabled"
] | [
304,
4
] | [
306,
45
] | python | en | ['en', 'en', 'en'] | True |
AmcrestCam.model | (self) | Return the camera model. | Return the camera model. | def model(self):
"""Return the camera model."""
return self._model | [
"def",
"model",
"(",
"self",
")",
":",
"return",
"self",
".",
"_model"
] | [
309,
4
] | [
311,
26
] | python | en | ['en', 'co', 'en'] | True |
AmcrestCam.stream_source | (self) | Return the source of the stream. | Return the source of the stream. | async def stream_source(self):
"""Return the source of the stream."""
return self._rtsp_url | [
"async",
"def",
"stream_source",
"(",
"self",
")",
":",
"return",
"self",
".",
"_rtsp_url"
] | [
313,
4
] | [
315,
29
] | python | en | ['en', 'en', 'en'] | True |
AmcrestCam.is_on | (self) | Return true if on. | Return true if on. | def is_on(self):
"""Return true if on."""
return self.is_streaming | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"is_streaming"
] | [
318,
4
] | [
320,
32
] | python | en | ['en', 'mt', 'en'] | True |
AmcrestCam.async_on_demand_update | (self) | Update state. | Update state. | async def async_on_demand_update(self):
"""Update state."""
self.async_schedule_update_ha_state(True) | [
"async",
"def",
"async_on_demand_update",
"(",
"self",
")",
":",
"self",
".",
"async_schedule_update_ha_state",
"(",
"True",
")"
] | [
324,
4
] | [
326,
49
] | python | en | ['en', 'co', 'en'] | False |
AmcrestCam.async_added_to_hass | (self) | Subscribe to signals and add camera to list. | Subscribe to signals and add camera to list. | async def async_added_to_hass(self):
"""Subscribe to signals and add camera to list."""
for service, params in CAMERA_SERVICES.items():
self._unsub_dispatcher.append(
async_dispatcher_connect(
self.hass,
service_signal(service, self.ent... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"for",
"service",
",",
"params",
"in",
"CAMERA_SERVICES",
".",
"items",
"(",
")",
":",
"self",
".",
"_unsub_dispatcher",
".",
"append",
"(",
"async_dispatcher_connect",
"(",
"self",
".",
"hass",
"... | [
328,
4
] | [
345,
68
] | python | en | ['en', 'en', 'en'] | True |
AmcrestCam.async_will_remove_from_hass | (self) | Remove camera from list and disconnect from signals. | Remove camera from list and disconnect from signals. | async def async_will_remove_from_hass(self):
"""Remove camera from list and disconnect from signals."""
self.hass.data[DATA_AMCREST][CAMERAS].remove(self.entity_id)
for unsub_dispatcher in self._unsub_dispatcher:
unsub_dispatcher() | [
"async",
"def",
"async_will_remove_from_hass",
"(",
"self",
")",
":",
"self",
".",
"hass",
".",
"data",
"[",
"DATA_AMCREST",
"]",
"[",
"CAMERAS",
"]",
".",
"remove",
"(",
"self",
".",
"entity_id",
")",
"for",
"unsub_dispatcher",
"in",
"self",
".",
"_unsub_... | [
347,
4
] | [
351,
30
] | python | en | ['en', 'en', 'en'] | True |
AmcrestCam.update | (self) | Update entity status. | Update entity status. | def update(self):
"""Update entity status."""
if not self.available or self._update_succeeded:
if not self.available:
self._update_succeeded = False
return
_LOGGER.debug("Updating %s camera", self.name)
try:
if self._brand is None:
... | [
"def",
"update",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"available",
"or",
"self",
".",
"_update_succeeded",
":",
"if",
"not",
"self",
".",
"available",
":",
"self",
".",
"_update_succeeded",
"=",
"False",
"return",
"_LOGGER",
".",
"debug",
"("... | [
353,
4
] | [
384,
41
] | python | en | ['en', 'la', 'en'] | True |
AmcrestCam.turn_off | (self) | Turn off camera. | Turn off camera. | def turn_off(self):
"""Turn off camera."""
self._enable_video(False) | [
"def",
"turn_off",
"(",
"self",
")",
":",
"self",
".",
"_enable_video",
"(",
"False",
")"
] | [
388,
4
] | [
390,
33
] | python | en | ['en', 'ja', 'en'] | True |
AmcrestCam.turn_on | (self) | Turn on camera. | Turn on camera. | def turn_on(self):
"""Turn on camera."""
self._enable_video(True) | [
"def",
"turn_on",
"(",
"self",
")",
":",
"self",
".",
"_enable_video",
"(",
"True",
")"
] | [
392,
4
] | [
394,
32
] | python | en | ['en', 'et', 'en'] | True |
AmcrestCam.enable_motion_detection | (self) | Enable motion detection in the camera. | Enable motion detection in the camera. | def enable_motion_detection(self):
"""Enable motion detection in the camera."""
self._enable_motion_detection(True) | [
"def",
"enable_motion_detection",
"(",
"self",
")",
":",
"self",
".",
"_enable_motion_detection",
"(",
"True",
")"
] | [
396,
4
] | [
398,
43
] | python | en | ['en', 'en', 'en'] | True |
AmcrestCam.disable_motion_detection | (self) | Disable motion detection in camera. | Disable motion detection in camera. | def disable_motion_detection(self):
"""Disable motion detection in camera."""
self._enable_motion_detection(False) | [
"def",
"disable_motion_detection",
"(",
"self",
")",
":",
"self",
".",
"_enable_motion_detection",
"(",
"False",
")"
] | [
400,
4
] | [
402,
44
] | python | en | ['it', 'en', 'en'] | True |
AmcrestCam.async_enable_recording | (self) | Call the job and enable recording. | Call the job and enable recording. | async def async_enable_recording(self):
"""Call the job and enable recording."""
await self.hass.async_add_executor_job(self._enable_recording, True) | [
"async",
"def",
"async_enable_recording",
"(",
"self",
")",
":",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"self",
".",
"_enable_recording",
",",
"True",
")"
] | [
406,
4
] | [
408,
76
] | python | en | ['en', 'en', 'en'] | True |
AmcrestCam.async_disable_recording | (self) | Call the job and disable recording. | Call the job and disable recording. | async def async_disable_recording(self):
"""Call the job and disable recording."""
await self.hass.async_add_executor_job(self._enable_recording, False) | [
"async",
"def",
"async_disable_recording",
"(",
"self",
")",
":",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"self",
".",
"_enable_recording",
",",
"False",
")"
] | [
410,
4
] | [
412,
77
] | python | en | ['en', 'en', 'en'] | True |
AmcrestCam.async_enable_audio | (self) | Call the job and enable audio. | Call the job and enable audio. | async def async_enable_audio(self):
"""Call the job and enable audio."""
await self.hass.async_add_executor_job(self._enable_audio, True) | [
"async",
"def",
"async_enable_audio",
"(",
"self",
")",
":",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"self",
".",
"_enable_audio",
",",
"True",
")"
] | [
414,
4
] | [
416,
72
] | python | en | ['en', 'en', 'en'] | True |
AmcrestCam.async_disable_audio | (self) | Call the job and disable audio. | Call the job and disable audio. | async def async_disable_audio(self):
"""Call the job and disable audio."""
await self.hass.async_add_executor_job(self._enable_audio, False) | [
"async",
"def",
"async_disable_audio",
"(",
"self",
")",
":",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"self",
".",
"_enable_audio",
",",
"False",
")"
] | [
418,
4
] | [
420,
73
] | python | en | ['en', 'en', 'en'] | True |
AmcrestCam.async_enable_motion_recording | (self) | Call the job and enable motion recording. | Call the job and enable motion recording. | async def async_enable_motion_recording(self):
"""Call the job and enable motion recording."""
await self.hass.async_add_executor_job(self._enable_motion_recording, True) | [
"async",
"def",
"async_enable_motion_recording",
"(",
"self",
")",
":",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"self",
".",
"_enable_motion_recording",
",",
"True",
")"
] | [
422,
4
] | [
424,
83
] | python | en | ['en', 'en', 'en'] | True |
AmcrestCam.async_disable_motion_recording | (self) | Call the job and disable motion recording. | Call the job and disable motion recording. | async def async_disable_motion_recording(self):
"""Call the job and disable motion recording."""
await self.hass.async_add_executor_job(self._enable_motion_recording, False) | [
"async",
"def",
"async_disable_motion_recording",
"(",
"self",
")",
":",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"self",
".",
"_enable_motion_recording",
",",
"False",
")"
] | [
426,
4
] | [
428,
84
] | python | en | ['en', 'en', 'en'] | True |
AmcrestCam.async_goto_preset | (self, preset) | Call the job and move camera to preset position. | Call the job and move camera to preset position. | async def async_goto_preset(self, preset):
"""Call the job and move camera to preset position."""
await self.hass.async_add_executor_job(self._goto_preset, preset) | [
"async",
"def",
"async_goto_preset",
"(",
"self",
",",
"preset",
")",
":",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"self",
".",
"_goto_preset",
",",
"preset",
")"
] | [
430,
4
] | [
432,
73
] | python | en | ['en', 'en', 'en'] | True |
AmcrestCam.async_set_color_bw | (self, color_bw) | Call the job and set camera color mode. | Call the job and set camera color mode. | async def async_set_color_bw(self, color_bw):
"""Call the job and set camera color mode."""
await self.hass.async_add_executor_job(self._set_color_bw, color_bw) | [
"async",
"def",
"async_set_color_bw",
"(",
"self",
",",
"color_bw",
")",
":",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"self",
".",
"_set_color_bw",
",",
"color_bw",
")"
] | [
434,
4
] | [
436,
76
] | python | en | ['en', 'pt', 'en'] | True |
AmcrestCam.async_start_tour | (self) | Call the job and start camera tour. | Call the job and start camera tour. | async def async_start_tour(self):
"""Call the job and start camera tour."""
await self.hass.async_add_executor_job(self._start_tour, True) | [
"async",
"def",
"async_start_tour",
"(",
"self",
")",
":",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"self",
".",
"_start_tour",
",",
"True",
")"
] | [
438,
4
] | [
440,
70
] | python | en | ['en', 'su', 'en'] | True |
AmcrestCam.async_stop_tour | (self) | Call the job and stop camera tour. | Call the job and stop camera tour. | async def async_stop_tour(self):
"""Call the job and stop camera tour."""
await self.hass.async_add_executor_job(self._start_tour, False) | [
"async",
"def",
"async_stop_tour",
"(",
"self",
")",
":",
"await",
"self",
".",
"hass",
".",
"async_add_executor_job",
"(",
"self",
".",
"_start_tour",
",",
"False",
")"
] | [
442,
4
] | [
444,
71
] | python | en | ['en', 'su', 'en'] | True |
AmcrestCam.async_ptz_control | (self, movement, travel_time) | Move or zoom camera in specified direction. | Move or zoom camera in specified direction. | async def async_ptz_control(self, movement, travel_time):
"""Move or zoom camera in specified direction."""
code = _ACTION[_MOV.index(movement)]
kwargs = {"code": code, "arg1": 0, "arg2": 0, "arg3": 0}
if code in _MOVE_1_ACTIONS:
kwargs["arg2"] = 1
elif code in _MOVE... | [
"async",
"def",
"async_ptz_control",
"(",
"self",
",",
"movement",
",",
"travel_time",
")",
":",
"code",
"=",
"_ACTION",
"[",
"_MOV",
".",
"index",
"(",
"movement",
")",
"]",
"kwargs",
"=",
"{",
"\"code\"",
":",
"code",
",",
"\"arg1\"",
":",
"0",
",",
... | [
446,
4
] | [
467,
13
] | python | en | ['nl', 'en', 'en'] | True |
AmcrestCam._enable_video | (self, enable) | Enable or disable camera video stream. | Enable or disable camera video stream. | def _enable_video(self, enable):
"""Enable or disable camera video stream."""
# Given the way the camera's state is determined by
# is_streaming and is_recording, we can't leave
# recording on if video stream is being turned off.
if self.is_recording and not enable:
s... | [
"def",
"_enable_video",
"(",
"self",
",",
"enable",
")",
":",
"# Given the way the camera's state is determined by",
"# is_streaming and is_recording, we can't leave",
"# recording on if video stream is being turned off.",
"if",
"self",
".",
"is_recording",
"and",
"not",
"enable",
... | [
501,
4
] | [
510,
32
] | python | en | ['en', 'en', 'en'] | True |
AmcrestCam._enable_recording | (self, enable) | Turn recording on or off. | Turn recording on or off. | def _enable_recording(self, enable):
"""Turn recording on or off."""
# Given the way the camera's state is determined by
# is_streaming and is_recording, we can't leave
# video stream off if recording is being turned on.
if not self.is_streaming and enable:
self._enab... | [
"def",
"_enable_recording",
"(",
"self",
",",
"enable",
")",
":",
"# Given the way the camera's state is determined by",
"# is_streaming and is_recording, we can't leave",
"# video stream off if recording is being turned on.",
"if",
"not",
"self",
".",
"is_streaming",
"and",
"enabl... | [
519,
4
] | [
526,
66
] | python | en | ['en', 'en', 'en'] | True |
AmcrestCam._enable_motion_detection | (self, enable) | Enable or disable motion detection. | Enable or disable motion detection. | def _enable_motion_detection(self, enable):
"""Enable or disable motion detection."""
self._change_setting(enable, "_motion_detection_enabled", "motion detection") | [
"def",
"_enable_motion_detection",
"(",
"self",
",",
"enable",
")",
":",
"self",
".",
"_change_setting",
"(",
"enable",
",",
"\"_motion_detection_enabled\"",
",",
"\"motion detection\"",
")"
] | [
534,
4
] | [
536,
85
] | python | en | ['en', 'en', 'en'] | True |
AmcrestCam._enable_audio | (self, enable) | Enable or disable audio stream. | Enable or disable audio stream. | def _enable_audio(self, enable):
"""Enable or disable audio stream."""
self._change_setting(enable, "_audio_enabled", "audio")
if self._control_light:
self._change_light() | [
"def",
"_enable_audio",
"(",
"self",
",",
"enable",
")",
":",
"self",
".",
"_change_setting",
"(",
"enable",
",",
"\"_audio_enabled\"",
",",
"\"audio\"",
")",
"if",
"self",
".",
"_control_light",
":",
"self",
".",
"_change_light",
"(",
")"
] | [
544,
4
] | [
548,
32
] | python | en | ['en', 'en', 'en'] | True |
AmcrestCam._change_light | (self) | Enable or disable indicator light. | Enable or disable indicator light. | def _change_light(self):
"""Enable or disable indicator light."""
self._change_setting(
self._audio_enabled or self.is_streaming, None, "indicator light"
) | [
"def",
"_change_light",
"(",
"self",
")",
":",
"self",
".",
"_change_setting",
"(",
"self",
".",
"_audio_enabled",
"or",
"self",
".",
"is_streaming",
",",
"None",
",",
"\"indicator light\"",
")"
] | [
560,
4
] | [
564,
9
] | python | en | ['en', 'en', 'en'] | True |
AmcrestCam._enable_motion_recording | (self, enable) | Enable or disable motion recording. | Enable or disable motion recording. | def _enable_motion_recording(self, enable):
"""Enable or disable motion recording."""
self._change_setting(enable, "_motion_recording_enabled", "motion recording") | [
"def",
"_enable_motion_recording",
"(",
"self",
",",
"enable",
")",
":",
"self",
".",
"_change_setting",
"(",
"enable",
",",
"\"_motion_recording_enabled\"",
",",
"\"motion recording\"",
")"
] | [
572,
4
] | [
574,
85
] | python | en | ['en', 'en', 'en'] | True |
AmcrestCam._goto_preset | (self, preset) | Move camera position and zoom to preset. | Move camera position and zoom to preset. | def _goto_preset(self, preset):
"""Move camera position and zoom to preset."""
try:
self._api.go_to_preset(action="start", preset_point_number=preset)
except AmcrestError as error:
log_update_error(
_LOGGER, "move", self.name, f"camera to preset {preset}",... | [
"def",
"_goto_preset",
"(",
"self",
",",
"preset",
")",
":",
"try",
":",
"self",
".",
"_api",
".",
"go_to_preset",
"(",
"action",
"=",
"\"start\"",
",",
"preset_point_number",
"=",
"preset",
")",
"except",
"AmcrestError",
"as",
"error",
":",
"log_update_erro... | [
576,
4
] | [
583,
13
] | python | en | ['en', 'en', 'en'] | True |
AmcrestCam._set_color_bw | (self, cbw) | Set camera color mode. | Set camera color mode. | def _set_color_bw(self, cbw):
"""Set camera color mode."""
self._change_setting(cbw, "_color_bw", "color mode") | [
"def",
"_set_color_bw",
"(",
"self",
",",
"cbw",
")",
":",
"self",
".",
"_change_setting",
"(",
"cbw",
",",
"\"_color_bw\"",
",",
"\"color mode\"",
")"
] | [
591,
4
] | [
593,
60
] | python | es | ['es', 'pt', 'it'] | False |
AmcrestCam._start_tour | (self, start) | Start camera tour. | Start camera tour. | def _start_tour(self, start):
"""Start camera tour."""
try:
self._api.tour(start=start)
except AmcrestError as error:
log_update_error(
_LOGGER, "start" if start else "stop", self.name, "camera tour", error
) | [
"def",
"_start_tour",
"(",
"self",
",",
"start",
")",
":",
"try",
":",
"self",
".",
"_api",
".",
"tour",
"(",
"start",
"=",
"start",
")",
"except",
"AmcrestError",
"as",
"error",
":",
"log_update_error",
"(",
"_LOGGER",
",",
"\"start\"",
"if",
"start",
... | [
595,
4
] | [
602,
13
] | python | en | ['fr', 'jv', 'en'] | False |
async_setup_platform | (hass, config, async_add_entities, discovery_info=None) | Set up the Satel Integra binary sensor devices. | Set up the Satel Integra binary sensor devices. | async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the Satel Integra binary sensor devices."""
if not discovery_info:
return
configured_zones = discovery_info[CONF_ZONES]
controller = hass.data[DATA_SATEL]
devices = []
for zone_num, device... | [
"async",
"def",
"async_setup_platform",
"(",
"hass",
",",
"config",
",",
"async_add_entities",
",",
"discovery_info",
"=",
"None",
")",
":",
"if",
"not",
"discovery_info",
":",
"return",
"configured_zones",
"=",
"discovery_info",
"[",
"CONF_ZONES",
"]",
"controlle... | [
19,
0
] | [
47,
31
] | python | en | ['en', 'mg', 'en'] | True |
SatelIntegraBinarySensor.__init__ | (
self, controller, device_number, device_name, zone_type, react_to_signal
) | Initialize the binary_sensor. | Initialize the binary_sensor. | def __init__(
self, controller, device_number, device_name, zone_type, react_to_signal
):
"""Initialize the binary_sensor."""
self._device_number = device_number
self._name = device_name
self._zone_type = zone_type
self._state = 0
self._react_to_signal = react... | [
"def",
"__init__",
"(",
"self",
",",
"controller",
",",
"device_number",
",",
"device_name",
",",
"zone_type",
",",
"react_to_signal",
")",
":",
"self",
".",
"_device_number",
"=",
"device_number",
"self",
".",
"_name",
"=",
"device_name",
"self",
".",
"_zone_... | [
53,
4
] | [
62,
32
] | python | en | ['en', 'haw', 'en'] | True |
SatelIntegraBinarySensor.async_added_to_hass | (self) | Register callbacks. | Register callbacks. | async def async_added_to_hass(self):
"""Register callbacks."""
if self._react_to_signal == SIGNAL_OUTPUTS_UPDATED:
if self._device_number in self._satel.violated_outputs:
self._state = 1
else:
self._state = 0
else:
if self._devi... | [
"async",
"def",
"async_added_to_hass",
"(",
"self",
")",
":",
"if",
"self",
".",
"_react_to_signal",
"==",
"SIGNAL_OUTPUTS_UPDATED",
":",
"if",
"self",
".",
"_device_number",
"in",
"self",
".",
"_satel",
".",
"violated_outputs",
":",
"self",
".",
"_state",
"="... | [
64,
4
] | [
80,
9
] | python | en | ['en', 'no', 'en'] | False |
SatelIntegraBinarySensor.name | (self) | Return the name of the entity. | Return the name of the entity. | def name(self):
"""Return the name of the entity."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | [
83,
4
] | [
85,
25
] | python | en | ['en', 'en', 'en'] | True |
SatelIntegraBinarySensor.icon | (self) | Icon for device by its type. | Icon for device by its type. | def icon(self):
"""Icon for device by its type."""
if self._zone_type == DEVICE_CLASS_SMOKE:
return "mdi:fire" | [
"def",
"icon",
"(",
"self",
")",
":",
"if",
"self",
".",
"_zone_type",
"==",
"DEVICE_CLASS_SMOKE",
":",
"return",
"\"mdi:fire\""
] | [
88,
4
] | [
91,
29
] | python | en | ['en', 'en', 'en'] | True |
SatelIntegraBinarySensor.should_poll | (self) | No polling needed. | No polling needed. | def should_poll(self):
"""No polling needed."""
return False | [
"def",
"should_poll",
"(",
"self",
")",
":",
"return",
"False"
] | [
94,
4
] | [
96,
20
] | python | en | ['en', 'en', 'en'] | True |
SatelIntegraBinarySensor.is_on | (self) | Return true if sensor is on. | Return true if sensor is on. | def is_on(self):
"""Return true if sensor is on."""
return self._state == 1 | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state",
"==",
"1"
] | [
99,
4
] | [
101,
31
] | python | en | ['en', 'et', 'en'] | True |
SatelIntegraBinarySensor.device_class | (self) | Return the class of this sensor, from DEVICE_CLASSES. | Return the class of this sensor, from DEVICE_CLASSES. | def device_class(self):
"""Return the class of this sensor, from DEVICE_CLASSES."""
return self._zone_type | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"self",
".",
"_zone_type"
] | [
104,
4
] | [
106,
30
] | python | en | ['en', 'en', 'en'] | True |
SatelIntegraBinarySensor._devices_updated | (self, zones) | Update the zone's state, if needed. | Update the zone's state, if needed. | def _devices_updated(self, zones):
"""Update the zone's state, if needed."""
if self._device_number in zones and self._state != zones[self._device_number]:
self._state = zones[self._device_number]
self.async_write_ha_state() | [
"def",
"_devices_updated",
"(",
"self",
",",
"zones",
")",
":",
"if",
"self",
".",
"_device_number",
"in",
"zones",
"and",
"self",
".",
"_state",
"!=",
"zones",
"[",
"self",
".",
"_device_number",
"]",
":",
"self",
".",
"_state",
"=",
"zones",
"[",
"se... | [
109,
4
] | [
113,
39
] | python | en | ['en', 'en', 'en'] | True |
async_setup | (hass: HomeAssistantType, config) | Set up UpCloud component. | Set up UpCloud component. | async def async_setup(hass: HomeAssistantType, config) -> bool:
"""Set up UpCloud component."""
domain_config = config.get(DOMAIN)
if not domain_config:
return True
_LOGGER.warning(
"Loading upcloud via top level config is deprecated and no longer "
"necessary as of 0.117. Pleas... | [
"async",
"def",
"async_setup",
"(",
"hass",
":",
"HomeAssistantType",
",",
"config",
")",
"->",
"bool",
":",
"domain_config",
"=",
"config",
".",
"get",
"(",
"DOMAIN",
")",
"if",
"not",
"domain_config",
":",
"return",
"True",
"_LOGGER",
".",
"warning",
"("... | [
121,
0
] | [
148,
15
] | python | en | ['en', 'en', 'en'] | True |
_config_entry_update_signal_name | (config_entry: ConfigEntry) | Get signal name for updates to a config entry. | Get signal name for updates to a config entry. | def _config_entry_update_signal_name(config_entry: ConfigEntry) -> str:
"""Get signal name for updates to a config entry."""
return CONFIG_ENTRY_UPDATE_SIGNAL_TEMPLATE.format(config_entry.unique_id) | [
"def",
"_config_entry_update_signal_name",
"(",
"config_entry",
":",
"ConfigEntry",
")",
"->",
"str",
":",
"return",
"CONFIG_ENTRY_UPDATE_SIGNAL_TEMPLATE",
".",
"format",
"(",
"config_entry",
".",
"unique_id",
")"
] | [
151,
0
] | [
153,
77
] | python | en | ['en', 'en', 'en'] | True |
_async_signal_options_update | (
hass: HomeAssistantType, config_entry: ConfigEntry
) | Signal config entry options update. | Signal config entry options update. | async def _async_signal_options_update(
hass: HomeAssistantType, config_entry: ConfigEntry
) -> None:
"""Signal config entry options update."""
async_dispatcher_send(
hass, _config_entry_update_signal_name(config_entry), config_entry
) | [
"async",
"def",
"_async_signal_options_update",
"(",
"hass",
":",
"HomeAssistantType",
",",
"config_entry",
":",
"ConfigEntry",
")",
"->",
"None",
":",
"async_dispatcher_send",
"(",
"hass",
",",
"_config_entry_update_signal_name",
"(",
"config_entry",
")",
",",
"confi... | [
156,
0
] | [
162,
5
] | python | en | ['en', 'en', 'en'] | True |
async_setup_entry | (hass: HomeAssistantType, config_entry: ConfigEntry) | Set up the UpCloud config entry. | Set up the UpCloud config entry. | async def async_setup_entry(hass: HomeAssistantType, config_entry: ConfigEntry) -> bool:
"""Set up the UpCloud config entry."""
manager = upcloud_api.CloudManager(
config_entry.data[CONF_USERNAME], config_entry.data[CONF_PASSWORD]
)
try:
await hass.async_add_executor_job(manager.authen... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistantType",
",",
"config_entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"manager",
"=",
"upcloud_api",
".",
"CloudManager",
"(",
"config_entry",
".",
"data",
"[",
"CONF_USERNAME",
"]",
",",
"... | [
165,
0
] | [
233,
15
] | python | en | ['en', 'en', 'en'] | True |
async_unload_entry | (hass, config_entry) | Unload the config entry. | Unload the config entry. | async def async_unload_entry(hass, config_entry):
"""Unload the config entry."""
for domain in CONFIG_ENTRY_DOMAINS:
await hass.config_entries.async_forward_entry_unload(config_entry, domain)
coordinator: UpCloudDataUpdateCoordinator = hass.data[
DATA_UPCLOUD
].coordinators.pop(config_e... | [
"async",
"def",
"async_unload_entry",
"(",
"hass",
",",
"config_entry",
")",
":",
"for",
"domain",
"in",
"CONFIG_ENTRY_DOMAINS",
":",
"await",
"hass",
".",
"config_entries",
".",
"async_forward_entry_unload",
"(",
"config_entry",
",",
"domain",
")",
"coordinator",
... | [
236,
0
] | [
247,
15
] | python | en | ['en', 'en', 'en'] | True |
UpCloudDataUpdateCoordinator.__init__ | (
self,
hass: HomeAssistantType,
*,
cloud_manager: upcloud_api.CloudManager,
update_interval: timedelta,
username: str,
) | Initialize coordinator. | Initialize coordinator. | def __init__(
self,
hass: HomeAssistantType,
*,
cloud_manager: upcloud_api.CloudManager,
update_interval: timedelta,
username: str,
) -> None:
"""Initialize coordinator."""
super().__init__(
hass, _LOGGER, name=f"{username}@UpCloud", update... | [
"def",
"__init__",
"(",
"self",
",",
"hass",
":",
"HomeAssistantType",
",",
"*",
",",
"cloud_manager",
":",
"upcloud_api",
".",
"CloudManager",
",",
"update_interval",
":",
"timedelta",
",",
"username",
":",
"str",
",",
")",
"->",
"None",
":",
"super",
"("... | [
81,
4
] | [
94,
53
] | python | it | ['it', 'ro', 'it'] | False |
UpCloudDataUpdateCoordinator.async_update_config | (self, config_entry: ConfigEntry) | Handle config update. | Handle config update. | async def async_update_config(self, config_entry: ConfigEntry) -> None:
"""Handle config update."""
self.update_interval = timedelta(
seconds=config_entry.options[CONF_SCAN_INTERVAL]
) | [
"async",
"def",
"async_update_config",
"(",
"self",
",",
"config_entry",
":",
"ConfigEntry",
")",
"->",
"None",
":",
"self",
".",
"update_interval",
"=",
"timedelta",
"(",
"seconds",
"=",
"config_entry",
".",
"options",
"[",
"CONF_SCAN_INTERVAL",
"]",
")"
] | [
96,
4
] | [
100,
9
] | python | de | ['de', 'nl', 'en'] | False |
UpCloudServerEntity.__init__ | (self, coordinator, uuid) | Initialize the UpCloud server entity. | Initialize the UpCloud server entity. | def __init__(self, coordinator, uuid):
"""Initialize the UpCloud server entity."""
super().__init__(coordinator)
self.uuid = uuid | [
"def",
"__init__",
"(",
"self",
",",
"coordinator",
",",
"uuid",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"coordinator",
")",
"self",
".",
"uuid",
"=",
"uuid"
] | [
253,
4
] | [
256,
24
] | python | en | ['en', 'en', 'en'] | True |
UpCloudServerEntity.unique_id | (self) | Return unique ID for the entity. | Return unique ID for the entity. | def unique_id(self) -> str:
"""Return unique ID for the entity."""
return self.uuid | [
"def",
"unique_id",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"uuid"
] | [
263,
4
] | [
265,
24
] | python | en | ['en', 'en', 'en'] | True |
UpCloudServerEntity.name | (self) | Return the name of the component. | Return the name of the component. | def name(self):
"""Return the name of the component."""
try:
return DEFAULT_COMPONENT_NAME.format(self._server.title)
except (AttributeError, KeyError, TypeError):
return DEFAULT_COMPONENT_NAME.format(self.uuid) | [
"def",
"name",
"(",
"self",
")",
":",
"try",
":",
"return",
"DEFAULT_COMPONENT_NAME",
".",
"format",
"(",
"self",
".",
"_server",
".",
"title",
")",
"except",
"(",
"AttributeError",
",",
"KeyError",
",",
"TypeError",
")",
":",
"return",
"DEFAULT_COMPONENT_NA... | [
268,
4
] | [
273,
59
] | python | en | ['en', 'en', 'en'] | True |
UpCloudServerEntity.icon | (self) | Return the icon of this server. | Return the icon of this server. | def icon(self):
"""Return the icon of this server."""
return "mdi:server" if self.is_on else "mdi:server-off" | [
"def",
"icon",
"(",
"self",
")",
":",
"return",
"\"mdi:server\"",
"if",
"self",
".",
"is_on",
"else",
"\"mdi:server-off\""
] | [
276,
4
] | [
278,
63
] | python | en | ['en', 'en', 'en'] | True |
UpCloudServerEntity.state | (self) | Return state of the server. | Return state of the server. | def state(self):
"""Return state of the server."""
try:
return STATE_MAP.get(self._server.state, self._server.state)
except AttributeError:
return None | [
"def",
"state",
"(",
"self",
")",
":",
"try",
":",
"return",
"STATE_MAP",
".",
"get",
"(",
"self",
".",
"_server",
".",
"state",
",",
"self",
".",
"_server",
".",
"state",
")",
"except",
"AttributeError",
":",
"return",
"None"
] | [
281,
4
] | [
286,
23
] | python | en | ['en', 'en', 'en'] | True |
UpCloudServerEntity.is_on | (self) | Return true if the server is on. | Return true if the server is on. | def is_on(self):
"""Return true if the server is on."""
return self.state == STATE_ON | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"state",
"==",
"STATE_ON"
] | [
289,
4
] | [
291,
37
] | python | en | ['en', 'en', 'en'] | True |
UpCloudServerEntity.device_class | (self) | Return the class of this server. | Return the class of this server. | def device_class(self):
"""Return the class of this server."""
return DEFAULT_COMPONENT_DEVICE_CLASS | [
"def",
"device_class",
"(",
"self",
")",
":",
"return",
"DEFAULT_COMPONENT_DEVICE_CLASS"
] | [
294,
4
] | [
296,
45
] | python | en | ['en', 'en', 'en'] | True |
UpCloudServerEntity.device_state_attributes | (self) | Return the state attributes of the UpCloud server. | Return the state attributes of the UpCloud server. | def device_state_attributes(self):
"""Return the state attributes of the UpCloud server."""
return {
x: getattr(self._server, x, None)
for x in (
ATTR_UUID,
ATTR_TITLE,
ATTR_HOSTNAME,
ATTR_ZONE,
ATTR_... | [
"def",
"device_state_attributes",
"(",
"self",
")",
":",
"return",
"{",
"x",
":",
"getattr",
"(",
"self",
".",
"_server",
",",
"x",
",",
"None",
")",
"for",
"x",
"in",
"(",
"ATTR_UUID",
",",
"ATTR_TITLE",
",",
"ATTR_HOSTNAME",
",",
"ATTR_ZONE",
",",
"A... | [
299,
4
] | [
311,
9
] | python | en | ['en', 'en', 'en'] | True |
get_soup | (url, headers=HEADERS) | Obtém objeto BeautifulSoup (soup) para o url dado. | Obtém objeto BeautifulSoup (soup) para o url dado. | def get_soup(url, headers=HEADERS):
"""Obtém objeto BeautifulSoup (soup) para o url dado."""
reqopen = Request(url, headers=headers)
req = urlopen(reqopen)
soup = BeautifulSoup(req.read(), "html.parser")
return soup | [
"def",
"get_soup",
"(",
"url",
",",
"headers",
"=",
"HEADERS",
")",
":",
"reqopen",
"=",
"Request",
"(",
"url",
",",
"headers",
"=",
"headers",
")",
"req",
"=",
"urlopen",
"(",
"reqopen",
")",
"soup",
"=",
"BeautifulSoup",
"(",
"req",
".",
"read",
"(... | [
7,
0
] | [
12,
15
] | python | pt | ['pt', 'pt', 'pt'] | True |
get_events_urls | () | Raspa URLs de todos os eventos da ANPUH. | Raspa URLs de todos os eventos da ANPUH. | def get_events_urls():
"""Raspa URLs de todos os eventos da ANPUH."""
pass | [
"def",
"get_events_urls",
"(",
")",
":",
"pass"
] | [
15,
0
] | [
17,
8
] | python | pt | ['pt', 'pt', 'pt'] | True |
get_event_id | (event_url) | Extrai número do evento com base em seu URL. | Extrai número do evento com base em seu URL. | def get_event_id(event_url):
"""Extrai número do evento com base em seu URL."""
pass | [
"def",
"get_event_id",
"(",
"event_url",
")",
":",
"pass"
] | [
20,
0
] | [
22,
8
] | python | pt | ['pt', 'pt', 'pt'] | True |
_is_whitespace | (char) | Checks whether `char` is a whitespace character. | Checks whether `char` is a whitespace character. | def _is_whitespace(char):
"""Checks whether `char` is a whitespace character."""
# \t, \n, and \r are technically control characters but we treat them
# as whitespace since they are generally considered as such.
if char == " " or char == "\t" or char == "\n" or char == "\r":
return True
cat ... | [
"def",
"_is_whitespace",
"(",
"char",
")",
":",
"# \\t, \\n, and \\r are technically control characters but we treat them",
"# as whitespace since they are generally considered as such.",
"if",
"char",
"==",
"\" \"",
"or",
"char",
"==",
"\"\\t\"",
"or",
"char",
"==",
"\"\\n\"",... | [
50,
0
] | [
59,
16
] | python | en | ['en', 'en', 'en'] | True |
_is_control | (char) | Checks whether `char` is a control character. | Checks whether `char` is a control character. | def _is_control(char):
"""Checks whether `char` is a control character."""
# These are technically control characters but we count them as whitespace
# characters.
if char == "\t" or char == "\n" or char == "\r":
return False
cat = unicodedata.category(char)
if cat.startswith("C"):
... | [
"def",
"_is_control",
"(",
"char",
")",
":",
"# These are technically control characters but we count them as whitespace",
"# characters.",
"if",
"char",
"==",
"\"\\t\"",
"or",
"char",
"==",
"\"\\n\"",
"or",
"char",
"==",
"\"\\r\"",
":",
"return",
"False",
"cat",
"=",... | [
62,
0
] | [
71,
16
] | python | en | ['en', 'en', 'en'] | True |
_is_punctuation | (char) | Checks whether `char` is a punctuation character. | Checks whether `char` is a punctuation character. | def _is_punctuation(char):
"""Checks whether `char` is a punctuation character."""
cp = ord(char)
# We treat all non-letter/number ASCII as punctuation.
# Characters such as "^", "$", and "`" are not in the Unicode
# Punctuation class but we treat them as punctuation anyways, for
# consistency.
... | [
"def",
"_is_punctuation",
"(",
"char",
")",
":",
"cp",
"=",
"ord",
"(",
"char",
")",
"# We treat all non-letter/number ASCII as punctuation.",
"# Characters such as \"^\", \"$\", and \"`\" are not in the Unicode",
"# Punctuation class but we treat them as punctuation anyways, for",
"# ... | [
74,
0
] | [
86,
16
] | python | en | ['en', 'en', 'en'] | True |
_is_end_of_word | (text) | Checks whether the last character in text is one of a punctuation, control or whitespace character. | Checks whether the last character in text is one of a punctuation, control or whitespace character. | def _is_end_of_word(text):
"""Checks whether the last character in text is one of a punctuation, control or whitespace character."""
last_char = text[-1]
return bool(_is_control(last_char) | _is_punctuation(last_char) | _is_whitespace(last_char)) | [
"def",
"_is_end_of_word",
"(",
"text",
")",
":",
"last_char",
"=",
"text",
"[",
"-",
"1",
"]",
"return",
"bool",
"(",
"_is_control",
"(",
"last_char",
")",
"|",
"_is_punctuation",
"(",
"last_char",
")",
"|",
"_is_whitespace",
"(",
"last_char",
")",
")"
] | [
89,
0
] | [
92,
96
] | python | en | ['en', 'en', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.