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
_parse_input_dimensions
(args, input_core_dims)
Parse broadcast and core dimensions for vectorize with a signature. Arguments --------- args : Tuple[ndarray, ...] Tuple of input arguments to examine. input_core_dims : List[Tuple[str, ...]] List of core dimensions corresponding to each input. Returns ------- broadcas...
Parse broadcast and core dimensions for vectorize with a signature.
def _parse_input_dimensions(args, input_core_dims): """ Parse broadcast and core dimensions for vectorize with a signature. Arguments --------- args : Tuple[ndarray, ...] Tuple of input arguments to examine. input_core_dims : List[Tuple[str, ...]] List of core dimensions corresp...
[ "def", "_parse_input_dimensions", "(", "args", ",", "input_core_dims", ")", ":", "broadcast_args", "=", "[", "]", "dim_sizes", "=", "{", "}", "for", "arg", ",", "core_dims", "in", "zip", "(", "args", ",", "input_core_dims", ")", ":", "_update_dim_sizes", "("...
[ 1851, 0 ]
[ 1877, 37 ]
python
en
['en', 'error', 'th']
False
_calculate_shapes
(broadcast_shape, dim_sizes, list_of_core_dims)
Helper for calculating broadcast shapes with core dimensions.
Helper for calculating broadcast shapes with core dimensions.
def _calculate_shapes(broadcast_shape, dim_sizes, list_of_core_dims): """Helper for calculating broadcast shapes with core dimensions.""" return [broadcast_shape + tuple(dim_sizes[dim] for dim in core_dims) for core_dims in list_of_core_dims]
[ "def", "_calculate_shapes", "(", "broadcast_shape", ",", "dim_sizes", ",", "list_of_core_dims", ")", ":", "return", "[", "broadcast_shape", "+", "tuple", "(", "dim_sizes", "[", "dim", "]", "for", "dim", "in", "core_dims", ")", "for", "core_dims", "in", "list_o...
[ 1880, 0 ]
[ 1883, 47 ]
python
en
['en', 'en', 'en']
True
_create_arrays
(broadcast_shape, dim_sizes, list_of_core_dims, dtypes)
Helper for creating output arrays in vectorize.
Helper for creating output arrays in vectorize.
def _create_arrays(broadcast_shape, dim_sizes, list_of_core_dims, dtypes): """Helper for creating output arrays in vectorize.""" shapes = _calculate_shapes(broadcast_shape, dim_sizes, list_of_core_dims) arrays = tuple(np.empty(shape, dtype=dtype) for shape, dtype in zip(shapes, dtypes)) ...
[ "def", "_create_arrays", "(", "broadcast_shape", ",", "dim_sizes", ",", "list_of_core_dims", ",", "dtypes", ")", ":", "shapes", "=", "_calculate_shapes", "(", "broadcast_shape", ",", "dim_sizes", ",", "list_of_core_dims", ")", "arrays", "=", "tuple", "(", "np", ...
[ 1886, 0 ]
[ 1891, 17 ]
python
en
['en', 'en', 'en']
True
cov
(m, y=None, rowvar=True, bias=False, ddof=None, fweights=None, aweights=None)
Estimate a covariance matrix, given data and weights. Covariance indicates the level to which two variables vary together. If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, then the covariance matrix element :math:`C_{ij}` is the covariance of :math:`x_i` and :math:`x_j`. The...
Estimate a covariance matrix, given data and weights.
def cov(m, y=None, rowvar=True, bias=False, ddof=None, fweights=None, aweights=None): """ Estimate a covariance matrix, given data and weights. Covariance indicates the level to which two variables vary together. If we examine N-dimensional samples, :math:`X = [x_1, x_2, ... x_N]^T`, then t...
[ "def", "cov", "(", "m", ",", "y", "=", "None", ",", "rowvar", "=", "True", ",", "bias", "=", "False", ",", "ddof", "=", "None", ",", "fweights", "=", "None", ",", "aweights", "=", "None", ")", ":", "# Check inputs", "if", "ddof", "is", "not", "No...
[ 2270, 0 ]
[ 2480, 22 ]
python
en
['en', 'error', 'th']
False
corrcoef
(x, y=None, rowvar=True, bias=np._NoValue, ddof=np._NoValue)
Return Pearson product-moment correlation coefficients. Please refer to the documentation for `cov` for more detail. The relationship between the correlation coefficient matrix, `R`, and the covariance matrix, `C`, is .. math:: R_{ij} = \\frac{ C_{ij} } { \\sqrt{ C_{ii} * C_{jj} } } The val...
Return Pearson product-moment correlation coefficients.
def corrcoef(x, y=None, rowvar=True, bias=np._NoValue, ddof=np._NoValue): """ Return Pearson product-moment correlation coefficients. Please refer to the documentation for `cov` for more detail. The relationship between the correlation coefficient matrix, `R`, and the covariance matrix, `C`, is ...
[ "def", "corrcoef", "(", "x", ",", "y", "=", "None", ",", "rowvar", "=", "True", ",", "bias", "=", "np", ".", "_NoValue", ",", "ddof", "=", "np", ".", "_NoValue", ")", ":", "if", "bias", "is", "not", "np", ".", "_NoValue", "or", "ddof", "is", "n...
[ 2488, 0 ]
[ 2568, 12 ]
python
en
['en', 'error', 'th']
False
blackman
(M)
Return the Blackman window. The Blackman window is a taper formed by using the first three terms of a summation of cosines. It was designed to have close to the minimal leakage possible. It is close to optimal, only slightly worse than a Kaiser window. Parameters ---------- M : int ...
Return the Blackman window.
def blackman(M): """ Return the Blackman window. The Blackman window is a taper formed by using the first three terms of a summation of cosines. It was designed to have close to the minimal leakage possible. It is close to optimal, only slightly worse than a Kaiser window. Parameters ...
[ "def", "blackman", "(", "M", ")", ":", "if", "M", "<", "1", ":", "return", "array", "(", "[", "]", ")", "if", "M", "==", "1", ":", "return", "ones", "(", "1", ",", "float", ")", "n", "=", "arange", "(", "0", ",", "M", ")", "return", "0.42",...
[ 2572, 0 ]
[ 2668, 68 ]
python
en
['en', 'error', 'th']
False
bartlett
(M)
Return the Bartlett window. The Bartlett window is very similar to a triangular window, except that the end points are at zero. It is often used in signal processing for tapering a signal, without generating too much ripple in the frequency domain. Parameters ---------- M : int ...
Return the Bartlett window.
def bartlett(M): """ Return the Bartlett window. The Bartlett window is very similar to a triangular window, except that the end points are at zero. It is often used in signal processing for tapering a signal, without generating too much ripple in the frequency domain. Parameters ----...
[ "def", "bartlett", "(", "M", ")", ":", "if", "M", "<", "1", ":", "return", "array", "(", "[", "]", ")", "if", "M", "==", "1", ":", "return", "ones", "(", "1", ",", "float", ")", "n", "=", "arange", "(", "0", ",", "M", ")", "return", "where"...
[ 2672, 0 ]
[ 2777, 74 ]
python
en
['en', 'error', 'th']
False
hanning
(M)
Return the Hanning window. The Hanning window is a taper formed by using a weighted cosine. Parameters ---------- M : int Number of points in the output window. If zero or less, an empty array is returned. Returns ------- out : ndarray, shape(M,) The window, w...
Return the Hanning window.
def hanning(M): """ Return the Hanning window. The Hanning window is a taper formed by using a weighted cosine. Parameters ---------- M : int Number of points in the output window. If zero or less, an empty array is returned. Returns ------- out : ndarray, shape(M,...
[ "def", "hanning", "(", "M", ")", ":", "if", "M", "<", "1", ":", "return", "array", "(", "[", "]", ")", "if", "M", "==", "1", ":", "return", "ones", "(", "1", ",", "float", ")", "n", "=", "arange", "(", "0", ",", "M", ")", "return", "0.5", ...
[ 2781, 0 ]
[ 2881, 40 ]
python
en
['en', 'error', 'th']
False
hamming
(M)
Return the Hamming window. The Hamming window is a taper formed by using a weighted cosine. Parameters ---------- M : int Number of points in the output window. If zero or less, an empty array is returned. Returns ------- out : ndarray The window, with the max...
Return the Hamming window.
def hamming(M): """ Return the Hamming window. The Hamming window is a taper formed by using a weighted cosine. Parameters ---------- M : int Number of points in the output window. If zero or less, an empty array is returned. Returns ------- out : ndarray T...
[ "def", "hamming", "(", "M", ")", ":", "if", "M", "<", "1", ":", "return", "array", "(", "[", "]", ")", "if", "M", "==", "1", ":", "return", "ones", "(", "1", ",", "float", ")", "n", "=", "arange", "(", "0", ",", "M", ")", "return", "0.54", ...
[ 2885, 0 ]
[ 2981, 42 ]
python
en
['en', 'error', 'th']
False
async_describe_events
( hass: HomeAssistant, async_describe_event: Callable[[str, str, Callable[[EventType], dict]], None], )
Describe logbook events.
Describe logbook events.
def async_describe_events( hass: HomeAssistant, async_describe_event: Callable[[str, str, Callable[[EventType], dict]], None], ) -> None: """Describe logbook events.""" @callback def async_describe_shelly_click_event(event: EventType) -> dict[str, str]: """Describe shelly.click logbook even...
[ "def", "async_describe_events", "(", "hass", ":", "HomeAssistant", ",", "async_describe_event", ":", "Callable", "[", "[", "str", ",", "str", ",", "Callable", "[", "[", "EventType", "]", ",", "dict", "]", "]", ",", "None", "]", ",", ")", "->", "None", ...
[ 21, 0 ]
[ 44, 87 ]
python
en
['en', 'es', 'en']
True
async_get_actions
( hass: HomeAssistant, device_id: str )
List device actions for Cover devices.
List device actions for Cover devices.
async def async_get_actions( hass: HomeAssistant, device_id: str ) -> list[dict[str, str]]: """List device actions for Cover devices.""" registry = await entity_registry.async_get_registry(hass) actions = [] # Get all the integrations entities for this device for entry in entity_registry.async_...
[ "async", "def", "async_get_actions", "(", "hass", ":", "HomeAssistant", ",", "device_id", ":", "str", ")", "->", "list", "[", "dict", "[", "str", ",", "str", "]", "]", ":", "registry", "=", "await", "entity_registry", ".", "async_get_registry", "(", "hass"...
[ 61, 0 ]
[ 100, 18 ]
python
en
['fr', 'en', 'en']
True
async_get_action_capabilities
( hass: HomeAssistant, config: ConfigType )
List action capabilities.
List action capabilities.
async def async_get_action_capabilities( hass: HomeAssistant, config: ConfigType ) -> dict[str, vol.Schema]: """List action capabilities.""" if config[CONF_TYPE] not in POSITION_ACTION_TYPES: return {} return { "extra_fields": vol.Schema( { vol.Optional(ATTR_...
[ "async", "def", "async_get_action_capabilities", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "ConfigType", ")", "->", "dict", "[", "str", ",", "vol", ".", "Schema", "]", ":", "if", "config", "[", "CONF_TYPE", "]", "not", "in", "POSITION_ACTION_TYP...
[ 103, 0 ]
[ 118, 5 ]
python
en
['ro', 'ga', 'en']
False
async_call_action_from_config
( hass: HomeAssistant, config: dict, variables: dict, context: Context | None )
Execute a device action.
Execute a device action.
async def async_call_action_from_config( hass: HomeAssistant, config: dict, variables: dict, context: Context | None ) -> None: """Execute a device action.""" service_data = {ATTR_ENTITY_ID: config[CONF_ENTITY_ID]} if config[CONF_TYPE] == "open": service = SERVICE_OPEN_COVER elif config[CON...
[ "async", "def", "async_call_action_from_config", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "dict", ",", "variables", ":", "dict", ",", "context", ":", "Context", "|", "None", ")", "->", "None", ":", "service_data", "=", "{", "ATTR_ENTITY_ID", ":...
[ 121, 0 ]
[ 146, 5 ]
python
en
['ro', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up a BleBox air quality entity.
Set up a BleBox air quality entity.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up a BleBox air quality entity.""" create_blebox_entities( hass, config_entry, async_add_entities, BleBoxAirQualityEntity, "air_qualities" )
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "create_blebox_entities", "(", "hass", ",", "config_entry", ",", "async_add_entities", ",", "BleBoxAirQualityEntity", ",", "\"air_qualities\"", ")" ]
[ 7, 0 ]
[ 11, 5 ]
python
en
['en', 'en', 'en']
True
BleBoxAirQualityEntity.particulate_matter_0_1
(self)
Return the particulate matter 0.1 level.
Return the particulate matter 0.1 level.
def particulate_matter_0_1(self): """Return the particulate matter 0.1 level.""" return self._feature.pm1
[ "def", "particulate_matter_0_1", "(", "self", ")", ":", "return", "self", ".", "_feature", ".", "pm1" ]
[ 20, 4 ]
[ 22, 32 ]
python
en
['en', 'en', 'en']
True
BleBoxAirQualityEntity.particulate_matter_2_5
(self)
Return the particulate matter 2.5 level.
Return the particulate matter 2.5 level.
def particulate_matter_2_5(self): """Return the particulate matter 2.5 level.""" return self._feature.pm2_5
[ "def", "particulate_matter_2_5", "(", "self", ")", ":", "return", "self", ".", "_feature", ".", "pm2_5" ]
[ 25, 4 ]
[ 27, 34 ]
python
en
['en', 'en', 'en']
True
BleBoxAirQualityEntity.particulate_matter_10
(self)
Return the particulate matter 10 level.
Return the particulate matter 10 level.
def particulate_matter_10(self): """Return the particulate matter 10 level.""" return self._feature.pm10
[ "def", "particulate_matter_10", "(", "self", ")", ":", "return", "self", ".", "_feature", ".", "pm10" ]
[ 30, 4 ]
[ 32, 33 ]
python
en
['en', 'en', 'en']
True
test_download_switch
(hass, nzbget_api)
Test the creation and values of the download switch.
Test the creation and values of the download switch.
async def test_download_switch(hass, nzbget_api) -> None: """Test the creation and values of the download switch.""" instance = nzbget_api.return_value entry = await init_integration(hass) assert entry registry = er.async_get(hass) entity_id = "switch.nzbgettest_download" entity_entry = re...
[ "async", "def", "test_download_switch", "(", "hass", ",", "nzbget_api", ")", "->", "None", ":", "instance", "=", "nzbget_api", ".", "return_value", "entry", "=", "await", "init_integration", "(", "hass", ")", "assert", "entry", "registry", "=", "er", ".", "a...
[ 14, 0 ]
[ 39, 35 ]
python
en
['en', 'en', 'en']
True
test_download_switch_services
(hass, nzbget_api)
Test download switch services.
Test download switch services.
async def test_download_switch_services(hass, nzbget_api) -> None: """Test download switch services.""" instance = nzbget_api.return_value entry = await init_integration(hass) entity_id = "switch.nzbgettest_download" assert entry await hass.services.async_call( SWITCH_DOMAIN, S...
[ "async", "def", "test_download_switch_services", "(", "hass", ",", "nzbget_api", ")", "->", "None", ":", "instance", "=", "nzbget_api", ".", "return_value", "entry", "=", "await", "init_integration", "(", "hass", ")", "entity_id", "=", "\"switch.nzbgettest_download\...
[ 42, 0 ]
[ 64, 48 ]
python
en
['en', 'en', 'en']
True
mock_controller_service
()
Mock a successful service.
Mock a successful service.
def mock_controller_service(): """Mock a successful service.""" with patch( "homeassistant.components.synology_dsm.config_flow.SynologyDSM" ) as service_mock: service_mock.return_value.information.serial = SERIAL service_mock.return_value.utilisation.cpu_user_load = 1 service...
[ "def", "mock_controller_service", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.synology_dsm.config_flow.SynologyDSM\"", ")", "as", "service_mock", ":", "service_mock", ".", "return_value", ".", "information", ".", "serial", "=", "SERIAL", "service_mock...
[ 57, 0 ]
[ 67, 26 ]
python
en
['en', 'ro', 'en']
True
mock_controller_service_2sa
()
Mock a successful service with 2SA login.
Mock a successful service with 2SA login.
def mock_controller_service_2sa(): """Mock a successful service with 2SA login.""" with patch( "homeassistant.components.synology_dsm.config_flow.SynologyDSM" ) as service_mock: service_mock.return_value.login = Mock( side_effect=SynologyDSMLogin2SARequiredException(USERNAME) ...
[ "def", "mock_controller_service_2sa", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.synology_dsm.config_flow.SynologyDSM\"", ")", "as", "service_mock", ":", "service_mock", ".", "return_value", ".", "login", "=", "Mock", "(", "side_effect", "=", "Syno...
[ 71, 0 ]
[ 84, 26 ]
python
en
['en', 'en', 'en']
True
mock_controller_service_vdsm
()
Mock a successful service.
Mock a successful service.
def mock_controller_service_vdsm(): """Mock a successful service.""" with patch( "homeassistant.components.synology_dsm.config_flow.SynologyDSM" ) as service_mock: service_mock.return_value.information.serial = SERIAL service_mock.return_value.utilisation.cpu_user_load = 1 se...
[ "def", "mock_controller_service_vdsm", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.synology_dsm.config_flow.SynologyDSM\"", ")", "as", "service_mock", ":", "service_mock", ".", "return_value", ".", "information", ".", "serial", "=", "SERIAL", "service...
[ 88, 0 ]
[ 98, 26 ]
python
en
['en', 'ro', 'en']
True
mock_controller_service_failed
()
Mock a failed service.
Mock a failed service.
def mock_controller_service_failed(): """Mock a failed service.""" with patch( "homeassistant.components.synology_dsm.config_flow.SynologyDSM" ) as service_mock: service_mock.return_value.information.serial = None service_mock.return_value.utilisation.cpu_user_load = None ser...
[ "def", "mock_controller_service_failed", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.synology_dsm.config_flow.SynologyDSM\"", ")", "as", "service_mock", ":", "service_mock", ".", "return_value", ".", "information", ".", "serial", "=", "None", "service...
[ 102, 0 ]
[ 112, 26 ]
python
en
['en', 'ga', 'en']
True
test_user
(hass: HomeAssistant, service: MagicMock)
Test user config.
Test user config.
async def test_user(hass: HomeAssistant, service: MagicMock): """Test user config.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=None ) assert result["type"] == data_entry_flow.RESULT_TYPE_FORM assert result["step_id"] == "user" # t...
[ "async", "def", "test_user", "(", "hass", ":", "HomeAssistant", ",", "service", ":", "MagicMock", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ":", ...
[ 115, 0 ]
[ 175, 51 ]
python
en
['en', 'da', 'en']
True
test_user_2sa
(hass: HomeAssistant, service_2sa: MagicMock)
Test user with 2sa authentication config.
Test user with 2sa authentication config.
async def test_user_2sa(hass: HomeAssistant, service_2sa: MagicMock): """Test user with 2sa authentication config.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data={CONF_HOST: HOST, CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD}, ...
[ "async", "def", "test_user_2sa", "(", "hass", ":", "HomeAssistant", ",", "service_2sa", ":", "MagicMock", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\"", ...
[ 178, 0 ]
[ 218, 51 ]
python
en
['en', 'en', 'en']
True
test_user_vdsm
(hass: HomeAssistant, service_vdsm: MagicMock)
Test user config.
Test user config.
async def test_user_vdsm(hass: HomeAssistant, service_vdsm: MagicMock): """Test user config.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=None ) assert result["type"] == data_entry_flow.RESULT_TYPE_FORM assert result["step_id"] == "user...
[ "async", "def", "test_user_vdsm", "(", "hass", ":", "HomeAssistant", ",", "service_vdsm", ":", "MagicMock", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{", "\"source\""...
[ 221, 0 ]
[ 254, 51 ]
python
en
['en', 'da', 'en']
True
test_reauth
(hass: HomeAssistant, service: MagicMock)
Test reauthentication.
Test reauthentication.
async def test_reauth(hass: HomeAssistant, service: MagicMock): """Test reauthentication.""" entry = MockConfigEntry( domain=DOMAIN, data={ CONF_HOST: HOST, CONF_USERNAME: USERNAME, CONF_PASSWORD: f"{PASSWORD}_invalid", }, unique_id=SERIAL, ...
[ "async", "def", "test_reauth", "(", "hass", ":", "HomeAssistant", ",", "service", ":", "MagicMock", ")", ":", "entry", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "data", "=", "{", "CONF_HOST", ":", "HOST", ",", "CONF_USERNAME", ":", "USERNA...
[ 257, 0 ]
[ 299, 54 ]
python
de
['de', 'fr', 'it']
False
test_reconfig_user
(hass: HomeAssistant, service: MagicMock)
Test re-configuration of already existing entry by user.
Test re-configuration of already existing entry by user.
async def test_reconfig_user(hass: HomeAssistant, service: MagicMock): """Test re-configuration of already existing entry by user.""" MockConfigEntry( domain=DOMAIN, data={ CONF_HOST: "wrong_host", CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD, }, ...
[ "async", "def", "test_reconfig_user", "(", "hass", ":", "HomeAssistant", ",", "service", ":", "MagicMock", ")", ":", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "data", "=", "{", "CONF_HOST", ":", "\"wrong_host\"", ",", "CONF_USERNAME", ":", "USERNAM...
[ 302, 0 ]
[ 324, 59 ]
python
en
['en', 'en', 'en']
True
test_login_failed
(hass: HomeAssistant, service: MagicMock)
Test when we have errors during login.
Test when we have errors during login.
async def test_login_failed(hass: HomeAssistant, service: MagicMock): """Test when we have errors during login.""" service.return_value.login = Mock( side_effect=(SynologyDSMLoginInvalidException(USERNAME)) ) result = await hass.config_entries.flow.async_init( DOMAIN, context={"...
[ "async", "def", "test_login_failed", "(", "hass", ":", "HomeAssistant", ",", "service", ":", "MagicMock", ")", ":", "service", ".", "return_value", ".", "login", "=", "Mock", "(", "side_effect", "=", "(", "SynologyDSMLoginInvalidException", "(", "USERNAME", ")",...
[ 327, 0 ]
[ 339, 62 ]
python
en
['en', 'en', 'en']
True
test_connection_failed
(hass: HomeAssistant, service: MagicMock)
Test when we have errors during connection.
Test when we have errors during connection.
async def test_connection_failed(hass: HomeAssistant, service: MagicMock): """Test when we have errors during connection.""" service.return_value.login = Mock( side_effect=SynologyDSMRequestException(IOError("arg")) ) result = await hass.config_entries.flow.async_init( DOMAIN, c...
[ "async", "def", "test_connection_failed", "(", "hass", ":", "HomeAssistant", ",", "service", ":", "MagicMock", ")", ":", "service", ".", "return_value", ".", "login", "=", "Mock", "(", "side_effect", "=", "SynologyDSMRequestException", "(", "IOError", "(", "\"ar...
[ 342, 0 ]
[ 355, 60 ]
python
en
['en', 'en', 'en']
True
test_unknown_failed
(hass: HomeAssistant, service: MagicMock)
Test when we have an unknown error.
Test when we have an unknown error.
async def test_unknown_failed(hass: HomeAssistant, service: MagicMock): """Test when we have an unknown error.""" service.return_value.login = Mock(side_effect=SynologyDSMException(None, None)) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, ...
[ "async", "def", "test_unknown_failed", "(", "hass", ":", "HomeAssistant", ",", "service", ":", "MagicMock", ")", ":", "service", ".", "return_value", ".", "login", "=", "Mock", "(", "side_effect", "=", "SynologyDSMException", "(", "None", ",", "None", ")", "...
[ 358, 0 ]
[ 369, 50 ]
python
en
['en', 'de', 'en']
True
test_missing_data_after_login
(hass: HomeAssistant, service_failed: MagicMock)
Test when we have errors during connection.
Test when we have errors during connection.
async def test_missing_data_after_login(hass: HomeAssistant, service_failed: MagicMock): """Test when we have errors during connection.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data={CONF_HOST: HOST, CONF_USERNAME: USERNAME, CONF_PAS...
[ "async", "def", "test_missing_data_after_login", "(", "hass", ":", "HomeAssistant", ",", "service_failed", ":", "MagicMock", ")", ":", "result", "=", "await", "hass", ".", "config_entries", ".", "flow", ".", "async_init", "(", "DOMAIN", ",", "context", "=", "{...
[ 372, 0 ]
[ 380, 55 ]
python
en
['en', 'en', 'en']
True
test_form_ssdp
(hass: HomeAssistant, service: MagicMock)
Test we can setup from ssdp.
Test we can setup from ssdp.
async def test_form_ssdp(hass: HomeAssistant, service: MagicMock): """Test we can setup from ssdp.""" await setup.async_setup_component(hass, "persistent_notification", {}) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_SSDP}, data={ ...
[ "async", "def", "test_form_ssdp", "(", "hass", ":", "HomeAssistant", ",", "service", ":", "MagicMock", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "result", "=", "await", "hass"...
[ 383, 0 ]
[ 416, 51 ]
python
en
['en', 'en', 'en']
True
test_reconfig_ssdp
(hass: HomeAssistant, service: MagicMock)
Test re-configuration of already existing entry by ssdp.
Test re-configuration of already existing entry by ssdp.
async def test_reconfig_ssdp(hass: HomeAssistant, service: MagicMock): """Test re-configuration of already existing entry by ssdp.""" await setup.async_setup_component(hass, "persistent_notification", {}) MockConfigEntry( domain=DOMAIN, data={ CONF_HOST: "wrong_host", ...
[ "async", "def", "test_reconfig_ssdp", "(", "hass", ":", "HomeAssistant", ",", "service", ":", "MagicMock", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "MockConfigEntry", "(", "dom...
[ 419, 0 ]
[ 444, 55 ]
python
en
['en', 'en', 'en']
True
test_existing_ssdp
(hass: HomeAssistant, service: MagicMock)
Test abort of already existing entry by ssdp.
Test abort of already existing entry by ssdp.
async def test_existing_ssdp(hass: HomeAssistant, service: MagicMock): """Test abort of already existing entry by ssdp.""" await setup.async_setup_component(hass, "persistent_notification", {}) MockConfigEntry( domain=DOMAIN, data={ CONF_HOST: "192.168.1.5", CONF_USE...
[ "async", "def", "test_existing_ssdp", "(", "hass", ":", "HomeAssistant", ",", "service", ":", "MagicMock", ")", ":", "await", "setup", ".", "async_setup_component", "(", "hass", ",", "\"persistent_notification\"", ",", "{", "}", ")", "MockConfigEntry", "(", "dom...
[ 447, 0 ]
[ 472, 51 ]
python
en
['en', 'en', 'en']
True
test_options_flow
(hass: HomeAssistant, service: MagicMock)
Test config flow options.
Test config flow options.
async def test_options_flow(hass: HomeAssistant, service: MagicMock): """Test config flow options.""" config_entry = MockConfigEntry( domain=DOMAIN, data={ CONF_HOST: HOST, CONF_USERNAME: USERNAME, CONF_PASSWORD: PASSWORD, CONF_MAC: MACS, }...
[ "async", "def", "test_options_flow", "(", "hass", ":", "HomeAssistant", ",", "service", ":", "MagicMock", ")", ":", "config_entry", "=", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "data", "=", "{", "CONF_HOST", ":", "HOST", ",", "CONF_USERNAME", "...
[ 475, 0 ]
[ 513, 51 ]
python
en
['en', 'fr', 'en']
True
create_lcn_switch_entity
( hass: HomeAssistant, entity_config: ConfigType, config_entry: ConfigEntry )
Set up an entity for this domain.
Set up an entity for this domain.
def create_lcn_switch_entity( hass: HomeAssistant, entity_config: ConfigType, config_entry: ConfigEntry ) -> LcnEntity: """Set up an entity for this domain.""" device_connection = get_device_connection( hass, entity_config[CONF_ADDRESS], config_entry ) if entity_config[CONF_DOMAIN_DATA][CON...
[ "def", "create_lcn_switch_entity", "(", "hass", ":", "HomeAssistant", ",", "entity_config", ":", "ConfigType", ",", "config_entry", ":", "ConfigEntry", ")", "->", "LcnEntity", ":", "device_connection", "=", "get_device_connection", "(", "hass", ",", "entity_config", ...
[ 21, 0 ]
[ 32, 82 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
( hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities: AddEntitiesCallback, )
Set up LCN switch entities from a config entry.
Set up LCN switch entities from a config entry.
async def async_setup_entry( hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities: AddEntitiesCallback, ) -> None: """Set up LCN switch entities from a config entry.""" entities = [] for entity_config in config_entry.data[CONF_ENTITIES]: if entity_config[CONF_DOMAIN] == D...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "config_entry", ":", "ConfigEntry", ",", "async_add_entities", ":", "AddEntitiesCallback", ",", ")", "->", "None", ":", "entities", "=", "[", "]", "for", "entity_config", "in", "config_...
[ 35, 0 ]
[ 48, 32 ]
python
en
['en', 'en', 'en']
True
LcnOutputSwitch.__init__
( self, config: ConfigType, entry_id: str, device_connection: DeviceConnectionType )
Initialize the LCN switch.
Initialize the LCN switch.
def __init__( self, config: ConfigType, entry_id: str, device_connection: DeviceConnectionType ) -> None: """Initialize the LCN switch.""" super().__init__(config, entry_id, device_connection) self.output = pypck.lcn_defs.OutputPort[config[CONF_DOMAIN_DATA][CONF_OUTPUT]] se...
[ "def", "__init__", "(", "self", ",", "config", ":", "ConfigType", ",", "entry_id", ":", "str", ",", "device_connection", ":", "DeviceConnectionType", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "config", ",", "entry_id", ",", "device_c...
[ 54, 4 ]
[ 62, 27 ]
python
en
['en', 'en', 'en']
True
LcnOutputSwitch.async_added_to_hass
(self)
Run when entity about to be added to hass.
Run when entity about to be added to hass.
async def async_added_to_hass(self) -> None: """Run when entity about to be added to hass.""" await super().async_added_to_hass() if not self.device_connection.is_group: await self.device_connection.activate_status_request_handler(self.output)
[ "async", "def", "async_added_to_hass", "(", "self", ")", "->", "None", ":", "await", "super", "(", ")", ".", "async_added_to_hass", "(", ")", "if", "not", "self", ".", "device_connection", ".", "is_group", ":", "await", "self", ".", "device_connection", ".",...
[ 64, 4 ]
[ 68, 85 ]
python
en
['en', 'en', 'en']
True
LcnOutputSwitch.async_will_remove_from_hass
(self)
Run when entity will be removed from hass.
Run when entity will be removed from hass.
async def async_will_remove_from_hass(self) -> None: """Run when entity will be removed from hass.""" await super().async_will_remove_from_hass() if not self.device_connection.is_group: await self.device_connection.cancel_status_request_handler(self.output)
[ "async", "def", "async_will_remove_from_hass", "(", "self", ")", "->", "None", ":", "await", "super", "(", ")", ".", "async_will_remove_from_hass", "(", ")", "if", "not", "self", ".", "device_connection", ".", "is_group", ":", "await", "self", ".", "device_con...
[ 70, 4 ]
[ 74, 83 ]
python
en
['en', 'en', 'en']
True
LcnOutputSwitch.is_on
(self)
Return True if entity is on.
Return True if entity is on.
def is_on(self) -> bool: """Return True if entity is on.""" return self._is_on
[ "def", "is_on", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_is_on" ]
[ 77, 4 ]
[ 79, 26 ]
python
en
['en', 'cy', 'en']
True
LcnOutputSwitch.async_turn_on
(self, **kwargs: Any)
Turn the entity on.
Turn the entity on.
async def async_turn_on(self, **kwargs: Any) -> None: """Turn the entity on.""" if not await self.device_connection.dim_output(self.output.value, 100, 0): return self._is_on = True self.async_write_ha_state()
[ "async", "def", "async_turn_on", "(", "self", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "if", "not", "await", "self", ".", "device_connection", ".", "dim_output", "(", "self", ".", "output", ".", "value", ",", "100", ",", "0", ")",...
[ 81, 4 ]
[ 86, 35 ]
python
en
['en', 'en', 'en']
True
LcnOutputSwitch.async_turn_off
(self, **kwargs: Any)
Turn the entity off.
Turn the entity off.
async def async_turn_off(self, **kwargs: Any) -> None: """Turn the entity off.""" if not await self.device_connection.dim_output(self.output.value, 0, 0): return self._is_on = False self.async_write_ha_state()
[ "async", "def", "async_turn_off", "(", "self", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "if", "not", "await", "self", ".", "device_connection", ".", "dim_output", "(", "self", ".", "output", ".", "value", ",", "0", ",", "0", ")", ...
[ 88, 4 ]
[ 93, 35 ]
python
en
['en', 'en', 'en']
True
LcnOutputSwitch.input_received
(self, input_obj: InputType)
Set switch state when LCN input object (command) is received.
Set switch state when LCN input object (command) is received.
def input_received(self, input_obj: InputType) -> None: """Set switch state when LCN input object (command) is received.""" if ( not isinstance(input_obj, pypck.inputs.ModStatusOutput) or input_obj.get_output_id() != self.output.value ): return self._...
[ "def", "input_received", "(", "self", ",", "input_obj", ":", "InputType", ")", "->", "None", ":", "if", "(", "not", "isinstance", "(", "input_obj", ",", "pypck", ".", "inputs", ".", "ModStatusOutput", ")", "or", "input_obj", ".", "get_output_id", "(", ")",...
[ 95, 4 ]
[ 104, 35 ]
python
en
['en', 'en', 'en']
True
LcnRelaySwitch.__init__
( self, config: ConfigType, entry_id: str, device_connection: DeviceConnectionType )
Initialize the LCN switch.
Initialize the LCN switch.
def __init__( self, config: ConfigType, entry_id: str, device_connection: DeviceConnectionType ) -> None: """Initialize the LCN switch.""" super().__init__(config, entry_id, device_connection) self.output = pypck.lcn_defs.RelayPort[config[CONF_DOMAIN_DATA][CONF_OUTPUT]] sel...
[ "def", "__init__", "(", "self", ",", "config", ":", "ConfigType", ",", "entry_id", ":", "str", ",", "device_connection", ":", "DeviceConnectionType", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "config", ",", "entry_id", ",", "device_c...
[ 110, 4 ]
[ 118, 27 ]
python
en
['en', 'en', 'en']
True
LcnRelaySwitch.async_added_to_hass
(self)
Run when entity about to be added to hass.
Run when entity about to be added to hass.
async def async_added_to_hass(self) -> None: """Run when entity about to be added to hass.""" await super().async_added_to_hass() if not self.device_connection.is_group: await self.device_connection.activate_status_request_handler(self.output)
[ "async", "def", "async_added_to_hass", "(", "self", ")", "->", "None", ":", "await", "super", "(", ")", ".", "async_added_to_hass", "(", ")", "if", "not", "self", ".", "device_connection", ".", "is_group", ":", "await", "self", ".", "device_connection", ".",...
[ 120, 4 ]
[ 124, 85 ]
python
en
['en', 'en', 'en']
True
LcnRelaySwitch.async_will_remove_from_hass
(self)
Run when entity will be removed from hass.
Run when entity will be removed from hass.
async def async_will_remove_from_hass(self) -> None: """Run when entity will be removed from hass.""" await super().async_will_remove_from_hass() if not self.device_connection.is_group: await self.device_connection.cancel_status_request_handler(self.output)
[ "async", "def", "async_will_remove_from_hass", "(", "self", ")", "->", "None", ":", "await", "super", "(", ")", ".", "async_will_remove_from_hass", "(", ")", "if", "not", "self", ".", "device_connection", ".", "is_group", ":", "await", "self", ".", "device_con...
[ 126, 4 ]
[ 130, 83 ]
python
en
['en', 'en', 'en']
True
LcnRelaySwitch.is_on
(self)
Return True if entity is on.
Return True if entity is on.
def is_on(self) -> bool: """Return True if entity is on.""" return self._is_on
[ "def", "is_on", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_is_on" ]
[ 133, 4 ]
[ 135, 26 ]
python
en
['en', 'cy', 'en']
True
LcnRelaySwitch.async_turn_on
(self, **kwargs: Any)
Turn the entity on.
Turn the entity on.
async def async_turn_on(self, **kwargs: Any) -> None: """Turn the entity on.""" states = [pypck.lcn_defs.RelayStateModifier.NOCHANGE] * 8 states[self.output.value] = pypck.lcn_defs.RelayStateModifier.ON if not await self.device_connection.control_relays(states): return ...
[ "async", "def", "async_turn_on", "(", "self", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "states", "=", "[", "pypck", ".", "lcn_defs", ".", "RelayStateModifier", ".", "NOCHANGE", "]", "*", "8", "states", "[", "self", ".", "output", ...
[ 137, 4 ]
[ 144, 35 ]
python
en
['en', 'en', 'en']
True
LcnRelaySwitch.async_turn_off
(self, **kwargs: Any)
Turn the entity off.
Turn the entity off.
async def async_turn_off(self, **kwargs: Any) -> None: """Turn the entity off.""" states = [pypck.lcn_defs.RelayStateModifier.NOCHANGE] * 8 states[self.output.value] = pypck.lcn_defs.RelayStateModifier.OFF if not await self.device_connection.control_relays(states): return ...
[ "async", "def", "async_turn_off", "(", "self", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "states", "=", "[", "pypck", ".", "lcn_defs", ".", "RelayStateModifier", ".", "NOCHANGE", "]", "*", "8", "states", "[", "self", ".", "output", ...
[ 146, 4 ]
[ 153, 35 ]
python
en
['en', 'en', 'en']
True
LcnRelaySwitch.input_received
(self, input_obj: InputType)
Set switch state when LCN input object (command) is received.
Set switch state when LCN input object (command) is received.
def input_received(self, input_obj: InputType) -> None: """Set switch state when LCN input object (command) is received.""" if not isinstance(input_obj, pypck.inputs.ModStatusRelays): return self._is_on = input_obj.get_state(self.output.value) self.async_write_ha_state()
[ "def", "input_received", "(", "self", ",", "input_obj", ":", "InputType", ")", "->", "None", ":", "if", "not", "isinstance", "(", "input_obj", ",", "pypck", ".", "inputs", ".", "ModStatusRelays", ")", ":", "return", "self", ".", "_is_on", "=", "input_obj",...
[ 155, 4 ]
[ 161, 35 ]
python
en
['en', 'en', 'en']
True
TestAdditionalPropertiesObject.testAdditionalPropertiesObject
(self)
Test AdditionalPropertiesObject
Test AdditionalPropertiesObject
def testAdditionalPropertiesObject(self): """Test AdditionalPropertiesObject""" # can make model without additional properties model = AdditionalPropertiesObject() # can make one with additional properties some_val = {} model = AdditionalPropertiesObject(some_key=some_va...
[ "def", "testAdditionalPropertiesObject", "(", "self", ")", ":", "# can make model without additional properties", "model", "=", "AdditionalPropertiesObject", "(", ")", "# can make one with additional properties", "some_val", "=", "{", "}", "model", "=", "AdditionalPropertiesObj...
[ 29, 4 ]
[ 45, 70 ]
python
en
['en', 'ny', 'en']
False
async_setup_entry
(hass, config_entry, async_add_entities)
Set up the Smappee Comfort Plugs.
Set up the Smappee Comfort Plugs.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up the Smappee Comfort Plugs.""" smappee_base = hass.data[DOMAIN][config_entry.entry_id] entities = [] for service_location in smappee_base.smappee.service_locations.values(): for actuator_id, actuator in service_locati...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "smappee_base", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "config_entry", ".", "entry_id", "]", "entities", "=", "[", "]", "for", "service_lo...
[ 9, 0 ]
[ 41, 38 ]
python
en
['en', 'en', 'en']
True
SmappeeActuator.__init__
( self, smappee_base, service_location, name, actuator_id, actuator_type, actuator_serialnumber, actuator_state_option=None, )
Initialize a new Smappee Comfort Plug.
Initialize a new Smappee Comfort Plug.
def __init__( self, smappee_base, service_location, name, actuator_id, actuator_type, actuator_serialnumber, actuator_state_option=None, ): """Initialize a new Smappee Comfort Plug.""" self._smappee_base = smappee_base self._ser...
[ "def", "__init__", "(", "self", ",", "smappee_base", ",", "service_location", ",", "name", ",", "actuator_id", ",", "actuator_type", ",", "actuator_serialnumber", ",", "actuator_state_option", "=", "None", ",", ")", ":", "self", ".", "_smappee_base", "=", "smapp...
[ 47, 4 ]
[ 68, 26 ]
python
en
['en', 'en', 'en']
True
SmappeeActuator.name
(self)
Return the name of the switch.
Return the name of the switch.
def name(self): """Return the name of the switch.""" if self._actuator_type == "INFINITY_OUTPUT_MODULE": return ( f"{self._service_location.service_location_name} - " f"Output module - {self._actuator_name} - {self._actuator_state_option}" ) ...
[ "def", "name", "(", "self", ")", ":", "if", "self", ".", "_actuator_type", "==", "\"INFINITY_OUTPUT_MODULE\"", ":", "return", "(", "f\"{self._service_location.service_location_name} - \"", "f\"Output module - {self._actuator_name} - {self._actuator_state_option}\"", ")", "# Switc...
[ 71, 4 ]
[ 83, 9 ]
python
en
['en', 'en', 'en']
True
SmappeeActuator.is_on
(self)
Return true if switch is on.
Return true if switch is on.
def is_on(self): """Return true if switch is on.""" if self._actuator_type == "INFINITY_OUTPUT_MODULE": return ( self._service_location.actuators.get(self._actuator_id).state == self._actuator_state_option ) # Switch or comfort plug ...
[ "def", "is_on", "(", "self", ")", ":", "if", "self", ".", "_actuator_type", "==", "\"INFINITY_OUTPUT_MODULE\"", ":", "return", "(", "self", ".", "_service_location", ".", "actuators", ".", "get", "(", "self", ".", "_actuator_id", ")", ".", "state", "==", "...
[ 86, 4 ]
[ 95, 37 ]
python
en
['en', 'fy', 'en']
True
SmappeeActuator.icon
(self)
Icon to use in the frontend.
Icon to use in the frontend.
def icon(self): """Icon to use in the frontend.""" return ICON
[ "def", "icon", "(", "self", ")", ":", "return", "ICON" ]
[ 98, 4 ]
[ 100, 19 ]
python
en
['en', 'en', 'en']
True
SmappeeActuator.turn_on
(self, **kwargs)
Turn on Comport Plug.
Turn on Comport Plug.
def turn_on(self, **kwargs): """Turn on Comport Plug.""" if self._actuator_type in ("SWITCH", "COMFORT_PLUG"): self._service_location.set_actuator_state(self._actuator_id, state="ON_ON") elif self._actuator_type == "INFINITY_OUTPUT_MODULE": self._service_location.set_actu...
[ "def", "turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "_actuator_type", "in", "(", "\"SWITCH\"", ",", "\"COMFORT_PLUG\"", ")", ":", "self", ".", "_service_location", ".", "set_actuator_state", "(", "self", ".", "_actuator_id", ...
[ 102, 4 ]
[ 109, 13 ]
python
en
['en', 'et', 'en']
True
SmappeeActuator.turn_off
(self, **kwargs)
Turn off Comport Plug.
Turn off Comport Plug.
def turn_off(self, **kwargs): """Turn off Comport Plug.""" if self._actuator_type in ("SWITCH", "COMFORT_PLUG"): self._service_location.set_actuator_state( self._actuator_id, state="OFF_OFF" ) elif self._actuator_type == "INFINITY_OUTPUT_MODULE": ...
[ "def", "turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "_actuator_type", "in", "(", "\"SWITCH\"", ",", "\"COMFORT_PLUG\"", ")", ":", "self", ".", "_service_location", ".", "set_actuator_state", "(", "self", ".", "_actuator_id",...
[ 111, 4 ]
[ 120, 13 ]
python
en
['en', 'et', 'en']
True
SmappeeActuator.available
(self)
Return True if entity is available. Unavailable for COMFORT_PLUGS.
Return True if entity is available. Unavailable for COMFORT_PLUGS.
def available(self): """Return True if entity is available. Unavailable for COMFORT_PLUGS.""" return ( self._connection_state == "CONNECTED" or self._actuator_type == "COMFORT_PLUG" )
[ "def", "available", "(", "self", ")", ":", "return", "(", "self", ".", "_connection_state", "==", "\"CONNECTED\"", "or", "self", ".", "_actuator_type", "==", "\"COMFORT_PLUG\"", ")" ]
[ 123, 4 ]
[ 128, 9 ]
python
en
['en', 'en', 'en']
True
SmappeeActuator.unique_id
( self, )
Return the unique ID for this switch.
Return the unique ID for this switch.
def unique_id( self, ): """Return the unique ID for this switch.""" if self._actuator_type == "INFINITY_OUTPUT_MODULE": return ( f"{self._service_location.device_serial_number}-" f"{self._service_location.service_location_id}-actuator-" ...
[ "def", "unique_id", "(", "self", ",", ")", ":", "if", "self", ".", "_actuator_type", "==", "\"INFINITY_OUTPUT_MODULE\"", ":", "return", "(", "f\"{self._service_location.device_serial_number}-\"", "f\"{self._service_location.service_location_id}-actuator-\"", "f\"{self._actuator_i...
[ 131, 4 ]
[ 147, 9 ]
python
en
['en', 'en', 'en']
True
SmappeeActuator.device_info
(self)
Return the device info for this switch.
Return the device info for this switch.
def device_info(self): """Return the device info for this switch.""" return { "identifiers": {(DOMAIN, self._service_location.device_serial_number)}, "name": self._service_location.service_location_name, "manufacturer": "Smappee", "model": self._service_lo...
[ "def", "device_info", "(", "self", ")", ":", "return", "{", "\"identifiers\"", ":", "{", "(", "DOMAIN", ",", "self", ".", "_service_location", ".", "device_serial_number", ")", "}", ",", "\"name\"", ":", "self", ".", "_service_location", ".", "service_location...
[ 150, 4 ]
[ 158, 9 ]
python
en
['en', 'en', 'en']
True
SmappeeActuator.async_update
(self)
Get the latest data from Smappee and update the state.
Get the latest data from Smappee and update the state.
async def async_update(self): """Get the latest data from Smappee and update the state.""" await self._smappee_base.async_update() new_state = self._service_location.actuators.get(self._actuator_id).state if new_state != self._state: self._state = new_state self....
[ "async", "def", "async_update", "(", "self", ")", ":", "await", "self", ".", "_smappee_base", ".", "async_update", "(", ")", "new_state", "=", "self", ".", "_service_location", ".", "actuators", ".", "get", "(", "self", ".", "_actuator_id", ")", ".", "stat...
[ 160, 4 ]
[ 171, 26 ]
python
en
['en', 'en', 'en']
True
async_setup
(hass, config)
Set up the GeoNet NZ Volcano component.
Set up the GeoNet NZ Volcano component.
async def async_setup(hass, config): """Set up the GeoNet NZ Volcano component.""" if DOMAIN not in config: return True conf = config[DOMAIN] latitude = conf.get(CONF_LATITUDE, hass.config.latitude) longitude = conf.get(CONF_LONGITUDE, hass.config.longitude) scan_interval = conf[CONF_S...
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "if", "DOMAIN", "not", "in", "config", ":", "return", "True", "conf", "=", "config", "[", "DOMAIN", "]", "latitude", "=", "conf", ".", "get", "(", "CONF_LATITUDE", ",", "hass", ".", ...
[ 47, 0 ]
[ 75, 15 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry)
Set up the GeoNet NZ Volcano component as config entry.
Set up the GeoNet NZ Volcano component as config entry.
async def async_setup_entry(hass, config_entry): """Set up the GeoNet NZ Volcano component as config entry.""" hass.data.setdefault(DOMAIN, {}) hass.data[DOMAIN].setdefault(FEED, {}) radius = config_entry.data[CONF_RADIUS] unit_system = config_entry.data[CONF_UNIT_SYSTEM] if unit_system == CONF...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ")", ":", "hass", ".", "data", ".", "setdefault", "(", "DOMAIN", ",", "{", "}", ")", "hass", ".", "data", "[", "DOMAIN", "]", ".", "setdefault", "(", "FEED", ",", "{", "}", ")", ...
[ 78, 0 ]
[ 92, 15 ]
python
en
['en', 'en', 'en']
True
async_unload_entry
(hass, entry)
Unload an GeoNet NZ Volcano component config entry.
Unload an GeoNet NZ Volcano component config entry.
async def async_unload_entry(hass, entry): """Unload an GeoNet NZ Volcano component config entry.""" manager = hass.data[DOMAIN][FEED].pop(entry.entry_id) await manager.async_stop() return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
[ "async", "def", "async_unload_entry", "(", "hass", ",", "entry", ")", ":", "manager", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "FEED", "]", ".", "pop", "(", "entry", ".", "entry_id", ")", "await", "manager", ".", "async_stop", "(", ")", "re...
[ 95, 0 ]
[ 99, 77 ]
python
en
['en', 'en', 'en']
True
GeonetnzVolcanoFeedEntityManager.__init__
(self, hass, config_entry, radius_in_km, unit_system)
Initialize the Feed Entity Manager.
Initialize the Feed Entity Manager.
def __init__(self, hass, config_entry, radius_in_km, unit_system): """Initialize the Feed Entity Manager.""" self._hass = hass self._config_entry = config_entry coordinates = ( config_entry.data[CONF_LATITUDE], config_entry.data[CONF_LONGITUDE], ) ...
[ "def", "__init__", "(", "self", ",", "hass", ",", "config_entry", ",", "radius_in_km", ",", "unit_system", ")", ":", "self", ".", "_hass", "=", "hass", "self", ".", "_config_entry", "=", "config_entry", "coordinates", "=", "(", "config_entry", ".", "data", ...
[ 105, 4 ]
[ 126, 27 ]
python
en
['en', 'en', 'en']
True
GeonetnzVolcanoFeedEntityManager.async_init
(self)
Schedule initial and regular updates based on configured time interval.
Schedule initial and regular updates based on configured time interval.
async def async_init(self): """Schedule initial and regular updates based on configured time interval.""" self._hass.config_entries.async_setup_platforms(self._config_entry, PLATFORMS) async def update(event_time): """Update.""" await self.async_update() # Trig...
[ "async", "def", "async_init", "(", "self", ")", ":", "self", ".", "_hass", ".", "config_entries", ".", "async_setup_platforms", "(", "self", ".", "_config_entry", ",", "PLATFORMS", ")", "async", "def", "update", "(", "event_time", ")", ":", "\"\"\"Update.\"\"\...
[ 128, 4 ]
[ 142, 56 ]
python
en
['en', 'en', 'en']
True
GeonetnzVolcanoFeedEntityManager.async_update
(self)
Refresh data.
Refresh data.
async def async_update(self): """Refresh data.""" await self._feed_manager.update() _LOGGER.debug("Feed entity manager updated")
[ "async", "def", "async_update", "(", "self", ")", ":", "await", "self", ".", "_feed_manager", ".", "update", "(", ")", "_LOGGER", ".", "debug", "(", "\"Feed entity manager updated\"", ")" ]
[ 144, 4 ]
[ 147, 52 ]
python
de
['de', 'sn', 'en']
False
GeonetnzVolcanoFeedEntityManager.async_stop
(self)
Stop this feed entity manager from refreshing.
Stop this feed entity manager from refreshing.
async def async_stop(self): """Stop this feed entity manager from refreshing.""" for unsub_dispatcher in self.listeners: unsub_dispatcher() self.listeners = [] if self._track_time_remove_callback: self._track_time_remove_callback() _LOGGER.debug("Feed enti...
[ "async", "def", "async_stop", "(", "self", ")", ":", "for", "unsub_dispatcher", "in", "self", ".", "listeners", ":", "unsub_dispatcher", "(", ")", "self", ".", "listeners", "=", "[", "]", "if", "self", ".", "_track_time_remove_callback", ":", "self", ".", ...
[ 149, 4 ]
[ 156, 52 ]
python
en
['en', 'en', 'en']
True
GeonetnzVolcanoFeedEntityManager.async_event_new_entity
(self)
Return manager specific event to signal new entity.
Return manager specific event to signal new entity.
def async_event_new_entity(self): """Return manager specific event to signal new entity.""" return f"geonetnz_volcano_new_sensor_{self._config_entry_id}"
[ "def", "async_event_new_entity", "(", "self", ")", ":", "return", "f\"geonetnz_volcano_new_sensor_{self._config_entry_id}\"" ]
[ 159, 4 ]
[ 161, 69 ]
python
en
['en', 'en', 'en']
True
GeonetnzVolcanoFeedEntityManager.get_entry
(self, external_id)
Get feed entry by external id.
Get feed entry by external id.
def get_entry(self, external_id): """Get feed entry by external id.""" return self._feed_manager.feed_entries.get(external_id)
[ "def", "get_entry", "(", "self", ",", "external_id", ")", ":", "return", "self", ".", "_feed_manager", ".", "feed_entries", ".", "get", "(", "external_id", ")" ]
[ 163, 4 ]
[ 165, 63 ]
python
en
['en', 'en', 'en']
True
GeonetnzVolcanoFeedEntityManager.last_update
(self)
Return the last update of this feed.
Return the last update of this feed.
def last_update(self) -> datetime | None: """Return the last update of this feed.""" return self._feed_manager.last_update
[ "def", "last_update", "(", "self", ")", "->", "datetime", "|", "None", ":", "return", "self", ".", "_feed_manager", ".", "last_update" ]
[ 167, 4 ]
[ 169, 45 ]
python
en
['en', 'en', 'en']
True
GeonetnzVolcanoFeedEntityManager.last_update_successful
(self)
Return the last successful update of this feed.
Return the last successful update of this feed.
def last_update_successful(self) -> datetime | None: """Return the last successful update of this feed.""" return self._feed_manager.last_update_successful
[ "def", "last_update_successful", "(", "self", ")", "->", "datetime", "|", "None", ":", "return", "self", ".", "_feed_manager", ".", "last_update_successful" ]
[ 171, 4 ]
[ 173, 56 ]
python
en
['en', 'en', 'en']
True
GeonetnzVolcanoFeedEntityManager._generate_entity
(self, external_id)
Generate new entity.
Generate new entity.
async def _generate_entity(self, external_id): """Generate new entity.""" async_dispatcher_send( self._hass, self.async_event_new_entity(), self, external_id, self._unit_system, )
[ "async", "def", "_generate_entity", "(", "self", ",", "external_id", ")", ":", "async_dispatcher_send", "(", "self", ".", "_hass", ",", "self", ".", "async_event_new_entity", "(", ")", ",", "self", ",", "external_id", ",", "self", ".", "_unit_system", ",", "...
[ 175, 4 ]
[ 183, 9 ]
python
en
['en', 'en', 'en']
True
GeonetnzVolcanoFeedEntityManager._update_entity
(self, external_id)
Update entity.
Update entity.
async def _update_entity(self, external_id): """Update entity.""" async_dispatcher_send(self._hass, f"geonetnz_volcano_update_{external_id}")
[ "async", "def", "_update_entity", "(", "self", ",", "external_id", ")", ":", "async_dispatcher_send", "(", "self", ".", "_hass", ",", "f\"geonetnz_volcano_update_{external_id}\"", ")" ]
[ 185, 4 ]
[ 187, 83 ]
python
en
['es', 'en', 'en']
False
GeonetnzVolcanoFeedEntityManager._remove_entity
(self, external_id)
Ignore removing entity.
Ignore removing entity.
async def _remove_entity(self, external_id): """Ignore removing entity."""
[ "async", "def", "_remove_entity", "(", "self", ",", "external_id", ")", ":" ]
[ 189, 4 ]
[ 190, 37 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the platform.
Set up the platform.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the platform.""" if discovery_info is None: return devices = [] for conf in discovery_info[ATTR_DISCOVER_DEVICES]: if conf[ATTR_DEVICE_TYPE] in HM_GARAGE: new_device = HMGarage(conf) else:...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "if", "discovery_info", "is", "None", ":", "return", "devices", "=", "[", "]", "for", "conf", "in", "discovery_info", "[", "ATTR_DISCOVER_...
[ 14, 0 ]
[ 27, 31 ]
python
en
['en', 'da', 'en']
True
HMCover.current_cover_position
(self)
Return current position of cover. None is unknown, 0 is closed, 100 is fully open.
Return current position of cover.
def current_cover_position(self): """ Return current position of cover. None is unknown, 0 is closed, 100 is fully open. """ return int(self._hm_get_state() * 100)
[ "def", "current_cover_position", "(", "self", ")", ":", "return", "int", "(", "self", ".", "_hm_get_state", "(", ")", "*", "100", ")" ]
[ 34, 4 ]
[ 40, 46 ]
python
en
['en', 'error', 'th']
False
HMCover.set_cover_position
(self, **kwargs)
Move the cover to a specific position.
Move the cover to a specific position.
def set_cover_position(self, **kwargs): """Move the cover to a specific position.""" if ATTR_POSITION in kwargs: position = float(kwargs[ATTR_POSITION]) position = min(100, max(0, position)) level = position / 100.0 self._hmdevice.set_level(level, self._ch...
[ "def", "set_cover_position", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "ATTR_POSITION", "in", "kwargs", ":", "position", "=", "float", "(", "kwargs", "[", "ATTR_POSITION", "]", ")", "position", "=", "min", "(", "100", ",", "max", "(", "0", ...
[ 42, 4 ]
[ 48, 58 ]
python
en
['en', 'en', 'en']
True
HMCover.is_closed
(self)
Return whether the cover is closed.
Return whether the cover is closed.
def is_closed(self): """Return whether the cover is closed.""" if self.current_cover_position is not None: return self.current_cover_position == 0 return None
[ "def", "is_closed", "(", "self", ")", ":", "if", "self", ".", "current_cover_position", "is", "not", "None", ":", "return", "self", ".", "current_cover_position", "==", "0", "return", "None" ]
[ 51, 4 ]
[ 55, 19 ]
python
en
['en', 'en', 'en']
True
HMCover.open_cover
(self, **kwargs)
Open the cover.
Open the cover.
def open_cover(self, **kwargs): """Open the cover.""" self._hmdevice.move_up(self._channel)
[ "def", "open_cover", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_hmdevice", ".", "move_up", "(", "self", ".", "_channel", ")" ]
[ 57, 4 ]
[ 59, 45 ]
python
en
['en', 'en', 'en']
True
HMCover.close_cover
(self, **kwargs)
Close the cover.
Close the cover.
def close_cover(self, **kwargs): """Close the cover.""" self._hmdevice.move_down(self._channel)
[ "def", "close_cover", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_hmdevice", ".", "move_down", "(", "self", ".", "_channel", ")" ]
[ 61, 4 ]
[ 63, 47 ]
python
en
['en', 'en', 'en']
True
HMCover.stop_cover
(self, **kwargs)
Stop the device if in motion.
Stop the device if in motion.
def stop_cover(self, **kwargs): """Stop the device if in motion.""" self._hmdevice.stop(self._channel)
[ "def", "stop_cover", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_hmdevice", ".", "stop", "(", "self", ".", "_channel", ")" ]
[ 65, 4 ]
[ 67, 42 ]
python
en
['en', 'en', 'en']
True
HMCover._init_data_struct
(self)
Generate a data dictionary (self._data) from metadata.
Generate a data dictionary (self._data) from metadata.
def _init_data_struct(self): """Generate a data dictionary (self._data) from metadata.""" self._state = "LEVEL" self._data.update({self._state: None}) if "LEVEL_2" in self._hmdevice.WRITENODE: self._data.update({"LEVEL_2": None})
[ "def", "_init_data_struct", "(", "self", ")", ":", "self", ".", "_state", "=", "\"LEVEL\"", "self", ".", "_data", ".", "update", "(", "{", "self", ".", "_state", ":", "None", "}", ")", "if", "\"LEVEL_2\"", "in", "self", ".", "_hmdevice", ".", "WRITENOD...
[ 69, 4 ]
[ 74, 48 ]
python
en
['en', 'en', 'it']
True
HMCover.current_cover_tilt_position
(self)
Return current position of cover tilt. None is unknown, 0 is closed, 100 is fully open.
Return current position of cover tilt.
def current_cover_tilt_position(self): """Return current position of cover tilt. None is unknown, 0 is closed, 100 is fully open. """ if "LEVEL_2" not in self._data: return None return int(self._data.get("LEVEL_2", 0) * 100)
[ "def", "current_cover_tilt_position", "(", "self", ")", ":", "if", "\"LEVEL_2\"", "not", "in", "self", ".", "_data", ":", "return", "None", "return", "int", "(", "self", ".", "_data", ".", "get", "(", "\"LEVEL_2\"", ",", "0", ")", "*", "100", ")" ]
[ 77, 4 ]
[ 85, 54 ]
python
en
['en', 'da', 'en']
True
HMCover.set_cover_tilt_position
(self, **kwargs)
Move the cover tilt to a specific position.
Move the cover tilt to a specific position.
def set_cover_tilt_position(self, **kwargs): """Move the cover tilt to a specific position.""" if "LEVEL_2" in self._data and ATTR_TILT_POSITION in kwargs: position = float(kwargs[ATTR_TILT_POSITION]) position = min(100, max(0, position)) level = position / 100.0 ...
[ "def", "set_cover_tilt_position", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "\"LEVEL_2\"", "in", "self", ".", "_data", "and", "ATTR_TILT_POSITION", "in", "kwargs", ":", "position", "=", "float", "(", "kwargs", "[", "ATTR_TILT_POSITION", "]", ")",...
[ 87, 4 ]
[ 93, 72 ]
python
en
['en', 'en', 'en']
True
HMCover.open_cover_tilt
(self, **kwargs)
Open the cover tilt.
Open the cover tilt.
def open_cover_tilt(self, **kwargs): """Open the cover tilt.""" if "LEVEL_2" in self._data: self._hmdevice.open_slats()
[ "def", "open_cover_tilt", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "\"LEVEL_2\"", "in", "self", ".", "_data", ":", "self", ".", "_hmdevice", ".", "open_slats", "(", ")" ]
[ 95, 4 ]
[ 98, 39 ]
python
en
['en', 'no', 'en']
True
HMCover.close_cover_tilt
(self, **kwargs)
Close the cover tilt.
Close the cover tilt.
def close_cover_tilt(self, **kwargs): """Close the cover tilt.""" if "LEVEL_2" in self._data: self._hmdevice.close_slats()
[ "def", "close_cover_tilt", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "\"LEVEL_2\"", "in", "self", ".", "_data", ":", "self", ".", "_hmdevice", ".", "close_slats", "(", ")" ]
[ 100, 4 ]
[ 103, 40 ]
python
en
['en', 'fr', 'en']
True
HMCover.stop_cover_tilt
(self, **kwargs)
Stop cover tilt.
Stop cover tilt.
def stop_cover_tilt(self, **kwargs): """Stop cover tilt.""" if "LEVEL_2" in self._data: self.stop_cover(**kwargs)
[ "def", "stop_cover_tilt", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "\"LEVEL_2\"", "in", "self", ".", "_data", ":", "self", ".", "stop_cover", "(", "*", "*", "kwargs", ")" ]
[ 105, 4 ]
[ 108, 37 ]
python
da
['da', 'no', 'en']
False
HMGarage.current_cover_position
(self)
Return current position of cover. None is unknown, 0 is closed, 100 is fully open.
Return current position of cover.
def current_cover_position(self): """ Return current position of cover. None is unknown, 0 is closed, 100 is fully open. """ # Garage covers do not support position; always return None return None
[ "def", "current_cover_position", "(", "self", ")", ":", "# Garage covers do not support position; always return None", "return", "None" ]
[ 117, 4 ]
[ 124, 19 ]
python
en
['en', 'error', 'th']
False
HMGarage.is_closed
(self)
Return whether the cover is closed.
Return whether the cover is closed.
def is_closed(self): """Return whether the cover is closed.""" return self._hmdevice.is_closed(self._hm_get_state())
[ "def", "is_closed", "(", "self", ")", ":", "return", "self", ".", "_hmdevice", ".", "is_closed", "(", "self", ".", "_hm_get_state", "(", ")", ")" ]
[ 127, 4 ]
[ 129, 61 ]
python
en
['en', 'en', 'en']
True
HMGarage._init_data_struct
(self)
Generate a data dictionary (self._data) from metadata.
Generate a data dictionary (self._data) from metadata.
def _init_data_struct(self): """Generate a data dictionary (self._data) from metadata.""" self._state = "DOOR_STATE" self._data.update({self._state: None})
[ "def", "_init_data_struct", "(", "self", ")", ":", "self", ".", "_state", "=", "\"DOOR_STATE\"", "self", ".", "_data", ".", "update", "(", "{", "self", ".", "_state", ":", "None", "}", ")" ]
[ 131, 4 ]
[ 134, 46 ]
python
en
['en', 'en', 'it']
True
async_setup_entry
( hass: HomeAssistant, entry: ConfigEntry, async_add_entities )
Set up the Meteo-France sensor platform.
Set up the Meteo-France sensor platform.
async def async_setup_entry( hass: HomeAssistant, entry: ConfigEntry, async_add_entities ) -> None: """Set up the Meteo-France sensor platform.""" coordinator_forecast = hass.data[DOMAIN][entry.entry_id][COORDINATOR_FORECAST] coordinator_rain = hass.data[DOMAIN][entry.entry_id][COORDINATOR_RAIN] coo...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistant", ",", "entry", ":", "ConfigEntry", ",", "async_add_entities", ")", "->", "None", ":", "coordinator_forecast", "=", "hass", ".", "data", "[", "DOMAIN", "]", "[", "entry", ".", "entry_id", ...
[ 40, 0 ]
[ 74, 5 ]
python
en
['en', 'da', 'en']
True
_find_first_probability_forecast_not_null
( probability_forecast: list, path: list )
Search the first not None value in the first forecast elements.
Search the first not None value in the first forecast elements.
def _find_first_probability_forecast_not_null( probability_forecast: list, path: list ) -> int: """Search the first not None value in the first forecast elements.""" for forecast in probability_forecast[0:3]: if forecast[path[1]][path[2]] is not None: return forecast[path[1]][path[2]] ...
[ "def", "_find_first_probability_forecast_not_null", "(", "probability_forecast", ":", "list", ",", "path", ":", "list", ")", "->", "int", ":", "for", "forecast", "in", "probability_forecast", "[", "0", ":", "3", "]", ":", "if", "forecast", "[", "path", "[", ...
[ 219, 0 ]
[ 228, 15 ]
python
en
['en', 'en', 'en']
True
MeteoFranceSensor.__init__
(self, sensor_type: str, coordinator: DataUpdateCoordinator)
Initialize the Meteo-France sensor.
Initialize the Meteo-France sensor.
def __init__(self, sensor_type: str, coordinator: DataUpdateCoordinator) -> None: """Initialize the Meteo-France sensor.""" super().__init__(coordinator) self._type = sensor_type if hasattr(self.coordinator.data, "position"): city_name = self.coordinator.data.position["name"]...
[ "def", "__init__", "(", "self", ",", "sensor_type", ":", "str", ",", "coordinator", ":", "DataUpdateCoordinator", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", "coordinator", ")", "self", ".", "_type", "=", "sensor_type", "if", "hasattr"...
[ 80, 4 ]
[ 87, 125 ]
python
en
['en', 'en', 'en']
True
MeteoFranceSensor.unique_id
(self)
Return the unique id.
Return the unique id.
def unique_id(self): """Return the unique id.""" return self._unique_id
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "_unique_id" ]
[ 90, 4 ]
[ 92, 30 ]
python
en
['en', 'la', 'en']
True
MeteoFranceSensor.name
(self)
Return the name.
Return the name.
def name(self): """Return the name.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 95, 4 ]
[ 97, 25 ]
python
en
['en', 'ig', 'en']
True
MeteoFranceSensor.device_info
(self)
Return the device info.
Return the device info.
def device_info(self): """Return the device info.""" return { "identifiers": {(DOMAIN, self.platform.config_entry.unique_id)}, "name": self.coordinator.name, "manufacturer": MANUFACTURER, "model": MODEL, "entry_type": "service", }
[ "def", "device_info", "(", "self", ")", ":", "return", "{", "\"identifiers\"", ":", "{", "(", "DOMAIN", ",", "self", ".", "platform", ".", "config_entry", ".", "unique_id", ")", "}", ",", "\"name\"", ":", "self", ".", "coordinator", ".", "name", ",", "...
[ 100, 4 ]
[ 108, 9 ]
python
en
['en', 'en', 'en']
True