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
async_setup_entry
(hass, config_entry, async_add_entities)
Set up the Demo config entry.
Set up the Demo config entry.
async def async_setup_entry(hass, config_entry, async_add_entities): """Set up the Demo config entry.""" await async_setup_platform(hass, {}, async_add_entities)
[ "async", "def", "async_setup_entry", "(", "hass", ",", "config_entry", ",", "async_add_entities", ")", ":", "await", "async_setup_platform", "(", "hass", ",", "{", "}", ",", "async_add_entities", ")" ]
[ 24, 0 ]
[ 26, 60 ]
python
en
['en', 'en', 'en']
True
DemoSwitch.__init__
(self, unique_id, name, state, icon, assumed, device_class=None)
Initialize the Demo switch.
Initialize the Demo switch.
def __init__(self, unique_id, name, state, icon, assumed, device_class=None): """Initialize the Demo switch.""" self._unique_id = unique_id self._name = name or DEVICE_DEFAULT_NAME self._state = state self._icon = icon self._assumed = assumed self._device_class = ...
[ "def", "__init__", "(", "self", ",", "unique_id", ",", "name", ",", "state", ",", "icon", ",", "assumed", ",", "device_class", "=", "None", ")", ":", "self", ".", "_unique_id", "=", "unique_id", "self", ".", "_name", "=", "name", "or", "DEVICE_DEFAULT_NA...
[ 32, 4 ]
[ 39, 41 ]
python
en
['en', 'en', 'en']
True
DemoSwitch.device_info
(self)
Return device info.
Return device info.
def device_info(self): """Return device info.""" return { "identifiers": { # Serial numbers are unique identifiers within a specific domain (DOMAIN, self.unique_id) }, "name": self.name, }
[ "def", "device_info", "(", "self", ")", ":", "return", "{", "\"identifiers\"", ":", "{", "# Serial numbers are unique identifiers within a specific domain", "(", "DOMAIN", ",", "self", ".", "unique_id", ")", "}", ",", "\"name\"", ":", "self", ".", "name", ",", "...
[ 42, 4 ]
[ 50, 9 ]
python
en
['es', 'hr', 'en']
False
DemoSwitch.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" ]
[ 53, 4 ]
[ 55, 30 ]
python
en
['en', 'la', 'en']
True
DemoSwitch.should_poll
(self)
No polling needed for a demo switch.
No polling needed for a demo switch.
def should_poll(self): """No polling needed for a demo switch.""" return False
[ "def", "should_poll", "(", "self", ")", ":", "return", "False" ]
[ 58, 4 ]
[ 60, 20 ]
python
en
['en', 'en', 'en']
True
DemoSwitch.name
(self)
Return the name of the device if any.
Return the name of the device if any.
def name(self): """Return the name of the device if any.""" return self._name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
[ 63, 4 ]
[ 65, 25 ]
python
en
['en', 'en', 'en']
True
DemoSwitch.icon
(self)
Return the icon to use for device if any.
Return the icon to use for device if any.
def icon(self): """Return the icon to use for device if any.""" return self._icon
[ "def", "icon", "(", "self", ")", ":", "return", "self", ".", "_icon" ]
[ 68, 4 ]
[ 70, 25 ]
python
en
['en', 'en', 'en']
True
DemoSwitch.assumed_state
(self)
Return if the state is based on assumptions.
Return if the state is based on assumptions.
def assumed_state(self): """Return if the state is based on assumptions.""" return self._assumed
[ "def", "assumed_state", "(", "self", ")", ":", "return", "self", ".", "_assumed" ]
[ 73, 4 ]
[ 75, 28 ]
python
en
['en', 'en', 'en']
True
DemoSwitch.current_power_w
(self)
Return the current power usage in W.
Return the current power usage in W.
def current_power_w(self): """Return the current power usage in W.""" if self._state: return 100
[ "def", "current_power_w", "(", "self", ")", ":", "if", "self", ".", "_state", ":", "return", "100" ]
[ 78, 4 ]
[ 81, 22 ]
python
en
['en', 'en', 'en']
True
DemoSwitch.today_energy_kwh
(self)
Return the today total energy usage in kWh.
Return the today total energy usage in kWh.
def today_energy_kwh(self): """Return the today total energy usage in kWh.""" return 15
[ "def", "today_energy_kwh", "(", "self", ")", ":", "return", "15" ]
[ 84, 4 ]
[ 86, 17 ]
python
en
['en', 'en', 'en']
True
DemoSwitch.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.""" return self._state
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 89, 4 ]
[ 91, 26 ]
python
en
['en', 'fy', 'en']
True
DemoSwitch.device_class
(self)
Return device of entity.
Return device of entity.
def device_class(self): """Return device of entity.""" return self._device_class
[ "def", "device_class", "(", "self", ")", ":", "return", "self", ".", "_device_class" ]
[ 94, 4 ]
[ 96, 33 ]
python
en
['en', 'cy', 'en']
True
DemoSwitch.turn_on
(self, **kwargs)
Turn the switch on.
Turn the switch on.
def turn_on(self, **kwargs): """Turn the switch on.""" self._state = True self.schedule_update_ha_state()
[ "def", "turn_on", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_state", "=", "True", "self", ".", "schedule_update_ha_state", "(", ")" ]
[ 98, 4 ]
[ 101, 39 ]
python
en
['en', 'en', 'en']
True
DemoSwitch.turn_off
(self, **kwargs)
Turn the device off.
Turn the device off.
def turn_off(self, **kwargs): """Turn the device off.""" self._state = False self.schedule_update_ha_state()
[ "def", "turn_off", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_state", "=", "False", "self", ".", "schedule_update_ha_state", "(", ")" ]
[ 103, 4 ]
[ 106, 39 ]
python
en
['en', 'en', 'en']
True
setup
(hass, config)
Set up the Goalfeed component.
Set up the Goalfeed component.
def setup(hass, config): """Set up the Goalfeed component.""" conf = config[DOMAIN] username = conf.get(CONF_USERNAME) password = conf.get(CONF_PASSWORD) def goal_handler(data): """Handle goal events.""" goal = json.loads(json.loads(data)) hass.bus.fire("goal", event_data=g...
[ "def", "setup", "(", "hass", ",", "config", ")", ":", "conf", "=", "config", "[", "DOMAIN", "]", "username", "=", "conf", ".", "get", "(", "CONF_USERNAME", ")", "password", "=", "conf", ".", "get", "(", "CONF_PASSWORD", ")", "def", "goal_handler", "(",...
[ 31, 0 ]
[ 62, 15 ]
python
en
['en', 'en', 'en']
True
prune_columns
(file_schema: Schema, expected_schema: Schema)
Given two Iceberg schema's returns a list of column_names for all id's in the file schema that are projected in the expected schema Parameters ---------- file_schema : iceberg.api.Schema An Iceberg schema of the file being read expected_schema : iceberg.api.Schema An Iceberg sc...
Given two Iceberg schema's returns a list of column_names for all id's in the file schema that are projected in the expected schema
def prune_columns(file_schema: Schema, expected_schema: Schema) -> List[str]: """ Given two Iceberg schema's returns a list of column_names for all id's in the file schema that are projected in the expected schema Parameters ---------- file_schema : iceberg.api.Schema An Iceberg schema ...
[ "def", "prune_columns", "(", "file_schema", ":", "Schema", ",", "expected_schema", ":", "Schema", ")", "->", "List", "[", "str", "]", ":", "return", "[", "column", ".", "name", "for", "column", "in", "file_schema", ".", "as_struct", "(", ")", ".", "field...
[ 23, 0 ]
[ 40, 63 ]
python
en
['en', 'error', 'th']
False
init_deepspeed
(trainer, num_training_steps, resume_from_checkpoint=None)
Init DeepSpeed, after updating the DeepSpeed configuration with any relevant Trainer's args. If ``resume_from_checkpoint`` was passed then an attempt to resume from a previously saved checkpoint will be made. Args: trainer: Trainer object num_training_steps: per single gpu resume_...
Init DeepSpeed, after updating the DeepSpeed configuration with any relevant Trainer's args.
def init_deepspeed(trainer, num_training_steps, resume_from_checkpoint=None): """ Init DeepSpeed, after updating the DeepSpeed configuration with any relevant Trainer's args. If ``resume_from_checkpoint`` was passed then an attempt to resume from a previously saved checkpoint will be made. Args: ...
[ "def", "init_deepspeed", "(", "trainer", ",", "num_training_steps", ",", "resume_from_checkpoint", "=", "None", ")", ":", "import", "deepspeed", "require_version", "(", "\"deepspeed>0.3.12\"", ")", "args", "=", "trainer", ".", "args", "ds_config_file", "=", "args", ...
[ 270, 0 ]
[ 459, 41 ]
python
en
['en', 'error', 'th']
False
WandbCallback.setup
(self, args, state, model, **kwargs)
Setup the optional Weights & Biases (`wandb`) integration. One can subclass and override this method to customize the setup if needed. Find more information `here <https://docs.wandb.ai/integrations/huggingface>`__. You can also override the following environment variables: Environmen...
Setup the optional Weights & Biases (`wandb`) integration.
def setup(self, args, state, model, **kwargs): """ Setup the optional Weights & Biases (`wandb`) integration. One can subclass and override this method to customize the setup if needed. Find more information `here <https://docs.wandb.ai/integrations/huggingface>`__. You can also overrid...
[ "def", "setup", "(", "self", ",", "args", ",", "state", ",", "model", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "_wandb", "is", "None", ":", "return", "self", ".", "_initialized", "=", "True", "if", "state", ".", "is_world_process_zero", ...
[ 565, 4 ]
[ 622, 17 ]
python
en
['en', 'error', 'th']
False
CometCallback.setup
(self, args, state, model)
Setup the optional Comet.ml integration. Environment: COMET_MODE (:obj:`str`, `optional`): "OFFLINE", "ONLINE", or "DISABLED" COMET_PROJECT_NAME (:obj:`str`, `optional`): Comet.ml project name for experiments COMET_OFFLINE_DIRECTORY (...
Setup the optional Comet.ml integration.
def setup(self, args, state, model): """ Setup the optional Comet.ml integration. Environment: COMET_MODE (:obj:`str`, `optional`): "OFFLINE", "ONLINE", or "DISABLED" COMET_PROJECT_NAME (:obj:`str`, `optional`): Comet.ml project name for e...
[ "def", "setup", "(", "self", ",", "args", ",", "state", ",", "model", ")", ":", "self", ".", "_initialized", "=", "True", "if", "state", ".", "is_world_process_zero", ":", "comet_mode", "=", "os", ".", "getenv", "(", "\"COMET_MODE\"", ",", "\"ONLINE\"", ...
[ 680, 4 ]
[ 711, 104 ]
python
en
['en', 'error', 'th']
False
MLflowCallback.setup
(self, args, state, model)
Setup the optional MLflow integration. Environment: HF_MLFLOW_LOG_ARTIFACTS (:obj:`str`, `optional`): Whether to use MLflow .log_artifact() facility to log artifacts. This only makes sense if logging to a remote server, e.g. s3 or GCS. If set to `True` or `...
Setup the optional MLflow integration.
def setup(self, args, state, model): """ Setup the optional MLflow integration. Environment: HF_MLFLOW_LOG_ARTIFACTS (:obj:`str`, `optional`): Whether to use MLflow .log_artifact() facility to log artifacts. This only makes sense if logging to a remo...
[ "def", "setup", "(", "self", ",", "args", ",", "state", ",", "model", ")", ":", "log_artifacts", "=", "os", ".", "getenv", "(", "\"HF_MLFLOW_LOG_ARTIFACTS\"", ",", "\"FALSE\"", ")", ".", "upper", "(", ")", "if", "log_artifacts", "in", "{", "\"TRUE\"", ",...
[ 767, 4 ]
[ 803, 32 ]
python
en
['en', 'error', 'th']
False
test_get_device_detects_none
(hass, mock_openzwave)
Test device returns none.
Test device returns none.
def test_get_device_detects_none(hass, mock_openzwave): """Test device returns none.""" node = MockNode() value = MockValue(data=0, node=node) values = MockEntityValues(primary=value, node=node) device = cover.get_device(hass=hass, node=node, values=values, node_config={}) assert device is None
[ "def", "test_get_device_detects_none", "(", "hass", ",", "mock_openzwave", ")", ":", "node", "=", "MockNode", "(", ")", "value", "=", "MockValue", "(", "data", "=", "0", ",", "node", "=", "node", ")", "values", "=", "MockEntityValues", "(", "primary", "=",...
[ 13, 0 ]
[ 20, 25 ]
python
en
['fr', 'en', 'en']
True
test_get_device_detects_rollershutter
(hass, mock_openzwave)
Test device returns rollershutter.
Test device returns rollershutter.
def test_get_device_detects_rollershutter(hass, mock_openzwave): """Test device returns rollershutter.""" hass.data[const.DATA_NETWORK] = MagicMock() node = MockNode() value = MockValue( data=0, node=node, command_class=const.COMMAND_CLASS_SWITCH_MULTILEVEL ) values = MockEntityValues(pr...
[ "def", "test_get_device_detects_rollershutter", "(", "hass", ",", "mock_openzwave", ")", ":", "hass", ".", "data", "[", "const", ".", "DATA_NETWORK", "]", "=", "MagicMock", "(", ")", "node", "=", "MockNode", "(", ")", "value", "=", "MockValue", "(", "data", ...
[ 23, 0 ]
[ 33, 55 ]
python
en
['fr', 'en', 'en']
True
test_get_device_detects_garagedoor_switch
(hass, mock_openzwave)
Test device returns garage door.
Test device returns garage door.
def test_get_device_detects_garagedoor_switch(hass, mock_openzwave): """Test device returns garage door.""" node = MockNode() value = MockValue( data=False, node=node, command_class=const.COMMAND_CLASS_SWITCH_BINARY ) values = MockEntityValues(primary=value, node=node) device = cover.ge...
[ "def", "test_get_device_detects_garagedoor_switch", "(", "hass", ",", "mock_openzwave", ")", ":", "node", "=", "MockNode", "(", ")", "value", "=", "MockValue", "(", "data", "=", "False", ",", "node", "=", "node", ",", "command_class", "=", "const", ".", "COM...
[ 36, 0 ]
[ 47, 68 ]
python
nl
['nl', 'nl', 'en']
True
test_get_device_detects_garagedoor_barrier
(hass, mock_openzwave)
Test device returns garage door.
Test device returns garage door.
def test_get_device_detects_garagedoor_barrier(hass, mock_openzwave): """Test device returns garage door.""" node = MockNode() value = MockValue( data="Closed", node=node, command_class=const.COMMAND_CLASS_BARRIER_OPERATOR ) values = MockEntityValues(primary=value, node=node) device = c...
[ "def", "test_get_device_detects_garagedoor_barrier", "(", "hass", ",", "mock_openzwave", ")", ":", "node", "=", "MockNode", "(", ")", "value", "=", "MockValue", "(", "data", "=", "\"Closed\"", ",", "node", "=", "node", ",", "command_class", "=", "const", ".", ...
[ 50, 0 ]
[ 61, 68 ]
python
nl
['nl', 'nl', 'en']
True
test_roller_no_position_workaround
(hass, mock_openzwave)
Test position changed.
Test position changed.
def test_roller_no_position_workaround(hass, mock_openzwave): """Test position changed.""" hass.data[const.DATA_NETWORK] = MagicMock() node = MockNode(manufacturer_id="0047", product_type="5a52") value = MockValue( data=45, node=node, command_class=const.COMMAND_CLASS_SWITCH_MULTILEVEL ) ...
[ "def", "test_roller_no_position_workaround", "(", "hass", ",", "mock_openzwave", ")", ":", "hass", ".", "data", "[", "const", ".", "DATA_NETWORK", "]", "=", "MagicMock", "(", ")", "node", "=", "MockNode", "(", "manufacturer_id", "=", "\"0047\"", ",", "product_...
[ 64, 0 ]
[ 74, 48 ]
python
en
['en', 'en', 'en']
True
test_roller_value_changed
(hass, mock_openzwave)
Test position changed.
Test position changed.
def test_roller_value_changed(hass, mock_openzwave): """Test position changed.""" hass.data[const.DATA_NETWORK] = MagicMock() node = MockNode() value = MockValue( data=None, node=node, command_class=const.COMMAND_CLASS_SWITCH_MULTILEVEL ) values = MockEntityValues(primary=value, open=Non...
[ "def", "test_roller_value_changed", "(", "hass", ",", "mock_openzwave", ")", ":", "hass", ".", "data", "[", "const", ".", "DATA_NETWORK", "]", "=", "MagicMock", "(", ")", "node", "=", "MockNode", "(", ")", "value", "=", "MockValue", "(", "data", "=", "No...
[ 77, 0 ]
[ 106, 31 ]
python
en
['en', 'en', 'en']
True
test_roller_commands
(hass, mock_openzwave)
Test position changed.
Test position changed.
def test_roller_commands(hass, mock_openzwave): """Test position changed.""" mock_network = hass.data[const.DATA_NETWORK] = MagicMock() node = MockNode() value = MockValue( data=50, node=node, command_class=const.COMMAND_CLASS_SWITCH_MULTILEVEL ) open_value = MockValue(data=False, node=n...
[ "def", "test_roller_commands", "(", "hass", ",", "mock_openzwave", ")", ":", "mock_network", "=", "hass", ".", "data", "[", "const", ".", "DATA_NETWORK", "]", "=", "MagicMock", "(", ")", "node", "=", "MockNode", "(", ")", "value", "=", "MockValue", "(", ...
[ 109, 0 ]
[ 142, 42 ]
python
en
['en', 'en', 'en']
True
test_roller_invert_percent
(hass, mock_openzwave)
Test position changed.
Test position changed.
def test_roller_invert_percent(hass, mock_openzwave): """Test position changed.""" mock_network = hass.data[const.DATA_NETWORK] = MagicMock() node = MockNode() value = MockValue( data=50, node=node, command_class=const.COMMAND_CLASS_SWITCH_MULTILEVEL ) open_value = MockValue(data=False, ...
[ "def", "test_roller_invert_percent", "(", "hass", ",", "mock_openzwave", ")", ":", "mock_network", "=", "hass", ".", "data", "[", "const", ".", "DATA_NETWORK", "]", "=", "MagicMock", "(", ")", "node", "=", "MockNode", "(", ")", "value", "=", "MockValue", "...
[ 145, 0 ]
[ 170, 42 ]
python
en
['en', 'en', 'en']
True
test_roller_reverse_open_close
(hass, mock_openzwave)
Test position changed.
Test position changed.
def test_roller_reverse_open_close(hass, mock_openzwave): """Test position changed.""" mock_network = hass.data[const.DATA_NETWORK] = MagicMock() node = MockNode() value = MockValue( data=50, node=node, command_class=const.COMMAND_CLASS_SWITCH_MULTILEVEL ) open_value = MockValue(data=Fal...
[ "def", "test_roller_reverse_open_close", "(", "hass", ",", "mock_openzwave", ")", ":", "mock_network", "=", "hass", ".", "data", "[", "const", ".", "DATA_NETWORK", "]", "=", "MagicMock", "(", ")", "node", "=", "MockNode", "(", ")", "value", "=", "MockValue",...
[ 173, 0 ]
[ 205, 43 ]
python
en
['en', 'en', 'en']
True
test_switch_garage_value_changed
(hass, mock_openzwave)
Test position changed.
Test position changed.
def test_switch_garage_value_changed(hass, mock_openzwave): """Test position changed.""" node = MockNode() value = MockValue( data=False, node=node, command_class=const.COMMAND_CLASS_SWITCH_BINARY ) values = MockEntityValues(primary=value, node=node) device = cover.get_device(hass=hass, ...
[ "def", "test_switch_garage_value_changed", "(", "hass", ",", "mock_openzwave", ")", ":", "node", "=", "MockNode", "(", ")", "value", "=", "MockValue", "(", "data", "=", "False", ",", "node", "=", "node", ",", "command_class", "=", "const", ".", "COMMAND_CLAS...
[ 208, 0 ]
[ 221, 31 ]
python
en
['en', 'en', 'en']
True
test_switch_garage_commands
(hass, mock_openzwave)
Test position changed.
Test position changed.
def test_switch_garage_commands(hass, mock_openzwave): """Test position changed.""" node = MockNode() value = MockValue( data=False, node=node, command_class=const.COMMAND_CLASS_SWITCH_BINARY ) values = MockEntityValues(primary=value, node=node) device = cover.get_device(hass=hass, node=...
[ "def", "test_switch_garage_commands", "(", "hass", ",", "mock_openzwave", ")", ":", "node", "=", "MockNode", "(", ")", "value", "=", "MockValue", "(", "data", "=", "False", ",", "node", "=", "node", ",", "command_class", "=", "const", ".", "COMMAND_CLASS_SWI...
[ 224, 0 ]
[ 237, 30 ]
python
en
['en', 'en', 'en']
True
test_barrier_garage_value_changed
(hass, mock_openzwave)
Test position changed.
Test position changed.
def test_barrier_garage_value_changed(hass, mock_openzwave): """Test position changed.""" node = MockNode() value = MockValue( data="Closed", node=node, command_class=const.COMMAND_CLASS_BARRIER_OPERATOR ) values = MockEntityValues(primary=value, node=node) device = cover.get_device(hass...
[ "def", "test_barrier_garage_value_changed", "(", "hass", ",", "mock_openzwave", ")", ":", "node", "=", "MockNode", "(", ")", "value", "=", "MockValue", "(", "data", "=", "\"Closed\"", ",", "node", "=", "node", ",", "command_class", "=", "const", ".", "COMMAN...
[ 240, 0 ]
[ 269, 28 ]
python
en
['en', 'en', 'en']
True
test_barrier_garage_commands
(hass, mock_openzwave)
Test position changed.
Test position changed.
def test_barrier_garage_commands(hass, mock_openzwave): """Test position changed.""" node = MockNode() value = MockValue( data="Closed", node=node, command_class=const.COMMAND_CLASS_BARRIER_OPERATOR ) values = MockEntityValues(primary=value, node=node) device = cover.get_device(hass=hass...
[ "def", "test_barrier_garage_commands", "(", "hass", ",", "mock_openzwave", ")", ":", "node", "=", "MockNode", "(", ")", "value", "=", "MockValue", "(", "data", "=", "\"Closed\"", ",", "node", "=", "node", ",", "command_class", "=", "const", ".", "COMMAND_CLA...
[ 272, 0 ]
[ 285, 33 ]
python
en
['en', 'en', 'en']
True
__git
(*opts)
Runs a git command and returns its output
Runs a git command and returns its output
def __git(*opts): """Runs a git command and returns its output""" cmd = "git " + " ".join(list(opts)) ret = subprocess.check_output(cmd, shell=True) return ret.decode("UTF-8")
[ "def", "__git", "(", "*", "opts", ")", ":", "cmd", "=", "\"git \"", "+", "\" \"", ".", "join", "(", "list", "(", "opts", ")", ")", "ret", "=", "subprocess", ".", "check_output", "(", "cmd", ",", "shell", "=", "True", ")", "return", "ret", ".", "d...
[ 24, 0 ]
[ 28, 30 ]
python
en
['en', 'en', 'en']
True
__gitdiff
(*opts)
Runs a git diff command with no pager set
Runs a git diff command with no pager set
def __gitdiff(*opts): """Runs a git diff command with no pager set""" return __git("--no-pager", "diff", *opts)
[ "def", "__gitdiff", "(", "*", "opts", ")", ":", "return", "__git", "(", "\"--no-pager\"", ",", "\"diff\"", ",", "*", "opts", ")" ]
[ 31, 0 ]
[ 33, 45 ]
python
en
['en', 'en', 'en']
True
branch
()
Returns the name of the current branch
Returns the name of the current branch
def branch(): """Returns the name of the current branch""" name = __git("rev-parse", "--abbrev-ref", "HEAD") name = name.rstrip() return name
[ "def", "branch", "(", ")", ":", "name", "=", "__git", "(", "\"rev-parse\"", ",", "\"--abbrev-ref\"", ",", "\"HEAD\"", ")", "name", "=", "name", ".", "rstrip", "(", ")", "return", "name" ]
[ 36, 0 ]
[ 40, 15 ]
python
en
['en', 'en', 'en']
True
uncommittedFiles
()
Returns a list of all changed files that are not yet committed. This means both untracked/unstaged as well as uncommitted files too.
Returns a list of all changed files that are not yet committed. This means both untracked/unstaged as well as uncommitted files too.
def uncommittedFiles(): """ Returns a list of all changed files that are not yet committed. This means both untracked/unstaged as well as uncommitted files too. """ files = __git("status", "-u", "-s") ret = [] for f in files.splitlines(): f = f.strip(" ") f = re.sub("\s+", " ...
[ "def", "uncommittedFiles", "(", ")", ":", "files", "=", "__git", "(", "\"status\"", ",", "\"-u\"", ",", "\"-s\"", ")", "ret", "=", "[", "]", "for", "f", "in", "files", ".", "splitlines", "(", ")", ":", "f", "=", "f", ".", "strip", "(", "\" \"", "...
[ 43, 0 ]
[ 58, 14 ]
python
en
['en', 'error', 'th']
False
changedFilesBetween
(b1, b2)
Returns a list of files changed between branches b1 and b2
Returns a list of files changed between branches b1 and b2
def changedFilesBetween(b1, b2): """Returns a list of files changed between branches b1 and b2""" current = branch() __git("checkout", "--quiet", b1) __git("checkout", "--quiet", b2) files = __gitdiff("--name-only", "--ignore-submodules", "%s...%s" % (b1, b2)) __git("checko...
[ "def", "changedFilesBetween", "(", "b1", ",", "b2", ")", ":", "current", "=", "branch", "(", ")", "__git", "(", "\"checkout\"", ",", "\"--quiet\"", ",", "b1", ")", "__git", "(", "\"checkout\"", ",", "\"--quiet\"", ",", "b2", ")", "files", "=", "__gitdiff...
[ 61, 0 ]
[ 69, 29 ]
python
en
['en', 'en', 'en']
True
changesInFileBetween
(file, b1, b2, filter=None)
Filters the changed lines to a file between the branches b1 and b2
Filters the changed lines to a file between the branches b1 and b2
def changesInFileBetween(file, b1, b2, filter=None): """Filters the changed lines to a file between the branches b1 and b2""" current = branch() __git("checkout", "--quiet", b1) __git("checkout", "--quiet", b2) diffs = __gitdiff("--ignore-submodules", "-w", "--minimal", "-U0", ...
[ "def", "changesInFileBetween", "(", "file", ",", "b1", ",", "b2", ",", "filter", "=", "None", ")", ":", "current", "=", "branch", "(", ")", "__git", "(", "\"checkout\"", ",", "\"--quiet\"", ",", "b1", ")", "__git", "(", "\"checkout\"", ",", "\"--quiet\""...
[ 72, 0 ]
[ 84, 16 ]
python
en
['en', 'en', 'en']
True
modifiedFiles
(filter=None)
If inside a CI-env (ie. currentBranch=current-pr-branch and the env-var PR_TARGET_BRANCH is defined), then lists out all files modified between these 2 branches. Else, lists out all the uncommitted files in the current branch. Such utility function is helpful while putting checker scripts as part ...
If inside a CI-env (ie. currentBranch=current-pr-branch and the env-var PR_TARGET_BRANCH is defined), then lists out all files modified between these 2 branches. Else, lists out all the uncommitted files in the current branch.
def modifiedFiles(filter=None): """ If inside a CI-env (ie. currentBranch=current-pr-branch and the env-var PR_TARGET_BRANCH is defined), then lists out all files modified between these 2 branches. Else, lists out all the uncommitted files in the current branch. Such utility function is helpful...
[ "def", "modifiedFiles", "(", "filter", "=", "None", ")", ":", "if", "\"PR_TARGET_BRANCH\"", "in", "os", ".", "environ", "and", "branch", "(", ")", "==", "\"current-pr-branch\"", ":", "allFiles", "=", "changedFilesBetween", "(", "os", ".", "environ", "[", "\"...
[ 87, 0 ]
[ 109, 16 ]
python
en
['en', 'error', 'th']
False
listAllFilesInDir
(folder)
Utility function to list all files/subdirs in the input folder
Utility function to list all files/subdirs in the input folder
def listAllFilesInDir(folder): """Utility function to list all files/subdirs in the input folder""" allFiles = [] for root, dirs, files in os.walk(folder): for name in files: allFiles.append(os.path.join(root, name)) return allFiles
[ "def", "listAllFilesInDir", "(", "folder", ")", ":", "allFiles", "=", "[", "]", "for", "root", ",", "dirs", ",", "files", "in", "os", ".", "walk", "(", "folder", ")", ":", "for", "name", "in", "files", ":", "allFiles", ".", "append", "(", "os", "."...
[ 112, 0 ]
[ 118, 19 ]
python
en
['en', 'en', 'en']
True
listFilesToCheck
(filesDirs, filter=None)
Utility function to filter the input list of files/dirs based on the input filter method and returns all the files that need to be checked
Utility function to filter the input list of files/dirs based on the input filter method and returns all the files that need to be checked
def listFilesToCheck(filesDirs, filter=None): """ Utility function to filter the input list of files/dirs based on the input filter method and returns all the files that need to be checked """ allFiles = [] for f in filesDirs: if os.path.isfile(f): if filter is None or filter...
[ "def", "listFilesToCheck", "(", "filesDirs", ",", "filter", "=", "None", ")", ":", "allFiles", "=", "[", "]", "for", "f", "in", "filesDirs", ":", "if", "os", ".", "path", ".", "isfile", "(", "f", ")", ":", "if", "filter", "is", "None", "or", "filte...
[ 121, 0 ]
[ 136, 19 ]
python
en
['en', 'error', 'th']
False
activate
(hass, entity_id=ENTITY_MATCH_ALL)
Activate a scene.
Activate a scene.
def activate(hass, entity_id=ENTITY_MATCH_ALL): """Activate a scene.""" data = {} if entity_id: data[ATTR_ENTITY_ID] = entity_id hass.services.call(DOMAIN, SERVICE_TURN_ON, data)
[ "def", "activate", "(", "hass", ",", "entity_id", "=", "ENTITY_MATCH_ALL", ")", ":", "data", "=", "{", "}", "if", "entity_id", ":", "data", "[", "ATTR_ENTITY_ID", "]", "=", "entity_id", "hass", ".", "services", ".", "call", "(", "DOMAIN", ",", "SERVICE_T...
[ 11, 0 ]
[ 18, 53 ]
python
en
['en', 'it', 'en']
True
dispatcher_connect
( hass: HomeAssistantType, signal: str, target: Callable[..., None] )
Connect a callable function to a signal.
Connect a callable function to a signal.
def dispatcher_connect( hass: HomeAssistantType, signal: str, target: Callable[..., None] ) -> Callable[[], None]: """Connect a callable function to a signal.""" async_unsub = run_callback_threadsafe( hass.loop, async_dispatcher_connect, hass, signal, target ).result() def remove_dispatcher...
[ "def", "dispatcher_connect", "(", "hass", ":", "HomeAssistantType", ",", "signal", ":", "str", ",", "target", ":", "Callable", "[", "...", ",", "None", "]", ")", "->", "Callable", "[", "[", "]", ",", "None", "]", ":", "async_unsub", "=", "run_callback_th...
[ 16, 0 ]
[ 28, 28 ]
python
en
['en', 'en', 'en']
True
async_dispatcher_connect
( hass: HomeAssistantType, signal: str, target: Callable[..., Any] )
Connect a callable function to a signal. This method must be run in the event loop.
Connect a callable function to a signal.
def async_dispatcher_connect( hass: HomeAssistantType, signal: str, target: Callable[..., Any] ) -> Callable[[], None]: """Connect a callable function to a signal. This method must be run in the event loop. """ if DATA_DISPATCHER not in hass.data: hass.data[DATA_DISPATCHER] = {} job = ...
[ "def", "async_dispatcher_connect", "(", "hass", ":", "HomeAssistantType", ",", "signal", ":", "str", ",", "target", ":", "Callable", "[", "...", ",", "Any", "]", ")", "->", "Callable", "[", "[", "]", ",", "None", "]", ":", "if", "DATA_DISPATCHER", "not",...
[ 33, 0 ]
[ 67, 34 ]
python
en
['en', 'en', 'en']
True
dispatcher_send
(hass: HomeAssistantType, signal: str, *args: Any)
Send signal and data.
Send signal and data.
def dispatcher_send(hass: HomeAssistantType, signal: str, *args: Any) -> None: """Send signal and data.""" hass.loop.call_soon_threadsafe(async_dispatcher_send, hass, signal, *args)
[ "def", "dispatcher_send", "(", "hass", ":", "HomeAssistantType", ",", "signal", ":", "str", ",", "*", "args", ":", "Any", ")", "->", "None", ":", "hass", ".", "loop", ".", "call_soon_threadsafe", "(", "async_dispatcher_send", ",", "hass", ",", "signal", ",...
[ 71, 0 ]
[ 73, 78 ]
python
en
['en', 'en', 'en']
True
async_dispatcher_send
(hass: HomeAssistantType, signal: str, *args: Any)
Send signal and data. This method must be run in the event loop.
Send signal and data.
def async_dispatcher_send(hass: HomeAssistantType, signal: str, *args: Any) -> None: """Send signal and data. This method must be run in the event loop. """ target_list = hass.data.get(DATA_DISPATCHER, {}).get(signal, []) for job in target_list: hass.async_add_hass_job(job, *args)
[ "def", "async_dispatcher_send", "(", "hass", ":", "HomeAssistantType", ",", "signal", ":", "str", ",", "*", "args", ":", "Any", ")", "->", "None", ":", "target_list", "=", "hass", ".", "data", ".", "get", "(", "DATA_DISPATCHER", ",", "{", "}", ")", "."...
[ 78, 0 ]
[ 86, 43 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Set up the Zestimate sensor.
Set up the Zestimate sensor.
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Zestimate sensor.""" name = config.get(CONF_NAME) properties = config[CONF_ZPID] sensors = [] for zpid in properties: params = {"zws-id": config[CONF_API_KEY]} params["zpid"] = zpid sensors.ap...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "name", "=", "config", ".", "get", "(", "CONF_NAME", ")", "properties", "=", "config", "[", "CONF_ZPID", "]", "sensors", "=", "[", "]"...
[ 45, 0 ]
[ 55, 31 ]
python
en
['en', 'cs', 'en']
True
ZestimateDataSensor.__init__
(self, name, params)
Initialize the sensor.
Initialize the sensor.
def __init__(self, name, params): """Initialize the sensor.""" self._name = name self.params = params self.data = None self.address = None self._state = None
[ "def", "__init__", "(", "self", ",", "name", ",", "params", ")", ":", "self", ".", "_name", "=", "name", "self", ".", "params", "=", "params", "self", ".", "data", "=", "None", "self", ".", "address", "=", "None", "self", ".", "_state", "=", "None"...
[ 61, 4 ]
[ 67, 26 ]
python
en
['en', 'en', 'en']
True
ZestimateDataSensor.unique_id
(self)
Return the ZPID.
Return the ZPID.
def unique_id(self): """Return the ZPID.""" return self.params["zpid"]
[ "def", "unique_id", "(", "self", ")", ":", "return", "self", ".", "params", "[", "\"zpid\"", "]" ]
[ 70, 4 ]
[ 72, 34 ]
python
en
['en', 'sn', 'en']
True
ZestimateDataSensor.name
(self)
Return the name of the sensor.
Return the name of the sensor.
def name(self): """Return the name of the sensor.""" return f"{self._name} {self.address}"
[ "def", "name", "(", "self", ")", ":", "return", "f\"{self._name} {self.address}\"" ]
[ 75, 4 ]
[ 77, 45 ]
python
en
['en', 'mi', 'en']
True
ZestimateDataSensor.state
(self)
Return the state of the sensor.
Return the state of the sensor.
def state(self): """Return the state of the sensor.""" try: return round(float(self._state), 1) except ValueError: return None
[ "def", "state", "(", "self", ")", ":", "try", ":", "return", "round", "(", "float", "(", "self", ".", "_state", ")", ",", "1", ")", "except", "ValueError", ":", "return", "None" ]
[ 80, 4 ]
[ 85, 23 ]
python
en
['en', 'en', 'en']
True
ZestimateDataSensor.device_state_attributes
(self)
Return the state attributes.
Return the state attributes.
def device_state_attributes(self): """Return the state attributes.""" attributes = {} if self.data is not None: attributes = self.data attributes["address"] = self.address attributes[ATTR_ATTRIBUTION] = ATTRIBUTION return attributes
[ "def", "device_state_attributes", "(", "self", ")", ":", "attributes", "=", "{", "}", "if", "self", ".", "data", "is", "not", "None", ":", "attributes", "=", "self", ".", "data", "attributes", "[", "\"address\"", "]", "=", "self", ".", "address", "attrib...
[ 88, 4 ]
[ 95, 25 ]
python
en
['en', 'en', 'en']
True
ZestimateDataSensor.icon
(self)
Icon to use in the frontend, if any.
Icon to use in the frontend, if any.
def icon(self): """Icon to use in the frontend, if any.""" return ICON
[ "def", "icon", "(", "self", ")", ":", "return", "ICON" ]
[ 98, 4 ]
[ 100, 19 ]
python
en
['en', 'en', 'en']
True
ZestimateDataSensor.update
(self)
Get the latest data and update the states.
Get the latest data and update the states.
def update(self): """Get the latest data and update the states.""" try: response = requests.get(_RESOURCE, params=self.params, timeout=5) data = response.content.decode("utf-8") data_dict = xmltodict.parse(data).get(ZESTIMATE) error_code = int(data_dict["...
[ "def", "update", "(", "self", ")", ":", "try", ":", "response", "=", "requests", ".", "get", "(", "_RESOURCE", ",", "params", "=", "self", ".", "params", ",", "timeout", "=", "5", ")", "data", "=", "response", ".", "content", ".", "decode", "(", "\...
[ 102, 4 ]
[ 134, 74 ]
python
en
['en', 'en', 'en']
True
tile
(x, count, dim=0)
Tiles x on dimension dim count times.
Tiles x on dimension dim count times.
def tile(x, count, dim=0): """ Tiles x on dimension dim count times. """ perm = list(range(len(x.size()))) if dim != 0: perm[0], perm[dim] = perm[dim], perm[0] x = x.permute(perm).contiguous() out_size = list(x.size()) out_size[0] *= count batch = x.size(0) x = x.view...
[ "def", "tile", "(", "x", ",", "count", ",", "dim", "=", "0", ")", ":", "perm", "=", "list", "(", "range", "(", "len", "(", "x", ".", "size", "(", ")", ")", ")", ")", "if", "dim", "!=", "0", ":", "perm", "[", "0", "]", ",", "perm", "[", ...
[ 985, 0 ]
[ 999, 12 ]
python
en
['en', 'error', 'th']
False
TransformerDecoder.forward
( self, input_ids, encoder_hidden_states=None, state=None, attention_mask=None, memory_lengths=None, step=None, cache=None, encoder_attention_mask=None, )
See :obj:`onmt.modules.RNNDecoderBase.forward()` memory_bank = encoder_hidden_states
See :obj:`onmt.modules.RNNDecoderBase.forward()` memory_bank = encoder_hidden_states
def forward( self, input_ids, encoder_hidden_states=None, state=None, attention_mask=None, memory_lengths=None, step=None, cache=None, encoder_attention_mask=None, ): """ See :obj:`onmt.modules.RNNDecoderBase.forward()` ...
[ "def", "forward", "(", "self", ",", "input_ids", ",", "encoder_hidden_states", "=", "None", ",", "state", "=", "None", ",", "attention_mask", "=", "None", ",", "memory_lengths", "=", "None", ",", "step", "=", "None", ",", "cache", "=", "None", ",", "enco...
[ 176, 4 ]
[ 250, 28 ]
python
en
['en', 'error', 'th']
False
TransformerDecoder.init_decoder_state
(self, src, memory_bank, with_cache=False)
Init decoder state
Init decoder state
def init_decoder_state(self, src, memory_bank, with_cache=False): """ Init decoder state """ state = TransformerDecoderState(src) if with_cache: state._init_cache(memory_bank, self.num_layers) return state
[ "def", "init_decoder_state", "(", "self", ",", "src", ",", "memory_bank", ",", "with_cache", "=", "False", ")", ":", "state", "=", "TransformerDecoderState", "(", "src", ")", "if", "with_cache", ":", "state", ".", "_init_cache", "(", "memory_bank", ",", "sel...
[ 252, 4 ]
[ 257, 20 ]
python
en
['fr', 'en', 'en']
True
TransformerDecoderLayer.forward
( self, inputs, memory_bank, src_pad_mask, tgt_pad_mask, previous_input=None, layer_cache=None, step=None, )
Args: inputs (`FloatTensor`): `[batch_size x 1 x model_dim]` memory_bank (`FloatTensor`): `[batch_size x src_len x model_dim]` src_pad_mask (`LongTensor`): `[batch_size x 1 x src_len]` tgt_pad_mask (`LongTensor`): `[batch_size x 1 x 1]` Returns: ...
Args: inputs (`FloatTensor`): `[batch_size x 1 x model_dim]` memory_bank (`FloatTensor`): `[batch_size x src_len x model_dim]` src_pad_mask (`LongTensor`): `[batch_size x 1 x src_len]` tgt_pad_mask (`LongTensor`): `[batch_size x 1 x 1]`
def forward( self, inputs, memory_bank, src_pad_mask, tgt_pad_mask, previous_input=None, layer_cache=None, step=None, ): """ Args: inputs (`FloatTensor`): `[batch_size x 1 x model_dim]` memory_bank (`FloatTensor`...
[ "def", "forward", "(", "self", ",", "inputs", ",", "memory_bank", ",", "src_pad_mask", ",", "tgt_pad_mask", ",", "previous_input", "=", "None", ",", "layer_cache", "=", "None", ",", "step", "=", "None", ",", ")", ":", "dec_mask", "=", "torch", ".", "gt",...
[ 314, 4 ]
[ 368, 32 ]
python
en
['en', 'error', 'th']
False
TransformerDecoderLayer._get_attn_subsequent_mask
(self, size)
Get an attention mask to avoid using the subsequent info. Args: size: int Returns: (`LongTensor`): * subsequent_mask `[1 x size x size]`
Get an attention mask to avoid using the subsequent info.
def _get_attn_subsequent_mask(self, size): """ Get an attention mask to avoid using the subsequent info. Args: size: int Returns: (`LongTensor`): * subsequent_mask `[1 x size x size]` """ attn_shape = (1, size, size) subseque...
[ "def", "_get_attn_subsequent_mask", "(", "self", ",", "size", ")", ":", "attn_shape", "=", "(", "1", ",", "size", ",", "size", ")", "subsequent_mask", "=", "np", ".", "triu", "(", "np", ".", "ones", "(", "attn_shape", ")", ",", "k", "=", "1", ")", ...
[ 371, 4 ]
[ 386, 30 ]
python
en
['en', 'error', 'th']
False
MultiHeadedAttention.forward
( self, key, value, query, mask=None, layer_cache=None, type=None, predefined_graph_1=None, )
Compute the context vector and the attention vectors. Args: key (`FloatTensor`): set of `key_len` key vectors `[batch, key_len, dim]` value (`FloatTensor`): set of `key_len` value vectors `[batch, key_len, dim]` query (`FloatTensor`): se...
Compute the context vector and the attention vectors.
def forward( self, key, value, query, mask=None, layer_cache=None, type=None, predefined_graph_1=None, ): """ Compute the context vector and the attention vectors. Args: key (`FloatTensor`): set of `key_len` ...
[ "def", "forward", "(", "self", ",", "key", ",", "value", ",", "query", ",", "mask", "=", "None", ",", "layer_cache", "=", "None", ",", "type", "=", "None", ",", "predefined_graph_1", "=", "None", ",", ")", ":", "batch_size", "=", "key", ".", "size", ...
[ 448, 4 ]
[ 560, 26 ]
python
en
['en', 'error', 'th']
False
DecoderState.detach
(self)
Need to document this
Need to document this
def detach(self): """ Need to document this """ self.hidden = tuple([_.detach() for _ in self.hidden]) self.input_feed = self.input_feed.detach()
[ "def", "detach", "(", "self", ")", ":", "self", ".", "hidden", "=", "tuple", "(", "[", "_", ".", "detach", "(", ")", "for", "_", "in", "self", ".", "hidden", "]", ")", "self", ".", "input_feed", "=", "self", ".", "input_feed", ".", "detach", "(",...
[ 572, 4 ]
[ 575, 50 ]
python
en
['en', 'en', 'en']
True
DecoderState.beam_update
(self, idx, positions, beam_size)
Need to document this
Need to document this
def beam_update(self, idx, positions, beam_size): """ Need to document this """ for e in self._all: sizes = e.size() br = sizes[1] if len(sizes) == 3: sent_states = e.view(sizes[0], beam_size, br // beam_size, sizes[2])[:, :, idx] else: ...
[ "def", "beam_update", "(", "self", ",", "idx", ",", "positions", ",", "beam_size", ")", ":", "for", "e", "in", "self", ".", "_all", ":", "sizes", "=", "e", ".", "size", "(", ")", "br", "=", "sizes", "[", "1", "]", "if", "len", "(", "sizes", ")"...
[ 577, 4 ]
[ 587, 79 ]
python
en
['en', 'en', 'en']
True
TransformerDecoderState.__init__
(self, src)
Args: src (FloatTensor): a sequence of source words tensors with optional feature tensors, of size (len x batch).
Args: src (FloatTensor): a sequence of source words tensors with optional feature tensors, of size (len x batch).
def __init__(self, src): """ Args: src (FloatTensor): a sequence of source words tensors with optional feature tensors, of size (len x batch). """ self.src = src self.previous_input = None self.previous_layer_inputs = None self.cach...
[ "def", "__init__", "(", "self", ",", "src", ")", ":", "self", ".", "src", "=", "src", "self", ".", "previous_input", "=", "None", "self", ".", "previous_layer_inputs", "=", "None", "self", ".", "cache", "=", "None" ]
[ 596, 4 ]
[ 605, 25 ]
python
en
['en', 'error', 'th']
False
TransformerDecoderState._all
(self)
Contains attributes that need to be updated in self.beam_update().
Contains attributes that need to be updated in self.beam_update().
def _all(self): """ Contains attributes that need to be updated in self.beam_update(). """ if self.previous_input is not None and self.previous_layer_inputs is not None: return (self.previous_input, self.previous_layer_inputs, self.src) else: return (self....
[ "def", "_all", "(", "self", ")", ":", "if", "self", ".", "previous_input", "is", "not", "None", "and", "self", ".", "previous_layer_inputs", "is", "not", "None", ":", "return", "(", "self", ".", "previous_input", ",", "self", ".", "previous_layer_inputs", ...
[ 608, 4 ]
[ 615, 30 ]
python
en
['en', 'error', 'th']
False
TransformerDecoderState.repeat_beam_size_times
(self, beam_size)
Repeat beam_size times along batch dimension.
Repeat beam_size times along batch dimension.
def repeat_beam_size_times(self, beam_size): """ Repeat beam_size times along batch dimension. """ self.src = self.src.data.repeat(1, beam_size, 1)
[ "def", "repeat_beam_size_times", "(", "self", ",", "beam_size", ")", ":", "self", ".", "src", "=", "self", ".", "src", ".", "data", ".", "repeat", "(", "1", ",", "beam_size", ",", "1", ")" ]
[ 639, 4 ]
[ 641, 56 ]
python
en
['cy', 'en', 'en']
True
GNMTGlobalScorer.score
(self, beam, logprobs)
Rescores a prediction based on penalty functions
Rescores a prediction based on penalty functions
def score(self, beam, logprobs): """ Rescores a prediction based on penalty functions """ normalized_probs = self.length_penalty(beam, logprobs, self.alpha) return normalized_probs
[ "def", "score", "(", "self", ",", "beam", ",", "logprobs", ")", ":", "normalized_probs", "=", "self", ".", "length_penalty", "(", "beam", ",", "logprobs", ",", "self", ".", "alpha", ")", "return", "normalized_probs" ]
[ 715, 4 ]
[ 720, 31 ]
python
en
['en', 'error', 'th']
False
PenaltyBuilder.length_wu
(self, beam, logprobs, alpha=0.0)
NMT length re-ranking score from "Google's Neural Machine Translation System" :cite:`wu2016google`.
NMT length re-ranking score from "Google's Neural Machine Translation System" :cite:`wu2016google`.
def length_wu(self, beam, logprobs, alpha=0.0): """ NMT length re-ranking score from "Google's Neural Machine Translation System" :cite:`wu2016google`. """ modifier = ((5 + len(beam.next_ys)) ** alpha) / ((5 + 1) ** alpha) return logprobs / modifier
[ "def", "length_wu", "(", "self", ",", "beam", ",", "logprobs", ",", "alpha", "=", "0.0", ")", ":", "modifier", "=", "(", "(", "5", "+", "len", "(", "beam", ".", "next_ys", ")", ")", "**", "alpha", ")", "/", "(", "(", "5", "+", "1", ")", "**",...
[ 747, 4 ]
[ 754, 34 ]
python
en
['en', 'error', 'th']
False
PenaltyBuilder.length_average
(self, beam, logprobs, alpha=0.0)
Returns the average probability of tokens in a sequence.
Returns the average probability of tokens in a sequence.
def length_average(self, beam, logprobs, alpha=0.0): """ Returns the average probability of tokens in a sequence. """ return logprobs / len(beam.next_ys)
[ "def", "length_average", "(", "self", ",", "beam", ",", "logprobs", ",", "alpha", "=", "0.0", ")", ":", "return", "logprobs", "/", "len", "(", "beam", ".", "next_ys", ")" ]
[ 756, 4 ]
[ 760, 43 ]
python
en
['en', 'error', 'th']
False
PenaltyBuilder.length_none
(self, beam, logprobs, alpha=0.0, beta=0.0)
Returns unmodified scores.
Returns unmodified scores.
def length_none(self, beam, logprobs, alpha=0.0, beta=0.0): """ Returns unmodified scores. """ return logprobs
[ "def", "length_none", "(", "self", ",", "beam", ",", "logprobs", ",", "alpha", "=", "0.0", ",", "beta", "=", "0.0", ")", ":", "return", "logprobs" ]
[ 762, 4 ]
[ 766, 23 ]
python
en
['en', 'error', 'th']
False
Translator.translate
(self, batch, step, attn_debug=False)
Generates summaries from one batch of data.
Generates summaries from one batch of data.
def translate(self, batch, step, attn_debug=False): """Generates summaries from one batch of data.""" self.model.eval() with torch.no_grad(): batch_data = self.translate_batch(batch) translations = self.from_batch(batch_data) return translations
[ "def", "translate", "(", "self", ",", "batch", ",", "step", ",", "attn_debug", "=", "False", ")", ":", "self", ".", "model", ".", "eval", "(", ")", "with", "torch", ".", "no_grad", "(", ")", ":", "batch_data", "=", "self", ".", "translate_batch", "("...
[ 803, 4 ]
[ 809, 27 ]
python
en
['en', 'en', 'en']
True
Translator.translate_batch
(self, batch, fast=False)
Translate a batch of sentences. Mostly a wrapper around :obj:`Beam`. Args: batch (:obj:`Batch`): a batch from a dataset object fast (bool): enables fast beam search (may not support all features)
Translate a batch of sentences.
def translate_batch(self, batch, fast=False): """ Translate a batch of sentences. Mostly a wrapper around :obj:`Beam`. Args: batch (:obj:`Batch`): a batch from a dataset object fast (bool): enables fast beam search (may not support all features) """ ...
[ "def", "translate_batch", "(", "self", ",", "batch", ",", "fast", "=", "False", ")", ":", "with", "torch", ".", "no_grad", "(", ")", ":", "return", "self", ".", "_fast_translate_batch", "(", "batch", ",", "self", ".", "max_length", ",", "min_length", "="...
[ 811, 4 ]
[ 822, 97 ]
python
en
['en', 'error', 'th']
False
Translator._fast_translate_batch
(self, batch, max_length, min_length=0)
Beam Search using the encoder inputs contained in `batch`.
Beam Search using the encoder inputs contained in `batch`.
def _fast_translate_batch(self, batch, max_length, min_length=0): """Beam Search using the encoder inputs contained in `batch`.""" # The batch object is funny # Instead of just looking at the size of the arguments we encapsulate # a size argument. # Where is it defined? ...
[ "def", "_fast_translate_batch", "(", "self", ",", "batch", ",", "max_length", ",", "min_length", "=", "0", ")", ":", "# The batch object is funny", "# Instead of just looking at the size of the arguments we encapsulate", "# a size argument.", "# Where is it defined?", "beam_size"...
[ 826, 4 ]
[ 957, 22 ]
python
en
['en', 'en', 'en']
True
get_service
(hass, config, discovery_info=None)
Get the MessageBird notification service.
Get the MessageBird notification service.
def get_service(hass, config, discovery_info=None): """Get the MessageBird notification service.""" client = messagebird.Client(config[CONF_API_KEY]) try: # validates the api key client.balance() except messagebird.client.ErrorException: _LOGGER.error("The specified MessageBird A...
[ "def", "get_service", "(", "hass", ",", "config", ",", "discovery_info", "=", "None", ")", ":", "client", "=", "messagebird", ".", "Client", "(", "config", "[", "CONF_API_KEY", "]", ")", "try", ":", "# validates the api key", "client", ".", "balance", "(", ...
[ 27, 0 ]
[ 37, 74 ]
python
en
['en', 'lb', 'en']
True
MessageBirdNotificationService.__init__
(self, sender, client)
Initialize the service.
Initialize the service.
def __init__(self, sender, client): """Initialize the service.""" self.sender = sender self.client = client
[ "def", "__init__", "(", "self", ",", "sender", ",", "client", ")", ":", "self", ".", "sender", "=", "sender", "self", ".", "client", "=", "client" ]
[ 43, 4 ]
[ 46, 28 ]
python
en
['en', 'en', 'en']
True
MessageBirdNotificationService.send_message
(self, message=None, **kwargs)
Send a message to a specified target.
Send a message to a specified target.
def send_message(self, message=None, **kwargs): """Send a message to a specified target.""" targets = kwargs.get(ATTR_TARGET) if not targets: _LOGGER.error("No target specified") return for target in targets: try: self.client.message_c...
[ "def", "send_message", "(", "self", ",", "message", "=", "None", ",", "*", "*", "kwargs", ")", ":", "targets", "=", "kwargs", ".", "get", "(", "ATTR_TARGET", ")", "if", "not", "targets", ":", "_LOGGER", ".", "error", "(", "\"No target specified\"", ")", ...
[ 48, 4 ]
[ 62, 24 ]
python
en
['en', 'en', 'en']
True
TestTTSMaryTTSPlatform.setup_method
(self)
Set up things to be run when tests are started.
Set up things to be run when tests are started.
def setup_method(self): """Set up things to be run when tests are started.""" self.hass = get_test_home_assistant() asyncio.run_coroutine_threadsafe( async_process_ha_core_config( self.hass, {"internal_url": "http://example.local:8123"} ), sel...
[ "def", "setup_method", "(", "self", ")", ":", "self", ".", "hass", "=", "get_test_home_assistant", "(", ")", "asyncio", ".", "run_coroutine_threadsafe", "(", "async_process_ha_core_config", "(", "self", ".", "hass", ",", "{", "\"internal_url\"", ":", "\"http://exa...
[ 21, 4 ]
[ 41, 9 ]
python
en
['en', 'en', 'en']
True
TestTTSMaryTTSPlatform.teardown_method
(self)
Stop everything that was started.
Stop everything that was started.
def teardown_method(self): """Stop everything that was started.""" default_tts = self.hass.config.path(tts.DEFAULT_CACHE_DIR) if os.path.isdir(default_tts): shutil.rmtree(default_tts) self.hass.stop()
[ "def", "teardown_method", "(", "self", ")", ":", "default_tts", "=", "self", ".", "hass", ".", "config", ".", "path", "(", "tts", ".", "DEFAULT_CACHE_DIR", ")", "if", "os", ".", "path", ".", "isdir", "(", "default_tts", ")", ":", "shutil", ".", "rmtree...
[ 43, 4 ]
[ 49, 24 ]
python
en
['en', 'en', 'en']
True
TestTTSMaryTTSPlatform.test_setup_component
(self)
Test setup component.
Test setup component.
def test_setup_component(self): """Test setup component.""" config = {tts.DOMAIN: {"platform": "marytts"}} with assert_setup_component(1, tts.DOMAIN): setup_component(self.hass, tts.DOMAIN, config)
[ "def", "test_setup_component", "(", "self", ")", ":", "config", "=", "{", "tts", ".", "DOMAIN", ":", "{", "\"platform\"", ":", "\"marytts\"", "}", "}", "with", "assert_setup_component", "(", "1", ",", "tts", ".", "DOMAIN", ")", ":", "setup_component", "(",...
[ 51, 4 ]
[ 56, 58 ]
python
en
['en', 'da', 'en']
True
TestTTSMaryTTSPlatform.test_service_say
(self)
Test service call say.
Test service call say.
def test_service_say(self): """Test service call say.""" calls = mock_service(self.hass, DOMAIN_MP, SERVICE_PLAY_MEDIA) config = {tts.DOMAIN: {"platform": "marytts"}} with assert_setup_component(1, tts.DOMAIN): setup_component(self.hass, tts.DOMAIN, config) with pa...
[ "def", "test_service_say", "(", "self", ")", ":", "calls", "=", "mock_service", "(", "self", ".", "hass", ",", "DOMAIN_MP", ",", "SERVICE_PLAY_MEDIA", ")", "config", "=", "{", "tts", ".", "DOMAIN", ":", "{", "\"platform\"", ":", "\"marytts\"", "}", "}", ...
[ 58, 4 ]
[ 85, 70 ]
python
en
['en', 'en', 'en']
True
TestTTSMaryTTSPlatform.test_service_say_with_effect
(self)
Test service call say with effects.
Test service call say with effects.
def test_service_say_with_effect(self): """Test service call say with effects.""" calls = mock_service(self.hass, DOMAIN_MP, SERVICE_PLAY_MEDIA) config = { tts.DOMAIN: {"platform": "marytts", "effect": {"Volume": "amount:2.0;"}} } with assert_setup_component(1, tts....
[ "def", "test_service_say_with_effect", "(", "self", ")", ":", "calls", "=", "mock_service", "(", "self", ".", "hass", ",", "DOMAIN_MP", ",", "SERVICE_PLAY_MEDIA", ")", "config", "=", "{", "tts", ".", "DOMAIN", ":", "{", "\"platform\"", ":", "\"marytts\"", ",...
[ 87, 4 ]
[ 116, 70 ]
python
en
['en', 'en', 'en']
True
TestTTSMaryTTSPlatform.test_service_say_http_error
(self)
Test service call say.
Test service call say.
def test_service_say_http_error(self): """Test service call say.""" calls = mock_service(self.hass, DOMAIN_MP, SERVICE_PLAY_MEDIA) config = {tts.DOMAIN: {"platform": "marytts"}} with assert_setup_component(1, tts.DOMAIN): setup_component(self.hass, tts.DOMAIN, config) ...
[ "def", "test_service_say_http_error", "(", "self", ")", ":", "calls", "=", "mock_service", "(", "self", ".", "hass", ",", "DOMAIN_MP", ",", "SERVICE_PLAY_MEDIA", ")", "config", "=", "{", "tts", ".", "DOMAIN", ":", "{", "\"platform\"", ":", "\"marytts\"", "}"...
[ 118, 4 ]
[ 142, 30 ]
python
en
['en', 'en', 'en']
True
get_checkpoint_callback
(output_dir, metric)
Saves the best model by validation EM score.
Saves the best model by validation EM score.
def get_checkpoint_callback(output_dir, metric): """Saves the best model by validation EM score.""" if metric == "rouge2": exp = "{val_avg_rouge2:.4f}-{step_count}" elif metric == "bleu": exp = "{val_avg_bleu:.4f}-{step_count}" elif metric == "em": exp = "{val_avg_em:.4f}-{step_c...
[ "def", "get_checkpoint_callback", "(", "output_dir", ",", "metric", ")", ":", "if", "metric", "==", "\"rouge2\"", ":", "exp", "=", "\"{val_avg_rouge2:.4f}-{step_count}\"", "elif", "metric", "==", "\"bleu\"", ":", "exp", "=", "\"{val_avg_bleu:.4f}-{step_count}\"", "eli...
[ 22, 0 ]
[ 42, 30 ]
python
en
['en', 'en', 'en']
True
flow_handler
(hass)
Return a registered config flow.
Return a registered config flow.
def flow_handler(hass): """Return a registered config flow.""" mock_platform(hass, f"{TEST_DOMAIN}.config_flow") class TestFlowHandler(config_entry_oauth2_flow.AbstractOAuth2FlowHandler): """Test flow handler.""" DOMAIN = TEST_DOMAIN @property def logger(self) -> logging....
[ "def", "flow_handler", "(", "hass", ")", ":", "mock_platform", "(", "hass", ",", "f\"{TEST_DOMAIN}.config_flow\"", ")", "class", "TestFlowHandler", "(", "config_entry_oauth2_flow", ".", "AbstractOAuth2FlowHandler", ")", ":", "\"\"\"Test flow handler.\"\"\"", "DOMAIN", "="...
[ 19, 0 ]
[ 35, 29 ]
python
en
['en', 'da', 'en']
True
test_setup_provide_implementation
(hass)
Test that we provide implementations.
Test that we provide implementations.
async def test_setup_provide_implementation(hass): """Test that we provide implementations.""" account_link.async_setup(hass) with patch( "homeassistant.components.cloud.account_link._get_services", return_value=[ {"service": "test", "min_version": "0.1.0"}, {"servic...
[ "async", "def", "test_setup_provide_implementation", "(", "hass", ")", ":", "account_link", ".", "async_setup", "(", "hass", ")", "with", "patch", "(", "\"homeassistant.components.cloud.account_link._get_services\"", ",", "return_value", "=", "[", "{", "\"service\"", ":...
[ 38, 0 ]
[ 66, 48 ]
python
en
['en', 'en', 'en']
True
test_get_services_cached
(hass)
Test that we cache services.
Test that we cache services.
async def test_get_services_cached(hass): """Test that we cache services.""" hass.data["cloud"] = None services = 1 with patch.object(account_link, "CACHE_TIMEOUT", 0), patch( "hass_nabucasa.account_link.async_fetch_available_services", side_effect=lambda _: services, ) as mock_fet...
[ "async", "def", "test_get_services_cached", "(", "hass", ")", ":", "hass", ".", "data", "[", "\"cloud\"", "]", "=", "None", "services", "=", "1", "with", "patch", ".", "object", "(", "account_link", ",", "\"CACHE_TIMEOUT\"", ",", "0", ")", ",", "patch", ...
[ 69, 0 ]
[ 95, 58 ]
python
en
['en', 'en', 'en']
True
test_get_services_error
(hass)
Test that we cache services.
Test that we cache services.
async def test_get_services_error(hass): """Test that we cache services.""" hass.data["cloud"] = None with patch.object(account_link, "CACHE_TIMEOUT", 0), patch( "hass_nabucasa.account_link.async_fetch_available_services", side_effect=asyncio.TimeoutError, ): assert await accoun...
[ "async", "def", "test_get_services_error", "(", "hass", ")", ":", "hass", ".", "data", "[", "\"cloud\"", "]", "=", "None", "with", "patch", ".", "object", "(", "account_link", ",", "\"CACHE_TIMEOUT\"", ",", "0", ")", ",", "patch", "(", "\"hass_nabucasa.accou...
[ 98, 0 ]
[ 107, 58 ]
python
en
['en', 'en', 'en']
True
test_implementation
(hass, flow_handler)
Test Cloud OAuth2 implementation.
Test Cloud OAuth2 implementation.
async def test_implementation(hass, flow_handler): """Test Cloud OAuth2 implementation.""" hass.data["cloud"] = None impl = account_link.CloudOAuth2Implementation(hass, "test") assert impl.name == "Home Assistant Cloud" assert impl.domain == "cloud" flow_handler.async_register_implementation(h...
[ "async", "def", "test_implementation", "(", "hass", ",", "flow_handler", ")", ":", "hass", ".", "data", "[", "\"cloud\"", "]", "=", "None", "impl", "=", "account_link", ".", "CloudOAuth2Implementation", "(", "hass", ",", "\"test\"", ")", "assert", "impl", "....
[ 110, 0 ]
[ 169, 5 ]
python
en
['nl', 'fr', 'en']
False
normalize
(inputs, epsilon=1e-8, scope="ln")
Applies layer normalization. Args: inputs: A tensor with 2 or more dimensions, where the first dimension has `batch_size`. epsilon: A floating number. A very small number for preventing ZeroDivision Error. scope: Optional scope for `variable_scope`. reuse: Boolean, whether to reuse ...
Applies layer normalization.
def normalize(inputs, epsilon=1e-8, scope="ln"): '''Applies layer normalization. Args: inputs: A tensor with 2 or more dimensions, where the first dimension has `batch_size`. epsilon: A floating number. A very small number for preventing ZeroDivision Error. ...
[ "def", "normalize", "(", "inputs", ",", "epsilon", "=", "1e-8", ",", "scope", "=", "\"ln\"", ")", ":", "with", "tf", ".", "variable_scope", "(", "scope", ")", ":", "inputs_shape", "=", "inputs", ".", "get_shape", "(", ")", "params_shape", "=", "inputs_sh...
[ 27, 0 ]
[ 53, 18 ]
python
en
['es', 'en', 'en']
True
multihead_attention
(queries, keys, scope="multihead_attention", num_units=None, num_heads=4, dropout_rate=0, is_training=True, causality=False)
Applies multihead attention. Args: queries: A 3d tensor with shape of [N, T_q, C_q]. keys: A 3d tensor with shape of [N, T_k, C_k]. num_units: A cdscalar. Attention size. dropout_rate: A floating point number. is_training: Boolean. Controller of mechanism for dropout. causality:...
Applies multihead attention.
def multihead_attention(queries, keys, scope="multihead_attention", num_units=None, num_heads=4, dropout_rate=0, is_training=True, causality=False): ...
[ "def", "multihead_attention", "(", "queries", ",", "keys", ",", "scope", "=", "\"multihead_attention\"", ",", "num_units", "=", "None", ",", "num_heads", "=", "4", ",", "dropout_rate", "=", "0", ",", "is_training", "=", "True", ",", "causality", "=", "False"...
[ 56, 0 ]
[ 163, 18 ]
python
en
['fi', 'en', 'en']
True
positional_encoding
(inputs, num_units=None, zero_pad=True, scale=True, scope="positional_encoding", reuse=None)
Return positinal embedding.
Return positinal embedding.
def positional_encoding(inputs, num_units=None, zero_pad=True, scale=True, scope="positional_encoding", reuse=None): ''' Return positinal embedding. ''' Shape = tf.shape(inputs) N ...
[ "def", "positional_encoding", "(", "inputs", ",", "num_units", "=", "None", ",", "zero_pad", "=", "True", ",", "scale", "=", "True", ",", "scope", "=", "\"positional_encoding\"", ",", "reuse", "=", "None", ")", ":", "Shape", "=", "tf", ".", "shape", "(",...
[ 166, 0 ]
[ 204, 22 ]
python
en
['en', 'error', 'th']
False
feedforward
(inputs, num_units, scope="multihead_attention")
Point-wise feed forward net. Args: inputs: A 3d tensor with shape of [N, T, C]. num_units: A list of two integers. scope: Optional scope for `variable_scope`. reuse: Boolean, whether to reuse the weights of a previous layer by the same name. Returns: A 3d tensor with the ...
Point-wise feed forward net.
def feedforward(inputs, num_units, scope="multihead_attention"): '''Point-wise feed forward net. Args: inputs: A 3d tensor with shape of [N, T, C]. num_units: A list of two integers. scope: Optional scope for `variable_scope`. reuse: Boolean, whether to r...
[ "def", "feedforward", "(", "inputs", ",", "num_units", ",", "scope", "=", "\"multihead_attention\"", ")", ":", "with", "tf", ".", "variable_scope", "(", "scope", ")", ":", "# Inner layer", "params", "=", "{", "\"inputs\"", ":", "inputs", ",", "\"filters\"", ...
[ 207, 0 ]
[ 239, 18 ]
python
en
['en', 'en', 'en']
True
setup_platform
(hass, config, add_entities, discovery_info=None)
Find and return switches controlled by shell commands.
Find and return switches controlled by shell commands.
def setup_platform(hass, config, add_entities, discovery_info=None): """Find and return switches controlled by shell commands.""" setup_reload_service(hass, DOMAIN, PLATFORMS) devices = config.get(CONF_SWITCHES, {}) switches = [] for object_id, device_config in devices.items(): value_temp...
[ "def", "setup_platform", "(", "hass", ",", "config", ",", "add_entities", ",", "discovery_info", "=", "None", ")", ":", "setup_reload_service", "(", "hass", ",", "DOMAIN", ",", "PLATFORMS", ")", "devices", "=", "config", ".", "get", "(", "CONF_SWITCHES", ","...
[ 42, 0 ]
[ 73, 26 ]
python
en
['en', 'en', 'en']
True
CommandSwitch.__init__
( self, hass, object_id, friendly_name, command_on, command_off, command_state, value_template, timeout, )
Initialize the switch.
Initialize the switch.
def __init__( self, hass, object_id, friendly_name, command_on, command_off, command_state, value_template, timeout, ): """Initialize the switch.""" self._hass = hass self.entity_id = ENTITY_ID_FORMAT.format(object_id) ...
[ "def", "__init__", "(", "self", ",", "hass", ",", "object_id", ",", "friendly_name", ",", "command_on", ",", "command_off", ",", "command_state", ",", "value_template", ",", "timeout", ",", ")", ":", "self", ".", "_hass", "=", "hass", "self", ".", "entity_...
[ 79, 4 ]
[ 99, 31 ]
python
en
['en', 'en', 'en']
True
CommandSwitch._switch
(self, command)
Execute the actual commands.
Execute the actual commands.
def _switch(self, command): """Execute the actual commands.""" _LOGGER.info("Running command: %s", command) success = call_shell_with_timeout(command, self._timeout) == 0 if not success: _LOGGER.error("Command failed: %s", command) return success
[ "def", "_switch", "(", "self", ",", "command", ")", ":", "_LOGGER", ".", "info", "(", "\"Running command: %s\"", ",", "command", ")", "success", "=", "call_shell_with_timeout", "(", "command", ",", "self", ".", "_timeout", ")", "==", "0", "if", "not", "suc...
[ 101, 4 ]
[ 110, 22 ]
python
en
['en', 'en', 'en']
True
CommandSwitch._query_state_value
(self, command)
Execute state command for return value.
Execute state command for return value.
def _query_state_value(self, command): """Execute state command for return value.""" _LOGGER.info("Running state value command: %s", command) return check_output_or_log(command, self._timeout)
[ "def", "_query_state_value", "(", "self", ",", "command", ")", ":", "_LOGGER", ".", "info", "(", "\"Running state value command: %s\"", ",", "command", ")", "return", "check_output_or_log", "(", "command", ",", "self", ".", "_timeout", ")" ]
[ 112, 4 ]
[ 115, 58 ]
python
en
['en', 'en', 'en']
True
CommandSwitch._query_state_code
(self, command)
Execute state command for return code.
Execute state command for return code.
def _query_state_code(self, command): """Execute state command for return code.""" _LOGGER.info("Running state code command: %s", command) return ( call_shell_with_timeout(command, self._timeout, log_return_code=False) == 0 )
[ "def", "_query_state_code", "(", "self", ",", "command", ")", ":", "_LOGGER", ".", "info", "(", "\"Running state code command: %s\"", ",", "command", ")", "return", "(", "call_shell_with_timeout", "(", "command", ",", "self", ".", "_timeout", ",", "log_return_code...
[ 117, 4 ]
[ 122, 9 ]
python
en
['en', 'en', 'en']
True
CommandSwitch.should_poll
(self)
Only poll if we have state command.
Only poll if we have state command.
def should_poll(self): """Only poll if we have state command.""" return self._command_state is not None
[ "def", "should_poll", "(", "self", ")", ":", "return", "self", ".", "_command_state", "is", "not", "None" ]
[ 125, 4 ]
[ 127, 46 ]
python
en
['en', 'en', 'en']
True
CommandSwitch.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" ]
[ 130, 4 ]
[ 132, 25 ]
python
en
['en', 'en', 'en']
True
CommandSwitch.is_on
(self)
Return true if device is on.
Return true if device is on.
def is_on(self): """Return true if device is on.""" return self._state
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "_state" ]
[ 135, 4 ]
[ 137, 26 ]
python
en
['en', 'fy', 'en']
True