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

Solve all flake8 warnings #163

Merged
merged 3 commits into from
May 31, 2017
Merged

Solve all flake8 warnings #163

merged 3 commits into from
May 31, 2017

Conversation

JoeLametta
Copy link
Collaborator

I've checked with pep8 too: now whipper is fully PEP8 compliant.
Implemented changes proposed by Freso.

I've checked with pep8 too: now whipper is fully PEP8 compliant.
Implemented changes proposed by Freso.
Copy link
Member

@Freso Freso left a comment

Choose a reason for hiding this comment

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

A few more comments, but nothing I think should block the PR. If you don't feel like implementing my changes, I might just make a follow up PR myself to do so. ;)

@@ -65,6 +67,8 @@ def _flac_encode(self):
# I only made it a task for now because that it's easier to integrate in
# program/cdparanoia.py - where whipper currently does the tagging.
# We should just move the tagging to a more sensible place.


Copy link
Member

Choose a reason for hiding this comment

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

I still think the comments should move "into" the class they're commenting on, rather than being separated further from it. Does flake8 also complain if the comments are inside the class?

# of current track as parsed so far reset on each TRACK statement
currentLength = 0
totalLength = 0 # accrued during TRACK record parsing, total disc
pregapLength = 0 # length of the pre-gap, current track in for loop
Copy link
Member

Choose a reason for hiding this comment

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

I also still think it would make more sense to put the comments before the assignments here, esp. considering the long comment for relativeOffset.

@@ -68,14 +68,15 @@ def readCue(self, name):
version so we can use it in comparisons.
"""
ret = open(os.path.join(os.path.dirname(__file__), name)).read(
).decode('utf-8')
).decode('utf-8')
Copy link
Member

Choose a reason for hiding this comment

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

Maybe instead do something like:

        cuefile = os.path.join(os.path.dirname(__file__), name)
        ret = open(cuefile).read().decode('utf-8')

This still splits it up in two lines, but instead of continuing one line's logic into the next, it makes the two lines have distinct pieces of the logic, making it easier to follow along in the code.

Copy link
Member

Choose a reason for hiding this comment

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

(Same as you did with filename in some of the tests further down.)

@@ -21,23 +21,25 @@ def tearDown(self):

def testAddReadOffset(self):
self.assertRaises(KeyError,
self._config.getReadOffset, 'PLEXTOR ', 'DVDR PX-L890SA', '1.05')
self._config.getReadOffset, 'PLEXTOR ',
Copy link
Member

Choose a reason for hiding this comment

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

I would move 'PLEXTOR ', to the next line and maybe move self._config.… to the line above (if that still stays within the limit) or just keep that on its own line. It's nicer on the (well, my :)) eyes to have the drive info together.

self.assertEquals(offset, 6)

def testAddReadOffsetSpaced(self):
self.assertRaises(KeyError,
self._config.getReadOffset, 'Slimtype', 'eSAU208 2 ', 'ML03')
self._config.getReadOffset, 'Slimtype',
Copy link
Member

Choose a reason for hiding this comment

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

Same as the testAddReadOffset() comment.

Second round of improvements suggested by Freso.
@JoeLametta JoeLametta merged commit b6fb7e8 into master May 31, 2017
@JoeLametta JoeLametta deleted the flake8-clean branch June 21, 2017 19:21
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.

2 participants