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
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Ezviz IP Cameras.
Set up the Ezviz IP Cameras.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Ezviz IP Cameras.""" conf_cameras = config[CONF_CAMERAS] account = config[CONF_USERNAME] password = config[CONF_PASSWORD] try: ezviz_client = EzvizClient(account, password) ezviz_client.login() ...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "conf_cameras", "=", "config", "[", "CONF_CAMERAS", "]", "account", "=", "config", "[", "CONF_USERNAME", "]", "password", "=", "config", "...
[ 39, 0 ]
[ 94, 33 ]
python
en
['en', 'sn', 'en']
True
HassEzvizCamera.__init__
(self, **data)
Initialize an Ezviz camera.
Initialize an Ezviz camera.
def __init__(self, **data): """Initialize an Ezviz camera.""" super().__init__() self._username = data["username"] self._password = data["password"] self._rtsp_stream = data["rtsp_stream"] self._ezviz_camera = data["ezviz_camera"] self._serial = data["serial"] ...
[ "def", "__init__", "(", "self", ",", "*", "*", "data", ")", ":", "super", "(", ")", ".", "__init__", "(", ")", "self", ".", "_username", "=", "data", "[", "\"username\"", "]", "self", ".", "_password", "=", "data", "[", "\"password\"", "]", "self", ...
[ 100, 4 ]
[ 125, 27 ]
python
br
['br', 'eu', 'it']
False
HassEzvizCamera.update
(self)
Update the camera states.
Update the camera states.
def update(self): """Update the camera states.""" data = self._ezviz_camera.status() self._name = data["name"] self._status = data["status"] self._privacy = data["privacy"] self._audio = data["audio"] self._ir_led = data["ir_led"] self._state_led = data[...
[ "def", "update", "(", "self", ")", ":", "data", "=", "self", ".", "_ezviz_camera", ".", "status", "(", ")", "self", ".", "_name", "=", "data", "[", "\"name\"", "]", "self", ".", "_status", "=", "data", "[", "\"status\"", "]", "self", ".", "_privacy",...
[ 127, 4 ]
[ 145, 55 ]
python
en
['en', 'co', 'en']
True
HassEzvizCamera.async_added_to_hass
(self)
Subscribe to ffmpeg and add camera to list.
Subscribe to ffmpeg and add camera to list.
async def async_added_to_hass(self): """Subscribe to ffmpeg and add camera to list.""" self._ffmpeg = self.hass.data[DATA_FFMPEG]
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "self", ".", "_ffmpeg", "=", "self", ".", "hass", ".", "data", "[", "DATA_FFMPEG", "]" ]
[ 147, 4 ]
[ 149, 50 ]
python
en
['en', 'en', 'en']
True
HassEzvizCamera.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" ]
[ 152, 4 ]
[ 157, 19 ]
python
en
['en', 'en', 'en']
True
HassEzvizCamera.device_state_attributes
(self)
Return the Ezviz-specific camera state attributes.
Return the Ezviz-specific camera state attributes.
def device_state_attributes(self): """Return the Ezviz-specific camera state attributes.""" return { # if privacy == true, the device closed the lid or did a 180° tilt "privacy": self._privacy, # is the camera listening ? "audio": self._audio, ...
[ "def", "device_state_attributes", "(", "self", ")", ":", "return", "{", "# if privacy == true, the device closed the lid or did a 180° tilt", "\"privacy\"", ":", "self", ".", "_privacy", ",", "# is the camera listening ?", "\"audio\"", ":", "self", ".", "_audio", ",", "# ...
[ 160, 4 ]
[ 183, 9 ]
python
en
['en', 'it', 'en']
True
HassEzvizCamera.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._status
[ "def", "available", "(", "self", ")", ":", "return", "self", ".", "_status" ]
[ 186, 4 ]
[ 188, 27 ]
python
en
['en', 'en', 'en']
True
HassEzvizCamera.brand
(self)
Return the camera brand.
Return the camera brand.
def brand(self): """Return the camera brand.""" return "Ezviz"
[ "def", "brand", "(", "self", ")", ":", "return", "\"Ezviz\"" ]
[ 191, 4 ]
[ 193, 22 ]
python
en
['en', 'bs', 'en']
True
HassEzvizCamera.supported_features
(self)
Return supported features.
Return supported features.
def supported_features(self): """Return supported features.""" if self._rtsp_stream: return SUPPORT_STREAM return 0
[ "def", "supported_features", "(", "self", ")", ":", "if", "self", ".", "_rtsp_stream", ":", "return", "SUPPORT_STREAM", "return", "0" ]
[ 196, 4 ]
[ 200, 16 ]
python
en
['en', 'en', 'en']
True
HassEzvizCamera.model
(self)
Return the camera model.
Return the camera model.
def model(self): """Return the camera model.""" return self._device_sub_category
[ "def", "model", "(", "self", ")", ":", "return", "self", ".", "_device_sub_category" ]
[ 203, 4 ]
[ 205, 40 ]
python
en
['en', 'co', 'en']
True
HassEzvizCamera.is_on
(self)
Return true if on.
Return true if on.
def is_on(self): """Return true if on.""" return self._status
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "_status" ]
[ 208, 4 ]
[ 210, 27 ]
python
en
['en', 'mt', 'en']
True
HassEzvizCamera.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" ]
[ 213, 4 ]
[ 215, 25 ]
python
en
['en', 'en', 'en']
True
HassEzvizCamera.async_camera_image
(self)
Return a frame from the camera stream.
Return a frame from the camera stream.
async def async_camera_image(self): """Return a frame from the camera stream.""" ffmpeg = ImageFrame(self._ffmpeg.binary, loop=self.hass.loop) image = await asyncio.shield( ffmpeg.get_image(self._rtsp_stream, output_format=IMAGE_JPEG) ) return image
[ "async", "def", "async_camera_image", "(", "self", ")", ":", "ffmpeg", "=", "ImageFrame", "(", "self", ".", "_ffmpeg", ".", "binary", ",", "loop", "=", "self", ".", "hass", ".", "loop", ")", "image", "=", "await", "asyncio", ".", "shield", "(", "ffmpeg...
[ 217, 4 ]
[ 224, 20 ]
python
en
['en', 'en', 'en']
True
HassEzvizCamera.stream_source
(self)
Return the stream source.
Return the stream source.
async def stream_source(self): """Return the stream source.""" if self._local_rtsp_port: rtsp_stream_source = ( f"rtsp://{self._username}:{self._password}@" f"{self._local_ip}:{self._local_rtsp_port}" ) _LOGGER.debug( "C...
[ "async", "def", "stream_source", "(", "self", ")", ":", "if", "self", ".", "_local_rtsp_port", ":", "rtsp_stream_source", "=", "(", "f\"rtsp://{self._username}:{self._password}@\"", "f\"{self._local_ip}:{self._local_rtsp_port}\"", ")", "_LOGGER", ".", "debug", "(", "\"Cam...
[ 226, 4 ]
[ 238, 19 ]
python
en
['en', 'ig', 'en']
True
setup_risco
(hass, options={})
Set up a Risco integration for testing.
Set up a Risco integration for testing.
async def setup_risco(hass, options={}): """Set up a Risco integration for testing.""" config_entry = MockConfigEntry(domain=DOMAIN, data=TEST_CONFIG, options=options) config_entry.add_to_hass(hass) with patch( "homeassistant.components.risco.RiscoAPI.login", return_value=True, ), p...
[ "async", "def", "setup_risco", "(", "hass", ",", "options", "=", "{", "}", ")", ":", "config_entry", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "data", "=", "TEST_CONFIG", ",", "options", "=", "options", ")", "config_entry", ".", "add_to_ha...
[ 18, 0 ]
[ 38, 23 ]
python
en
['en', 'en', 'en']
True
two_zone_alarm
()
Fixture to mock alarm with two zones.
Fixture to mock alarm with two zones.
def two_zone_alarm(): """Fixture to mock alarm with two zones.""" zone_mocks = {0: _zone_mock(), 1: _zone_mock()} alarm_mock = MagicMock() with patch.object( zone_mocks[0], "id", new_callable=PropertyMock(return_value=0) ), patch.object( zone_mocks[0], "name", new_callable=PropertyMo...
[ "def", "two_zone_alarm", "(", ")", ":", "zone_mocks", "=", "{", "0", ":", "_zone_mock", "(", ")", ",", "1", ":", "_zone_mock", "(", ")", "}", "alarm_mock", "=", "MagicMock", "(", ")", "with", "patch", ".", "object", "(", "zone_mocks", "[", "0", "]", ...
[ 49, 0 ]
[ 69, 24 ]
python
en
['en', 'en', 'en']
True
test_flow_works
(hass)
Test that config flow works.
Test that config flow works.
async def test_flow_works(hass): """Test that config flow works.""" with requests_mock.Mocker() as mock: mock.get( "https://id.starline.ru/apiV3/application/getCode/", text='{"state": 1, "desc": {"code": "' + TEST_APP_CODE + '"}}', ) mock.get( "https:/...
[ "async", "def", "test_flow_works", "(", "hass", ")", ":", "with", "requests_mock", ".", "Mocker", "(", ")", "as", "mock", ":", "mock", ".", "get", "(", "\"https://id.starline.ru/apiV3/application/getCode/\"", ",", "text", "=", "'{\"state\": 1, \"desc\": {\"code\": \"'...
[ 16, 0 ]
[ 67, 62 ]
python
en
['en', 'en', 'en']
True
test_step_auth_app_code_falls
(hass)
Test config flow works when app auth code fails.
Test config flow works when app auth code fails.
async def test_step_auth_app_code_falls(hass): """Test config flow works when app auth code fails.""" with requests_mock.Mocker() as mock: mock.get( "https://id.starline.ru/apiV3/application/getCode/", text='{"state": 0}}' ) result = await hass.config_entries.flow.async_init(...
[ "async", "def", "test_step_auth_app_code_falls", "(", "hass", ")", ":", "with", "requests_mock", ".", "Mocker", "(", ")", "as", "mock", ":", "mock", ".", "get", "(", "\"https://id.starline.ru/apiV3/application/getCode/\"", ",", "text", "=", "'{\"state\": 0}}'", ")",...
[ 70, 0 ]
[ 86, 61 ]
python
en
['en', 'fr', 'en']
True
test_step_auth_app_token_falls
(hass)
Test config flow works when app auth token fails.
Test config flow works when app auth token fails.
async def test_step_auth_app_token_falls(hass): """Test config flow works when app auth token fails.""" with requests_mock.Mocker() as mock: mock.get( "https://id.starline.ru/apiV3/application/getCode/", text='{"state": 1, "desc": {"code": "' + TEST_APP_CODE + '"}}', ) ...
[ "async", "def", "test_step_auth_app_token_falls", "(", "hass", ")", ":", "with", "requests_mock", ".", "Mocker", "(", ")", "as", "mock", ":", "mock", ".", "get", "(", "\"https://id.starline.ru/apiV3/application/getCode/\"", ",", "text", "=", "'{\"state\": 1, \"desc\":...
[ 89, 0 ]
[ 109, 61 ]
python
en
['en', 'fr', 'en']
True
test_step_auth_user_falls
(hass)
Test config flow works when user fails.
Test config flow works when user fails.
async def test_step_auth_user_falls(hass): """Test config flow works when user fails.""" with requests_mock.Mocker() as mock: mock.post("https://id.starline.ru/apiV3/user/login/", text='{"state": 0}') flow = config_flow.StarlineFlowHandler() flow.hass = hass result = await flow.a...
[ "async", "def", "test_step_auth_user_falls", "(", "hass", ")", ":", "with", "requests_mock", ".", "Mocker", "(", ")", "as", "mock", ":", "mock", ".", "post", "(", "\"https://id.starline.ru/apiV3/user/login/\"", ",", "text", "=", "'{\"state\": 0}'", ")", "flow", ...
[ 112, 0 ]
[ 126, 62 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up the Risco alarm control panel.
Set up the Risco alarm control panel.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up the Risco alarm control panel.""" coordinator = hass.data[DOMAIN][config_entry.entry_id][DATA_COORDINATOR] options = {**DEFAULT_OPTIONS, **config_entry.options} entities = [ RiscoAlarm(coordinator, partition_id, confi...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "coordinator", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "config_entry", ".", "entry_id", "]", "[", "DATA_COORDINATOR", "]", "options", "=", ...
[ 48, 0 ]
[ 57, 39 ]
python
en
['en', 'en', 'en']
True
RiscoAlarm.__init__
(self, coordinator, partition_id, code, options)
Init the partition.
Init the partition.
def __init__(self, coordinator, partition_id, code, options): """Init the partition.""" super().__init__(coordinator) self._partition_id = partition_id self._partition = self.coordinator.data.partitions[self._partition_id] self._code = code self._code_arm_required = optio...
[ "def", "__init__", "(", "self", ",", "coordinator", ",", "partition_id", ",", "code", ",", "options", ")", ":", "super", "(", ")", ".", "__init__", "(", "coordinator", ")", "self", ".", "_partition_id", "=", "partition_id", "self", ".", "_partition", "=", ...
[ 63, 4 ]
[ 75, 73 ]
python
en
['en', 'en', 'en']
True
RiscoAlarm.device_info
(self)
Return device info for this device.
Return device info for this device.
def device_info(self): """Return device info for this device.""" return { "identifiers": {(DOMAIN, self.unique_id)}, "name": self.name, "manufacturer": "Risco", }
[ "def", "device_info", "(", "self", ")", ":", "return", "{", "\"identifiers\"", ":", "{", "(", "DOMAIN", ",", "self", ".", "unique_id", ")", "}", ",", "\"name\"", ":", "self", ".", "name", ",", "\"manufacturer\"", ":", "\"Risco\"", ",", "}" ]
[ 81, 4 ]
[ 87, 9 ]
python
en
['en', 'en', 'en']
True
RiscoAlarm.name
(self)
Return the name of the partition.
Return the name of the partition.
def name(self): """Return the name of the partition.""" return f"Risco {self._risco.site_name} Partition {self._partition_id}"
[ "def", "name", "(", "self", ")", ":", "return", "f\"Risco {self._risco.site_name} Partition {self._partition_id}\"" ]
[ 90, 4 ]
[ 92, 78 ]
python
en
['en', 'en', 'en']
True
RiscoAlarm.unique_id
(self)
Return a unique id for that partition.
Return a unique id for that partition.
def unique_id(self): """Return a unique id for that partition.""" return f"{self._risco.site_uuid}_{self._partition_id}"
[ "def", "unique_id", "(", "self", ")", ":", "return", "f\"{self._risco.site_uuid}_{self._partition_id}\"" ]
[ 95, 4 ]
[ 97, 62 ]
python
en
['en', 'fr', 'en']
True
RiscoAlarm.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._partition.triggered: return STATE_ALARM_TRIGGERED if self._partition.arming: return STATE_ALARM_ARMING if self._partition.disarmed: return STATE_ALARM_DISARMED if self._partition.a...
[ "def", "state", "(", "self", ")", ":", "if", "self", ".", "_partition", ".", "triggered", ":", "return", "STATE_ALARM_TRIGGERED", "if", "self", ".", "_partition", ".", "arming", ":", "return", "STATE_ALARM_ARMING", "if", "self", ".", "_partition", ".", "disa...
[ 100, 4 ]
[ 117, 19 ]
python
en
['en', 'en', 'en']
True
RiscoAlarm.supported_features
(self)
Return the list of supported features.
Return the list of supported features.
def supported_features(self): """Return the list of supported features.""" return self._supported_states
[ "def", "supported_features", "(", "self", ")", ":", "return", "self", ".", "_supported_states" ]
[ 120, 4 ]
[ 122, 37 ]
python
en
['en', 'en', 'en']
True
RiscoAlarm.code_arm_required
(self)
Whether the code is required for arm actions.
Whether the code is required for arm actions.
def code_arm_required(self): """Whether the code is required for arm actions.""" return self._code_arm_required
[ "def", "code_arm_required", "(", "self", ")", ":", "return", "self", ".", "_code_arm_required" ]
[ 125, 4 ]
[ 127, 38 ]
python
en
['en', 'en', 'en']
True
RiscoAlarm.code_format
(self)
Return one or more digits/characters.
Return one or more digits/characters.
def code_format(self): """Return one or more digits/characters.""" return FORMAT_NUMBER
[ "def", "code_format", "(", "self", ")", ":", "return", "FORMAT_NUMBER" ]
[ 130, 4 ]
[ 132, 28 ]
python
en
['en', 'en', 'en']
True
RiscoAlarm._validate_code
(self, code)
Validate given code.
Validate given code.
def _validate_code(self, code): """Validate given code.""" return code == self._code
[ "def", "_validate_code", "(", "self", ",", "code", ")", ":", "return", "code", "==", "self", ".", "_code" ]
[ 134, 4 ]
[ 136, 33 ]
python
en
['en', 'en', 'en']
True
RiscoAlarm.async_alarm_disarm
(self, code=None)
Send disarm command.
Send disarm command.
async def async_alarm_disarm(self, code=None): """Send disarm command.""" if self._code_disarm_required and not self._validate_code(code): _LOGGER.warning("Wrong code entered for disarming") return await self._call_alarm_method("disarm")
[ "async", "def", "async_alarm_disarm", "(", "self", ",", "code", "=", "None", ")", ":", "if", "self", ".", "_code_disarm_required", "and", "not", "self", ".", "_validate_code", "(", "code", ")", ":", "_LOGGER", ".", "warning", "(", "\"Wrong code entered for dis...
[ 138, 4 ]
[ 143, 47 ]
python
en
['en', 'pt', 'en']
True
RiscoAlarm.async_alarm_arm_home
(self, code=None)
Send arm home command.
Send arm home command.
async def async_alarm_arm_home(self, code=None): """Send arm home command.""" await self._arm(STATE_ALARM_ARMED_HOME, code)
[ "async", "def", "async_alarm_arm_home", "(", "self", ",", "code", "=", "None", ")", ":", "await", "self", ".", "_arm", "(", "STATE_ALARM_ARMED_HOME", ",", "code", ")" ]
[ 145, 4 ]
[ 147, 53 ]
python
en
['en', 'pt', 'en']
True
RiscoAlarm.async_alarm_arm_away
(self, code=None)
Send arm away command.
Send arm away command.
async def async_alarm_arm_away(self, code=None): """Send arm away command.""" await self._arm(STATE_ALARM_ARMED_AWAY, code)
[ "async", "def", "async_alarm_arm_away", "(", "self", ",", "code", "=", "None", ")", ":", "await", "self", ".", "_arm", "(", "STATE_ALARM_ARMED_AWAY", ",", "code", ")" ]
[ 149, 4 ]
[ 151, 53 ]
python
en
['en', 'en', 'en']
True
RiscoAlarm.async_alarm_arm_night
(self, code=None)
Send arm night command.
Send arm night command.
async def async_alarm_arm_night(self, code=None): """Send arm night command.""" await self._arm(STATE_ALARM_ARMED_NIGHT, code)
[ "async", "def", "async_alarm_arm_night", "(", "self", ",", "code", "=", "None", ")", ":", "await", "self", ".", "_arm", "(", "STATE_ALARM_ARMED_NIGHT", ",", "code", ")" ]
[ 153, 4 ]
[ 155, 54 ]
python
en
['en', 'zh', 'en']
True
RiscoAlarm.async_alarm_arm_custom_bypass
(self, code=None)
Send arm custom bypass command.
Send arm custom bypass command.
async def async_alarm_arm_custom_bypass(self, code=None): """Send arm custom bypass command.""" await self._arm(STATE_ALARM_ARMED_CUSTOM_BYPASS, code)
[ "async", "def", "async_alarm_arm_custom_bypass", "(", "self", ",", "code", "=", "None", ")", ":", "await", "self", ".", "_arm", "(", "STATE_ALARM_ARMED_CUSTOM_BYPASS", ",", "code", ")" ]
[ 157, 4 ]
[ 159, 62 ]
python
en
['en', 'ga', 'en']
True
async_setup_entry
( hass: HomeAssistant, entry: ConfigEntry, async_add_entities: Callable[[List[Entity], bool], None], )
Set up the sensor config entry.
Set up the sensor config entry.
async def async_setup_entry( hass: HomeAssistant, entry: ConfigEntry, async_add_entities: Callable[[List[Entity], bool], None], ) -> None: """Set up the sensor config entry.""" controller_data = get_controller_data(hass, entry) async_add_entities( [ VeraThermostat(device, con...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ",", "async_add_entities", ":", "Callable", "[", "[", "List", "[", "Entity", "]", ",", "bool", "]", ",", "None", "]", ",", ")", "->", "None", ":", ...
[ 35, 0 ]
[ 47, 5 ]
python
en
['en', 'pt', 'en']
True
VeraThermostat.__init__
( self, vera_device: veraApi.VeraThermostat, controller_data: ControllerData )
Initialize the Vera device.
Initialize the Vera device.
def __init__( self, vera_device: veraApi.VeraThermostat, controller_data: ControllerData ): """Initialize the Vera device.""" VeraDevice.__init__(self, vera_device, controller_data) self.entity_id = ENTITY_ID_FORMAT.format(self.vera_id)
[ "def", "__init__", "(", "self", ",", "vera_device", ":", "veraApi", ".", "VeraThermostat", ",", "controller_data", ":", "ControllerData", ")", ":", "VeraDevice", ".", "__init__", "(", "self", ",", "vera_device", ",", "controller_data", ")", "self", ".", "entit...
[ 53, 4 ]
[ 58, 62 ]
python
en
['en', 'en', 'en']
True
VeraThermostat.supported_features
(self)
Return the list of supported features.
Return the list of supported features.
def supported_features(self) -> Optional[int]: """Return the list of supported features.""" return SUPPORT_FLAGS
[ "def", "supported_features", "(", "self", ")", "->", "Optional", "[", "int", "]", ":", "return", "SUPPORT_FLAGS" ]
[ 61, 4 ]
[ 63, 28 ]
python
en
['en', 'en', 'en']
True
VeraThermostat.hvac_mode
(self)
Return hvac operation ie. heat, cool mode. Need to be one of HVAC_MODE_*.
Return hvac operation ie. heat, cool mode.
def hvac_mode(self) -> str: """Return hvac operation ie. heat, cool mode. Need to be one of HVAC_MODE_*. """ mode = self.vera_device.get_hvac_mode() if mode == "HeatOn": return HVAC_MODE_HEAT if mode == "CoolOn": return HVAC_MODE_COOL if m...
[ "def", "hvac_mode", "(", "self", ")", "->", "str", ":", "mode", "=", "self", ".", "vera_device", ".", "get_hvac_mode", "(", ")", "if", "mode", "==", "\"HeatOn\"", ":", "return", "HVAC_MODE_HEAT", "if", "mode", "==", "\"CoolOn\"", ":", "return", "HVAC_MODE_...
[ 66, 4 ]
[ 78, 28 ]
python
bg
['en', 'bg', 'bg']
True
VeraThermostat.hvac_modes
(self)
Return the list of available hvac operation modes. Need to be a subset of HVAC_MODES.
Return the list of available hvac operation modes.
def hvac_modes(self) -> List[str]: """Return the list of available hvac operation modes. Need to be a subset of HVAC_MODES. """ return SUPPORT_HVAC
[ "def", "hvac_modes", "(", "self", ")", "->", "List", "[", "str", "]", ":", "return", "SUPPORT_HVAC" ]
[ 81, 4 ]
[ 86, 27 ]
python
en
['en', 'en', 'en']
True
VeraThermostat.fan_mode
(self)
Return the fan setting.
Return the fan setting.
def fan_mode(self) -> Optional[str]: """Return the fan setting.""" mode = self.vera_device.get_fan_mode() if mode == "ContinuousOn": return FAN_ON return FAN_AUTO
[ "def", "fan_mode", "(", "self", ")", "->", "Optional", "[", "str", "]", ":", "mode", "=", "self", ".", "vera_device", ".", "get_fan_mode", "(", ")", "if", "mode", "==", "\"ContinuousOn\"", ":", "return", "FAN_ON", "return", "FAN_AUTO" ]
[ 89, 4 ]
[ 94, 23 ]
python
en
['en', 'fy', 'en']
True
VeraThermostat.fan_modes
(self)
Return a list of available fan modes.
Return a list of available fan modes.
def fan_modes(self) -> Optional[List[str]]: """Return a list of available fan modes.""" return FAN_OPERATION_LIST
[ "def", "fan_modes", "(", "self", ")", "->", "Optional", "[", "List", "[", "str", "]", "]", ":", "return", "FAN_OPERATION_LIST" ]
[ 97, 4 ]
[ 99, 33 ]
python
en
['en', 'en', 'en']
True
VeraThermostat.set_fan_mode
(self, fan_mode)
Set new target temperature.
Set new target temperature.
def set_fan_mode(self, fan_mode) -> None: """Set new target temperature.""" if fan_mode == FAN_ON: self.vera_device.fan_on() else: self.vera_device.fan_auto() self.schedule_update_ha_state()
[ "def", "set_fan_mode", "(", "self", ",", "fan_mode", ")", "->", "None", ":", "if", "fan_mode", "==", "FAN_ON", ":", "self", ".", "vera_device", ".", "fan_on", "(", ")", "else", ":", "self", ".", "vera_device", ".", "fan_auto", "(", ")", "self", ".", ...
[ 101, 4 ]
[ 108, 39 ]
python
en
['en', 'ca', 'en']
True
VeraThermostat.current_power_w
(self)
Return the current power usage in W.
Return the current power usage in W.
def current_power_w(self) -> Optional[float]: """Return the current power usage in W.""" power = self.vera_device.power if power: return convert(power, float, 0.0)
[ "def", "current_power_w", "(", "self", ")", "->", "Optional", "[", "float", "]", ":", "power", "=", "self", ".", "vera_device", ".", "power", "if", "power", ":", "return", "convert", "(", "power", ",", "float", ",", "0.0", ")" ]
[ 111, 4 ]
[ 115, 45 ]
python
en
['en', 'en', 'en']
True
VeraThermostat.temperature_unit
(self)
Return the unit of measurement.
Return the unit of measurement.
def temperature_unit(self) -> str: """Return the unit of measurement.""" vera_temp_units = self.vera_device.vera_controller.temperature_units if vera_temp_units == "F": return TEMP_FAHRENHEIT return TEMP_CELSIUS
[ "def", "temperature_unit", "(", "self", ")", "->", "str", ":", "vera_temp_units", "=", "self", ".", "vera_device", ".", "vera_controller", ".", "temperature_units", "if", "vera_temp_units", "==", "\"F\"", ":", "return", "TEMP_FAHRENHEIT", "return", "TEMP_CELSIUS" ]
[ 118, 4 ]
[ 125, 27 ]
python
en
['en', 'la', 'en']
True
VeraThermostat.current_temperature
(self)
Return the current temperature.
Return the current temperature.
def current_temperature(self) -> Optional[float]: """Return the current temperature.""" return self.vera_device.get_current_temperature()
[ "def", "current_temperature", "(", "self", ")", "->", "Optional", "[", "float", "]", ":", "return", "self", ".", "vera_device", ".", "get_current_temperature", "(", ")" ]
[ 128, 4 ]
[ 130, 57 ]
python
en
['en', 'la', 'en']
True
VeraThermostat.operation
(self)
Return current operation ie. heat, cool, idle.
Return current operation ie. heat, cool, idle.
def operation(self) -> str: """Return current operation ie. heat, cool, idle.""" return self.vera_device.get_hvac_mode()
[ "def", "operation", "(", "self", ")", "->", "str", ":", "return", "self", ".", "vera_device", ".", "get_hvac_mode", "(", ")" ]
[ 133, 4 ]
[ 135, 47 ]
python
en
['nl', 'en', 'en']
True
VeraThermostat.target_temperature
(self)
Return the temperature we try to reach.
Return the temperature we try to reach.
def target_temperature(self) -> Optional[float]: """Return the temperature we try to reach.""" return self.vera_device.get_current_goal_temperature()
[ "def", "target_temperature", "(", "self", ")", "->", "Optional", "[", "float", "]", ":", "return", "self", ".", "vera_device", ".", "get_current_goal_temperature", "(", ")" ]
[ 138, 4 ]
[ 140, 62 ]
python
en
['en', 'en', 'en']
True
VeraThermostat.set_temperature
(self, **kwargs: Any)
Set new target temperatures.
Set new target temperatures.
def set_temperature(self, **kwargs: Any) -> None: """Set new target temperatures.""" if kwargs.get(ATTR_TEMPERATURE) is not None: self.vera_device.set_temperature(kwargs.get(ATTR_TEMPERATURE)) self.schedule_update_ha_state()
[ "def", "set_temperature", "(", "self", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "if", "kwargs", ".", "get", "(", "ATTR_TEMPERATURE", ")", "is", "not", "None", ":", "self", ".", "vera_device", ".", "set_temperature", "(", "kwargs", "...
[ 142, 4 ]
[ 147, 39 ]
python
en
['en', 'ca', 'en']
True
VeraThermostat.set_hvac_mode
(self, hvac_mode)
Set new target hvac mode.
Set new target hvac mode.
def set_hvac_mode(self, hvac_mode) -> None: """Set new target hvac mode.""" if hvac_mode == HVAC_MODE_OFF: self.vera_device.turn_off() elif hvac_mode == HVAC_MODE_HEAT_COOL: self.vera_device.turn_auto_on() elif hvac_mode == HVAC_MODE_COOL: self.vera_de...
[ "def", "set_hvac_mode", "(", "self", ",", "hvac_mode", ")", "->", "None", ":", "if", "hvac_mode", "==", "HVAC_MODE_OFF", ":", "self", ".", "vera_device", ".", "turn_off", "(", ")", "elif", "hvac_mode", "==", "HVAC_MODE_HEAT_COOL", ":", "self", ".", "vera_dev...
[ 149, 4 ]
[ 160, 39 ]
python
da
['da', 'su', 'en']
False
async_setup_entry
(hass, config_entry, async_add_devices)
Set up the CoolMasterNet climate platform.
Set up the CoolMasterNet climate platform.
async def async_setup_entry(hass, config_entry, async_add_devices): """Set up the CoolMasterNet climate platform.""" supported_modes = config_entry.data.get(CONF_SUPPORTED_MODES) info = hass.data[DOMAIN][config_entry.entry_id][DATA_INFO] coordinator = hass.data[DOMAIN][config_entry.entry_id][DATA_COORD...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_devices", ")", ":", "supported_modes", "=", "config_entry", ".", "data", ".", "get", "(", "CONF_SUPPORTED_MODES", ")", "info", "=", "hass", ".", "data", "[", "DOMAIN", "]", ...
[ 43, 0 ]
[ 55, 34 ]
python
en
['en', 'da', 'en']
True
CoolmasterClimate.__init__
(self, coordinator, unit_id, unit, supported_modes, info)
Initialize the climate device.
Initialize the climate device.
def __init__(self, coordinator, unit_id, unit, supported_modes, info): """Initialize the climate device.""" super().__init__(coordinator) self._unit_id = unit_id self._unit = unit self._hvac_modes = supported_modes self._info = info
[ "def", "__init__", "(", "self", ",", "coordinator", ",", "unit_id", ",", "unit", ",", "supported_modes", ",", "info", ")", ":", "super", "(", ")", ".", "__init__", "(", "coordinator", ")", "self", ".", "_unit_id", "=", "unit_id", "self", ".", "_unit", ...
[ 61, 4 ]
[ 67, 25 ]
python
en
['en', 'en', 'en']
True
CoolmasterClimate.device_info
(self)
Return device info for this device.
Return device info for this device.
def device_info(self): """Return device info for this device.""" return { "identifiers": {(DOMAIN, self.unique_id)}, "name": self.name, "manufacturer": "CoolAutomation", "model": "CoolMasterNet", "sw_version": self._info["version"], }
[ "def", "device_info", "(", "self", ")", ":", "return", "{", "\"identifiers\"", ":", "{", "(", "DOMAIN", ",", "self", ".", "unique_id", ")", "}", ",", "\"name\"", ":", "self", ".", "name", ",", "\"manufacturer\"", ":", "\"CoolAutomation\"", ",", "\"model\""...
[ 75, 4 ]
[ 83, 9 ]
python
en
['en', 'en', 'en']
True
CoolmasterClimate.unique_id
(self)
Return unique ID for this device.
Return unique ID for this device.
def unique_id(self): """Return unique ID for this device.""" return self._unit_id
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "_unit_id" ]
[ 86, 4 ]
[ 88, 28 ]
python
en
['en', 'en', 'en']
True
CoolmasterClimate.supported_features
(self)
Return the list of supported features.
Return the list of supported features.
def supported_features(self): """Return the list of supported features.""" return SUPPORT_FLAGS
[ "def", "supported_features", "(", "self", ")", ":", "return", "SUPPORT_FLAGS" ]
[ 91, 4 ]
[ 93, 28 ]
python
en
['en', 'en', 'en']
True
CoolmasterClimate.name
(self)
Return the name of the climate device.
Return the name of the climate device.
def name(self): """Return the name of the climate device.""" return self.unique_id
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "unique_id" ]
[ 96, 4 ]
[ 98, 29 ]
python
en
['en', 'en', 'en']
True
CoolmasterClimate.temperature_unit
(self)
Return the unit of measurement.
Return the unit of measurement.
def temperature_unit(self): """Return the unit of measurement.""" if self._unit.temperature_unit == "celsius": return TEMP_CELSIUS return TEMP_FAHRENHEIT
[ "def", "temperature_unit", "(", "self", ")", ":", "if", "self", ".", "_unit", ".", "temperature_unit", "==", "\"celsius\"", ":", "return", "TEMP_CELSIUS", "return", "TEMP_FAHRENHEIT" ]
[ 101, 4 ]
[ 106, 30 ]
python
en
['en', 'la', 'en']
True
CoolmasterClimate.current_temperature
(self)
Return the current temperature.
Return the current temperature.
def current_temperature(self): """Return the current temperature.""" return self._unit.temperature
[ "def", "current_temperature", "(", "self", ")", ":", "return", "self", ".", "_unit", ".", "temperature" ]
[ 109, 4 ]
[ 111, 37 ]
python
en
['en', 'la', 'en']
True
CoolmasterClimate.target_temperature
(self)
Return the temperature we are trying to reach.
Return the temperature we are trying to reach.
def target_temperature(self): """Return the temperature we are trying to reach.""" return self._unit.thermostat
[ "def", "target_temperature", "(", "self", ")", ":", "return", "self", ".", "_unit", ".", "thermostat" ]
[ 114, 4 ]
[ 116, 36 ]
python
en
['en', 'en', 'en']
True
CoolmasterClimate.hvac_mode
(self)
Return hvac target hvac state.
Return hvac target hvac state.
def hvac_mode(self): """Return hvac target hvac state.""" mode = self._unit.mode is_on = self._unit.is_on if not is_on: return HVAC_MODE_OFF return CM_TO_HA_STATE[mode]
[ "def", "hvac_mode", "(", "self", ")", ":", "mode", "=", "self", ".", "_unit", ".", "mode", "is_on", "=", "self", ".", "_unit", ".", "is_on", "if", "not", "is_on", ":", "return", "HVAC_MODE_OFF", "return", "CM_TO_HA_STATE", "[", "mode", "]" ]
[ 119, 4 ]
[ 126, 35 ]
python
en
['en', 'hi-Latn', 'ru']
False
CoolmasterClimate.hvac_modes
(self)
Return the list of available operation modes.
Return the list of available operation modes.
def hvac_modes(self): """Return the list of available operation modes.""" return self._hvac_modes
[ "def", "hvac_modes", "(", "self", ")", ":", "return", "self", ".", "_hvac_modes" ]
[ 129, 4 ]
[ 131, 31 ]
python
en
['en', 'en', 'en']
True
CoolmasterClimate.fan_mode
(self)
Return the fan setting.
Return the fan setting.
def fan_mode(self): """Return the fan setting.""" return self._unit.fan_speed
[ "def", "fan_mode", "(", "self", ")", ":", "return", "self", ".", "_unit", ".", "fan_speed" ]
[ 134, 4 ]
[ 136, 35 ]
python
en
['en', 'fy', 'en']
True
CoolmasterClimate.fan_modes
(self)
Return the list of available fan modes.
Return the list of available fan modes.
def fan_modes(self): """Return the list of available fan modes.""" return FAN_MODES
[ "def", "fan_modes", "(", "self", ")", ":", "return", "FAN_MODES" ]
[ 139, 4 ]
[ 141, 24 ]
python
en
['en', 'en', 'en']
True
CoolmasterClimate.async_set_temperature
(self, **kwargs)
Set new target temperatures.
Set new target temperatures.
async def async_set_temperature(self, **kwargs): """Set new target temperatures.""" temp = kwargs.get(ATTR_TEMPERATURE) if temp is not None: _LOGGER.debug("Setting temp of %s to %s", self.unique_id, str(temp)) self._unit = await self._unit.set_thermostat(temp) ...
[ "async", "def", "async_set_temperature", "(", "self", ",", "*", "*", "kwargs", ")", ":", "temp", "=", "kwargs", ".", "get", "(", "ATTR_TEMPERATURE", ")", "if", "temp", "is", "not", "None", ":", "_LOGGER", ".", "debug", "(", "\"Setting temp of %s to %s\"", ...
[ 143, 4 ]
[ 149, 39 ]
python
en
['en', 'ca', 'en']
True
CoolmasterClimate.async_set_fan_mode
(self, fan_mode)
Set new fan mode.
Set new fan mode.
async def async_set_fan_mode(self, fan_mode): """Set new fan mode.""" _LOGGER.debug("Setting fan mode of %s to %s", self.unique_id, fan_mode) self._unit = await self._unit.set_fan_speed(fan_mode) self.async_write_ha_state()
[ "async", "def", "async_set_fan_mode", "(", "self", ",", "fan_mode", ")", ":", "_LOGGER", ".", "debug", "(", "\"Setting fan mode of %s to %s\"", ",", "self", ".", "unique_id", ",", "fan_mode", ")", "self", ".", "_unit", "=", "await", "self", ".", "_unit", "."...
[ 151, 4 ]
[ 155, 35 ]
python
en
['id', 'fy', 'en']
False
CoolmasterClimate.async_set_hvac_mode
(self, hvac_mode)
Set new operation mode.
Set new operation mode.
async def async_set_hvac_mode(self, hvac_mode): """Set new operation mode.""" _LOGGER.debug("Setting operation mode of %s to %s", self.unique_id, hvac_mode) if hvac_mode == HVAC_MODE_OFF: await self.async_turn_off() else: self._unit = await self._unit.set_mode(HA...
[ "async", "def", "async_set_hvac_mode", "(", "self", ",", "hvac_mode", ")", ":", "_LOGGER", ".", "debug", "(", "\"Setting operation mode of %s to %s\"", ",", "self", ".", "unique_id", ",", "hvac_mode", ")", "if", "hvac_mode", "==", "HVAC_MODE_OFF", ":", "await", ...
[ 157, 4 ]
[ 165, 38 ]
python
en
['en', 'ny', 'en']
True
com_port
()
Mock of a serial port.
Mock of a serial port.
def com_port(): """Mock of a serial port.""" port = serial.tools.list_ports_common.ListPortInfo() port.serial_number = "1234" port.manufacturer = "Virtual serial port" port.device = "/dev/ttyUSB1234" port.description = "Some serial port" return port
[ "def", "com_port", "(", ")", ":", "port", "=", "serial", ".", "tools", ".", "list_ports_common", ".", "ListPortInfo", "(", ")", "port", ".", "serial_number", "=", "\"1234\"", "port", ".", "manufacturer", "=", "\"Virtual serial port\"", "port", ".", "device", ...
[ 19, 0 ]
[ 27, 15 ]
python
en
['en', 'en', 'en']
True
test_user_flow
(detect_mock, hass)
Test user flow -- radio detected.
Test user flow -- radio detected.
async def test_user_flow(detect_mock, hass): """Test user flow -- radio detected.""" port = com_port() port_select = f"{port}, s/n: {port.serial_number} - {port.manufacturer}" result = await hass.config_entries.flow.async_init( DOMAIN, context={CONF_SOURCE: SOURCE_USER}, data={...
[ "async", "def", "test_user_flow", "(", "detect_mock", ",", "hass", ")", ":", "port", "=", "com_port", "(", ")", "port_select", "=", "f\"{port}, s/n: {port.serial_number} - {port.manufacturer}\"", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", "....
[ 35, 0 ]
[ 50, 54 ]
python
en
['pt', 'sr', 'en']
False
test_user_flow_not_detected
(detect_mock, hass)
Test user flow, radio not detected.
Test user flow, radio not detected.
async def test_user_flow_not_detected(detect_mock, hass): """Test user flow, radio not detected.""" port = com_port() port_select = f"{port}, s/n: {port.serial_number} - {port.manufacturer}" result = await hass.config_entries.flow.async_init( DOMAIN, context={CONF_SOURCE: SOURCE_USER},...
[ "async", "def", "test_user_flow_not_detected", "(", "detect_mock", ",", "hass", ")", ":", "port", "=", "com_port", "(", ")", "port_select", "=", "f\"{port}, s/n: {port.serial_number} - {port.manufacturer}\"", "result", "=", "await", "hass", ".", "config_entries", ".", ...
[ 58, 0 ]
[ 73, 54 ]
python
en
['en', 'nl', 'en']
True
test_user_flow_show_form
(hass)
Test user step form.
Test user step form.
async def test_user_flow_show_form(hass): """Test user step form.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={CONF_SOURCE: SOURCE_USER}, ) assert result["type"] == RESULT_TYPE_FORM assert result["step_id"] == "user"
[ "async", "def", "test_user_flow_show_form", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "CONF_SOURCE", ":", "SOURCE_USER", "}", ",", ")", "assert", "...
[ 76, 0 ]
[ 84, 38 ]
python
da
['da', 'da', 'en']
True
test_user_flow_manual
(hass)
Test user flow manual entry.
Test user flow manual entry.
async def test_user_flow_manual(hass): """Test user flow manual entry.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={CONF_SOURCE: SOURCE_USER}, data={zigpy.config.CONF_DEVICE_PATH: config_flow.CONF_MANUAL_PATH}, ) assert result["type"] == RESULT_TYPE_FO...
[ "async", "def", "test_user_flow_manual", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "CONF_SOURCE", ":", "SOURCE_USER", "}", ",", "data", "=", "{", ...
[ 87, 0 ]
[ 96, 44 ]
python
en
['en', 'en', 'en']
True
test_pick_radio_flow
(hass, radio_type)
Test radio picker.
Test radio picker.
async def test_pick_radio_flow(hass, radio_type): """Test radio picker.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={CONF_SOURCE: "pick_radio"}, data={CONF_RADIO_TYPE: radio_type} ) assert result["type"] == RESULT_TYPE_FORM assert result["step_id"] == "port_config...
[ "async", "def", "test_pick_radio_flow", "(", "hass", ",", "radio_type", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "CONF_SOURCE", ":", "\"pick_radio\"", "}", ",", ...
[ 100, 0 ]
[ 107, 45 ]
python
de
['lt', 'de', 'en']
False
test_user_flow_existing_config_entry
(hass)
Test if config entry already exists.
Test if config entry already exists.
async def test_user_flow_existing_config_entry(hass): """Test if config entry already exists.""" MockConfigEntry(domain=DOMAIN, data={"usb_path": "/dev/ttyUSB1"}).add_to_hass(hass) await setup.async_setup_component(hass, "persistent_notification", {}) result = await hass.config_entries.flow.async_init( ...
[ "async", "def", "test_user_flow_existing_config_entry", "(", "hass", ")", ":", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "data", "=", "{", "\"usb_path\"", ":", "\"/dev/ttyUSB1\"", "}", ")", ".", "add_to_hass", "(", "hass", ")", "await", "setup", "....
[ 110, 0 ]
[ 118, 36 ]
python
en
['en', 'en', 'en']
True
test_probe_radios
(xbee_probe, zigate_probe, deconz_probe, cc_probe, hass)
Test detect radios.
Test detect radios.
async def test_probe_radios(xbee_probe, zigate_probe, deconz_probe, cc_probe, hass): """Test detect radios.""" app_ctrl_cls = MagicMock() app_ctrl_cls.SCHEMA_DEVICE = zigpy.config.SCHEMA_DEVICE app_ctrl_cls.probe = AsyncMock(side_effect=(True, False)) p1 = patch( "bellows.zigbee.application...
[ "async", "def", "test_probe_radios", "(", "xbee_probe", ",", "zigate_probe", ",", "deconz_probe", ",", "cc_probe", ",", "hass", ")", ":", "app_ctrl_cls", "=", "MagicMock", "(", ")", "app_ctrl_cls", ".", "SCHEMA_DEVICE", "=", "zigpy", ".", "config", ".", "SCHEM...
[ 129, 0 ]
[ 153, 40 ]
python
da
['da', 'la', 'en']
False
test_user_port_config_fail
(probe_mock, hass)
Test port config flow.
Test port config flow.
async def test_user_port_config_fail(probe_mock, hass): """Test port config flow.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={CONF_SOURCE: "pick_radio"}, data={CONF_RADIO_TYPE: RadioType.ezsp.description}, ) result = await hass.config_entries.flow.as...
[ "async", "def", "test_user_port_config_fail", "(", "probe_mock", ",", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "CONF_SOURCE", ":", "\"pick_radio\"", "}", ...
[ 157, 0 ]
[ 173, 38 ]
python
en
['en', 'da', 'en']
True
test_user_port_config
(probe_mock, hass)
Test port config.
Test port config.
async def test_user_port_config(probe_mock, hass): """Test port config.""" await setup.async_setup_component(hass, "persistent_notification", {}) result = await hass.config_entries.flow.async_init( DOMAIN, context={CONF_SOURCE: "pick_radio"}, data={CONF_RADIO_TYPE: RadioType.ezsp.de...
[ "async", "def", "test_user_port_config", "(", "probe_mock", ",", "hass", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "result", "=", "await", "hass", ".", "config_entries", ".", ...
[ 178, 0 ]
[ 200, 38 ]
python
da
['es', 'da', 'en']
False
test_get_serial_by_id_no_dir
()
Test serial by id conversion if there's no /dev/serial/by-id.
Test serial by id conversion if there's no /dev/serial/by-id.
def test_get_serial_by_id_no_dir(): """Test serial by id conversion if there's no /dev/serial/by-id.""" p1 = patch("os.path.isdir", MagicMock(return_value=False)) p2 = patch("os.scandir") with p1 as is_dir_mock, p2 as scan_mock: res = config_flow.get_serial_by_id(sentinel.path) assert re...
[ "def", "test_get_serial_by_id_no_dir", "(", ")", ":", "p1", "=", "patch", "(", "\"os.path.isdir\"", ",", "MagicMock", "(", "return_value", "=", "False", ")", ")", "p2", "=", "patch", "(", "\"os.scandir\"", ")", "with", "p1", "as", "is_dir_mock", ",", "p2", ...
[ 203, 0 ]
[ 211, 40 ]
python
en
['en', 'en', 'en']
True
test_get_serial_by_id
()
Test serial by id conversion.
Test serial by id conversion.
def test_get_serial_by_id(): """Test serial by id conversion.""" p1 = patch("os.path.isdir", MagicMock(return_value=True)) p2 = patch("os.scandir") def _realpath(path): if path is sentinel.matched_link: return sentinel.path return sentinel.serial_link_path p3 = patch("o...
[ "def", "test_get_serial_by_id", "(", ")", ":", "p1", "=", "patch", "(", "\"os.path.isdir\"", ",", "MagicMock", "(", "return_value", "=", "True", ")", ")", "p2", "=", "patch", "(", "\"os.scandir\"", ")", "def", "_realpath", "(", "path", ")", ":", "if", "p...
[ 214, 0 ]
[ 247, 40 ]
python
en
['en', 'en', 'en']
True
async_turn_on
(hass, entity_id=ENTITY_MATCH_ALL, speed: str = None)
Turn all or specified fan on.
Turn all or specified fan on.
async def async_turn_on(hass, entity_id=ENTITY_MATCH_ALL, speed: str = None) -> None: """Turn all or specified fan on.""" data = { key: value for key, value in [(ATTR_ENTITY_ID, entity_id), (ATTR_SPEED, speed)] if value is not None } await hass.services.async_call(DOMAIN, SERVIC...
[ "async", "def", "async_turn_on", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ",", "speed", ":", "str", "=", "None", ")", "->", "None", ":", "data", "=", "{", "key", ":", "value", "for", "key", ",", "value", "in", "[", "(", "ATTR_ENTITY_ID",...
[ 22, 0 ]
[ 30, 80 ]
python
en
['en', 'fy', 'en']
True
async_turn_off
(hass, entity_id=ENTITY_MATCH_ALL)
Turn all or specified fan off.
Turn all or specified fan off.
async def async_turn_off(hass, entity_id=ENTITY_MATCH_ALL) -> None: """Turn all or specified fan off.""" data = {ATTR_ENTITY_ID: entity_id} if entity_id else {} await hass.services.async_call(DOMAIN, SERVICE_TURN_OFF, data, blocking=True)
[ "async", "def", "async_turn_off", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", "->", "None", ":", "data", "=", "{", "ATTR_ENTITY_ID", ":", "entity_id", "}", "if", "entity_id", "else", "{", "}", "await", "hass", ".", "services", ".", "async_...
[ 33, 0 ]
[ 37, 81 ]
python
en
['en', 'fy', 'en']
True
async_oscillate
( hass, entity_id=ENTITY_MATCH_ALL, should_oscillate: bool = True )
Set oscillation on all or specified fan.
Set oscillation on all or specified fan.
async def async_oscillate( hass, entity_id=ENTITY_MATCH_ALL, should_oscillate: bool = True ) -> None: """Set oscillation on all or specified fan.""" data = { key: value for key, value in [ (ATTR_ENTITY_ID, entity_id), (ATTR_OSCILLATING, should_oscillate), ] ...
[ "async", "def", "async_oscillate", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ",", "should_oscillate", ":", "bool", "=", "True", ")", "->", "None", ":", "data", "=", "{", "key", ":", "value", "for", "key", ",", "value", "in", "[", "(", "AT...
[ 40, 0 ]
[ 53, 82 ]
python
en
['en', 'en', 'en']
True
async_set_speed
(hass, entity_id=ENTITY_MATCH_ALL, speed: str = None)
Set speed for all or specified fan.
Set speed for all or specified fan.
async def async_set_speed(hass, entity_id=ENTITY_MATCH_ALL, speed: str = None) -> None: """Set speed for all or specified fan.""" data = { key: value for key, value in [(ATTR_ENTITY_ID, entity_id), (ATTR_SPEED, speed)] if value is not None } await hass.services.async_call(DOMAIN...
[ "async", "def", "async_set_speed", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ",", "speed", ":", "str", "=", "None", ")", "->", "None", ":", "data", "=", "{", "key", ":", "value", "for", "key", ",", "value", "in", "[", "(", "ATTR_ENTITY_ID...
[ 56, 0 ]
[ 64, 82 ]
python
en
['en', 'en', 'en']
True
async_set_direction
( hass, entity_id=ENTITY_MATCH_ALL, direction: str = None )
Set direction for all or specified fan.
Set direction for all or specified fan.
async def async_set_direction( hass, entity_id=ENTITY_MATCH_ALL, direction: str = None ) -> None: """Set direction for all or specified fan.""" data = { key: value for key, value in [(ATTR_ENTITY_ID, entity_id), (ATTR_DIRECTION, direction)] if value is not None } await hass....
[ "async", "def", "async_set_direction", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ",", "direction", ":", "str", "=", "None", ")", "->", "None", ":", "data", "=", "{", "key", ":", "value", "for", "key", ",", "value", "in", "[", "(", "ATTR_E...
[ 67, 0 ]
[ 77, 86 ]
python
en
['en', 'en', 'en']
True
mock_bridge_setup
()
Mock bridge setup.
Mock bridge setup.
def mock_bridge_setup(): """Mock bridge setup.""" with patch.object(hue, "HueBridge") as mock_bridge: mock_bridge.return_value.async_setup = AsyncMock(return_value=True) mock_bridge.return_value.api.config = Mock(bridgeid="mock-id") yield mock_bridge.return_value
[ "def", "mock_bridge_setup", "(", ")", ":", "with", "patch", ".", "object", "(", "hue", ",", "\"HueBridge\"", ")", "as", "mock_bridge", ":", "mock_bridge", ".", "return_value", ".", "async_setup", "=", "AsyncMock", "(", "return_value", "=", "True", ")", "mock...
[ 14, 0 ]
[ 19, 38 ]
python
en
['en', 'st', 'en']
True
test_setup_with_no_config
(hass)
Test that we do not discover anything or try to set up a bridge.
Test that we do not discover anything or try to set up a bridge.
async def test_setup_with_no_config(hass): """Test that we do not discover anything or try to set up a bridge.""" assert await async_setup_component(hass, hue.DOMAIN, {}) is True # No flows started assert len(hass.config_entries.flow.async_progress()) == 0 # No configs stored assert hass.data[...
[ "async", "def", "test_setup_with_no_config", "(", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "hue", ".", "DOMAIN", ",", "{", "}", ")", "is", "True", "# No flows started", "assert", "len", "(", "hass", ".", "config_entries",...
[ 22, 0 ]
[ 30, 38 ]
python
en
['en', 'en', 'en']
True
test_unload_entry
(hass, mock_bridge_setup)
Test being able to unload an entry.
Test being able to unload an entry.
async def test_unload_entry(hass, mock_bridge_setup): """Test being able to unload an entry.""" entry = MockConfigEntry(domain=hue.DOMAIN, data={"host": "0.0.0.0"}) entry.add_to_hass(hass) assert await async_setup_component(hass, hue.DOMAIN, {}) is True assert len(mock_bridge_setup.mock_calls) == 1...
[ "async", "def", "test_unload_entry", "(", "hass", ",", "mock_bridge_setup", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "hue", ".", "DOMAIN", ",", "data", "=", "{", "\"host\"", ":", "\"0.0.0.0\"", "}", ")", "entry", ".", "add_to_hass", "...
[ 33, 0 ]
[ 44, 38 ]
python
en
['en', 'en', 'en']
True
test_setting_unique_id
(hass, mock_bridge_setup)
Test we set unique ID if not set yet.
Test we set unique ID if not set yet.
async def test_setting_unique_id(hass, mock_bridge_setup): """Test we set unique ID if not set yet.""" entry = MockConfigEntry(domain=hue.DOMAIN, data={"host": "0.0.0.0"}) entry.add_to_hass(hass) assert await async_setup_component(hass, hue.DOMAIN, {}) is True assert entry.unique_id == "mock-id"
[ "async", "def", "test_setting_unique_id", "(", "hass", ",", "mock_bridge_setup", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "hue", ".", "DOMAIN", ",", "data", "=", "{", "\"host\"", ":", "\"0.0.0.0\"", "}", ")", "entry", ".", "add_to_hass"...
[ 47, 0 ]
[ 52, 39 ]
python
en
['en', 'en', 'en']
True
test_fixing_unique_id_no_other
(hass, mock_bridge_setup)
Test we set unique ID if not set yet.
Test we set unique ID if not set yet.
async def test_fixing_unique_id_no_other(hass, mock_bridge_setup): """Test we set unique ID if not set yet.""" entry = MockConfigEntry( domain=hue.DOMAIN, data={"host": "0.0.0.0"}, unique_id="invalid-id" ) entry.add_to_hass(hass) assert await async_setup_component(hass, hue.DOMAIN, {}) is Tr...
[ "async", "def", "test_fixing_unique_id_no_other", "(", "hass", ",", "mock_bridge_setup", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "hue", ".", "DOMAIN", ",", "data", "=", "{", "\"host\"", ":", "\"0.0.0.0\"", "}", ",", "unique_id", "=", "...
[ 55, 0 ]
[ 62, 39 ]
python
en
['en', 'en', 'en']
True
test_fixing_unique_id_other_ignored
(hass, mock_bridge_setup)
Test we set unique ID if not set yet.
Test we set unique ID if not set yet.
async def test_fixing_unique_id_other_ignored(hass, mock_bridge_setup): """Test we set unique ID if not set yet.""" MockConfigEntry( domain=hue.DOMAIN, data={"host": "0.0.0.0"}, unique_id="mock-id", source=config_entries.SOURCE_IGNORE, ).add_to_hass(hass) entry = MockConf...
[ "async", "def", "test_fixing_unique_id_other_ignored", "(", "hass", ",", "mock_bridge_setup", ")", ":", "MockConfigEntry", "(", "domain", "=", "hue", ".", "DOMAIN", ",", "data", "=", "{", "\"host\"", ":", "\"0.0.0.0\"", "}", ",", "unique_id", "=", "\"mock-id\"",...
[ 65, 0 ]
[ 82, 57 ]
python
en
['en', 'en', 'en']
True
test_fixing_unique_id_other_correct
(hass, mock_bridge_setup)
Test we remove config entry if another one has correct ID.
Test we remove config entry if another one has correct ID.
async def test_fixing_unique_id_other_correct(hass, mock_bridge_setup): """Test we remove config entry if another one has correct ID.""" correct_entry = MockConfigEntry( domain=hue.DOMAIN, data={"host": "0.0.0.0"}, unique_id="mock-id", ) correct_entry.add_to_hass(hass) entry ...
[ "async", "def", "test_fixing_unique_id_other_correct", "(", "hass", ",", "mock_bridge_setup", ")", ":", "correct_entry", "=", "MockConfigEntry", "(", "domain", "=", "hue", ".", "DOMAIN", ",", "data", "=", "{", "\"host\"", ":", "\"0.0.0.0\"", "}", ",", "unique_id...
[ 85, 0 ]
[ 101, 65 ]
python
en
['en', 'en', 'en']
True
test_security_vuln_check
(hass)
Test that we report security vulnerabilities.
Test that we report security vulnerabilities.
async def test_security_vuln_check(hass): """Test that we report security vulnerabilities.""" assert await async_setup_component(hass, "persistent_notification", {}) entry = MockConfigEntry(domain=hue.DOMAIN, data={"host": "0.0.0.0"}) entry.add_to_hass(hass) config = Mock(bridgeid="", mac="", model...
[ "async", "def", "test_security_vuln_check", "(", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "entry", "=", "MockConfigEntry", "(", "domain", "=", "hue", ".", "DOMAIN", ",", ...
[ 104, 0 ]
[ 129, 57 ]
python
en
['en', 'nl', 'en']
True
mock_responses
(mock, single=False)
Mock responses for SleepIQ.
Mock responses for SleepIQ.
def mock_responses(mock, single=False): """Mock responses for SleepIQ.""" base_url = "https://prod-api.sleepiq.sleepnumber.com/rest/" if single: suffix = "-single" else: suffix = "" mock.put(base_url + "login", text=load_fixture("sleepiq-login.json")) mock.get(base_url + "bed?_k=...
[ "def", "mock_responses", "(", "mock", ",", "single", "=", "False", ")", ":", "base_url", "=", "\"https://prod-api.sleepiq.sleepnumber.com/rest/\"", "if", "single", ":", "suffix", "=", "\"-single\"", "else", ":", "suffix", "=", "\"\"", "mock", ".", "put", "(", ...
[ 10, 0 ]
[ 23, 5 ]
python
en
['en', 'no', 'en']
True
test_setup
(hass, requests_mock)
Test the setup.
Test the setup.
async def test_setup(hass, requests_mock): """Test the setup.""" mock_responses(requests_mock) # We're mocking the load_platform discoveries or else the platforms # will be setup during tear down when blocking till done, but the mocks # are no longer active. with patch("homeassistant.helpers.di...
[ "async", "def", "test_setup", "(", "hass", ",", "requests_mock", ")", ":", "mock_responses", "(", "requests_mock", ")", "# We're mocking the load_platform discoveries or else the platforms", "# will be setup during tear down when blocking till done, but the mocks", "# are no longer act...
[ 26, 0 ]
[ 34, 42 ]
python
en
['en', 'haw', 'en']
True
test_setup_login_failed
(hass, requests_mock)
Test the setup if a bad username or password is given.
Test the setup if a bad username or password is given.
async def test_setup_login_failed(hass, requests_mock): """Test the setup if a bad username or password is given.""" mock_responses(requests_mock) requests_mock.put( "https://prod-api.sleepiq.sleepnumber.com/rest/login", status_code=401, json=load_fixture("sleepiq-login-failed.json")...
[ "async", "def", "test_setup_login_failed", "(", "hass", ",", "requests_mock", ")", ":", "mock_responses", "(", "requests_mock", ")", "requests_mock", ".", "put", "(", "\"https://prod-api.sleepiq.sleepnumber.com/rest/login\"", ",", "status_code", "=", "401", ",", "json",...
[ 37, 0 ]
[ 47, 23 ]
python
en
['en', 'en', 'en']
True
test_setup_component_no_login
(hass)
Test the setup when no login is configured.
Test the setup when no login is configured.
async def test_setup_component_no_login(hass): """Test the setup when no login is configured.""" conf = CONFIG.copy() del conf["sleepiq"]["username"] assert not await setup.async_setup_component(hass, sleepiq.DOMAIN, conf)
[ "async", "def", "test_setup_component_no_login", "(", "hass", ")", ":", "conf", "=", "CONFIG", ".", "copy", "(", ")", "del", "conf", "[", "\"sleepiq\"", "]", "[", "\"username\"", "]", "assert", "not", "await", "setup", ".", "async_setup_component", "(", "has...
[ 50, 0 ]
[ 54, 76 ]
python
en
['en', 'en', 'en']
True
test_setup_component_no_password
(hass)
Test the setup when no password is configured.
Test the setup when no password is configured.
async def test_setup_component_no_password(hass): """Test the setup when no password is configured.""" conf = CONFIG.copy() del conf["sleepiq"]["password"] assert not await setup.async_setup_component(hass, sleepiq.DOMAIN, conf)
[ "async", "def", "test_setup_component_no_password", "(", "hass", ")", ":", "conf", "=", "CONFIG", ".", "copy", "(", ")", "del", "conf", "[", "\"sleepiq\"", "]", "[", "\"password\"", "]", "assert", "not", "await", "setup", ".", "async_setup_component", "(", "...
[ 57, 0 ]
[ 62, 76 ]
python
en
['en', 'en', 'en']
True
async_setup_platform
( hass: HomeAssistantType, config: ConfigType, async_add_entities, discovery_info=None )
Set up the Genius Hub climate entities.
Set up the Genius Hub climate entities.
async def async_setup_platform( hass: HomeAssistantType, config: ConfigType, async_add_entities, discovery_info=None ) -> None: """Set up the Genius Hub climate entities.""" if discovery_info is None: return broker = hass.data[DOMAIN]["broker"] async_add_entities( [ Gen...
[ "async", "def", "async_setup_platform", "(", "hass", ":", "HomeAssistantType", ",", "config", ":", "ConfigType", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", "->", "None", ":", "if", "discovery_info", "is", "None", ":", "return", "broker",...
[ 29, 0 ]
[ 44, 5 ]
python
en
['en', 'en', 'en']
True
GeniusClimateZone.__init__
(self, broker, zone)
Initialize the climate device.
Initialize the climate device.
def __init__(self, broker, zone) -> None: """Initialize the climate device.""" super().__init__(broker, zone) self._max_temp = 28.0 self._min_temp = 4.0 self._supported_features = SUPPORT_TARGET_TEMPERATURE | SUPPORT_PRESET_MODE
[ "def", "__init__", "(", "self", ",", "broker", ",", "zone", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "broker", ",", "zone", ")", "self", ".", "_max_temp", "=", "28.0", "self", ".", "_min_temp", "=", "4.0", "self", ".", "_sup...
[ 50, 4 ]
[ 56, 83 ]
python
en
['en', 'en', 'en']
True
GeniusClimateZone.icon
(self)
Return the icon to use in the frontend UI.
Return the icon to use in the frontend UI.
def icon(self) -> str: """Return the icon to use in the frontend UI.""" return "mdi:radiator"
[ "def", "icon", "(", "self", ")", "->", "str", ":", "return", "\"mdi:radiator\"" ]
[ 59, 4 ]
[ 61, 29 ]
python
en
['en', 'en', 'en']
True
GeniusClimateZone.hvac_mode
(self)
Return hvac operation ie. heat, cool mode.
Return hvac operation ie. heat, cool mode.
def hvac_mode(self) -> str: """Return hvac operation ie. heat, cool mode.""" return GH_HVAC_TO_HA.get(self._zone.data["mode"], HVAC_MODE_HEAT)
[ "def", "hvac_mode", "(", "self", ")", "->", "str", ":", "return", "GH_HVAC_TO_HA", ".", "get", "(", "self", ".", "_zone", ".", "data", "[", "\"mode\"", "]", ",", "HVAC_MODE_HEAT", ")" ]
[ 64, 4 ]
[ 66, 73 ]
python
bg
['en', 'bg', 'bg']
True