Skip to content

Conversation

@sourcery-ai
Copy link

@sourcery-ai sourcery-ai bot commented May 31, 2020

Branch master refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the master branch, then run:

git fetch origin sourcery/master
git merge --ff-only FETCH_HEAD
git reset HEAD^

self.path = os.path.relpath(path, local.root)
else:
self.path = path
self.path = os.path.relpath(path, local.root) if path.startswith('/') else path
Copy link
Author

Choose a reason for hiding this comment

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

Function LocalResource.__init__ refactored with the following changes:

  • Replace if statement with if expression

Comment on lines -102 to +99
while len(paths_to_get) > 0:
while paths_to_get:
Copy link
Author

Choose a reason for hiding this comment

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

Function Local.all_resources refactored with the following changes:

  • Simplify sequence comparison


def remote_names_from_config(config):
return set(d['remote'] for d in config if 'remote' in d)
return {d['remote'] for d in config if 'remote' in d}
Copy link
Author

Choose a reason for hiding this comment

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

Function remote_names_from_config refactored with the following changes:

  • Replace list(), dict() or set() with comprehension

root = SunVoxDir(self, top)
paths_to_get = [root]
while len(paths_to_get) > 0:
while paths_to_get:
Copy link
Author

Choose a reason for hiding this comment

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

Function SunVoxRemote.all_resources refactored with the following changes:

  • Simplify sequence comparison

hrefs = {a.attrib['href'] for a in doc('a')}
names = {href for href in hrefs if not href.startswith('?')}
return names
return {href for href in hrefs if not href.startswith('?')}
Copy link
Author

Choose a reason for hiding this comment

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

Function SunVoxRemote.names_in_page refactored with the following changes:

  • Inline variable that is only used once

Comment on lines -143 to +142
doc = PQ(response.content)
return doc
return PQ(response.content)
Copy link
Author

Choose a reason for hiding this comment

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

Function SunVoxRemote.page_for_path refactored with the following changes:

  • Inline variable that is only used once

print()
print('Ensuring directories:')
dest_paths = set(r.path for r in dest_resources if r.is_dir)
dest_paths = {r.path for r in dest_resources if r.is_dir}
Copy link
Author

Choose a reason for hiding this comment

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

Function Sync.perform refactored with the following changes:

  • Replace list(), dict() or set() with comprehension

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