metadata_add_all._add_enum_value_python_name() removes common prefixes, suffixes from a user-set 'python_name'.

Open
#2,066 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
tooling

Research direction

Locate metadata_add_all._add_enum_value_python_name() and trace how enum values receive their python_name. Verify that user-set values remain unchanged while automatically expanded names may have common prefixes or suffixes removed; confirm the behavior with the relevant existing tests, if present.

Written by the indexing model from the issue text.

Description

codegen
Description of issue

The 'python_name' key for enum values pulls double duty in metadata_add_all._add_enum_value_python_name(). It's intended that a user can set it to override the expanded name with the name that they want to be used in the API. In such a case, the user-set value should not be modified. But the helper method also uses the same key for the expansion process when it's not set by the user and does not track whether the user set it. As a result, common prefixes or suffixes may get removed from the user-set 'python_name', instead of using it, as is, to override the expanded name.

Dominant language
Python
Stars
128
Forks
110
Avg merge
5d 14h
Merged PRs (30d)
10

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ni/nimi-python

All issues in ni/nimi-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.