Skip to content

F401 + F811 - auto-fix removes both top the level import and any inside-function import #10905

@Adamasterr

Description

@Adamasterr

Hello!

Here's a minimal example, applying auto-fix to the following:

import os  # F401


def function():
    import os  # F811

    print(os.name)

Results in the following:

def function():

    print(os.name)  # F821, here, "os" is not defined

This makes for a fix that breaks the code.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingfixesRelated to suggested fixes for violations

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions