Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: incorrect docstring on ImportFrom.level #2571

Open
epenet opened this issue Sep 20, 2024 · 0 comments
Open

Bug: incorrect docstring on ImportFrom.level #2571

epenet opened this issue Sep 20, 2024 · 0 comments

Comments

@epenet
Copy link

epenet commented Sep 20, 2024

According to the docstring the level of a relative import is 0 for absolute imports.
However, in practise it is actually None.

See:

# TODO When is 'level' None?
self.level: int | None = level # can be None
"""The level of relative import.
Essentially this is the number of dots in the import.
This is always 0 for absolute imports.
"""

I would suggest that the TODO is removed and that the docstring is ajusted accordingly.

python -c "from astroid import __pkginfo__; print(__pkginfo__.version)" output

3.2.4

@epenet epenet changed the title Bug: incorrect docstring on ImportFrom node Bug: incorrect docstring on ImportFrom.level Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant