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
ZHAGateway.async_device_initialized
(self, device: zha_typing.ZigpyDeviceType)
Handle device joined and basic information discovered (async).
Handle device joined and basic information discovered (async).
async def async_device_initialized(self, device: zha_typing.ZigpyDeviceType): """Handle device joined and basic information discovered (async).""" zha_device = self._async_get_or_create_device(device) # This is an active device so set a last seen if it is none if zha_device.last_seen is ...
[ "async", "def", "async_device_initialized", "(", "self", ",", "device", ":", "zha_typing", ".", "ZigpyDeviceType", ")", ":", "zha_device", "=", "self", ".", "_async_get_or_create_device", "(", "device", ")", "# This is an active device so set a last seen if it is none", "...
[ 531, 4 ]
[ 570, 9 ]
python
en
['en', 'en', 'en']
True
ZHAGateway.async_create_zigpy_group
( self, name: str, members: List[GroupMember] )
Create a new Zigpy Zigbee group.
Create a new Zigpy Zigbee group.
async def async_create_zigpy_group( self, name: str, members: List[GroupMember] ) -> ZhaGroupType: """Create a new Zigpy Zigbee group.""" # we start with two to fill any gaps from a user removing existing groups group_id = 2 while group_id in self.groups: group_id...
[ "async", "def", "async_create_zigpy_group", "(", "self", ",", "name", ":", "str", ",", "members", ":", "List", "[", "GroupMember", "]", ")", "->", "ZhaGroupType", ":", "# we start with two to fill any gaps from a user removing existing groups", "group_id", "=", "2", "...
[ 590, 4 ]
[ 618, 40 ]
python
en
['en', 'tg', 'en']
True
ZHAGateway.async_remove_zigpy_group
(self, group_id: int)
Remove a Zigbee group from Zigpy.
Remove a Zigbee group from Zigpy.
async def async_remove_zigpy_group(self, group_id: int) -> None: """Remove a Zigbee group from Zigpy.""" group = self.groups.get(group_id) if not group: _LOGGER.debug("Group: %s:0x%04x could not be found", group.name, group_id) return if group.members: ...
[ "async", "def", "async_remove_zigpy_group", "(", "self", ",", "group_id", ":", "int", ")", "->", "None", ":", "group", "=", "self", ".", "groups", ".", "get", "(", "group_id", ")", "if", "not", "group", ":", "_LOGGER", ".", "debug", "(", "\"Group: %s:0x%...
[ 620, 4 ]
[ 632, 56 ]
python
en
['en', 'en', 'en']
True
ZHAGateway.shutdown
(self)
Stop ZHA Controller Application.
Stop ZHA Controller Application.
async def shutdown(self): """Stop ZHA Controller Application.""" _LOGGER.debug("Shutting down ZHA ControllerApplication") for unsubscribe in self._unsubs: unsubscribe() await self.application_controller.pre_shutdown()
[ "async", "def", "shutdown", "(", "self", ")", ":", "_LOGGER", ".", "debug", "(", "\"Shutting down ZHA ControllerApplication\"", ")", "for", "unsubscribe", "in", "self", ".", "_unsubs", ":", "unsubscribe", "(", ")", "await", "self", ".", "application_controller", ...
[ 634, 4 ]
[ 639, 56 ]
python
en
['sv', 'gl', 'en']
False
LogRelayHandler.__init__
(self, hass, gateway)
Initialize a new LogErrorHandler.
Initialize a new LogErrorHandler.
def __init__(self, hass, gateway): """Initialize a new LogErrorHandler.""" super().__init__() self.hass = hass self.gateway = gateway
[ "def", "__init__", "(", "self", ",", "hass", ",", "gateway", ")", ":", "super", "(", ")", ".", "__init__", "(", ")", "self", ".", "hass", "=", "hass", "self", ".", "gateway", "=", "gateway" ]
[ 677, 4 ]
[ 681, 30 ]
python
en
['en', 'lb', 'en']
True
LogRelayHandler.emit
(self, record)
Relay log message via dispatcher.
Relay log message via dispatcher.
def emit(self, record): """Relay log message via dispatcher.""" stack = [] if record.levelno >= logging.WARN: if not record.exc_info: stack = [f for f, _, _, _ in traceback.extract_stack()] entry = LogEntry(record, stack, _figure_out_source(record, stack, sel...
[ "def", "emit", "(", "self", ",", "record", ")", ":", "stack", "=", "[", "]", "if", "record", ".", "levelno", ">=", "logging", ".", "WARN", ":", "if", "not", "record", ".", "exc_info", ":", "stack", "=", "[", "f", "for", "f", ",", "_", ",", "_",...
[ 683, 4 ]
[ 695, 9 ]
python
en
['ms', 'pt', 'en']
False
calc_time_offset
(start_time: int, offset: int, unit: str)
Calculate time by offset and time unit.
Calculate time by offset and time unit.
def calc_time_offset(start_time: int, offset: int, unit: str): """Calculate time by offset and time unit.""" seconds_per_unit = unit_seconds(unit) return offset * seconds_per_unit + start_time
[ "def", "calc_time_offset", "(", "start_time", ":", "int", ",", "offset", ":", "int", ",", "unit", ":", "str", ")", ":", "seconds_per_unit", "=", "unit_seconds", "(", "unit", ")", "return", "offset", "*", "seconds_per_unit", "+", "start_time" ]
[ 34, 0 ]
[ 38, 49 ]
python
en
['en', 'en', 'en']
True
ItemTickPicker.items
(self, tick: int)
Get items for specified ticks. NOTE: This method will compare timestamp of item to pick.
Get items for specified ticks.
def items(self, tick: int): """Get items for specified ticks. NOTE: This method will compare timestamp of item to pick. """ seconds_per_unit = unit_seconds(self._time_unit) ticks_in_seconds = self._starttime + tick * seconds_per_unit while True: ...
[ "def", "items", "(", "self", ",", "tick", ":", "int", ")", ":", "seconds_per_unit", "=", "unit_seconds", "(", "self", ".", "_time_unit", ")", "ticks_in_seconds", "=", "self", ".", "_starttime", "+", "tick", "*", "seconds_per_unit", "while", "True", ":", "i...
[ 79, 4 ]
[ 111, 20 ]
python
en
['en', 'en', 'en']
True
BinaryReader.meta
(self)
BinaryMeta: Meta data in binary file.
BinaryMeta: Meta data in binary file.
def meta(self) -> BinaryMeta: """BinaryMeta: Meta data in binary file.""" return self._meta
[ "def", "meta", "(", "self", ")", "->", "BinaryMeta", ":", "return", "self", ".", "_meta" ]
[ 179, 4 ]
[ 181, 25 ]
python
en
['en', 'yo', 'it']
False
BinaryReader.start_datetime
(self)
datetime: Start datetime of this file (UTC).
datetime: Start datetime of this file (UTC).
def start_datetime(self) -> datetime: """datetime: Start datetime of this file (UTC).""" return self._to_utc_datetime(self.header.starttime)
[ "def", "start_datetime", "(", "self", ")", "->", "datetime", ":", "return", "self", ".", "_to_utc_datetime", "(", "self", ".", "header", ".", "starttime", ")" ]
[ 184, 4 ]
[ 186, 59 ]
python
en
['en', 'en', 'en']
True
BinaryReader.end_datetime
(self)
datetime: End datetime of this file (UTC).
datetime: End datetime of this file (UTC).
def end_datetime(self) -> datetime: """datetime: End datetime of this file (UTC).""" return self._to_utc_datetime(self.header.endtime)
[ "def", "end_datetime", "(", "self", ")", "->", "datetime", ":", "return", "self", ".", "_to_utc_datetime", "(", "self", ".", "header", ".", "endtime", ")" ]
[ 189, 4 ]
[ 191, 57 ]
python
en
['en', 'en', 'en']
True
BinaryReader.items_tick_picker
(self, start_time_offset: int = 0, end_time_offset: int = None, time_unit: str = "s")
Filter items by specified time range, and then pick by tick sequentially. Args: start_time_offset(int): Specified the which tick (in seconds) to start. end_time_offset(int): Specified the end tick (in seconds) to start. time_unit (str): Unit of time used to calculate offset,...
Filter items by specified time range, and then pick by tick sequentially.
def items_tick_picker(self, start_time_offset: int = 0, end_time_offset: int = None, time_unit: str = "s"): """Filter items by specified time range, and then pick by tick sequentially. Args: start_time_offset(int): Specified the which tick (in seconds) to start. end_time_offset(...
[ "def", "items_tick_picker", "(", "self", ",", "start_time_offset", ":", "int", "=", "0", ",", "end_time_offset", ":", "int", "=", "None", ",", "time_unit", ":", "str", "=", "\"s\"", ")", ":", "item_filter", "=", "self", ".", "items", "(", "start_time_offse...
[ 193, 4 ]
[ 206, 76 ]
python
en
['en', 'en', 'en']
True
BinaryReader.items
(self, start_time_offset: int = 0, end_time_offset: int = None, time_unit: str = "s")
Get all items in specified time range. Args: start_time_offset(int): Specified the which tick (in seconds) to start. end_time_offset(int): Specified the end tick (in seconds) to start. time_unit (str): Unit of time used to calculate offset, 's': seconds, 'm': minute, 'h': ho...
Get all items in specified time range.
def items(self, start_time_offset: int = 0, end_time_offset: int = None, time_unit: str = "s"): """Get all items in specified time range. Args: start_time_offset(int): Specified the which tick (in seconds) to start. end_time_offset(int): Specified the end tick (in seconds) to st...
[ "def", "items", "(", "self", ",", "start_time_offset", ":", "int", "=", "0", ",", "end_time_offset", ":", "int", "=", "None", ",", "time_unit", ":", "str", "=", "\"s\"", ")", ":", "# reset to read from beginning", "self", ".", "reset", "(", ")", "# default...
[ 208, 4 ]
[ 282, 21 ]
python
en
['en', 'en', 'en']
True
BinaryReader.reset
(self)
Reset binary reader.
Reset binary reader.
def reset(self): """Reset binary reader.""" self._readed_data_size = 0
[ "def", "reset", "(", "self", ")", ":", "self", ".", "_readed_data_size", "=", "0" ]
[ 284, 4 ]
[ 286, 34 ]
python
en
['en', 'sv', 'en']
True
BinaryReader.__del__
(self)
Clear resources.
Clear resources.
def __del__(self): """Clear resources.""" self.close()
[ "def", "__del__", "(", "self", ")", ":", "self", ".", "close", "(", ")" ]
[ 288, 4 ]
[ 290, 20 ]
python
en
['en', 'en', 'en']
False
BinaryReader.close
(self)
Close file.
Close file.
def close(self): """Close file.""" if self._mmap and not self._mmap.closed: self._mmap.close() self._mmap = None if self._file_fp and not self._file_fp.closed: self._file_fp.close() self._file_fp = None
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "_mmap", "and", "not", "self", ".", "_mmap", ".", "closed", ":", "self", ".", "_mmap", ".", "close", "(", ")", "self", ".", "_mmap", "=", "None", "if", "self", ".", "_file_fp", "and", "not...
[ 292, 4 ]
[ 302, 32 ]
python
en
['en', 'sm', 'en']
False
BinaryReader._to_utc_datetime
(self, timestamp: int)
Convert timestamp into datetime.
Convert timestamp into datetime.
def _to_utc_datetime(self, timestamp: int): """Convert timestamp into datetime.""" # TODO: make it as a common method if sys.platform == "win32": return (timestamp_start + relativedelta(seconds=timestamp)) else: return datetime.utcfromtimestamp(timestamp).replace...
[ "def", "_to_utc_datetime", "(", "self", ",", "timestamp", ":", "int", ")", ":", "# TODO: make it as a common method", "if", "sys", ".", "platform", "==", "\"win32\"", ":", "return", "(", "timestamp_start", "+", "relativedelta", "(", "seconds", "=", "timestamp", ...
[ 304, 4 ]
[ 311, 75 ]
python
en
['it', 'en', 'en']
True
BinaryReader._read_header
(self)
Read header part.
Read header part.
def _read_header(self): """Read header part.""" header_bytes = memoryview(self._mmap[0:header_struct.size]) self.header = FileHeader._make(header_struct.unpack_from(header_bytes)) # validate header # if current version less than file, then a warning if VERSION < self.he...
[ "def", "_read_header", "(", "self", ")", ":", "header_bytes", "=", "memoryview", "(", "self", ".", "_mmap", "[", "0", ":", "header_struct", ".", "size", "]", ")", "self", ".", "header", "=", "FileHeader", ".", "_make", "(", "header_struct", ".", "unpack_...
[ 313, 4 ]
[ 323, 100 ]
python
en
['en', 'sv', 'en']
True
BinaryReader._read_meta
(self)
Read meta part.
Read meta part.
def _read_meta(self): """Read meta part.""" meta_bytes = self._mmap[self.header.meta_offset: self.header.meta_offset + self.header.meta_size] self._meta.from_bytes(meta_bytes)
[ "def", "_read_meta", "(", "self", ")", ":", "meta_bytes", "=", "self", ".", "_mmap", "[", "self", ".", "header", ".", "meta_offset", ":", "self", ".", "header", ".", "meta_offset", "+", "self", ".", "header", ".", "meta_size", "]", "self", ".", "_meta"...
[ 325, 4 ]
[ 330, 41 ]
python
en
['en', 'la', 'en']
True
BinaryReader._fulfill_buffer
(self)
Fulfill buffer from file.
Fulfill buffer from file.
def _fulfill_buffer(self): """Fulfill buffer from file.""" buffer = self._item_buffer size_to_read = self._meta.item_size * self._buffer_size remaining_size = self.header.data_size - self._readed_data_size size_to_read = min(size_to_read, remaining_size) if size_to_re...
[ "def", "_fulfill_buffer", "(", "self", ")", ":", "buffer", "=", "self", ".", "_item_buffer", "size_to_read", "=", "self", ".", "_meta", ".", "item_size", "*", "self", ".", "_buffer_size", "remaining_size", "=", "self", ".", "header", ".", "data_size", "-", ...
[ 332, 4 ]
[ 349, 36 ]
python
en
['en', 'en', 'en']
True
load_forecastMock
(key, lat, lon, units, lang)
Mock darksky forecast loading.
Mock darksky forecast loading.
def load_forecastMock(key, lat, lon, units, lang): # pylint: disable=invalid-name """Mock darksky forecast loading.""" return ""
[ "def", "load_forecastMock", "(", "key", ",", "lat", ",", "lon", ",", "units", ",", "lang", ")", ":", "# pylint: disable=invalid-name", "return", "\"\"" ]
[ 83, 0 ]
[ 85, 13 ]
python
en
['en', 'da', 'en']
True
TestDarkSkySetup.add_entities
(self, new_entities, update_before_add=False)
Mock add entities.
Mock add entities.
def add_entities(self, new_entities, update_before_add=False): """Mock add entities.""" if update_before_add: for entity in new_entities: entity.update() for entity in new_entities: self.entities.append(entity)
[ "def", "add_entities", "(", "self", ",", "new_entities", ",", "update_before_add", "=", "False", ")", ":", "if", "update_before_add", ":", "for", "entity", "in", "new_entities", ":", "entity", ".", "update", "(", ")", "for", "entity", "in", "new_entities", "...
[ 91, 4 ]
[ 98, 40 ]
python
en
['en', 'fy', 'en']
True
TestDarkSkySetup.setUp
(self)
Initialize values for this testcase class.
Initialize values for this testcase class.
def setUp(self): """Initialize values for this testcase class.""" self.hass = get_test_home_assistant() self.key = "foo" self.lat = self.hass.config.latitude = 37.8267 self.lon = self.hass.config.longitude = -122.423 self.entities = [] self.addCleanup(self.tear_do...
[ "def", "setUp", "(", "self", ")", ":", "self", ".", "hass", "=", "get_test_home_assistant", "(", ")", "self", ".", "key", "=", "\"foo\"", "self", ".", "lat", "=", "self", ".", "hass", ".", "config", ".", "latitude", "=", "37.8267", "self", ".", "lon"...
[ 100, 4 ]
[ 107, 47 ]
python
en
['en', 'en', 'en']
True
TestDarkSkySetup.tear_down_cleanup
(self)
Stop everything that was started.
Stop everything that was started.
def tear_down_cleanup(self): """Stop everything that was started.""" self.hass.stop()
[ "def", "tear_down_cleanup", "(", "self", ")", ":", "self", ".", "hass", ".", "stop", "(", ")" ]
[ 109, 4 ]
[ 111, 24 ]
python
en
['en', 'en', 'en']
True
TestDarkSkySetup.test_setup_with_config
(self)
Test the platform setup with configuration.
Test the platform setup with configuration.
def test_setup_with_config(self): """Test the platform setup with configuration.""" setup_component(self.hass, "sensor", VALID_CONFIG_MINIMAL) self.hass.block_till_done() state = self.hass.states.get("sensor.dark_sky_summary") assert state is not None
[ "def", "test_setup_with_config", "(", "self", ")", ":", "setup_component", "(", "self", ".", "hass", ",", "\"sensor\"", ",", "VALID_CONFIG_MINIMAL", ")", "self", ".", "hass", ".", "block_till_done", "(", ")", "state", "=", "self", ".", "hass", ".", "states",...
[ 117, 4 ]
[ 123, 32 ]
python
en
['en', 'en', 'en']
True
TestDarkSkySetup.test_setup_with_invalid_config
(self)
Test the platform setup with invalid configuration.
Test the platform setup with invalid configuration.
def test_setup_with_invalid_config(self): """Test the platform setup with invalid configuration.""" setup_component(self.hass, "sensor", INVALID_CONFIG_MINIMAL) self.hass.block_till_done() state = self.hass.states.get("sensor.dark_sky_summary") assert state is None
[ "def", "test_setup_with_invalid_config", "(", "self", ")", ":", "setup_component", "(", "self", ".", "hass", ",", "\"sensor\"", ",", "INVALID_CONFIG_MINIMAL", ")", "self", ".", "hass", ".", "block_till_done", "(", ")", "state", "=", "self", ".", "hass", ".", ...
[ 125, 4 ]
[ 131, 28 ]
python
en
['en', 'en', 'en']
True
TestDarkSkySetup.test_setup_with_language_config
(self)
Test the platform setup with language configuration.
Test the platform setup with language configuration.
def test_setup_with_language_config(self): """Test the platform setup with language configuration.""" setup_component(self.hass, "sensor", VALID_CONFIG_LANG_DE) self.hass.block_till_done() state = self.hass.states.get("sensor.dark_sky_summary") assert state is not None
[ "def", "test_setup_with_language_config", "(", "self", ")", ":", "setup_component", "(", "self", ".", "hass", ",", "\"sensor\"", ",", "VALID_CONFIG_LANG_DE", ")", "self", ".", "hass", ".", "block_till_done", "(", ")", "state", "=", "self", ".", "hass", ".", ...
[ 137, 4 ]
[ 143, 32 ]
python
en
['en', 'zu', 'en']
True
TestDarkSkySetup.test_setup_with_invalid_language_config
(self)
Test the platform setup with language configuration.
Test the platform setup with language configuration.
def test_setup_with_invalid_language_config(self): """Test the platform setup with language configuration.""" setup_component(self.hass, "sensor", INVALID_CONFIG_LANG) self.hass.block_till_done() state = self.hass.states.get("sensor.dark_sky_summary") assert state is None
[ "def", "test_setup_with_invalid_language_config", "(", "self", ")", ":", "setup_component", "(", "self", ".", "hass", ",", "\"sensor\"", ",", "INVALID_CONFIG_LANG", ")", "self", ".", "hass", ".", "block_till_done", "(", ")", "state", "=", "self", ".", "hass", ...
[ 145, 4 ]
[ 151, 28 ]
python
en
['en', 'zu', 'en']
True
TestDarkSkySetup.test_setup_bad_api_key
(self, mock_get_forecast)
Test for handling a bad API key.
Test for handling a bad API key.
def test_setup_bad_api_key(self, mock_get_forecast): """Test for handling a bad API key.""" # The Dark Sky API wrapper that we use raises an HTTP error # when you try to use a bad (or no) API key. url = "https://api.darksky.net/forecast/{}/{},{}?units=auto".format( self.key, ...
[ "def", "test_setup_bad_api_key", "(", "self", ",", "mock_get_forecast", ")", ":", "# The Dark Sky API wrapper that we use raises an HTTP error", "# when you try to use a bad (or no) API key.", "url", "=", "\"https://api.darksky.net/forecast/{}/{},{}?units=auto\"", ".", "format", "(", ...
[ 154, 4 ]
[ 167, 27 ]
python
en
['en', 'da', 'en']
True
TestDarkSkySetup.test_setup_with_alerts_config
(self)
Test the platform setup with alert configuration.
Test the platform setup with alert configuration.
def test_setup_with_alerts_config(self): """Test the platform setup with alert configuration.""" setup_component(self.hass, "sensor", VALID_CONFIG_ALERTS) self.hass.block_till_done() state = self.hass.states.get("sensor.dark_sky_alerts") assert state.state == "0"
[ "def", "test_setup_with_alerts_config", "(", "self", ")", ":", "setup_component", "(", "self", ".", "hass", ",", "\"sensor\"", ",", "VALID_CONFIG_ALERTS", ")", "self", ".", "hass", ".", "block_till_done", "(", ")", "state", "=", "self", ".", "hass", ".", "st...
[ 173, 4 ]
[ 179, 33 ]
python
en
['en', 'da', 'en']
True
TestDarkSkySetup.test_setup
(self, mock_req, mock_get_forecast)
Test for successfully setting up the forecast.io platform.
Test for successfully setting up the forecast.io platform.
def test_setup(self, mock_req, mock_get_forecast): """Test for successfully setting up the forecast.io platform.""" uri = ( r"https://api.(darksky.net|forecast.io)\/forecast\/(\w+)\/" r"(-?\d+\.?\d*),(-?\d+\.?\d*)" ) mock_req.get(re.compile(uri), text=load_fixture...
[ "def", "test_setup", "(", "self", ",", "mock_req", ",", "mock_get_forecast", ")", ":", "uri", "=", "(", "r\"https://api.(darksky.net|forecast.io)\\/forecast\\/(\\w+)\\/\"", "r\"(-?\\d+\\.?\\d*),(-?\\d+\\.?\\d*)\"", ")", "mock_req", ".", "get", "(", "re", ".", "compile", ...
[ 183, 4 ]
[ 207, 68 ]
python
en
['en', 'en', 'en']
True
test_valid_config
(hass)
Test configuration.
Test configuration.
async def test_valid_config(hass): """Test configuration.""" assert await async_setup_component( hass, "switch", { "switch": { "platform": "flux", "name": "flux", "lights": ["light.desk", "light.lamp"], } }, ...
[ "async", "def", "test_valid_config", "(", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"switch\"", ",", "{", "\"switch\"", ":", "{", "\"platform\"", ":", "\"flux\"", ",", "\"name\"", ":", "\"flux\"", ",", "\"lights\"", ":",...
[ 24, 0 ]
[ 40, 31 ]
python
en
['en', 'fr', 'en']
False
test_restore_state_last_on
(hass)
Test restoring state when the last state is on.
Test restoring state when the last state is on.
async def test_restore_state_last_on(hass): """Test restoring state when the last state is on.""" mock_restore_cache(hass, [State("switch.flux", "on")]) assert await async_setup_component( hass, "switch", { "switch": { "platform": "flux", ...
[ "async", "def", "test_restore_state_last_on", "(", "hass", ")", ":", "mock_restore_cache", "(", "hass", ",", "[", "State", "(", "\"switch.flux\"", ",", "\"on\"", ")", "]", ")", "assert", "await", "async_setup_component", "(", "hass", ",", "\"switch\"", ",", "{...
[ 43, 0 ]
[ 62, 30 ]
python
en
['en', 'en', 'en']
True
test_restore_state_last_off
(hass)
Test restoring state when the last state is off.
Test restoring state when the last state is off.
async def test_restore_state_last_off(hass): """Test restoring state when the last state is off.""" mock_restore_cache(hass, [State("switch.flux", "off")]) assert await async_setup_component( hass, "switch", { "switch": { "platform": "flux", ...
[ "async", "def", "test_restore_state_last_off", "(", "hass", ")", ":", "mock_restore_cache", "(", "hass", ",", "[", "State", "(", "\"switch.flux\"", ",", "\"off\"", ")", "]", ")", "assert", "await", "async_setup_component", "(", "hass", ",", "\"switch\"", ",", ...
[ 65, 0 ]
[ 84, 31 ]
python
en
['en', 'en', 'en']
True
test_valid_config_with_info
(hass)
Test configuration.
Test configuration.
async def test_valid_config_with_info(hass): """Test configuration.""" assert await async_setup_component( hass, "switch", { "switch": { "platform": "flux", "name": "flux", "lights": ["light.desk", "light.lamp"], ...
[ "async", "def", "test_valid_config_with_info", "(", "hass", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"switch\"", ",", "{", "\"switch\"", ":", "{", "\"platform\"", ":", "\"flux\"", ",", "\"name\"", ":", "\"flux\"", ",", "\"lights\...
[ 87, 0 ]
[ 105, 38 ]
python
en
['en', 'fr', 'en']
False
test_valid_config_no_name
(hass)
Test configuration.
Test configuration.
async def test_valid_config_no_name(hass): """Test configuration.""" with assert_setup_component(1, "switch"): assert await async_setup_component( hass, "switch", {"switch": {"platform": "flux", "lights": ["light.desk", "light.lamp"]}}, ) await hass.as...
[ "async", "def", "test_valid_config_no_name", "(", "hass", ")", ":", "with", "assert_setup_component", "(", "1", ",", "\"switch\"", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"switch\"", ",", "{", "\"switch\"", ":", "{", "\"platform...
[ 108, 0 ]
[ 116, 42 ]
python
en
['en', 'fr', 'en']
False
test_invalid_config_no_lights
(hass)
Test configuration.
Test configuration.
async def test_invalid_config_no_lights(hass): """Test configuration.""" with assert_setup_component(0, "switch"): assert await async_setup_component( hass, "switch", {"switch": {"platform": "flux", "name": "flux"}} ) await hass.async_block_till_done()
[ "async", "def", "test_invalid_config_no_lights", "(", "hass", ")", ":", "with", "assert_setup_component", "(", "0", ",", "\"switch\"", ")", ":", "assert", "await", "async_setup_component", "(", "hass", ",", "\"switch\"", ",", "{", "\"switch\"", ":", "{", "\"plat...
[ 119, 0 ]
[ 125, 42 ]
python
en
['en', 'fr', 'en']
False
test_flux_when_switch_is_off
(hass, legacy_patchable_time)
Test the flux switch when it is off.
Test the flux switch when it is off.
async def test_flux_when_switch_is_off(hass, legacy_patchable_time): """Test the flux switch when it is off.""" platform = getattr(hass.components, "test.light") platform.init() assert await async_setup_component( hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}} ) await hass.a...
[ "async", "def", "test_flux_when_switch_is_off", "(", "hass", ",", "legacy_patchable_time", ")", ":", "platform", "=", "getattr", "(", "hass", ".", "components", ",", "\"test.light\"", ")", "platform", ".", "init", "(", ")", "assert", "await", "async_setup_componen...
[ 128, 0 ]
[ 176, 28 ]
python
en
['en', 'en', 'en']
True
test_flux_before_sunrise
(hass, legacy_patchable_time)
Test the flux switch before sunrise.
Test the flux switch before sunrise.
async def test_flux_before_sunrise(hass, legacy_patchable_time): """Test the flux switch before sunrise.""" platform = getattr(hass.components, "test.light") platform.init() assert await async_setup_component( hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}} ) await hass.async...
[ "async", "def", "test_flux_before_sunrise", "(", "hass", ",", "legacy_patchable_time", ")", ":", "platform", "=", "getattr", "(", "hass", ".", "components", ",", "\"test.light\"", ")", "platform", ".", "init", "(", ")", "assert", "await", "async_setup_component", ...
[ 179, 0 ]
[ 235, 59 ]
python
en
['en', 'en', 'en']
True
test_flux_before_sunrise_known_location
(hass, legacy_patchable_time)
Test the flux switch before sunrise.
Test the flux switch before sunrise.
async def test_flux_before_sunrise_known_location(hass, legacy_patchable_time): """Test the flux switch before sunrise.""" platform = getattr(hass.components, "test.light") platform.init() assert await async_setup_component( hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}} ) a...
[ "async", "def", "test_flux_before_sunrise_known_location", "(", "hass", ",", "legacy_patchable_time", ")", ":", "platform", "=", "getattr", "(", "hass", ".", "components", ",", "\"test.light\"", ")", "platform", ".", "init", "(", ")", "assert", "await", "async_set...
[ 238, 0 ]
[ 293, 59 ]
python
en
['en', 'en', 'en']
True
test_flux_after_sunrise_before_sunset
(hass, legacy_patchable_time)
Test the flux switch after sunrise and before sunset.
Test the flux switch after sunrise and before sunset.
async def test_flux_after_sunrise_before_sunset(hass, legacy_patchable_time): """Test the flux switch after sunrise and before sunset.""" platform = getattr(hass.components, "test.light") platform.init() assert await async_setup_component( hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test...
[ "async", "def", "test_flux_after_sunrise_before_sunset", "(", "hass", ",", "legacy_patchable_time", ")", ":", "platform", "=", "getattr", "(", "hass", ".", "components", ",", "\"test.light\"", ")", "platform", ".", "init", "(", ")", "assert", "await", "async_setup...
[ 297, 0 ]
[ 352, 58 ]
python
en
['en', 'en', 'en']
True
test_flux_after_sunset_before_stop
(hass, legacy_patchable_time)
Test the flux switch after sunset and before stop.
Test the flux switch after sunset and before stop.
async def test_flux_after_sunset_before_stop(hass, legacy_patchable_time): """Test the flux switch after sunset and before stop.""" platform = getattr(hass.components, "test.light") platform.init() assert await async_setup_component( hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}} ...
[ "async", "def", "test_flux_after_sunset_before_stop", "(", "hass", ",", "legacy_patchable_time", ")", ":", "platform", "=", "getattr", "(", "hass", ".", "components", ",", "\"test.light\"", ")", "platform", ".", "init", "(", ")", "assert", "await", "async_setup_co...
[ 356, 0 ]
[ 412, 59 ]
python
en
['en', 'en', 'en']
True
test_flux_after_stop_before_sunrise
(hass, legacy_patchable_time)
Test the flux switch after stop and before sunrise.
Test the flux switch after stop and before sunrise.
async def test_flux_after_stop_before_sunrise(hass, legacy_patchable_time): """Test the flux switch after stop and before sunrise.""" platform = getattr(hass.components, "test.light") platform.init() assert await async_setup_component( hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}} ...
[ "async", "def", "test_flux_after_stop_before_sunrise", "(", "hass", ",", "legacy_patchable_time", ")", ":", "platform", "=", "getattr", "(", "hass", ".", "components", ",", "\"test.light\"", ")", "platform", ".", "init", "(", ")", "assert", "await", "async_setup_c...
[ 416, 0 ]
[ 471, 59 ]
python
en
['en', 'en', 'en']
True
test_flux_with_custom_start_stop_times
(hass, legacy_patchable_time)
Test the flux with custom start and stop times.
Test the flux with custom start and stop times.
async def test_flux_with_custom_start_stop_times(hass, legacy_patchable_time): """Test the flux with custom start and stop times.""" platform = getattr(hass.components, "test.light") platform.init() assert await async_setup_component( hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}} ...
[ "async", "def", "test_flux_with_custom_start_stop_times", "(", "hass", ",", "legacy_patchable_time", ")", ":", "platform", "=", "getattr", "(", "hass", ".", "components", ",", "\"test.light\"", ")", "platform", ".", "init", "(", ")", "assert", "await", "async_setu...
[ 475, 0 ]
[ 532, 59 ]
python
en
['en', 'en', 'en']
True
test_flux_before_sunrise_stop_next_day
(hass, legacy_patchable_time)
Test the flux switch before sunrise. This test has the stop_time on the next day (after midnight).
Test the flux switch before sunrise.
async def test_flux_before_sunrise_stop_next_day(hass, legacy_patchable_time): """Test the flux switch before sunrise. This test has the stop_time on the next day (after midnight). """ platform = getattr(hass.components, "test.light") platform.init() assert await async_setup_component( ...
[ "async", "def", "test_flux_before_sunrise_stop_next_day", "(", "hass", ",", "legacy_patchable_time", ")", ":", "platform", "=", "getattr", "(", "hass", ".", "components", ",", "\"test.light\"", ")", "platform", ".", "init", "(", ")", "assert", "await", "async_setu...
[ 535, 0 ]
[ 594, 59 ]
python
en
['en', 'en', 'en']
True
test_flux_after_sunrise_before_sunset_stop_next_day
( hass, legacy_patchable_time )
Test the flux switch after sunrise and before sunset. This test has the stop_time on the next day (after midnight).
Test the flux switch after sunrise and before sunset.
async def test_flux_after_sunrise_before_sunset_stop_next_day( hass, legacy_patchable_time ): """ Test the flux switch after sunrise and before sunset. This test has the stop_time on the next day (after midnight). """ platform = getattr(hass.components, "test.light") platform.init() ass...
[ "async", "def", "test_flux_after_sunrise_before_sunset_stop_next_day", "(", "hass", ",", "legacy_patchable_time", ")", ":", "platform", "=", "getattr", "(", "hass", ".", "components", ",", "\"test.light\"", ")", "platform", ".", "init", "(", ")", "assert", "await", ...
[ 598, 0 ]
[ 660, 58 ]
python
en
['en', 'error', 'th']
False
test_flux_after_sunset_before_midnight_stop_next_day
( hass, legacy_patchable_time, x )
Test the flux switch after sunset and before stop. This test has the stop_time on the next day (after midnight).
Test the flux switch after sunset and before stop.
async def test_flux_after_sunset_before_midnight_stop_next_day( hass, legacy_patchable_time, x ): """Test the flux switch after sunset and before stop. This test has the stop_time on the next day (after midnight). """ platform = getattr(hass.components, "test.light") platform.init() assert ...
[ "async", "def", "test_flux_after_sunset_before_midnight_stop_next_day", "(", "hass", ",", "legacy_patchable_time", ",", "x", ")", ":", "platform", "=", "getattr", "(", "hass", ".", "components", ",", "\"test.light\"", ")", "platform", ".", "init", "(", ")", "asser...
[ 665, 0 ]
[ 726, 59 ]
python
en
['en', 'en', 'en']
True
test_flux_after_sunset_after_midnight_stop_next_day
( hass, legacy_patchable_time )
Test the flux switch after sunset and before stop. This test has the stop_time on the next day (after midnight).
Test the flux switch after sunset and before stop.
async def test_flux_after_sunset_after_midnight_stop_next_day( hass, legacy_patchable_time ): """Test the flux switch after sunset and before stop. This test has the stop_time on the next day (after midnight). """ platform = getattr(hass.components, "test.light") platform.init() assert awai...
[ "async", "def", "test_flux_after_sunset_after_midnight_stop_next_day", "(", "hass", ",", "legacy_patchable_time", ")", ":", "platform", "=", "getattr", "(", "hass", ".", "components", ",", "\"test.light\"", ")", "platform", ".", "init", "(", ")", "assert", "await", ...
[ 730, 0 ]
[ 791, 59 ]
python
en
['en', 'en', 'en']
True
test_flux_after_stop_before_sunrise_stop_next_day
( hass, legacy_patchable_time )
Test the flux switch after stop and before sunrise. This test has the stop_time on the next day (after midnight).
Test the flux switch after stop and before sunrise.
async def test_flux_after_stop_before_sunrise_stop_next_day( hass, legacy_patchable_time ): """Test the flux switch after stop and before sunrise. This test has the stop_time on the next day (after midnight). """ platform = getattr(hass.components, "test.light") platform.init() assert await...
[ "async", "def", "test_flux_after_stop_before_sunrise_stop_next_day", "(", "hass", ",", "legacy_patchable_time", ")", ":", "platform", "=", "getattr", "(", "hass", ".", "components", ",", "\"test.light\"", ")", "platform", ".", "init", "(", ")", "assert", "await", ...
[ 795, 0 ]
[ 856, 59 ]
python
en
['en', 'en', 'en']
True
test_flux_with_custom_colortemps
(hass, legacy_patchable_time)
Test the flux with custom start and stop colortemps.
Test the flux with custom start and stop colortemps.
async def test_flux_with_custom_colortemps(hass, legacy_patchable_time): """Test the flux with custom start and stop colortemps.""" platform = getattr(hass.components, "test.light") platform.init() assert await async_setup_component( hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}} ...
[ "async", "def", "test_flux_with_custom_colortemps", "(", "hass", ",", "legacy_patchable_time", ")", ":", "platform", "=", "getattr", "(", "hass", ".", "components", ",", "\"test.light\"", ")", "platform", ".", "init", "(", ")", "assert", "await", "async_setup_comp...
[ 860, 0 ]
[ 918, 59 ]
python
en
['en', 'en', 'en']
True
test_flux_with_custom_brightness
(hass, legacy_patchable_time)
Test the flux with custom start and stop colortemps.
Test the flux with custom start and stop colortemps.
async def test_flux_with_custom_brightness(hass, legacy_patchable_time): """Test the flux with custom start and stop colortemps.""" platform = getattr(hass.components, "test.light") platform.init() assert await async_setup_component( hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}} ...
[ "async", "def", "test_flux_with_custom_brightness", "(", "hass", ",", "legacy_patchable_time", ")", ":", "platform", "=", "getattr", "(", "hass", ".", "components", ",", "\"test.light\"", ")", "platform", ".", "init", "(", ")", "assert", "await", "async_setup_comp...
[ 922, 0 ]
[ 979, 59 ]
python
en
['en', 'en', 'en']
True
test_flux_with_multiple_lights
(hass, legacy_patchable_time)
Test the flux switch with multiple light entities.
Test the flux switch with multiple light entities.
async def test_flux_with_multiple_lights(hass, legacy_patchable_time): """Test the flux switch with multiple light entities.""" platform = getattr(hass.components, "test.light") platform.init() assert await async_setup_component( hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}} ) ...
[ "async", "def", "test_flux_with_multiple_lights", "(", "hass", ",", "legacy_patchable_time", ")", ":", "platform", "=", "getattr", "(", "hass", ".", "components", ",", "\"test.light\"", ")", "platform", ".", "init", "(", ")", "assert", "await", "async_setup_compon...
[ 982, 0 ]
[ 1062, 58 ]
python
en
['en', 'en', 'en']
True
test_flux_with_mired
(hass, legacy_patchable_time)
Test the flux switch´s mode mired.
Test the flux switch´s mode mired.
async def test_flux_with_mired(hass, legacy_patchable_time): """Test the flux switch´s mode mired.""" platform = getattr(hass.components, "test.light") platform.init() assert await async_setup_component( hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}} ) await hass.async_block...
[ "async", "def", "test_flux_with_mired", "(", "hass", ",", "legacy_patchable_time", ")", ":", "platform", "=", "getattr", "(", "hass", ".", "components", ",", "\"test.light\"", ")", "platform", ".", "init", "(", ")", "assert", "await", "async_setup_component", "(...
[ 1065, 0 ]
[ 1119, 50 ]
python
en
['en', 'en', 'en']
True
test_flux_with_rgb
(hass, legacy_patchable_time)
Test the flux switch´s mode rgb.
Test the flux switch´s mode rgb.
async def test_flux_with_rgb(hass, legacy_patchable_time): """Test the flux switch´s mode rgb.""" platform = getattr(hass.components, "test.light") platform.init() assert await async_setup_component( hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}} ) await hass.async_block_til...
[ "async", "def", "test_flux_with_rgb", "(", "hass", ",", "legacy_patchable_time", ")", ":", "platform", "=", "getattr", "(", "hass", ".", "components", ",", "\"test.light\"", ")", "platform", ".", "init", "(", ")", "assert", "await", "async_setup_component", "(",...
[ 1122, 0 ]
[ 1178, 30 ]
python
en
['en', 'en', 'en']
True
_lookup_domain
( perm_lookup: PermissionLookup, domains_dict: SubCategoryDict, entity_id: str )
Look up entity permissions by domain.
Look up entity permissions by domain.
def _lookup_domain( perm_lookup: PermissionLookup, domains_dict: SubCategoryDict, entity_id: str ) -> Optional[ValueType]: """Look up entity permissions by domain.""" return domains_dict.get(entity_id.split(".", 1)[0])
[ "def", "_lookup_domain", "(", "perm_lookup", ":", "PermissionLookup", ",", "domains_dict", ":", "SubCategoryDict", ",", "entity_id", ":", "str", ")", "->", "Optional", "[", "ValueType", "]", ":", "return", "domains_dict", ".", "get", "(", "entity_id", ".", "sp...
[ 43, 0 ]
[ 47, 55 ]
python
en
['en', 'en', 'en']
True
_lookup_area
( perm_lookup: PermissionLookup, area_dict: SubCategoryDict, entity_id: str )
Look up entity permissions by area.
Look up entity permissions by area.
def _lookup_area( perm_lookup: PermissionLookup, area_dict: SubCategoryDict, entity_id: str ) -> Optional[ValueType]: """Look up entity permissions by area.""" entity_entry = perm_lookup.entity_registry.async_get(entity_id) if entity_entry is None or entity_entry.device_id is None: return None ...
[ "def", "_lookup_area", "(", "perm_lookup", ":", "PermissionLookup", ",", "area_dict", ":", "SubCategoryDict", ",", "entity_id", ":", "str", ")", "->", "Optional", "[", "ValueType", "]", ":", "entity_entry", "=", "perm_lookup", ".", "entity_registry", ".", "async...
[ 50, 0 ]
[ 64, 46 ]
python
en
['en', 'en', 'en']
True
_lookup_device
( perm_lookup: PermissionLookup, devices_dict: SubCategoryDict, entity_id: str )
Look up entity permissions by device.
Look up entity permissions by device.
def _lookup_device( perm_lookup: PermissionLookup, devices_dict: SubCategoryDict, entity_id: str ) -> Optional[ValueType]: """Look up entity permissions by device.""" entity_entry = perm_lookup.entity_registry.async_get(entity_id) if entity_entry is None or entity_entry.device_id is None: retur...
[ "def", "_lookup_device", "(", "perm_lookup", ":", "PermissionLookup", ",", "devices_dict", ":", "SubCategoryDict", ",", "entity_id", ":", "str", ")", "->", "Optional", "[", "ValueType", "]", ":", "entity_entry", "=", "perm_lookup", ".", "entity_registry", ".", "...
[ 67, 0 ]
[ 76, 51 ]
python
en
['en', 'en', 'en']
True
_lookup_entity_id
( perm_lookup: PermissionLookup, entities_dict: SubCategoryDict, entity_id: str )
Look up entity permission by entity id.
Look up entity permission by entity id.
def _lookup_entity_id( perm_lookup: PermissionLookup, entities_dict: SubCategoryDict, entity_id: str ) -> Optional[ValueType]: """Look up entity permission by entity id.""" return entities_dict.get(entity_id)
[ "def", "_lookup_entity_id", "(", "perm_lookup", ":", "PermissionLookup", ",", "entities_dict", ":", "SubCategoryDict", ",", "entity_id", ":", "str", ")", "->", "Optional", "[", "ValueType", "]", ":", "return", "entities_dict", ".", "get", "(", "entity_id", ")" ]
[ 79, 0 ]
[ 83, 39 ]
python
en
['en', 'cy', 'en']
True
compile_entities
( policy: CategoryType, perm_lookup: PermissionLookup )
Compile policy into a function that tests policy.
Compile policy into a function that tests policy.
def compile_entities( policy: CategoryType, perm_lookup: PermissionLookup ) -> Callable[[str, str], bool]: """Compile policy into a function that tests policy.""" subcategories: SubCatLookupType = OrderedDict() subcategories[ENTITY_ENTITY_IDS] = _lookup_entity_id subcategories[ENTITY_DEVICE_IDS] = _...
[ "def", "compile_entities", "(", "policy", ":", "CategoryType", ",", "perm_lookup", ":", "PermissionLookup", ")", "->", "Callable", "[", "[", "str", ",", "str", "]", ",", "bool", "]", ":", "subcategories", ":", "SubCatLookupType", "=", "OrderedDict", "(", ")"...
[ 86, 0 ]
[ 97, 61 ]
python
en
['en', 'en', 'en']
True
setup_comp
(hass)
Initialize components.
Initialize components.
def setup_comp(hass): """Initialize components.""" mock_component(hass, "zone") yaml_devices = hass.config.path(YAML_DEVICES) yield if os.path.isfile(yaml_devices): os.remove(yaml_devices)
[ "def", "setup_comp", "(", "hass", ")", ":", "mock_component", "(", "hass", ",", "\"zone\"", ")", "yaml_devices", "=", "hass", ".", "config", ".", "path", "(", "YAML_DEVICES", ")", "yield", "if", "os", ".", "path", ".", "isfile", "(", "yaml_devices", ")",...
[ 31, 0 ]
[ 37, 31 ]
python
en
['de', 'en', 'en']
False
test_get_scanner
(unifi_mock, hass)
Test creating an Unifi direct scanner with a password.
Test creating an Unifi direct scanner with a password.
async def test_get_scanner(unifi_mock, hass): """Test creating an Unifi direct scanner with a password.""" conf_dict = { DOMAIN: { CONF_PLATFORM: "unifi_direct", CONF_HOST: "fake_host", CONF_USERNAME: "fake_user", CONF_PASSWORD: "fake_pass", CO...
[ "async", "def", "test_get_scanner", "(", "unifi_mock", ",", "hass", ")", ":", "conf_dict", "=", "{", "DOMAIN", ":", "{", "CONF_PLATFORM", ":", "\"unifi_direct\"", ",", "CONF_HOST", ":", "\"fake_host\"", ",", "CONF_USERNAME", ":", "\"fake_user\"", ",", "CONF_PASS...
[ 41, 0 ]
[ 59, 58 ]
python
en
['en', 'en', 'en']
True
test_get_device_name
(mock_ssh, hass)
Testing MAC matching.
Testing MAC matching.
async def test_get_device_name(mock_ssh, hass): """Testing MAC matching.""" conf_dict = { DOMAIN: { CONF_PLATFORM: "unifi_direct", CONF_HOST: "fake_host", CONF_USERNAME: "fake_user", CONF_PASSWORD: "fake_pass", CONF_PORT: 22, CONF_T...
[ "async", "def", "test_get_device_name", "(", "mock_ssh", ",", "hass", ")", ":", "conf_dict", "=", "{", "DOMAIN", ":", "{", "CONF_PLATFORM", ":", "\"unifi_direct\"", ",", "CONF_HOST", ":", "\"fake_host\"", ",", "CONF_USERNAME", ":", "\"fake_user\"", ",", "CONF_PA...
[ 63, 0 ]
[ 81, 67 ]
python
en
['en', 'jv', 'en']
True
test_failed_to_log_in
(mock_login, mock_logout, hass)
Testing exception at login results in False.
Testing exception at login results in False.
async def test_failed_to_log_in(mock_login, mock_logout, hass): """Testing exception at login results in False.""" from pexpect import exceptions conf_dict = { DOMAIN: { CONF_PLATFORM: "unifi_direct", CONF_HOST: "fake_host", CONF_USERNAME: "fake_user", ...
[ "async", "def", "test_failed_to_log_in", "(", "mock_login", ",", "mock_logout", ",", "hass", ")", ":", "from", "pexpect", "import", "exceptions", "conf_dict", "=", "{", "DOMAIN", ":", "{", "CONF_PLATFORM", ":", "\"unifi_direct\"", ",", "CONF_HOST", ":", "\"fake_...
[ 86, 0 ]
[ 104, 22 ]
python
en
['en', 'en', 'en']
True
test_to_get_update
(mock_sendline, mock_prompt, mock_login, mock_logout, hass)
Testing exception in get_update matching.
Testing exception in get_update matching.
async def test_to_get_update(mock_sendline, mock_prompt, mock_login, mock_logout, hass): """Testing exception in get_update matching.""" conf_dict = { DOMAIN: { CONF_PLATFORM: "unifi_direct", CONF_HOST: "fake_host", CONF_USERNAME: "fake_user", CONF_PASSWOR...
[ "async", "def", "test_to_get_update", "(", "mock_sendline", ",", "mock_prompt", ",", "mock_login", ",", "mock_logout", ",", "hass", ")", ":", "conf_dict", "=", "{", "DOMAIN", ":", "{", "CONF_PLATFORM", ":", "\"unifi_direct\"", ",", "CONF_HOST", ":", "\"fake_host...
[ 111, 0 ]
[ 129, 26 ]
python
en
['nl', 'en', 'en']
True
test_good_response_parses
(hass)
Test that the response form the AP parses to JSON correctly.
Test that the response form the AP parses to JSON correctly.
def test_good_response_parses(hass): """Test that the response form the AP parses to JSON correctly.""" response = _response_to_json(load_fixture("unifi_direct.txt")) assert response != {}
[ "def", "test_good_response_parses", "(", "hass", ")", ":", "response", "=", "_response_to_json", "(", "load_fixture", "(", "\"unifi_direct.txt\"", ")", ")", "assert", "response", "!=", "{", "}" ]
[ 132, 0 ]
[ 135, 25 ]
python
en
['en', 'en', 'en']
True
test_bad_response_returns_none
(hass)
Test that a bad response form the AP parses to JSON correctly.
Test that a bad response form the AP parses to JSON correctly.
def test_bad_response_returns_none(hass): """Test that a bad response form the AP parses to JSON correctly.""" assert _response_to_json("{(}") == {}
[ "def", "test_bad_response_returns_none", "(", "hass", ")", ":", "assert", "_response_to_json", "(", "\"{(}\"", ")", "==", "{", "}" ]
[ 138, 0 ]
[ 140, 41 ]
python
en
['en', 'en', 'en']
True
test_config_error
()
Test for configuration errors.
Test for configuration errors.
def test_config_error(): """Test for configuration errors.""" with pytest.raises(vol.Invalid): PLATFORM_SCHEMA( { # no username CONF_PASSWORD: "password", CONF_PLATFORM: DOMAIN, CONF_HOST: "myhost", "port": 123, ...
[ "def", "test_config_error", "(", ")", ":", "with", "pytest", ".", "raises", "(", "vol", ".", "Invalid", ")", ":", "PLATFORM_SCHEMA", "(", "{", "# no username", "CONF_PASSWORD", ":", "\"password\"", ",", "CONF_PLATFORM", ":", "DOMAIN", ",", "CONF_HOST", ":", ...
[ 143, 0 ]
[ 174, 9 ]
python
en
['da', 'en', 'en']
True
async_setup_intents
(hass: HomeAssistant)
Set up the light intents.
Set up the light intents.
async def async_setup_intents(hass: HomeAssistant) -> None: """Set up the light intents.""" hass.helpers.intent.async_register(SetIntentHandler())
[ "async", "def", "async_setup_intents", "(", "hass", ":", "HomeAssistant", ")", "->", "None", ":", "hass", ".", "helpers", ".", "intent", ".", "async_register", "(", "SetIntentHandler", "(", ")", ")" ]
[ 21, 0 ]
[ 23, 58 ]
python
en
['en', 'en', 'en']
True
SetIntentHandler.async_handle
(self, intent_obj: intent.Intent)
Handle the hass intent.
Handle the hass intent.
async def async_handle(self, intent_obj: intent.Intent) -> intent.IntentResponse: """Handle the hass intent.""" hass = intent_obj.hass slots = self.async_validate_slots(intent_obj.slots) state = hass.helpers.intent.async_match_state( slots["name"]["value"], hass.states.async_...
[ "async", "def", "async_handle", "(", "self", ",", "intent_obj", ":", "intent", ".", "Intent", ")", "->", "intent", ".", "IntentResponse", ":", "hass", "=", "intent_obj", ".", "hass", "slots", "=", "self", ".", "async_validate_slots", "(", "intent_obj", ".", ...
[ 36, 4 ]
[ 79, 23 ]
python
en
['en', 'en', 'en']
True
MBart50Tokenizer._convert_token_to_id
(self, token: str)
Converts a token (str) in an id using the vocab.
Converts a token (str) in an id using the vocab.
def _convert_token_to_id(self, token: str) -> int: """ Converts a token (str) in an id using the vocab. """ if token in self.fairseq_tokens_to_ids: return self.fairseq_tokens_to_ids[token] spm_id = self.sp_model.PieceToId(token) # Need to return unknown token if the SP model...
[ "def", "_convert_token_to_id", "(", "self", ",", "token", ":", "str", ")", "->", "int", ":", "if", "token", "in", "self", ".", "fairseq_tokens_to_ids", ":", "return", "self", ".", "fairseq_tokens_to_ids", "[", "token", "]", "spm_id", "=", "self", ".", "sp_...
[ 190, 4 ]
[ 197, 76 ]
python
en
['en', 'en', 'en']
True
MBart50Tokenizer._convert_id_to_token
(self, index: int)
Converts an index (integer) in a token (str) using the vocab.
Converts an index (integer) in a token (str) using the vocab.
def _convert_id_to_token(self, index: int) -> str: """Converts an index (integer) in a token (str) using the vocab.""" if index in self.fairseq_ids_to_tokens: return self.fairseq_ids_to_tokens[index] return self.sp_model.IdToPiece(index - self.fairseq_offset)
[ "def", "_convert_id_to_token", "(", "self", ",", "index", ":", "int", ")", "->", "str", ":", "if", "index", "in", "self", ".", "fairseq_ids_to_tokens", ":", "return", "self", ".", "fairseq_ids_to_tokens", "[", "index", "]", "return", "self", ".", "sp_model",...
[ 199, 4 ]
[ 203, 67 ]
python
en
['en', 'en', 'en']
True
MBart50Tokenizer.convert_tokens_to_string
(self, tokens: List[str])
Converts a sequence of tokens (strings for sub-words) in a single string.
Converts a sequence of tokens (strings for sub-words) in a single string.
def convert_tokens_to_string(self, tokens: List[str]) -> str: """Converts a sequence of tokens (strings for sub-words) in a single string.""" out_string = "".join(tokens).replace(SPIECE_UNDERLINE, " ").strip() return out_string
[ "def", "convert_tokens_to_string", "(", "self", ",", "tokens", ":", "List", "[", "str", "]", ")", "->", "str", ":", "out_string", "=", "\"\"", ".", "join", "(", "tokens", ")", ".", "replace", "(", "SPIECE_UNDERLINE", ",", "\" \"", ")", ".", "strip", "(...
[ 205, 4 ]
[ 208, 25 ]
python
en
['en', 'en', 'en']
True
MBart50Tokenizer.get_special_tokens_mask
( self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None, already_has_special_tokens: bool = False )
Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding special tokens using the tokenizer ``prepare_for_model`` method. Args: token_ids_0 (:obj:`List[int]`): List of IDs. token_ids_1 (:obj:`List[int]`,...
Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding special tokens using the tokenizer ``prepare_for_model`` method.
def get_special_tokens_mask( self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None, already_has_special_tokens: bool = False ) -> List[int]: """ Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding special tokens ...
[ "def", "get_special_tokens_mask", "(", "self", ",", "token_ids_0", ":", "List", "[", "int", "]", ",", "token_ids_1", ":", "Optional", "[", "List", "[", "int", "]", "]", "=", "None", ",", "already_has_special_tokens", ":", "bool", "=", "False", ")", "->", ...
[ 223, 4 ]
[ 253, 94 ]
python
en
['en', 'error', 'th']
False
MBart50Tokenizer.build_inputs_with_special_tokens
( self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None )
Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and adding special tokens. An MBART-50 sequence has the following format, where ``X`` represents the sequence: - ``input_ids`` (for encoder) ``[src_lang_code] X [eos]`` - ``label...
Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and adding special tokens. An MBART-50 sequence has the following format, where ``X`` represents the sequence:
def build_inputs_with_special_tokens( self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None ) -> List[int]: """ Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and adding special tokens. An MBART-50 sequence ...
[ "def", "build_inputs_with_special_tokens", "(", "self", ",", "token_ids_0", ":", "List", "[", "int", "]", ",", "token_ids_1", ":", "Optional", "[", "List", "[", "int", "]", "]", "=", "None", ")", "->", "List", "[", "int", "]", ":", "if", "token_ids_1", ...
[ 255, 4 ]
[ 280, 82 ]
python
en
['en', 'error', 'th']
False
MBart50Tokenizer.as_target_tokenizer
(self)
Temporarily sets the tokenizer for encoding the targets. Useful for tokenizer associated to sequence-to-sequence models that need a slightly different processing for the labels.
Temporarily sets the tokenizer for encoding the targets. Useful for tokenizer associated to sequence-to-sequence models that need a slightly different processing for the labels.
def as_target_tokenizer(self): """ Temporarily sets the tokenizer for encoding the targets. Useful for tokenizer associated to sequence-to-sequence models that need a slightly different processing for the labels. """ self.set_tgt_lang_special_tokens(self.tgt_lang) yield ...
[ "def", "as_target_tokenizer", "(", "self", ")", ":", "self", ".", "set_tgt_lang_special_tokens", "(", "self", ".", "tgt_lang", ")", "yield", "self", ".", "set_src_lang_special_tokens", "(", "self", ".", "src_lang", ")" ]
[ 295, 4 ]
[ 302, 55 ]
python
en
['en', 'error', 'th']
False
MBart50Tokenizer.set_src_lang_special_tokens
(self, src_lang: str)
Reset the special tokens to the source lang setting. prefix=[src_lang_code] and suffix=[eos].
Reset the special tokens to the source lang setting. prefix=[src_lang_code] and suffix=[eos].
def set_src_lang_special_tokens(self, src_lang: str) -> None: """Reset the special tokens to the source lang setting. prefix=[src_lang_code] and suffix=[eos].""" self.cur_lang_code_id = self.lang_code_to_id[src_lang] self.prefix_tokens = [self.cur_lang_code_id] self.suffix_tokens = [self...
[ "def", "set_src_lang_special_tokens", "(", "self", ",", "src_lang", ":", "str", ")", "->", "None", ":", "self", ".", "cur_lang_code_id", "=", "self", ".", "lang_code_to_id", "[", "src_lang", "]", "self", ".", "prefix_tokens", "=", "[", "self", ".", "cur_lang...
[ 304, 4 ]
[ 308, 48 ]
python
en
['en', 'en', 'en']
True
MBart50Tokenizer.set_tgt_lang_special_tokens
(self, tgt_lang: str)
Reset the special tokens to the target language setting. prefix=[tgt_lang_code] and suffix=[eos].
Reset the special tokens to the target language setting. prefix=[tgt_lang_code] and suffix=[eos].
def set_tgt_lang_special_tokens(self, tgt_lang: str) -> None: """Reset the special tokens to the target language setting. prefix=[tgt_lang_code] and suffix=[eos].""" self.cur_lang_code_id = self.lang_code_to_id[tgt_lang] self.prefix_tokens = [self.cur_lang_code_id] self.suffix_tokens = [...
[ "def", "set_tgt_lang_special_tokens", "(", "self", ",", "tgt_lang", ":", "str", ")", "->", "None", ":", "self", ".", "cur_lang_code_id", "=", "self", ".", "lang_code_to_id", "[", "tgt_lang", "]", "self", ".", "prefix_tokens", "=", "[", "self", ".", "cur_lang...
[ 310, 4 ]
[ 314, 48 ]
python
en
['en', 'en', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Import the platform into a config entry.
Import the platform into a config entry.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Import the platform into a config entry.""" hass.async_create_task( hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_IMPORT}, data=config ) )
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "hass", ".", "async_create_task", "(", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",...
[ 59, 0 ]
[ 66, 5 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up the NUT sensors.
Set up the NUT sensors.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up the NUT sensors.""" pynut_data = hass.data[DOMAIN][config_entry.entry_id] unique_id = pynut_data[PYNUT_UNIQUE_ID] manufacturer = pynut_data[PYNUT_MANUFACTURER] model = pynut_data[PYNUT_MODEL] firmware = pynut_data[PY...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "pynut_data", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "config_entry", ".", "entry_id", "]", "unique_id", "=", "pynut_data", "[", "PYNUT_UNIQU...
[ 69, 0 ]
[ 116, 38 ]
python
en
['en', 'sq', 'en']
True
_format_display_state
(status)
Return UPS display state.
Return UPS display state.
def _format_display_state(status): """Return UPS display state.""" if status is None: return STATE_TYPES["OFF"] try: return " ".join(STATE_TYPES[state] for state in status[KEY_STATUS].split()) except KeyError: return STATE_UNKNOWN
[ "def", "_format_display_state", "(", "status", ")", ":", "if", "status", "is", "None", ":", "return", "STATE_TYPES", "[", "\"OFF\"", "]", "try", ":", "return", "\" \"", ".", "join", "(", "STATE_TYPES", "[", "state", "]", "for", "state", "in", "status", "...
[ 208, 0 ]
[ 215, 28 ]
python
en
['en', 'id', 'en']
True
NUTSensor.__init__
( self, coordinator, data, name, sensor_type, unique_id, manufacturer, model, firmware, )
Initialize the sensor.
Initialize the sensor.
def __init__( self, coordinator, data, name, sensor_type, unique_id, manufacturer, model, firmware, ): """Initialize the sensor.""" super().__init__(coordinator) self._type = sensor_type self._manufacturer = manu...
[ "def", "__init__", "(", "self", ",", "coordinator", ",", "data", ",", "name", ",", "sensor_type", ",", "unique_id", ",", "manufacturer", ",", "model", ",", "firmware", ",", ")", ":", "super", "(", ")", ".", "__init__", "(", "coordinator", ")", "self", ...
[ 122, 4 ]
[ 143, 35 ]
python
en
['en', 'en', 'en']
True
NUTSensor.device_info
(self)
Device info for the ups.
Device info for the ups.
def device_info(self): """Device info for the ups.""" if not self._unique_id: return None device_info = { "identifiers": {(DOMAIN, self._unique_id)}, "name": self._device_name, } if self._model: device_info["model"] = self._model ...
[ "def", "device_info", "(", "self", ")", ":", "if", "not", "self", ".", "_unique_id", ":", "return", "None", "device_info", "=", "{", "\"identifiers\"", ":", "{", "(", "DOMAIN", ",", "self", ".", "_unique_id", ")", "}", ",", "\"name\"", ":", "self", "."...
[ 146, 4 ]
[ 160, 26 ]
python
en
['en', 'en', 'en']
True
NUTSensor.unique_id
(self)
Sensor Unique id.
Sensor Unique id.
def unique_id(self): """Sensor Unique id.""" if not self._unique_id: return None return f"{self._unique_id}_{self._type}"
[ "def", "unique_id", "(", "self", ")", ":", "if", "not", "self", ".", "_unique_id", ":", "return", "None", "return", "f\"{self._unique_id}_{self._type}\"" ]
[ 163, 4 ]
[ 167, 48 ]
python
ca
['fr', 'ca', 'it']
False
NUTSensor.name
(self)
Return the name of the UPS sensor.
Return the name of the UPS sensor.
def name(self): """Return the name of the UPS sensor.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 170, 4 ]
[ 172, 25 ]
python
en
['en', 'mi', 'en']
True
NUTSensor.icon
(self)
Icon to use in the frontend, if any.
Icon to use in the frontend, if any.
def icon(self): """Icon to use in the frontend, if any.""" if SENSOR_TYPES[self._type][SENSOR_DEVICE_CLASS]: # The UI will assign an icon # if it has a class return None return SENSOR_TYPES[self._type][SENSOR_ICON]
[ "def", "icon", "(", "self", ")", ":", "if", "SENSOR_TYPES", "[", "self", ".", "_type", "]", "[", "SENSOR_DEVICE_CLASS", "]", ":", "# The UI will assign an icon", "# if it has a class", "return", "None", "return", "SENSOR_TYPES", "[", "self", ".", "_type", "]", ...
[ 175, 4 ]
[ 181, 52 ]
python
en
['en', 'en', 'en']
True
NUTSensor.device_class
(self)
Device class of the sensor.
Device class of the sensor.
def device_class(self): """Device class of the sensor.""" return SENSOR_TYPES[self._type][SENSOR_DEVICE_CLASS]
[ "def", "device_class", "(", "self", ")", ":", "return", "SENSOR_TYPES", "[", "self", ".", "_type", "]", "[", "SENSOR_DEVICE_CLASS", "]" ]
[ 184, 4 ]
[ 186, 60 ]
python
en
['en', 'ro', 'en']
True
NUTSensor.state
(self)
Return entity state from ups.
Return entity state from ups.
def state(self): """Return entity state from ups.""" if not self._data.status: return None if self._type == KEY_STATUS_DISPLAY: return _format_display_state(self._data.status) return self._data.status.get(self._type)
[ "def", "state", "(", "self", ")", ":", "if", "not", "self", ".", "_data", ".", "status", ":", "return", "None", "if", "self", ".", "_type", "==", "KEY_STATUS_DISPLAY", ":", "return", "_format_display_state", "(", "self", ".", "_data", ".", "status", ")",...
[ 189, 4 ]
[ 195, 48 ]
python
en
['en', 'en', 'en']
True
NUTSensor.unit_of_measurement
(self)
Return the unit of measurement of this entity, if any.
Return the unit of measurement of this entity, if any.
def unit_of_measurement(self): """Return the unit of measurement of this entity, if any.""" return self._unit
[ "def", "unit_of_measurement", "(", "self", ")", ":", "return", "self", ".", "_unit" ]
[ 198, 4 ]
[ 200, 25 ]
python
en
['en', 'en', 'en']
True
NUTSensor.device_state_attributes
(self)
Return the sensor attributes.
Return the sensor attributes.
def device_state_attributes(self): """Return the sensor attributes.""" return {ATTR_STATE: _format_display_state(self._data.status)}
[ "def", "device_state_attributes", "(", "self", ")", ":", "return", "{", "ATTR_STATE", ":", "_format_display_state", "(", "self", ".", "_data", ".", "status", ")", "}" ]
[ 203, 4 ]
[ 205, 69 ]
python
en
['en', 'sq', 'en']
True
Scheduler.run_tester
(self, cycle=CYCLE_TESTER)
run tester
run tester
def run_tester(self, cycle=CYCLE_TESTER): """ run tester """ if not ENABLE_TESTER: logger.info('tester not enabled, exit') return tester = Tester() loop = 0 while True: logger.debug(f'tester loop {loop} start...') te...
[ "def", "run_tester", "(", "self", ",", "cycle", "=", "CYCLE_TESTER", ")", ":", "if", "not", "ENABLE_TESTER", ":", "logger", ".", "info", "(", "'tester not enabled, exit'", ")", "return", "tester", "=", "Tester", "(", ")", "loop", "=", "0", "while", "True",...
[ 21, 4 ]
[ 34, 29 ]
python
en
['en', 'error', 'th']
False
Scheduler.run_getter
(self, cycle=CYCLE_GETTER)
run getter
run getter
def run_getter(self, cycle=CYCLE_GETTER): """ run getter """ if not ENABLE_GETTER: logger.info('getter not enabled, exit') return getter = Getter() loop = 0 while True: logger.debug(f'getter loop {loop} start...') ge...
[ "def", "run_getter", "(", "self", ",", "cycle", "=", "CYCLE_GETTER", ")", ":", "if", "not", "ENABLE_GETTER", ":", "logger", ".", "info", "(", "'getter not enabled, exit'", ")", "return", "getter", "=", "Getter", "(", ")", "loop", "=", "0", "while", "True",...
[ 36, 4 ]
[ 49, 29 ]
python
en
['en', 'error', 'th']
False
Scheduler.run_server
(self)
run server for api
run server for api
def run_server(self): """ run server for api """ if not ENABLE_SERVER: logger.info('server not enabled, exit') return app.run(host=API_HOST, port=API_PORT, threaded=API_THREADED)
[ "def", "run_server", "(", "self", ")", ":", "if", "not", "ENABLE_SERVER", ":", "logger", ".", "info", "(", "'server not enabled, exit'", ")", "return", "app", ".", "run", "(", "host", "=", "API_HOST", ",", "port", "=", "API_PORT", ",", "threaded", "=", "...
[ 51, 4 ]
[ 58, 68 ]
python
en
['en', 'error', 'th']
False
test_duplicate_error
(hass)
Test that errors are shown when duplicates are added.
Test that errors are shown when duplicates are added.
async def test_duplicate_error(hass): """Test that errors are shown when duplicates are added.""" conf = {CONF_PLACE_ID: "12345", CONF_SERVICE_ID: "12345"} MockConfigEntry(domain=DOMAIN, unique_id="12345, 12345", data=conf).add_to_hass( hass ) result = await hass.config_entries.flow.async_...
[ "async", "def", "test_duplicate_error", "(", "hass", ")", ":", "conf", "=", "{", "CONF_PLACE_ID", ":", "\"12345\"", ",", "CONF_SERVICE_ID", ":", "\"12345\"", "}", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "unique_id", "=", "\"12345, 12345\"", ",", ...
[ 15, 0 ]
[ 28, 51 ]
python
en
['en', 'en', 'en']
True
test_invalid_place_or_service_id
(hass)
Test that an invalid Place or Service ID throws an error.
Test that an invalid Place or Service ID throws an error.
async def test_invalid_place_or_service_id(hass): """Test that an invalid Place or Service ID throws an error.""" conf = {CONF_PLACE_ID: "12345", CONF_SERVICE_ID: "12345"} with patch( "aiorecollect.client.Client.async_get_next_pickup_event", side_effect=RecollectError, ): result...
[ "async", "def", "test_invalid_place_or_service_id", "(", "hass", ")", ":", "conf", "=", "{", "CONF_PLACE_ID", ":", "\"12345\"", ",", "CONF_SERVICE_ID", ":", "\"12345\"", "}", "with", "patch", "(", "\"aiorecollect.client.Client.async_get_next_pickup_event\"", ",", "side_...
[ 31, 0 ]
[ 44, 74 ]
python
en
['en', 'en', 'en']
True
test_show_form
(hass)
Test that the form is served with no input.
Test that the form is served with no input.
async def test_show_form(hass): """Test that the form is served with no input.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} ) assert result["type"] == data_entry_flow.RESULT_TYPE_FORM assert result["step_id"] == "user"
[ "async", "def", "test_show_form", "(", "hass", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", "SOURCE_USER", "}", ")", "assert", "result", "[", ...
[ 47, 0 ]
[ 54, 38 ]
python
en
['en', 'en', 'en']
True
test_step_import
(hass)
Test that the user step works.
Test that the user step works.
async def test_step_import(hass): """Test that the user step works.""" conf = {CONF_PLACE_ID: "12345", CONF_SERVICE_ID: "12345"} with patch( "homeassistant.components.recollect_waste.async_setup_entry", return_value=True ), patch( "aiorecollect.client.Client.async_get_next_pickup_event"...
[ "async", "def", "test_step_import", "(", "hass", ")", ":", "conf", "=", "{", "CONF_PLACE_ID", ":", "\"12345\"", ",", "CONF_SERVICE_ID", ":", "\"12345\"", "}", "with", "patch", "(", "\"homeassistant.components.recollect_waste.async_setup_entry\"", ",", "return_value", ...
[ 57, 0 ]
[ 72, 83 ]
python
en
['en', 'en', 'en']
True
test_step_user
(hass)
Test that the user step works.
Test that the user step works.
async def test_step_user(hass): """Test that the user step works.""" conf = {CONF_PLACE_ID: "12345", CONF_SERVICE_ID: "12345"} with patch( "homeassistant.components.recollect_waste.async_setup_entry", return_value=True ), patch( "aiorecollect.client.Client.async_get_next_pickup_event", ...
[ "async", "def", "test_step_user", "(", "hass", ")", ":", "conf", "=", "{", "CONF_PLACE_ID", ":", "\"12345\"", ",", "CONF_SERVICE_ID", ":", "\"12345\"", "}", "with", "patch", "(", "\"homeassistant.components.recollect_waste.async_setup_entry\"", ",", "return_value", "=...
[ 75, 0 ]
[ 90, 83 ]
python
en
['en', 'en', 'en']
True
device_reg
(hass)
Return an empty, loaded, registry.
Return an empty, loaded, registry.
def device_reg(hass): """Return an empty, loaded, registry.""" return mock_device_registry(hass)
[ "def", "device_reg", "(", "hass", ")", ":", "return", "mock_device_registry", "(", "hass", ")" ]
[ 39, 0 ]
[ 41, 37 ]
python
en
['en', 'fy', 'en']
True
entity_reg
(hass)
Return an empty, loaded, registry.
Return an empty, loaded, registry.
def entity_reg(hass): """Return an empty, loaded, registry.""" return mock_registry(hass)
[ "def", "entity_reg", "(", "hass", ")", ":", "return", "mock_registry", "(", "hass", ")" ]
[ 45, 0 ]
[ 47, 30 ]
python
en
['en', 'fy', 'en']
True
tag_mock
()
Fixture to mock tag.
Fixture to mock tag.
def tag_mock(): """Fixture to mock tag.""" with patch("homeassistant.components.tag.async_scan_tag") as mock_tag: yield mock_tag
[ "def", "tag_mock", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.tag.async_scan_tag\"", ")", "as", "mock_tag", ":", "yield", "mock_tag" ]
[ 51, 0 ]
[ 54, 22 ]
python
en
['en', 'en', 'en']
True