8000 Make rcsetup.py flak8 compliant by hershen · Pull Request #12543 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Make rcsetup.py flak8 compliant #12543

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

Merged
merged 1 commit into from
Oct 28, 2018

Conversation

hershen
Copy link
Contributor
@hershen hershen commented Oct 17, 2018

PR Summary

Inspired by #12525, this PR makes rcsetup.py flake8 compliant.

Copy link
Member
@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome to matplotlib and thanks for your contribution! Please be aware that, while some flake8 execeptions are there because of historical non-compliant code, we leave others intentionally in place.

@@ -74,7 +74,8 @@ def f(s):
if allow_stringlist:
# Sometimes, a list of colors might be a single string
# of single-letter colornames. So give that a shot.
return [scalar_validator(v.strip()) for v in s if v.strip()]
return [scalar_validator(v.strip()) for v in s if
v.strip()]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The preferred way to split list comprehensions is before the keyword for (and/or if if additionally required:

return [scalar_validator(v.strip())
        for v in s if v.strip()]

This keeps the logical blocks together.

# http://nedbatchelder.com/blog/201206/eval_really_is_dangerous.html
# We should replace this eval with a combo of PyParsing and
# ast.literal_eval()
# TODO: We might want to rethink this...
Copy link
8000
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you dedenting here? This was correctly indented 4 spaces.

@@ -1012,7 +1015,7 @@ def _validate_linestyle(ls):
'lines.solid_joinstyle': ['round', validate_joinstyle],
'lines.dash_capstyle': ['butt', validate_capstyle],
'lines.solid_capstyle': ['projecting', validate_capstyle],
'lines.dashed_pattern': [[3.7, 1.6], validate_nseq_float(allow_none=True)],
'lines.dashed_pattern': [[3.7, 1.6], validate_nseq_float(allow_none=True)],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While generally, we try to be flake8 conform, I would not insist on line length limits for the definition of the default parameters. These definitions should be kept as structured as possible. I thus propose to leave E501 in and limit the changes to defaultParams to cases where we do not have to bent over or excessively stretch comments over serveral lines to satisfy the line limit.

@hershen hershen force-pushed the make-flake8-complient branch from 07af35f to e0e068f Compare October 28, 2018 16:34
@hershen
Copy link
Contributor Author
hershen commented Oct 28, 2018

Thanks @timhoffm.
I removed the problematic changes.

@timhoffm
Copy link
Member

Thanks @hershen and congratulations to your first contribution to matplotlib!

@timhoffm timhoffm merged commit 5e2e9c2 into matplotlib:master Oct 28, 2018
@tacaswell tacaswell added this to the v3.1 milestone Oct 28, 2018
@hershen
Copy link
Contributor Author
hershen commented Oct 28, 2018

Thanks!

@hershen hershen deleted the make-flake8-complient branch October 29, 2018 21:50
@hershen hershen restored the make-flake8-complient branch October 29, 2018 21:50
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.

4 participants
0