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
test_async_setup_entry_error
( hass: HomeAssistant, vera_component_factory: ComponentFactory )
Test function.
Test function.
async def test_async_setup_entry_error( hass: HomeAssistant, vera_component_factory: ComponentFactory ) -> None: """Test function.""" def setup_callback(controller: pv.VeraController) -> None: controller.get_devices.side_effect = RequestException() controller.get_scenes.side_effect = Reques...
[ "async", "def", "test_async_setup_entry_error", "(", "hass", ":", "HomeAssistant", ",", "vera_component_factory", ":", "ComponentFactory", ")", "->", "None", ":", "def", "setup_callback", "(", "controller", ":", "pv", ".", "VeraController", ")", "->", "None", ":",...
[ 151, 0 ]
[ 173, 68 ]
python
en
['en', 'en', 'en']
False
test_exclude_and_light_ids
( hass: HomeAssistant, vera_component_factory: ComponentFactory, options )
Test device exclusion, marking switches as lights and fixing the data type.
Test device exclusion, marking switches as lights and fixing the data type.
async def test_exclude_and_light_ids( hass: HomeAssistant, vera_component_factory: ComponentFactory, options ) -> None: """Test device exclusion, marking switches as lights and fixing the data type.""" vera_device1 = MagicMock(spec=pv.VeraBinarySensor) # type: pv.VeraBinarySensor vera_device1.device_id...
[ "async", "def", "test_exclude_and_light_ids", "(", "hass", ":", "HomeAssistant", ",", "vera_component_factory", ":", "ComponentFactory", ",", "options", ")", "->", "None", ":", "vera_device1", "=", "MagicMock", "(", "spec", "=", "pv", ".", "VeraBinarySensor", ")",...
[ 183, 0 ]
[ 242, 50 ]
python
en
['en', 'en', 'en']
True
XLMRobertaTokenizerFast.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 XLM-RoBERTa sequence has the following format: - single sequence: ``<s> X </s>`` - pair of sequences: ``<s> A </s></s> B </s>`` Args: ...
Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and adding special tokens. An XLM-RoBERTa sequence has the following format:
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 XLM-RoBERTa sequen...
[ "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", ...
[ 148, 4 ]
[ 172, 64 ]
python
en
['en', 'error', 'th']
False
XLMRobertaTokenizerFast.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", ")", "->", ...
[ 174, 4 ]
[ 203, 87 ]
python
en
['en', 'error', 'th']
False
XLMRobertaTokenizerFast.create_token_type_ids_from_sequences
( self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None )
Create a mask from the two sequences passed to be used in a sequence-pair classification task. XLM-RoBERTa does not make use of token type ids, therefore a list of zeros is returned. Args: token_ids_0 (:obj:`List[int]`): List of IDs. token_ids_1 (:obj:`L...
Create a mask from the two sequences passed to be used in a sequence-pair classification task. XLM-RoBERTa does not make use of token type ids, therefore a list of zeros is returned.
def create_token_type_ids_from_sequences( self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None ) -> List[int]: """ Create a mask from the two sequences passed to be used in a sequence-pair classification task. XLM-RoBERTa does not make use of token type ids, therefor...
[ "def", "create_token_type_ids_from_sequences", "(", "self", ",", "token_ids_0", ":", "List", "[", "int", "]", ",", "token_ids_1", ":", "Optional", "[", "List", "[", "int", "]", "]", "=", "None", ")", "->", "List", "[", "int", "]", ":", "sep", "=", "[",...
[ 205, 4 ]
[ 228, 75 ]
python
en
['en', 'error', 'th']
False
mock_config_entry
()
Return the default mocked config entry.
Return the default mocked config entry.
def mock_config_entry(): """Return the default mocked config entry.""" return MockConfigEntry( domain=DOMAIN, data=DEFAULT_DATA, options=DEFAULT_OPTIONS, unique_id=DEFAULT_DATA["server_id"], )
[ "def", "mock_config_entry", "(", ")", ":", "return", "MockConfigEntry", "(", "domain", "=", "DOMAIN", ",", "data", "=", "DEFAULT_DATA", ",", "options", "=", "DEFAULT_OPTIONS", ",", "unique_id", "=", "DEFAULT_DATA", "[", "\"server_id\"", "]", ",", ")" ]
[ 13, 0 ]
[ 20, 5 ]
python
en
['en', 'da', 'en']
True
mock_plex_account
()
Mock the PlexAccount class and return the used instance.
Mock the PlexAccount class and return the used instance.
def mock_plex_account(): """Mock the PlexAccount class and return the used instance.""" plex_account = MockPlexAccount() with patch("plexapi.myplex.MyPlexAccount", return_value=plex_account): yield plex_account
[ "def", "mock_plex_account", "(", ")", ":", "plex_account", "=", "MockPlexAccount", "(", ")", "with", "patch", "(", "\"plexapi.myplex.MyPlexAccount\"", ",", "return_value", "=", "plex_account", ")", ":", "yield", "plex_account" ]
[ 24, 0 ]
[ 28, 26 ]
python
en
['en', 'en', 'en']
True
mock_websocket
()
Mock the PlexWebsocket class.
Mock the PlexWebsocket class.
def mock_websocket(): """Mock the PlexWebsocket class.""" with patch("homeassistant.components.plex.PlexWebsocket", autospec=True) as ws: yield ws
[ "def", "mock_websocket", "(", ")", ":", "with", "patch", "(", "\"homeassistant.components.plex.PlexWebsocket\"", ",", "autospec", "=", "True", ")", "as", "ws", ":", "yield", "ws" ]
[ 32, 0 ]
[ 35, 16 ]
python
en
['en', 'fy', 'en']
True
setup_plex_server
(hass, entry, mock_plex_account, mock_websocket)
Set up and return a mocked Plex server instance.
Set up and return a mocked Plex server instance.
def setup_plex_server(hass, entry, mock_plex_account, mock_websocket): """Set up and return a mocked Plex server instance.""" async def _wrapper(**kwargs): """Wrap the fixture to allow passing arguments to the MockPlexServer instance.""" config_entry = kwargs.get("config_entry", entry) ...
[ "def", "setup_plex_server", "(", "hass", ",", "entry", ",", "mock_plex_account", ",", "mock_websocket", ")", ":", "async", "def", "_wrapper", "(", "*", "*", "kwargs", ")", ":", "\"\"\"Wrap the fixture to allow passing arguments to the MockPlexServer instance.\"\"\"", "con...
[ 39, 0 ]
[ 56, 19 ]
python
en
['en', 'da', 'en']
True
mock_plex_server
(entry, setup_plex_server)
Init from a config entry and return a mocked PlexServer instance.
Init from a config entry and return a mocked PlexServer instance.
async def mock_plex_server(entry, setup_plex_server): """Init from a config entry and return a mocked PlexServer instance.""" return await setup_plex_server(config_entry=entry)
[ "async", "def", "mock_plex_server", "(", "entry", ",", "setup_plex_server", ")", ":", "return", "await", "setup_plex_server", "(", "config_entry", "=", "entry", ")" ]
[ 60, 0 ]
[ 62, 54 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
( hass: HomeAssistantType, entry: ConfigEntry, async_add_entities: Callable[[List[Entity], bool], None], )
Set up NZBGet sensor based on a config entry.
Set up NZBGet sensor based on a config entry.
async def async_setup_entry( hass: HomeAssistantType, entry: ConfigEntry, async_add_entities: Callable[[List[Entity], bool], None], ) -> None: """Set up NZBGet sensor based on a config entry.""" coordinator: NZBGetDataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id][ DATA_COORDINATOR ...
[ "async", "def", "async_setup_entry", "(", "hass", ":", "HomeAssistantType", ",", "entry", ":", "ConfigEntry", ",", "async_add_entities", ":", "Callable", "[", "[", "List", "[", "Entity", "]", ",", "bool", "]", ",", "None", "]", ",", ")", "->", "None", ":...
[ 40, 0 ]
[ 63, 31 ]
python
en
['en', 'da', 'en']
True
NZBGetSensor.__init__
( self, coordinator: NZBGetDataUpdateCoordinator, entry_id: str, entry_name: str, sensor_type: str, sensor_name: str, unit_of_measurement: Optional[str] = None, )
Initialize a new NZBGet sensor.
Initialize a new NZBGet sensor.
def __init__( self, coordinator: NZBGetDataUpdateCoordinator, entry_id: str, entry_name: str, sensor_type: str, sensor_name: str, unit_of_measurement: Optional[str] = None, ): """Initialize a new NZBGet sensor.""" self._sensor_type = sensor_typ...
[ "def", "__init__", "(", "self", ",", "coordinator", ":", "NZBGetDataUpdateCoordinator", ",", "entry_id", ":", "str", ",", "entry_name", ":", "str", ",", "sensor_type", ":", "str", ",", "sensor_name", ":", "str", ",", "unit_of_measurement", ":", "Optional", "["...
[ 69, 4 ]
[ 87, 9 ]
python
en
['en', 'en', 'en']
True
NZBGetSensor.device_class
(self)
Return the device class.
Return the device class.
def device_class(self): """Return the device class.""" if "UpTimeSec" in self._sensor_type: return DEVICE_CLASS_TIMESTAMP return None
[ "def", "device_class", "(", "self", ")", ":", "if", "\"UpTimeSec\"", "in", "self", ".", "_sensor_type", ":", "return", "DEVICE_CLASS_TIMESTAMP", "return", "None" ]
[ 90, 4 ]
[ 95, 19 ]
python
en
['en', 'en', 'en']
True
NZBGetSensor.unique_id
(self)
Return the unique ID of the sensor.
Return the unique ID of the sensor.
def unique_id(self) -> str: """Return the unique ID of the sensor.""" return self._unique_id
[ "def", "unique_id", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_unique_id" ]
[ 98, 4 ]
[ 100, 30 ]
python
en
['en', 'la', 'en']
True
NZBGetSensor.unit_of_measurement
(self)
Return the unit that the state of sensor is expressed in.
Return the unit that the state of sensor is expressed in.
def unit_of_measurement(self) -> str: """Return the unit that the state of sensor is expressed in.""" return self._unit_of_measurement
[ "def", "unit_of_measurement", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_unit_of_measurement" ]
[ 103, 4 ]
[ 105, 40 ]
python
en
['en', 'en', 'en']
True
NZBGetSensor.state
(self)
Return the state of the sensor.
Return the state of the sensor.
def state(self): """Return the state of the sensor.""" value = self.coordinator.data["status"].get(self._sensor_type) if value is None: _LOGGER.warning("Unable to locate value for %s", self._sensor_type) return None if "DownloadRate" in self._sensor_type and val...
[ "def", "state", "(", "self", ")", ":", "value", "=", "self", ".", "coordinator", ".", "data", "[", "\"status\"", "]", ".", "get", "(", "self", ".", "_sensor_type", ")", "if", "value", "is", "None", ":", "_LOGGER", ".", "warning", "(", "\"Unable to loca...
[ 108, 4 ]
[ 124, 20 ]
python
en
['en', 'en', 'en']
True
Seq2SeqTrainer.evaluate
( self, eval_dataset: Optional[Dataset] = None, ignore_keys: Optional[List[str]] = None, metric_key_prefix: str = "eval", max_length: Optional[int] = None, num_beams: Optional[int] = None, )
Run evaluation and returns metrics. The calling script will be responsible for providing a method to compute metrics, as they are task-dependent (pass it to the init :obj:`compute_metrics` argument). You can also subclass and override this method to inject custom behavior. Ar...
Run evaluation and returns metrics.
def evaluate( self, eval_dataset: Optional[Dataset] = None, ignore_keys: Optional[List[str]] = None, metric_key_prefix: str = "eval", max_length: Optional[int] = None, num_beams: Optional[int] = None, ) -> Dict[str, float]: """ Run evaluation and retur...
[ "def", "evaluate", "(", "self", ",", "eval_dataset", ":", "Optional", "[", "Dataset", "]", "=", "None", ",", "ignore_keys", ":", "Optional", "[", "List", "[", "str", "]", "]", "=", "None", ",", "metric_key_prefix", ":", "str", "=", "\"eval\"", ",", "ma...
[ 34, 4 ]
[ 73, 107 ]
python
en
['en', 'error', 'th']
False
Seq2SeqTrainer.predict
( self, test_dataset: Dataset, ignore_keys: Optional[List[str]] = None, metric_key_prefix: str = "eval", max_length: Optional[int] = None, num_beams: Optional[int] = None, )
Run prediction and returns predictions and potential metrics. Depending on the dataset and your use case, your test dataset may contain labels. In that case, this method will also return metrics, like in :obj:`evaluate()`. Args: test_dataset (:obj:`Dataset`): ...
Run prediction and returns predictions and potential metrics.
def predict( self, test_dataset: Dataset, ignore_keys: Optional[List[str]] = None, metric_key_prefix: str = "eval", max_length: Optional[int] = None, num_beams: Optional[int] = None, ) -> PredictionOutput: """ Run prediction and returns predictions and...
[ "def", "predict", "(", "self", ",", "test_dataset", ":", "Dataset", ",", "ignore_keys", ":", "Optional", "[", "List", "[", "str", "]", "]", "=", "None", ",", "metric_key_prefix", ":", "str", "=", "\"eval\"", ",", "max_length", ":", "Optional", "[", "int"...
[ 75, 4 ]
[ 120, 106 ]
python
en
['en', 'error', 'th']
False
Seq2SeqTrainer.prediction_step
( self, model: nn.Module, inputs: Dict[str, Union[torch.Tensor, Any]], prediction_loss_only: bool, ignore_keys: Optional[List[str]] = None, )
Perform an evaluation step on :obj:`model` using obj:`inputs`. Subclass and override to inject custom behavior. Args: model (:obj:`nn.Module`): The model to evaluate. inputs (:obj:`Dict[str, Union[torch.Tensor, Any]]`): The inputs and ta...
Perform an evaluation step on :obj:`model` using obj:`inputs`.
def prediction_step( self, model: nn.Module, inputs: Dict[str, Union[torch.Tensor, Any]], prediction_loss_only: bool, ignore_keys: Optional[List[str]] = None, ) -> Tuple[Optional[float], Optional[torch.Tensor], Optional[torch.Tensor]]: """ Perform an evaluatio...
[ "def", "prediction_step", "(", "self", ",", "model", ":", "nn", ".", "Module", ",", "inputs", ":", "Dict", "[", "str", ",", "Union", "[", "torch", ".", "Tensor", ",", "Any", "]", "]", ",", "prediction_loss_only", ":", "bool", ",", "ignore_keys", ":", ...
[ 122, 4 ]
[ 193, 47 ]
python
en
['en', 'error', 'th']
False
GenerateConfig
(context)
Generate configuration.
Generate configuration.
def GenerateConfig(context): """Generate configuration.""" base_name = context.env['name'] # Properties for the container-based instance. instance = { 'zone': context.properties['zone'], 'machineType': ZonalComputeUrl(context.env['project'], context.properties[...
[ "def", "GenerateConfig", "(", "context", ")", ":", "base_name", "=", "context", ".", "env", "[", "'name'", "]", "# Properties for the container-based instance.", "instance", "=", "{", "'zone'", ":", "context", ".", "properties", "[", "'zone'", "]", ",", "'machin...
[ 32, 0 ]
[ 87, 18 ]
python
en
['en', 'la', 'en']
False
test_entity_registry
(hass)
Tests that the devices are registered in the entity registry.
Tests that the devices are registered in the entity registry.
async def test_entity_registry(hass): """Tests that the devices are registered in the entity registry.""" await setup_platform(hass, ALARM_DOMAIN) entity_registry = await hass.helpers.entity_registry.async_get_registry() entry = entity_registry.async_get(DEVICE_ID) # Abode alarm device unique_id is...
[ "async", "def", "test_entity_registry", "(", "hass", ")", ":", "await", "setup_platform", "(", "hass", ",", "ALARM_DOMAIN", ")", "entity_registry", "=", "await", "hass", ".", "helpers", ".", "entity_registry", ".", "async_get_registry", "(", ")", "entry", "=", ...
[ 24, 0 ]
[ 31, 44 ]
python
en
['en', 'en', 'en']
True
test_attributes
(hass)
Test the alarm control panel attributes are correct.
Test the alarm control panel attributes are correct.
async def test_attributes(hass): """Test the alarm control panel attributes are correct.""" await setup_platform(hass, ALARM_DOMAIN) state = hass.states.get(DEVICE_ID) assert state.state == STATE_ALARM_DISARMED assert state.attributes.get(ATTR_DEVICE_ID) == "area_1" assert not state.attributes....
[ "async", "def", "test_attributes", "(", "hass", ")", ":", "await", "setup_platform", "(", "hass", ",", "ALARM_DOMAIN", ")", "state", "=", "hass", ".", "states", ".", "get", "(", "DEVICE_ID", ")", "assert", "state", ".", "state", "==", "STATE_ALARM_DISARMED",...
[ 34, 0 ]
[ 44, 61 ]
python
en
['en', 'en', 'en']
True
test_set_alarm_away
(hass)
Test the alarm control panel can be set to away.
Test the alarm control panel can be set to away.
async def test_set_alarm_away(hass): """Test the alarm control panel can be set to away.""" with patch("abodepy.AbodeEventController.add_device_callback") as mock_callback: with patch("abodepy.ALARM.AbodeAlarm.set_away") as mock_set_away: await setup_platform(hass, ALARM_DOMAIN) ...
[ "async", "def", "test_set_alarm_away", "(", "hass", ")", ":", "with", "patch", "(", "\"abodepy.AbodeEventController.add_device_callback\"", ")", "as", "mock_callback", ":", "with", "patch", "(", "\"abodepy.ALARM.AbodeAlarm.set_away\"", ")", "as", "mock_set_away", ":", "...
[ 47, 0 ]
[ 73, 56 ]
python
en
['en', 'en', 'en']
True
test_set_alarm_home
(hass)
Test the alarm control panel can be set to home.
Test the alarm control panel can be set to home.
async def test_set_alarm_home(hass): """Test the alarm control panel can be set to home.""" with patch("abodepy.AbodeEventController.add_device_callback") as mock_callback: with patch("abodepy.ALARM.AbodeAlarm.set_home") as mock_set_home: await setup_platform(hass, ALARM_DOMAIN) ...
[ "async", "def", "test_set_alarm_home", "(", "hass", ")", ":", "with", "patch", "(", "\"abodepy.AbodeEventController.add_device_callback\"", ")", "as", "mock_callback", ":", "with", "patch", "(", "\"abodepy.ALARM.AbodeAlarm.set_home\"", ")", "as", "mock_set_home", ":", "...
[ 76, 0 ]
[ 101, 56 ]
python
en
['en', 'en', 'en']
True
test_set_alarm_standby
(hass)
Test the alarm control panel can be set to standby.
Test the alarm control panel can be set to standby.
async def test_set_alarm_standby(hass): """Test the alarm control panel can be set to standby.""" with patch("abodepy.AbodeEventController.add_device_callback") as mock_callback: with patch("abodepy.ALARM.AbodeAlarm.set_standby") as mock_set_standby: await setup_platform(hass, ALARM_DOMAIN) ...
[ "async", "def", "test_set_alarm_standby", "(", "hass", ")", ":", "with", "patch", "(", "\"abodepy.AbodeEventController.add_device_callback\"", ")", "as", "mock_callback", ":", "with", "patch", "(", "\"abodepy.ALARM.AbodeAlarm.set_standby\"", ")", "as", "mock_set_standby", ...
[ 104, 0 ]
[ 128, 54 ]
python
en
['en', 'en', 'en']
True
test_state_unknown
(hass)
Test an unknown alarm control panel state.
Test an unknown alarm control panel state.
async def test_state_unknown(hass): """Test an unknown alarm control panel state.""" with patch("abodepy.ALARM.AbodeAlarm.mode", new_callable=PropertyMock) as mock_mode: await setup_platform(hass, ALARM_DOMAIN) await hass.async_block_till_done() mock_mode.return_value = None st...
[ "async", "def", "test_state_unknown", "(", "hass", ")", ":", "with", "patch", "(", "\"abodepy.ALARM.AbodeAlarm.mode\"", ",", "new_callable", "=", "PropertyMock", ")", "as", "mock_mode", ":", "await", "setup_platform", "(", "hass", ",", "ALARM_DOMAIN", ")", "await"...
[ 131, 0 ]
[ 140, 39 ]
python
en
['en', 'en', 'en']
True
_find_text_in_file
(filename, start_prompt, end_prompt)
Find the text in `filename` between a line beginning with `start_prompt` and before `end_prompt`, removing empty lines.
Find the text in `filename` between a line beginning with `start_prompt` and before `end_prompt`, removing empty lines.
def _find_text_in_file(filename, start_prompt, end_prompt): """ Find the text in `filename` between a line beginning with `start_prompt` and before `end_prompt`, removing empty lines. """ with open(filename, "r", encoding="utf-8", newline="\n") as f: lines = f.readlines() # Find the star...
[ "def", "_find_text_in_file", "(", "filename", ",", "start_prompt", ",", "end_prompt", ")", ":", "with", "open", "(", "filename", ",", "\"r\"", ",", "encoding", "=", "\"utf-8\"", ",", "newline", "=", "\"\\n\"", ")", "as", "f", ":", "lines", "=", "f", ".",...
[ 29, 0 ]
[ 52, 79 ]
python
en
['en', 'error', 'th']
False
camel_case_split
(identifier)
Split a camelcased `identifier` into words.
Split a camelcased `identifier` into words.
def camel_case_split(identifier): "Split a camelcased `identifier` into words." matches = re.finditer(".+?(?:(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])|$)", identifier) return [m.group(0) for m in matches]
[ "def", "camel_case_split", "(", "identifier", ")", ":", "matches", "=", "re", ".", "finditer", "(", "\".+?(?:(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])|$)\"", ",", "identifier", ")", "return", "[", "m", ".", "group", "(", "0", ")", "for", "m", "in", "matches",...
[ 65, 0 ]
[ 68, 40 ]
python
en
['en', 'fy', 'en']
True
get_model_table_from_auto_modules
()
Generates an up-to-date model table from the content of the auto modules.
Generates an up-to-date model table from the content of the auto modules.
def get_model_table_from_auto_modules(): """Generates an up-to-date model table from the content of the auto modules.""" # This is to make sure the transformers module imported is the one in the repo. spec = importlib.util.spec_from_file_location( "transformers", os.path.join(TRANSFORMERS_PA...
[ "def", "get_model_table_from_auto_modules", "(", ")", ":", "# This is to make sure the transformers module imported is the one in the repo.", "spec", "=", "importlib", ".", "util", ".", "spec_from_file_location", "(", "\"transformers\"", ",", "os", ".", "path", ".", "join", ...
[ 78, 0 ]
[ 157, 16 ]
python
en
['en', 'en', 'en']
True
check_model_table
(overwrite=False)
Check the model table in the index.rst is consistent with the state of the lib and maybe `overwrite`.
Check the model table in the index.rst is consistent with the state of the lib and maybe `overwrite`.
def check_model_table(overwrite=False): """ Check the model table in the index.rst is consistent with the state of the lib and maybe `overwrite`. """ current_table, start_index, end_index, lines = _find_text_in_file( filename=os.path.join(PATH_TO_DOCS, "index.rst"), start_prompt=" This table ...
[ "def", "check_model_table", "(", "overwrite", "=", "False", ")", ":", "current_table", ",", "start_index", ",", "end_index", ",", "lines", "=", "_find_text_in_file", "(", "filename", "=", "os", ".", "path", ".", "join", "(", "PATH_TO_DOCS", ",", "\"index.rst\"...
[ 160, 0 ]
[ 176, 13 ]
python
en
['en', 'en', 'en']
True
keygen
(kt=symmetric.KeyType.RANDOM)
Generate private and public keys.
Generate private and public keys.
def keygen(kt=symmetric.KeyType.RANDOM): """Generate private and public keys.""" # Generate regular secret key sk = symmetric.keygen(kt) # Generate a set of encryptions of zero pk = [symmetric.encrypt(sk, 0, PK_M_BIT_LENGTH) for i in range(PK_SIZE)] return (sk, pk)
[ "def", "keygen", "(", "kt", "=", "symmetric", ".", "KeyType", ".", "RANDOM", ")", ":", "# Generate regular secret key", "sk", "=", "symmetric", ".", "keygen", "(", "kt", ")", "# Generate a set of encryptions of zero", "pk", "=", "[", "symmetric", ".", "encrypt",...
[ 8, 0 ]
[ 17, 19 ]
python
en
['en', 'en', 'en']
True
encrypt
(pk, b)
Encrypt a bit b into an integer based on a public key.
Encrypt a bit b into an integer based on a public key.
def encrypt(pk, b): """Encrypt a bit b into an integer based on a public key.""" # Choose a random subset of the pk's encrypted zeros idxs = np.random.choice(np.arange(PK_SIZE), PK_SUBSET_SIZE, replace=False) # Sum subset of encrypted zeros along with the bit to be encrypted cypher = b + sum([...
[ "def", "encrypt", "(", "pk", ",", "b", ")", ":", "# Choose a random subset of the pk's encrypted zeros", "idxs", "=", "np", ".", "random", ".", "choice", "(", "np", ".", "arange", "(", "PK_SIZE", ")", ",", "PK_SUBSET_SIZE", ",", "replace", "=", "False", ")",...
[ 20, 0 ]
[ 29, 17 ]
python
en
['en', 'hu', 'en']
True
decrypt
(sk, c)
Decrypt using the normal symmetric algorithm.
Decrypt using the normal symmetric algorithm.
def decrypt(sk, c): """Decrypt using the normal symmetric algorithm.""" return symmetric.decrypt(sk, c)
[ "def", "decrypt", "(", "sk", ",", "c", ")", ":", "return", "symmetric", ".", "decrypt", "(", "sk", ",", "c", ")" ]
[ 32, 0 ]
[ 34, 35 ]
python
en
['en', 'fr', 'en']
True
async_setup
(hass, yaml_config)
Activate the emulated_hue component.
Activate the emulated_hue component.
async def async_setup(hass, yaml_config): """Activate the emulated_hue component.""" config = Config(hass, yaml_config.get(DOMAIN, {})) app = web.Application() app["hass"] = hass # We misunderstood the startup signal. You're not allowed to change # anything during startup. Temp workaround. ...
[ "async", "def", "async_setup", "(", "hass", ",", "yaml_config", ")", ":", "config", "=", "Config", "(", "hass", ",", "yaml_config", ".", "get", "(", "DOMAIN", ",", "{", "}", ")", ")", "app", "=", "web", ".", "Application", "(", ")", "app", "[", "\"...
[ 100, 0 ]
[ 176, 15 ]
python
en
['en', 'en', 'en']
True
_load_json
(filename)
Load JSON, handling invalid syntax.
Load JSON, handling invalid syntax.
def _load_json(filename): """Load JSON, handling invalid syntax.""" try: return load_json(filename) except HomeAssistantError: pass return {}
[ "def", "_load_json", "(", "filename", ")", ":", "try", ":", "return", "load_json", "(", "filename", ")", "except", "HomeAssistantError", ":", "pass", "return", "{", "}" ]
[ 338, 0 ]
[ 344, 13 ]
python
en
['en', 'en', 'en']
True
Config.__init__
(self, hass, conf)
Initialize the instance.
Initialize the instance.
def __init__(self, hass, conf): """Initialize the instance.""" self.hass = hass self.type = conf.get(CONF_TYPE) self.numbers = None self.cached_states = {} self._exposed_cache = {} if self.type == TYPE_ALEXA: _LOGGER.warning( "Emulated...
[ "def", "__init__", "(", "self", ",", "hass", ",", "conf", ")", ":", "self", ".", "hass", "=", "hass", "self", ".", "type", "=", "conf", ".", "get", "(", "CONF_TYPE", ")", "self", ".", "numbers", "=", "None", "self", ".", "cached_states", "=", "{", ...
[ 182, 4 ]
[ 253, 69 ]
python
en
['en', 'en', 'en']
True
Config.entity_id_to_number
(self, entity_id)
Get a unique number for the entity id.
Get a unique number for the entity id.
def entity_id_to_number(self, entity_id): """Get a unique number for the entity id.""" if self.type == TYPE_ALEXA: return entity_id if self.numbers is None: self.numbers = _load_json(self.hass.config.path(NUMBERS_FILE)) # Google Home for number, ent_id i...
[ "def", "entity_id_to_number", "(", "self", ",", "entity_id", ")", ":", "if", "self", ".", "type", "==", "TYPE_ALEXA", ":", "return", "entity_id", "if", "self", ".", "numbers", "is", "None", ":", "self", ".", "numbers", "=", "_load_json", "(", "self", "."...
[ 255, 4 ]
[ 273, 21 ]
python
en
['en', 'en', 'en']
True
Config.number_to_entity_id
(self, number)
Convert unique number to entity id.
Convert unique number to entity id.
def number_to_entity_id(self, number): """Convert unique number to entity id.""" if self.type == TYPE_ALEXA: return number if self.numbers is None: self.numbers = _load_json(self.hass.config.path(NUMBERS_FILE)) # Google Home assert isinstance(number, str...
[ "def", "number_to_entity_id", "(", "self", ",", "number", ")", ":", "if", "self", ".", "type", "==", "TYPE_ALEXA", ":", "return", "number", "if", "self", ".", "numbers", "is", "None", ":", "self", ".", "numbers", "=", "_load_json", "(", "self", ".", "h...
[ 275, 4 ]
[ 285, 39 ]
python
en
['en', 'en', 'en']
True
Config.get_entity_name
(self, entity)
Get the name of an entity.
Get the name of an entity.
def get_entity_name(self, entity): """Get the name of an entity.""" if ( entity.entity_id in self.entities and CONF_ENTITY_NAME in self.entities[entity.entity_id] ): return self.entities[entity.entity_id][CONF_ENTITY_NAME] return entity.attributes.get...
[ "def", "get_entity_name", "(", "self", ",", "entity", ")", ":", "if", "(", "entity", ".", "entity_id", "in", "self", ".", "entities", "and", "CONF_ENTITY_NAME", "in", "self", ".", "entities", "[", "entity", ".", "entity_id", "]", ")", ":", "return", "sel...
[ 287, 4 ]
[ 295, 73 ]
python
en
['en', 'en', 'en']
True
Config.is_entity_exposed
(self, entity)
Cache determine if an entity should be exposed on the emulated bridge.
Cache determine if an entity should be exposed on the emulated bridge.
def is_entity_exposed(self, entity): """Cache determine if an entity should be exposed on the emulated bridge.""" entity_id = entity.entity_id if entity_id not in self._exposed_cache: self._exposed_cache[entity_id] = self._is_entity_exposed(entity) return self._exposed_cache[...
[ "def", "is_entity_exposed", "(", "self", ",", "entity", ")", ":", "entity_id", "=", "entity", ".", "entity_id", "if", "entity_id", "not", "in", "self", ".", "_exposed_cache", ":", "self", ".", "_exposed_cache", "[", "entity_id", "]", "=", "self", ".", "_is...
[ 297, 4 ]
[ 302, 45 ]
python
en
['en', 'en', 'en']
True
Config.filter_exposed_entities
(self, states)
Filter a list of all states down to exposed entities.
Filter a list of all states down to exposed entities.
def filter_exposed_entities(self, states): """Filter a list of all states down to exposed entities.""" exposed = [] for entity in states: entity_id = entity.entity_id if entity_id not in self._exposed_cache: self._exposed_cache[entity_id] = self._is_entity...
[ "def", "filter_exposed_entities", "(", "self", ",", "states", ")", ":", "exposed", "=", "[", "]", "for", "entity", "in", "states", ":", "entity_id", "=", "entity", ".", "entity_id", "if", "entity_id", "not", "in", "self", ".", "_exposed_cache", ":", "self"...
[ 304, 4 ]
[ 313, 22 ]
python
en
['en', 'en', 'en']
True
Config._is_entity_exposed
(self, entity)
Determine if an entity should be exposed on the emulated bridge. Async friendly.
Determine if an entity should be exposed on the emulated bridge.
def _is_entity_exposed(self, entity): """Determine if an entity should be exposed on the emulated bridge. Async friendly. """ if entity.attributes.get("view") is not None: # Ignore entities that are views return False if entity.entity_id in self._entitie...
[ "def", "_is_entity_exposed", "(", "self", ",", "entity", ")", ":", "if", "entity", ".", "attributes", ".", "get", "(", "\"view\"", ")", "is", "not", "None", ":", "# Ignore entities that are views", "return", "False", "if", "entity", ".", "entity_id", "in", "...
[ 315, 4 ]
[ 335, 20 ]
python
en
['en', 'en', 'en']
True
ThresholdBinarizer.forward
(ctx, inputs: torch.tensor, threshold: float, sigmoid: bool)
Args: inputs (`torch.FloatTensor`) The input matrix from which the binarizer computes the binary mask. threshold (`float`) The threshold value (in R). sigmoid (`bool`) If set to ``True``, we apply the sigmoid function to the `i...
Args: inputs (`torch.FloatTensor`) The input matrix from which the binarizer computes the binary mask. threshold (`float`) The threshold value (in R). sigmoid (`bool`) If set to ``True``, we apply the sigmoid function to the `i...
def forward(ctx, inputs: torch.tensor, threshold: float, sigmoid: bool): """ Args: inputs (`torch.FloatTensor`) The input matrix from which the binarizer computes the binary mask. threshold (`float`) The threshold value (in R). sigmoid ...
[ "def", "forward", "(", "ctx", ",", "inputs", ":", "torch", ".", "tensor", ",", "threshold", ":", "float", ",", "sigmoid", ":", "bool", ")", ":", "nb_elems", "=", "inputs", ".", "numel", "(", ")", "nb_min", "=", "int", "(", "0.005", "*", "nb_elems", ...
[ 36, 4 ]
[ 61, 19 ]
python
en
['en', 'error', 'th']
False
TopKBinarizer.forward
(ctx, inputs: torch.tensor, threshold: float)
Args: inputs (`torch.FloatTensor`) The input matrix from which the binarizer computes the binary mask. threshold (`float`) The percentage of weights to keep (the rest is pruned). `threshold` is a float between 0 and 1. Returns: ...
Args: inputs (`torch.FloatTensor`) The input matrix from which the binarizer computes the binary mask. threshold (`float`) The percentage of weights to keep (the rest is pruned). `threshold` is a float between 0 and 1. Returns: ...
def forward(ctx, inputs: torch.tensor, threshold: float): """ Args: inputs (`torch.FloatTensor`) The input matrix from which the binarizer computes the binary mask. threshold (`float`) The percentage of weights to keep (the rest is pruned). ...
[ "def", "forward", "(", "ctx", ",", "inputs", ":", "torch", ".", "tensor", ",", "threshold", ":", "float", ")", ":", "# Get the subnetwork by sorting the inputs and using the top threshold %", "mask", "=", "inputs", ".", "clone", "(", ")", "_", ",", "idx", "=", ...
[ 81, 4 ]
[ 103, 19 ]
python
en
['en', 'error', 'th']
False
MagnitudeBinarizer.apply
(inputs: torch.tensor, threshold: float)
Args: inputs (`torch.FloatTensor`) The input matrix from which the binarizer computes the binary mask. This input marix is typically the weight matrix. threshold (`float`) The percentage of weights to keep (the rest is pruned). ...
Args: inputs (`torch.FloatTensor`) The input matrix from which the binarizer computes the binary mask. This input marix is typically the weight matrix. threshold (`float`) The percentage of weights to keep (the rest is pruned). ...
def apply(inputs: torch.tensor, threshold: float): """ Args: inputs (`torch.FloatTensor`) The input matrix from which the binarizer computes the binary mask. This input marix is typically the weight matrix. threshold (`float`) The p...
[ "def", "apply", "(", "inputs", ":", "torch", ".", "tensor", ",", "threshold", ":", "float", ")", ":", "# Get the subnetwork by sorting the inputs and using the top threshold %", "mask", "=", "inputs", ".", "clone", "(", ")", "_", ",", "idx", "=", "inputs", ".", ...
[ 120, 4 ]
[ 143, 19 ]
python
en
['en', 'error', 'th']
False
async_setup
(hass, config)
Set up the Tibber component.
Set up the Tibber component.
async def async_setup(hass, config): """Set up the Tibber component.""" hass.data[DATA_HASS_CONFIG] = config if DOMAIN not in config: return True hass.async_create_task( hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_IMPOR...
[ "async", "def", "async_setup", "(", "hass", ",", "config", ")", ":", "hass", ".", "data", "[", "DATA_HASS_CONFIG", "]", "=", "config", "if", "DOMAIN", "not", "in", "config", ":", "return", "True", "hass", ".", "async_create_task", "(", "hass", ".", "conf...
[ 30, 0 ]
[ 46, 15 ]
python
en
['en', 'da', 'en']
True
async_setup_entry
(hass, entry)
Set up a config entry.
Set up a config entry.
async def async_setup_entry(hass, entry): """Set up a config entry.""" tibber_connection = tibber.Tibber( access_token=entry.data[CONF_ACCESS_TOKEN], websession=async_get_clientsession(hass), time_zone=dt_util.DEFAULT_TIME_ZONE, ) hass.data[DOMAIN] = tibber_connection async...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "entry", ")", ":", "tibber_connection", "=", "tibber", ".", "Tibber", "(", "access_token", "=", "entry", ".", "data", "[", "CONF_ACCESS_TOKEN", "]", ",", "websession", "=", "async_get_clientsession", "(", ...
[ 49, 0 ]
[ 87, 15 ]
python
en
['en', 'en', 'en']
True
async_unload_entry
(hass, config_entry)
Unload a config entry.
Unload a config entry.
async def async_unload_entry(hass, config_entry): """Unload a config entry.""" unload_ok = all( await asyncio.gather( *[ hass.config_entries.async_forward_entry_unload(config_entry, component) for component in PLATFORMS ] ) ) if un...
[ "async", "def", "async_unload_entry", "(", "hass", ",", "config_entry", ")", ":", "unload_ok", "=", "all", "(", "await", "asyncio", ".", "gather", "(", "*", "[", "hass", ".", "config_entries", ".", "async_forward_entry_unload", "(", "config_entry", ",", "compo...
[ 90, 0 ]
[ 105, 20 ]
python
en
['en', 'es', 'en']
True
FlaxPerformerLayerNorm.__call__
(self, x)
Applies layer normalization on the input. It normalizes the activations of the layer for each given example in a batch independently, rather than across a batch like Batch Normalization. i.e. applies a transformation that maintains the mean activation within each example close to 0 and the acti...
Applies layer normalization on the input. It normalizes the activations of the layer for each given example in a batch independently, rather than across a batch like Batch Normalization. i.e. applies a transformation that maintains the mean activation within each example close to 0 and the acti...
def __call__(self, x): """ Applies layer normalization on the input. It normalizes the activations of the layer for each given example in a batch independently, rather than across a batch like Batch Normalization. i.e. applies a transformation that maintains the mean activation within ea...
[ "def", "__call__", "(", "self", ",", "x", ")", ":", "features", "=", "x", ".", "shape", "[", "-", "1", "]", "mean", "=", "jnp", ".", "mean", "(", "x", ",", "axis", "=", "-", "1", ",", "keepdims", "=", "True", ")", "mean2", "=", "jnp", ".", ...
[ 119, 4 ]
[ 141, 16 ]
python
en
['en', 'error', 'th']
False
test_bad_trigger_platform
(hass)
Test bad trigger platform.
Test bad trigger platform.
async def test_bad_trigger_platform(hass): """Test bad trigger platform.""" with pytest.raises(vol.Invalid) as ex: await async_validate_trigger_config(hass, [{"platform": "not_a_platform"}]) assert "Invalid platform 'not_a_platform' specified" in str(ex)
[ "async", "def", "test_bad_trigger_platform", "(", "hass", ")", ":", "with", "pytest", ".", "raises", "(", "vol", ".", "Invalid", ")", "as", "ex", ":", "await", "async_validate_trigger_config", "(", "hass", ",", "[", "{", "\"platform\"", ":", "\"not_a_platform\...
[ 7, 0 ]
[ 11, 67 ]
python
en
['en', 'da', 'en']
True
async_setup_platform
(hass, config, async_add_entities, discovery_info=None)
Import the device and set up custom switches. This is for backward compatibility. Do not use this method.
Import the device and set up custom switches.
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Import the device and set up custom switches. This is for backward compatibility. Do not use this method. """ mac_addr = config[CONF_MAC] host = config.get(CONF_HOST) switches = config.get(CONF_SWITCHE...
[ "async", "def", "async_setup_platform", "(", "hass", ",", "config", ",", "async_add_entities", ",", "discovery_info", "=", "None", ")", ":", "mac_addr", "=", "config", "[", "CONF_MAC", "]", "host", "=", "config", ".", "get", "(", "CONF_HOST", ")", "switches"...
[ 71, 0 ]
[ 104, 33 ]
python
en
['en', 'en', 'en']
True
async_setup_entry
(hass, config_entry, async_add_entities)
Set up the Broadlink switch.
Set up the Broadlink switch.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up the Broadlink switch.""" device = hass.data[DOMAIN].devices[config_entry.entry_id] if device.api.type in {"RM2", "RM4"}: platform_data = hass.data[DOMAIN].platforms.get(SWITCH_DOMAIN, {}) user_defined_switches = ...
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "device", "=", "hass", ".", "data", "[", "DOMAIN", "]", ".", "devices", "[", "config_entry", ".", "entry_id", "]", "if", "device", ".", "api", ".", ...
[ 107, 0 ]
[ 133, 32 ]
python
en
['en', 'en', 'en']
True
BroadlinkSwitch.__init__
(self, device, command_on, command_off)
Initialize the switch.
Initialize the switch.
def __init__(self, device, command_on, command_off): """Initialize the switch.""" self._device = device self._command_on = command_on self._command_off = command_off self._coordinator = device.update_manager.coordinator self._device_class = None self._state = None
[ "def", "__init__", "(", "self", ",", "device", ",", "command_on", ",", "command_off", ")", ":", "self", ".", "_device", "=", "device", "self", ".", "_command_on", "=", "command_on", "self", ".", "_command_off", "=", "command_off", "self", ".", "_coordinator"...
[ 139, 4 ]
[ 146, 26 ]
python
en
['en', 'en', 'en']
True
BroadlinkSwitch.name
(self)
Return the name of the switch.
Return the name of the switch.
def name(self): """Return the name of the switch.""" return f"{self._device.name} Switch"
[ "def", "name", "(", "self", ")", ":", "return", "f\"{self._device.name} Switch\"" ]
[ 149, 4 ]
[ 151, 44 ]
python
en
['en', 'en', 'en']
True
BroadlinkSwitch.assumed_state
(self)
Return True if unable to access real state of the switch.
Return True if unable to access real state of the switch.
def assumed_state(self): """Return True if unable to access real state of the switch.""" return True
[ "def", "assumed_state", "(", "self", ")", ":", "return", "True" ]
[ 154, 4 ]
[ 156, 19 ]
python
en
['en', 'en', 'en']
True
BroadlinkSwitch.available
(self)
Return True if the switch is available.
Return True if the switch is available.
def available(self): """Return True if the switch is available.""" return self._device.update_manager.available
[ "def", "available", "(", "self", ")", ":", "return", "self", ".", "_device", ".", "update_manager", ".", "available" ]
[ 159, 4 ]
[ 161, 52 ]
python
en
['en', 'en', 'en']
True
BroadlinkSwitch.is_on
(self)
Return True if the switch is on.
Return True if the switch is on.
def is_on(self): """Return True if the switch is on.""" return self._state
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 164, 4 ]
[ 166, 26 ]
python
en
['en', 'en', 'en']
True
BroadlinkSwitch.should_poll
(self)
Return True if the switch has to be polled for state.
Return True if the switch has to be polled for state.
def should_poll(self): """Return True if the switch has to be polled for state.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 169, 4 ]
[ 171, 20 ]
python
en
['en', 'en', 'en']
True
BroadlinkSwitch.device_class
(self)
Return device class.
Return device class.
def device_class(self): """Return device class.""" return self._device_class
[ "def", "device_class", "(", "self", ")", ":", "return", "self", ".", "_device_class" ]
[ 174, 4 ]
[ 176, 33 ]
python
en
['es', 'zh', 'en']
False
BroadlinkSwitch.device_info
(self)
Return device info.
Return device info.
def device_info(self): """Return device info.""" return { "identifiers": {(DOMAIN, self._device.unique_id)}, "manufacturer": self._device.api.manufacturer, "model": self._device.api.model, "name": self._device.name, "sw_version": self._device.f...
[ "def", "device_info", "(", "self", ")", ":", "return", "{", "\"identifiers\"", ":", "{", "(", "DOMAIN", ",", "self", ".", "_device", ".", "unique_id", ")", "}", ",", "\"manufacturer\"", ":", "self", ".", "_device", ".", "api", ".", "manufacturer", ",", ...
[ 179, 4 ]
[ 187, 9 ]
python
en
['es', 'hr', 'en']
False
BroadlinkSwitch.update_data
(self)
Update data.
Update data.
def update_data(self): """Update data.""" self.async_write_ha_state()
[ "def", "update_data", "(", "self", ")", ":", "self", ".", "async_write_ha_state", "(", ")" ]
[ 190, 4 ]
[ 192, 35 ]
python
co
['fr', 'co', 'en']
False
BroadlinkSwitch.async_added_to_hass
(self)
Call when the switch is added to hass.
Call when the switch is added to hass.
async def async_added_to_hass(self): """Call when the switch is added to hass.""" if self._state is None: state = await self.async_get_last_state() self._state = state is not None and state.state == STATE_ON self.async_on_remove(self._coordinator.async_add_listener(self.u...
[ "async", "def", "async_added_to_hass", "(", "self", ")", ":", "if", "self", ".", "_state", "is", "None", ":", "state", "=", "await", "self", ".", "async_get_last_state", "(", ")", "self", ".", "_state", "=", "state", "is", "not", "None", "and", "state", ...
[ 194, 4 ]
[ 199, 84 ]
python
en
['en', 'en', 'en']
True
BroadlinkSwitch.async_update
(self)
Update the switch.
Update the switch.
async def async_update(self): """Update the switch.""" await self._coordinator.async_request_refresh()
[ "async", "def", "async_update", "(", "self", ")", ":", "await", "self", ".", "_coordinator", ".", "async_request_refresh", "(", ")" ]
[ 201, 4 ]
[ 203, 55 ]
python
en
['en', 'en', 'en']
True
BroadlinkSwitch.async_turn_on
(self, **kwargs)
Turn on the switch.
Turn on the switch.
async def async_turn_on(self, **kwargs): """Turn on the switch.""" if await self._async_send_packet(self._command_on): self._state = True self.async_write_ha_state()
[ "async", "def", "async_turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "await", "self", ".", "_async_send_packet", "(", "self", ".", "_command_on", ")", ":", "self", ".", "_state", "=", "True", "self", ".", "async_write_ha_state", "(", ")...
[ 205, 4 ]
[ 209, 39 ]
python
en
['en', 'en', 'en']
True
BroadlinkSwitch.async_turn_off
(self, **kwargs)
Turn off the switch.
Turn off the switch.
async def async_turn_off(self, **kwargs): """Turn off the switch.""" if await self._async_send_packet(self._command_off): self._state = False self.async_write_ha_state()
[ "async", "def", "async_turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "await", "self", ".", "_async_send_packet", "(", "self", ".", "_command_off", ")", ":", "self", ".", "_state", "=", "False", "self", ".", "async_write_ha_state", "(", ...
[ 211, 4 ]
[ 215, 39 ]
python
en
['en', 'en', 'en']
True
BroadlinkSwitch._async_send_packet
(self, packet)
Send a packet to the device.
Send a packet to the device.
async def _async_send_packet(self, packet): """Send a packet to the device."""
[ "async", "def", "_async_send_packet", "(", "self", ",", "packet", ")", ":" ]
[ 218, 4 ]
[ 219, 42 ]
python
en
['en', 'en', 'en']
True
BroadlinkRMSwitch.__init__
(self, device, config)
Initialize the switch.
Initialize the switch.
def __init__(self, device, config): """Initialize the switch.""" super().__init__( device, config.get(CONF_COMMAND_ON), config.get(CONF_COMMAND_OFF) ) self._name = config[CONF_NAME]
[ "def", "__init__", "(", "self", ",", "device", ",", "config", ")", ":", "super", "(", ")", ".", "__init__", "(", "device", ",", "config", ".", "get", "(", "CONF_COMMAND_ON", ")", ",", "config", ".", "get", "(", "CONF_COMMAND_OFF", ")", ")", "self", "...
[ 225, 4 ]
[ 230, 38 ]
python
en
['en', 'en', 'en']
True
BroadlinkRMSwitch.name
(self)
Return the name of the switch.
Return the name of the switch.
def name(self): """Return the name of the switch.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 233, 4 ]
[ 235, 25 ]
python
en
['en', 'en', 'en']
True
BroadlinkRMSwitch._async_send_packet
(self, packet)
Send a packet to the device.
Send a packet to the device.
async def _async_send_packet(self, packet): """Send a packet to the device.""" if packet is None: return True try: await self._device.async_request(self._device.api.send_data, packet) except (BroadlinkException, OSError) as err: _LOGGER.error("Failed ...
[ "async", "def", "_async_send_packet", "(", "self", ",", "packet", ")", ":", "if", "packet", "is", "None", ":", "return", "True", "try", ":", "await", "self", ".", "_device", ".", "async_request", "(", "self", ".", "_device", ".", "api", ".", "send_data",...
[ 237, 4 ]
[ 247, 19 ]
python
en
['en', 'en', 'en']
True
BroadlinkSP1Switch.__init__
(self, device)
Initialize the switch.
Initialize the switch.
def __init__(self, device): """Initialize the switch.""" super().__init__(device, 1, 0) self._device_class = DEVICE_CLASS_OUTLET
[ "def", "__init__", "(", "self", ",", "device", ")", ":", "super", "(", ")", ".", "__init__", "(", "device", ",", "1", ",", "0", ")", "self", ".", "_device_class", "=", "DEVICE_CLASS_OUTLET" ]
[ 253, 4 ]
[ 256, 48 ]
python
en
['en', 'en', 'en']
True
BroadlinkSP1Switch.unique_id
(self)
Return the unique id of the switch.
Return the unique id of the switch.
def unique_id(self): """Return the unique id of the switch.""" return self._device.unique_id
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "_device", ".", "unique_id" ]
[ 259, 4 ]
[ 261, 37 ]
python
en
['en', 'en', 'en']
True
BroadlinkSP1Switch._async_send_packet
(self, packet)
Send a packet to the device.
Send a packet to the device.
async def _async_send_packet(self, packet): """Send a packet to the device.""" try: await self._device.async_request(self._device.api.set_power, packet) except (BroadlinkException, OSError) as err: _LOGGER.error("Failed to send packet: %s", err) return False ...
[ "async", "def", "_async_send_packet", "(", "self", ",", "packet", ")", ":", "try", ":", "await", "self", ".", "_device", ".", "async_request", "(", "self", ".", "_device", ".", "api", ".", "set_power", ",", "packet", ")", "except", "(", "BroadlinkException...
[ 263, 4 ]
[ 270, 19 ]
python
en
['en', 'en', 'en']
True
BroadlinkSP2Switch.__init__
(self, device, *args, **kwargs)
Initialize the switch.
Initialize the switch.
def __init__(self, device, *args, **kwargs): """Initialize the switch.""" super().__init__(device, *args, **kwargs) self._state = self._coordinator.data["state"] self._load_power = self._coordinator.data["load_power"] if device.api.model == "SC1": self._device_class =...
[ "def", "__init__", "(", "self", ",", "device", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "super", "(", ")", ".", "__init__", "(", "device", ",", "*", "args", ",", "*", "*", "kwargs", ")", "self", ".", "_state", "=", "self", ".", "_co...
[ 276, 4 ]
[ 282, 52 ]
python
en
['en', 'en', 'en']
True
BroadlinkSP2Switch.assumed_state
(self)
Return True if unable to access real state of the switch.
Return True if unable to access real state of the switch.
def assumed_state(self): """Return True if unable to access real state of the switch.""" return False
[ "def", "assumed_state", "(", "self", ")", ":", "return", "False" ]
[ 285, 4 ]
[ 287, 20 ]
python
en
['en', 'en', 'en']
True
BroadlinkSP2Switch.current_power_w
(self)
Return the current power usage in Watt.
Return the current power usage in Watt.
def current_power_w(self): """Return the current power usage in Watt.""" return self._load_power
[ "def", "current_power_w", "(", "self", ")", ":", "return", "self", ".", "_load_power" ]
[ 290, 4 ]
[ 292, 31 ]
python
en
['en', 'de', 'en']
True
BroadlinkSP2Switch.update_data
(self)
Update data.
Update data.
def update_data(self): """Update data.""" if self._coordinator.last_update_success: self._state = self._coordinator.data["state"] self._load_power = self._coordinator.data["load_power"] self.async_write_ha_state()
[ "def", "update_data", "(", "self", ")", ":", "if", "self", ".", "_coordinator", ".", "last_update_success", ":", "self", ".", "_state", "=", "self", ".", "_coordinator", ".", "data", "[", "\"state\"", "]", "self", ".", "_load_power", "=", "self", ".", "_...
[ 295, 4 ]
[ 300, 35 ]
python
co
['fr', 'co', 'en']
False
BroadlinkSP4Switch.__init__
(self, device, *args, **kwargs)
Initialize the switch.
Initialize the switch.
def __init__(self, device, *args, **kwargs): """Initialize the switch.""" super().__init__(device, *args, **kwargs) self._state = self._coordinator.data["pwr"]
[ "def", "__init__", "(", "self", ",", "device", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "super", "(", ")", ".", "__init__", "(", "device", ",", "*", "args", ",", "*", "*", "kwargs", ")", "self", ".", "_state", "=", "self", ".", "_co...
[ 306, 4 ]
[ 309, 51 ]
python
en
['en', 'en', 'en']
True
BroadlinkSP4Switch.assumed_state
(self)
Return True if unable to access real state of the switch.
Return True if unable to access real state of the switch.
def assumed_state(self): """Return True if unable to access real state of the switch.""" return False
[ "def", "assumed_state", "(", "self", ")", ":", "return", "False" ]
[ 312, 4 ]
[ 314, 20 ]
python
en
['en', 'en', 'en']
True
BroadlinkSP4Switch.update_data
(self)
Update data.
Update data.
def update_data(self): """Update data.""" if self._coordinator.last_update_success: self._state = self._coordinator.data["pwr"] self.async_write_ha_state()
[ "def", "update_data", "(", "self", ")", ":", "if", "self", ".", "_coordinator", ".", "last_update_success", ":", "self", ".", "_state", "=", "self", ".", "_coordinator", ".", "data", "[", "\"pwr\"", "]", "self", ".", "async_write_ha_state", "(", ")" ]
[ 317, 4 ]
[ 321, 35 ]
python
co
['fr', 'co', 'en']
False
BroadlinkMP1Slot.__init__
(self, device, slot)
Initialize the switch.
Initialize the switch.
def __init__(self, device, slot): """Initialize the switch.""" super().__init__(device, 1, 0) self._slot = slot self._state = self._coordinator.data[f"s{slot}"] self._device_class = DEVICE_CLASS_OUTLET
[ "def", "__init__", "(", "self", ",", "device", ",", "slot", ")", ":", "super", "(", ")", ".", "__init__", "(", "device", ",", "1", ",", "0", ")", "self", ".", "_slot", "=", "slot", "self", ".", "_state", "=", "self", ".", "_coordinator", ".", "da...
[ 327, 4 ]
[ 332, 48 ]
python
en
['en', 'en', 'en']
True
BroadlinkMP1Slot.unique_id
(self)
Return the unique id of the slot.
Return the unique id of the slot.
def unique_id(self): """Return the unique id of the slot.""" return f"{self._device.unique_id}-s{self._slot}"
[ "def", "unique_id", "(", "self", ")", ":", "return", "f\"{self._device.unique_id}-s{self._slot}\"" ]
[ 335, 4 ]
[ 337, 56 ]
python
en
['en', 'en', 'en']
True
BroadlinkMP1Slot.name
(self)
Return the name of the switch.
Return the name of the switch.
def name(self): """Return the name of the switch.""" return f"{self._device.name} S{self._slot}"
[ "def", "name", "(", "self", ")", ":", "return", "f\"{self._device.name} S{self._slot}\"" ]
[ 340, 4 ]
[ 342, 51 ]
python
en
['en', 'en', 'en']
True
BroadlinkMP1Slot.assumed_state
(self)
Return True if unable to access real state of the switch.
Return True if unable to access real state of the switch.
def assumed_state(self): """Return True if unable to access real state of the switch.""" return False
[ "def", "assumed_state", "(", "self", ")", ":", "return", "False" ]
[ 345, 4 ]
[ 347, 20 ]
python
en
['en', 'en', 'en']
True
BroadlinkMP1Slot.update_data
(self)
Update data.
Update data.
def update_data(self): """Update data.""" if self._coordinator.last_update_success: self._state = self._coordinator.data[f"s{self._slot}"] self.async_write_ha_state()
[ "def", "update_data", "(", "self", ")", ":", "if", "self", ".", "_coordinator", ".", "last_update_success", ":", "self", ".", "_state", "=", "self", ".", "_coordinator", ".", "data", "[", "f\"s{self._slot}\"", "]", "self", ".", "async_write_ha_state", "(", "...
[ 350, 4 ]
[ 354, 35 ]
python
co
['fr', 'co', 'en']
False
BroadlinkMP1Slot._async_send_packet
(self, packet)
Send a packet to the device.
Send a packet to the device.
async def _async_send_packet(self, packet): """Send a packet to the device.""" try: await self._device.async_request( self._device.api.set_power, self._slot, packet ) except (BroadlinkException, OSError) as err: _LOGGER.error("Failed to send pa...
[ "async", "def", "_async_send_packet", "(", "self", ",", "packet", ")", ":", "try", ":", "await", "self", ".", "_device", ".", "async_request", "(", "self", ".", "_device", ".", "api", ".", "set_power", ",", "self", ".", "_slot", ",", "packet", ")", "ex...
[ 356, 4 ]
[ 365, 19 ]
python
en
['en', 'en', 'en']
True
BroadlinkBG1Slot.__init__
(self, device, slot)
Initialize the switch.
Initialize the switch.
def __init__(self, device, slot): """Initialize the switch.""" super().__init__(device, 1, 0) self._slot = slot self._state = self._coordinator.data[f"pwr{slot}"] self._device_class = DEVICE_CLASS_OUTLET
[ "def", "__init__", "(", "self", ",", "device", ",", "slot", ")", ":", "super", "(", ")", ".", "__init__", "(", "device", ",", "1", ",", "0", ")", "self", ".", "_slot", "=", "slot", "self", ".", "_state", "=", "self", ".", "_coordinator", ".", "da...
[ 371, 4 ]
[ 376, 48 ]
python
en
['en', 'en', 'en']
True
BroadlinkBG1Slot.unique_id
(self)
Return the unique id of the slot.
Return the unique id of the slot.
def unique_id(self): """Return the unique id of the slot.""" return f"{self._device.unique_id}-s{self._slot}"
[ "def", "unique_id", "(", "self", ")", ":", "return", "f\"{self._device.unique_id}-s{self._slot}\"" ]
[ 379, 4 ]
[ 381, 56 ]
python
en
['en', 'en', 'en']
True
BroadlinkBG1Slot.name
(self)
Return the name of the switch.
Return the name of the switch.
def name(self): """Return the name of the switch.""" return f"{self._device.name} S{self._slot}"
[ "def", "name", "(", "self", ")", ":", "return", "f\"{self._device.name} S{self._slot}\"" ]
[ 384, 4 ]
[ 386, 51 ]
python
en
['en', 'en', 'en']
True
BroadlinkBG1Slot.assumed_state
(self)
Return True if unable to access real state of the switch.
Return True if unable to access real state of the switch.
def assumed_state(self): """Return True if unable to access real state of the switch.""" return False
[ "def", "assumed_state", "(", "self", ")", ":", "return", "False" ]
[ 389, 4 ]
[ 391, 20 ]
python
en
['en', 'en', 'en']
True
BroadlinkBG1Slot.update_data
(self)
Update data.
Update data.
def update_data(self): """Update data.""" if self._coordinator.last_update_success: self._state = self._coordinator.data[f"pwr{self._slot}"] self.async_write_ha_state()
[ "def", "update_data", "(", "self", ")", ":", "if", "self", ".", "_coordinator", ".", "last_update_success", ":", "self", ".", "_state", "=", "self", ".", "_coordinator", ".", "data", "[", "f\"pwr{self._slot}\"", "]", "self", ".", "async_write_ha_state", "(", ...
[ 394, 4 ]
[ 398, 35 ]
python
co
['fr', 'co', 'en']
False
BroadlinkBG1Slot._async_send_packet
(self, packet)
Send a packet to the device.
Send a packet to the device.
async def _async_send_packet(self, packet): """Send a packet to the device.""" set_state = partial(self._device.api.set_state, **{f"pwr{self._slot}": packet}) try: await self._device.async_request(set_state) except (BroadlinkException, OSError) as err: _LOGGER.err...
[ "async", "def", "_async_send_packet", "(", "self", ",", "packet", ")", ":", "set_state", "=", "partial", "(", "self", ".", "_device", ".", "api", ".", "set_state", ",", "*", "*", "{", "f\"pwr{self._slot}\"", ":", "packet", "}", ")", "try", ":", "await", ...
[ 400, 4 ]
[ 408, 19 ]
python
en
['en', 'en', 'en']
True
tokenize_numbers
(text_array: List[str])
Splits large comma-separated numbers and floating point values. This is done by replacing commas with ' @,@ ' and dots with ' @.@ '. Args: text_array: An already tokenized text as list. Returns: A list of strings with tokenized numbers. Example:: >>> tokenize_numbers(["$"...
Splits large comma-separated numbers and floating point values. This is done by replacing commas with ' @,@ ' and dots with ' @.@ '.
def tokenize_numbers(text_array: List[str]) -> List[str]: """ Splits large comma-separated numbers and floating point values. This is done by replacing commas with ' @,@ ' and dots with ' @.@ '. Args: text_array: An already tokenized text as list. Returns: A list of strings with to...
[ "def", "tokenize_numbers", "(", "text_array", ":", "List", "[", "str", "]", ")", "->", "List", "[", "str", "]", ":", "tokenized", "=", "[", "]", "for", "i", "in", "range", "(", "len", "(", "text_array", ")", ")", ":", "reg", ",", "sub", "=", "MAT...
[ 67, 0 ]
[ 88, 20 ]
python
en
['en', 'error', 'th']
False
detokenize_numbers
(text: str)
Inverts the operation of `tokenize_numbers`. This is replacing ' @,@ ' and ' @.@' by ',' and '.'. Args: text: A string where the number should be detokenized. Returns: A detokenized string. Example:: >>> detokenize_numbers("$ 5 @,@ 000 1 @.@ 73 m") "$ 5,000 1.73 m" ...
Inverts the operation of `tokenize_numbers`. This is replacing ' @,@ ' and ' @.@' by ',' and '.'.
def detokenize_numbers(text: str) -> str: """ Inverts the operation of `tokenize_numbers`. This is replacing ' @,@ ' and ' @.@' by ',' and '.'. Args: text: A string where the number should be detokenized. Returns: A detokenized string. Example:: >>> detokenize_numbers("$ 5...
[ "def", "detokenize_numbers", "(", "text", ":", "str", ")", "->", "str", ":", "for", "reg", ",", "sub", "in", "DETOKENIZE_NUMBERS", ":", "text", "=", "re", ".", "sub", "(", "reg", ",", "sub", ",", "text", ")", "return", "text" ]
[ 91, 0 ]
[ 107, 15 ]
python
en
['en', 'error', 'th']
False
TransfoXLTokenizer.count_sents
(self, sents, verbose=False)
sents : a list of sentences, each a list of tokenized symbols
sents : a list of sentences, each a list of tokenized symbols
def count_sents(self, sents, verbose=False): """ sents : a list of sentences, each a list of tokenized symbols """ if verbose: logger.info("counting {} sents ...".format(len(sents))) for idx, symbols in enumerate(sents): if verbose and idx > 0 and idx % 50...
[ "def", "count_sents", "(", "self", ",", "sents", ",", "verbose", "=", "False", ")", ":", "if", "verbose", ":", "logger", ".", "info", "(", "\"counting {} sents ...\"", ".", "format", "(", "len", "(", "sents", ")", ")", ")", "for", "idx", ",", "symbols"...
[ 270, 4 ]
[ 279, 40 ]
python
en
['en', 'error', 'th']
False
TransfoXLTokenizer.move_added_token
(self, token: str, target_idx: int)
Moves an added token to a specific position in the vocab. This method should be used when resizing an embedding layer other than the last one in the `AdaptiveEmbedding` in order to move the token in the tokenizer from the default position (at the very end) to the desired one. Args: ...
Moves an added token to a specific position in the vocab. This method should be used when resizing an embedding layer other than the last one in the `AdaptiveEmbedding` in order to move the token in the tokenizer from the default position (at the very end) to the desired one.
def move_added_token(self, token: str, target_idx: int): """ Moves an added token to a specific position in the vocab. This method should be used when resizing an embedding layer other than the last one in the `AdaptiveEmbedding` in order to move the token in the tokenizer from the defau...
[ "def", "move_added_token", "(", "self", ",", "token", ":", "str", ",", "target_idx", ":", "int", ")", ":", "assert", "token", "in", "self", ".", "added_tokens_encoder", ",", "\"Token which should be moved has to be an added token\"", "assert", "token", "not", "in", ...
[ 372, 4 ]
[ 397, 44 ]
python
en
['en', 'error', 'th']
False
TransfoXLTokenizer.moses_pipeline
(self, text: str)
Does basic tokenization using :class:`sacremoses.MosesPunctNormalizer` and :class:`sacremoses.MosesTokenizer` with `aggressive_dash_splits=True` (see :func:`sacremoses.tokenize.MosesTokenizer.tokenize`). Additionally, large comma-separated numbers and floating point values are split. E.g. "23,0...
Does basic tokenization using :class:`sacremoses.MosesPunctNormalizer` and :class:`sacremoses.MosesTokenizer` with `aggressive_dash_splits=True` (see :func:`sacremoses.tokenize.MosesTokenizer.tokenize`). Additionally, large comma-separated numbers and floating point values are split. E.g. "23,0...
def moses_pipeline(self, text: str) -> List[str]: """ Does basic tokenization using :class:`sacremoses.MosesPunctNormalizer` and :class:`sacremoses.MosesTokenizer` with `aggressive_dash_splits=True` (see :func:`sacremoses.tokenize.MosesTokenizer.tokenize`). Additionally, large comma-sepa...
[ "def", "moses_pipeline", "(", "self", ",", "text", ":", "str", ")", "->", "List", "[", "str", "]", ":", "text", "=", "self", ".", "moses_punct_norm", "(", "text", ")", "text", "=", "self", ".", "moses_tokenize", "(", "text", ")", "text", "=", "tokeni...
[ 407, 4 ]
[ 428, 19 ]
python
en
['en', 'error', 'th']
False
TransfoXLTokenizer._convert_id_to_token
(self, idx)
Converts an id in a token (BPE) using the vocab.
Converts an id in a token (BPE) using the vocab.
def _convert_id_to_token(self, idx): """Converts an id in a token (BPE) using the vocab.""" assert 0 <= idx < len(self), "Index {} out of vocabulary range".format(idx) return self.idx2sym[idx]
[ "def", "_convert_id_to_token", "(", "self", ",", "idx", ")", ":", "assert", "0", "<=", "idx", "<", "len", "(", "self", ")", ",", "\"Index {} out of vocabulary range\"", ".", "format", "(", "idx", ")", "return", "self", ".", "idx2sym", "[", "idx", "]" ]
[ 430, 4 ]
[ 433, 32 ]
python
en
['en', 'en', 'en']
True
TransfoXLTokenizer._convert_token_to_id
(self, sym)
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, sym): """ Converts a token (str) in an id using the vocab. """ if sym in self.sym2idx: return self.sym2idx[sym] else: # logger.info('encounter unk {}'.format(sym)) # assert '<eos>' not in sym if hasattr(self, "unk_idx...
[ "def", "_convert_token_to_id", "(", "self", ",", "sym", ")", ":", "if", "sym", "in", "self", ".", "sym2idx", ":", "return", "self", ".", "sym2idx", "[", "sym", "]", "else", ":", "# logger.info('encounter unk {}'.format(sym))", "# assert '<eos>' not in sym", "if", ...
[ 435, 4 ]
[ 450, 108 ]
python
en
['en', 'en', 'en']
True
TransfoXLTokenizer.convert_tokens_to_string
(self, tokens)
Converts a sequence of tokens (string) in a single string. Additionally, the split numbers are converted back into it's original form.
Converts a sequence of tokens (string) in a single string. Additionally, the split numbers are converted back into it's original form.
def convert_tokens_to_string(self, tokens): """ Converts a sequence of tokens (string) in a single string. Additionally, the split numbers are converted back into it's original form. """ out_string = self.moses_detokenizer.detokenize(tokens) return detokenize_numbers(out_...
[ "def", "convert_tokens_to_string", "(", "self", ",", "tokens", ")", ":", "out_string", "=", "self", ".", "moses_detokenizer", ".", "detokenize", "(", "tokens", ")", "return", "detokenize_numbers", "(", "out_string", ")", ".", "strip", "(", ")" ]
[ 452, 4 ]
[ 458, 53 ]
python
en
['en', 'error', 'th']
False
LMOrderedIterator.__init__
(self, data, bsz, bptt, device="cpu", ext_len=None)
data -- LongTensor -- the LongTensor is strictly ordered
data -- LongTensor -- the LongTensor is strictly ordered
def __init__(self, data, bsz, bptt, device="cpu", ext_len=None): """ data -- LongTensor -- the LongTensor is strictly ordered """ self.bsz = bsz self.bptt = bptt self.ext_len = ext_len if ext_len is not None else 0 self.device = device # Work out how cle...
[ "def", "__init__", "(", "self", ",", "data", ",", "bsz", ",", "bptt", ",", "device", "=", "\"cpu\"", ",", "ext_len", "=", "None", ")", ":", "self", ".", "bsz", "=", "bsz", "self", ".", "bptt", "=", "bptt", "self", ".", "ext_len", "=", "ext_len", ...
[ 492, 4 ]
[ 512, 65 ]
python
en
['en', 'error', 'th']
False