Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix import statement moved above the module doc by E402 #467

Conversation

Hanaasagi
Copy link
Contributor

@Hanaasagi Hanaasagi commented Jan 13, 2019

This pull request resolves that import statement moved above the module document when fixing E402. I don't want to use the pycodestyle.DOCSTRING_REGEX to check whether this line is a docstring. Because pycodestyle implement it as:

DOCSTRING_REGEX = re.compile(r'u?r?["\']')

In PEP 257 -- Docstring Conventions

For consistency, always use """triple double quotes""" around docstrings. Use r"""raw triple double quotes""" if you use any backslashes in your docstrings. For Unicode docstrings, use u"""Unicode triple-quoted strings""".

So, I add a regex DOCSTRING_START_REGEX to match the module doc prefix.

resolves #459

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.01%) to 98.67% when pulling 59318cb on Hanaasagi:fix/import-statement-moved-above-docstring-by-E402 into 89886b4 on hhatto:master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.01%) to 98.67% when pulling 59318cb on Hanaasagi:fix/import-statement-moved-above-docstring-by-E402 into 89886b4 on hhatto:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.01%) to 98.67% when pulling 59318cb on Hanaasagi:fix/import-statement-moved-above-docstring-by-E402 into 89886b4 on hhatto:master.

@hhatto
Copy link
Owner

hhatto commented Jan 13, 2019

Cool!!

LGTM 👍

@hhatto hhatto merged commit 3addaa7 into hhatto:master Jan 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Imports are always moved to top of the file
3 participants