Skip to content

Block autopep off/on does not work for imports #770

Open
@KubaO

Description

@KubaO

autopep8 off/on doesn't work

Before formatting:

# autopep8: off
import sys
sys.dont_write_bytecode = True
# autopep8: on
import locale

After:

# autopep8: off
import locale
import sys
sys.dont_write_bytecode = True
# autopep8: on

The workaround is to add a semicolon and join the import line with the non-import line(s):

# autopep8: off
import sys; sys.dont_write_bytecode = True
# autopep8: on
import locale

Originally posted by @PlatonB in #460 (comment)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions