Skip to content

False positive for WPS201 in __init__.py #3570

@Evgenmater

Description

@Evgenmater

WPS201 is reported in an __init__.py file that is used as a public module.
Such modules often re-export multiple objects to provide a convenient import surface.

Example:

from myapp.infra.dtos.example_parts.example_first import ExampleFirst as ExampleFirst
from myapp.infra.dtos.example_parts.example_second import ExampleSecond as ExampleSecond

Example usage:

from myapp.infra.dtos.example import example_parts
example_parts.ExampleFirst
example_parts.ExampleSecond

Expected behavior:
__init__.py acting as a public namespace module should not trigger WPS201.

Possible solutions:
Exclude __init__.py from WPS201.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions