[GRASS-git] [OSGeo/grass-addons] 388845: Replaced num of params for setitem method (#993)

Ataf Fazledin Ahamed noreply at github.com
Mon Jan 8 08:04:48 PST 2024


  Branch: refs/heads/grass8
  Home:   https://github.com/OSGeo/grass-addons
  Commit: 388845466ec4680c6d6036a9818c86fb888177d1
      https://github.com/OSGeo/grass-addons/commit/388845466ec4680c6d6036a9818c86fb888177d1
  Author: Ataf Fazledin Ahamed <ataf at openrefactory.com>
  Date:   2024-01-08 (Mon, 08 Jan 2024)

  Changed paths:
    M src/vector/v.civil/road_tables.py

  Log Message:
  -----------
  Replaced num of params for setitem method (#993)

In file: road_tables.py, class: RoadTable, there is a special method __setitem__ that contains an unexpected number of parameters. Each call to this method will result in a TypeError. iCR suggested that special methods should have an expected number of parameters. More infomation can be found in the Python documentation on the various special method.

Here, the error is being thrown, because the __setitem__ method (the one under the hood), is expecting another argument called value- because we defined our __setitem__ method as such. Which is why, we must follow documentation and implement the methods accordingly. In this case, we can simply extract the index and name from the parameter which can be a tuple.

Signed-off-by: fazledyn-or <ataf at openrefactory.com>




More information about the grass-commit mailing list