Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Flake8 code style fixes#241

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed

Conversation

roaffix
Copy link
Contributor

  • Fix flake8 errors
  • Fix some FIXME tags
  • Moveto_str method to library from utils to avoid import errors

@roaffixroaffix changed the base branch frommaster todevNovember 13, 2020 04:54
@roaffixroaffix changed the titleFlake8 code stype fixesFlake8 code style fixesNov 13, 2020
Copy link
Member

@9prady99prady9 left a comment

Choose a reason for hiding this comment

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

Most of utility abstractions look good although it seems majority of if checks are now contradicting PEP8 style in the following two patterns:

  1. if <var> is None: orif <var> is not None should be preferred overif <var>: per PEP8 guidline -https://www.python.org/dev/peps/pep-0008/#programming-recommendations
  2. if <var> == 0 or <some number> - not sure what's PEP8 stance on this type of comparisons, but numerical comparisons are better written this way to ensure better code readability and understanding instead ofif <var>: which seems like checking for None and may lead to confusion.

roaffix reacted with eyes emoji
@roaffixroaffixforce-pushed thefix/flake8-refactoring branch 2 times, most recently from16f3c01 to9b328f1CompareNovember 13, 2020 17:18
@roaffix
Copy link
ContributorAuthor

Most of utility abstractions look good although it seems majority of if checks are now contradicting PEP8 style in the following two patterns:

  1. if <var> is None: orif <var> is not None should be preferred overif <var>: per PEP8 guidline -https://www.python.org/dev/peps/pep-0008/#programming-recommendations
  2. if <var> == 0 or <some number> - not sure what's PEP8 stance on this type of comparisons, but numerical comparisons are better written this way to ensure better code readability and understanding instead ofif <var>: which seems like checking for None and may lead to confusion.

You are right. Some variables are considered to beNone by default, so it should be checked. Nice catch! I'll fix that.
In other cases, some of your checks, e.g.,AF_PATH inlibrary.py check ifAF_PATH is None, but it should fail ifAF_PATH == "". Simple conditions change toif AF_PATH can fix such problems when the default value or variable type is not known.

location = Source.device
else:
location = Source.host
location = Source.device if is_device else Source.host
Copy link
Contributor

Choose a reason for hiding this comment

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

revert

roaffix reacted with thumbs down emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

IMO, it's better now :)

high_arr = constant_array(high, vdims[0], vdims[1], vdims[2], vdims[3], vty)
else:
high_arr = high.arr
low_arr = low.arr if is_low_array else constant_array(low, vdims[0], vdims[1], vdims[2], vdims[3], vty)
Copy link
Contributor

Choose a reason for hiding this comment

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

revert

roaffix reacted with thumbs down emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Still, I don't see a point to revert these changes. These variables are just temp variables and they are not changed later anyhow. But we drop extra 7 lines of code.

@roaffixroaffix reopened thisNov 14, 2020
@roaffixroaffixforce-pushed thefix/flake8-refactoring branch 4 times, most recently fromc20136f to911be16CompareNovember 14, 2020 16:24
@roaffix
Copy link
ContributorAuthor

I'm going to postpone this PR till#244 is merged. I will add the arg--flake8 to the pytest for automatic code style checks here right after.

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

@9prady99prady99prady9 left review comments

@syurkevisyurkevisyurkevi left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@roaffix@9prady9@syurkevi

[8]ページ先頭

©2009-2025 Movatter.jp