Skip to content

False positive deprecated-module caused by name collision #4629

@akosthekiss

Description

@akosthekiss

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]

Metadata

Metadata

Assignees

Labels

False Positive 🦟A message is emitted but nothing is wrong with the code

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions