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

False positive deprecated-module caused by name collision #4629

Closed
akosthekiss opened this issue Jun 29, 2021 · 4 comments · Fixed by #4678
Closed

False positive deprecated-module caused by name collision #4629

akosthekiss opened this issue Jun 29, 2021 · 4 comments · Fixed by #4678
Assignees
Labels
False Positive 🦟 A message is emitted but nothing is wrong with the code

Comments

@akosthekiss
Copy link

Steps to reproduce

Given multiple files:

mypkg/
    formatter/
        __init__.py
    other/
        __init__.py
    __init__.py

Where:

"""mypkg/formatter/__init__.py"""

def fmtr():
    """fmtr()"""
"""mypkg/other/__init__.py"""

from ..formatter import fmtr
"""mypkg/__init__.py"""

from . import formatter
from .formatter import fmtr

Current behavior

Result of pylint mypkg:

************* Module mypkg
mypkg/__init__.py:4:0: W0402: Uses of a deprecated module 'formatter' (deprecated-module)
************* Module mypkg.other
mypkg/other/__init__.py:3:0: W0402: Uses of a deprecated module 'formatter' (deprecated-module)

Expected behavior

No deprecated-module diagnostics.

pylint --version output

Result of pylint --version output:

pylint 3.0.0-a4
astroid 2.6.1
Python 3.6.9 (default, Jan 26 2021, 15:33:00) 
[GCC 8.4.0]
pylint 2.9.0
astroid 2.6.1
Python 3.6.9 (default, Jan 26 2021, 15:33:00) 
[GCC 8.4.0]
@Pierre-Sassoulas Pierre-Sassoulas added the False Positive 🦟 A message is emitted but nothing is wrong with the code label Jun 30, 2021
@Pierre-Sassoulas
Copy link
Member

@matusvalo do you have an idea how to fix this ? Can we use the absolute name to do the check ?

@matusvalo
Copy link
Collaborator

I suppose that yes. I will investigate.

@matusvalo
Copy link
Collaborator

Please assign this issue to me.

@Pierre-Sassoulas
Copy link
Member

Thank you for handling this, much appreciated :)

@Pierre-Sassoulas Pierre-Sassoulas changed the title False positive deprecated-module if module is named formatter False positive deprecated-module caused by name collision Jul 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
False Positive 🦟 A message is emitted but nothing is wrong with the code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants