strip_or_import no longer fixes types of the form "module.foo[str,str]"
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
Bug Report
Stubgenc's strip_or_import no longer fixes types that contain a [.
This seems to be caused by #14564
Specifically, [ is not included in the match for the regex replacement. This causes the subtype before the [ to not be replaced as it should be.
To Reproduce
Create a py extension with a function which has a return type referencing a class in the local module with [ in the type.
Expected Behavior
The fully-qualified module should be excluded.
class KeysView[str]:
...
class MyMap:
def keys(self) -> KeysView[str]: ...
Actual Behavior
The fully-qualified name is left behind and not replaced.
class KeysView[str]:
...
class MyMap:
def keys(self) -> full.module.name.KeysView[str]: ...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate stubgenc's strip_or_import implementation and inspect the regex replacement that handles qualified names. Reproduce the issue with a return type such as KeysView[str]; done means the local module prefix is removed from the subtype while preserving the bracketed type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100