Skip to content

manual-from-import (PLR0402)

Added in v0.0.155 · Related issues · View source

Derived from the Pylint linter.

Fix is sometimes available.

What it does

Checks for submodule imports that are aliased to the submodule name.

Why is this bad?

Using the from keyword to import the submodule is more concise and readable.

Example

import concurrent.futures as futures

Use instead:

from concurrent import futures

Options

This rule will not trigger on imports required by the isort configuration.

References