Skip to content

Sourcery refactored master branch #1

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Oct 12, 2023

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^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from edson-github October 12, 2023 14:54
elif character in string.punctuation:
pass
else:
elif character not in string.punctuation:
Copy link
Author

Choose a reason for hiding this comment

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

Function header_link refactored with the following changes:

Comment on lines -107 to +105
if default:
# yes by default
question += ' [Y/n] '
else:
# no by default
question += ' [y/N] '

question += ' [Y/n] ' if default else ' [y/N] '
Copy link
Author

Choose a reason for hiding this comment

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

Function askyesno refactored with the following changes:

This removes the following comments ( why? ):

# yes by default
# no by default

shutil.copy(filename, filename + '.backup')
shutil.copy(filename, f'{filename}.backup')
try:
yield
except Exception:
# It failed, we need to restore from the backup.
shutil.copy(filename + '.backup', filename)
shutil.copy(f'{filename}.backup', filename)
else:
# Everything's fine, we can safely get rid of the backup.
os.remove(filename + '.backup')
os.remove(f'{filename}.backup')
Copy link
Author

Choose a reason for hiding this comment

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

Function backup refactored with the following changes:

Comment on lines -152 to +144
elif character in string.punctuation:
pass
else:
elif character not in string.punctuation:
Copy link
Author

Choose a reason for hiding this comment

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

Function header_link refactored with the following changes:

Comment on lines -70 to +74
else:
# A file.
if not os.path.isfile(path):
return "not a file"
elif not os.path.isfile(path):
return "not a file"

if title is not None and title not in titledict[path]:
return "no title named %s" % title
return f"no title named {title}"
Copy link
Author

Choose a reason for hiding this comment

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

Function check refactored with the following changes:

This removes the following comments ( why? ):

# A file.

Comment on lines -140 to +137
link = fix_filename(before) + '#' + after
link = f'{fix_filename(before)}#{after}'
Copy link
Author

Choose a reason for hiding this comment

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

Function TutorialRenderer.link refactored with the following changes:

Comment on lines -167 to +168
result.append('<p><font color="green">%s</font></p>'
% line.strip('+'))
result.append(f"""<p><font color="green">{line.strip('+')}</font></p>""")
elif line.startswith('-'):
result.append('<p><font color="red">%s</font></p>'
% line.strip('-'))
result.append(f"""<p><font color="red">{line.strip('-')}</font></p>""")
else:
result.append('<p>%s</p>' % line)
result.append(f'<p>{line}</p>')
Copy link
Author

Choose a reason for hiding this comment

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

Function TutorialRenderer.block_code refactored with the following changes:

Comment on lines -194 to +189
result = []
for part in text.split('\n'):
result.append(textwrap.fill(part))
result = [textwrap.fill(part) for part in text.split('\n')]
Copy link
Author

Choose a reason for hiding this comment

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

Function wrap_text refactored with the following changes:

Comment on lines -229 to +222
print(" %s -m pip install pygments" % python)
print(f" {python} -m pip install pygments")
Copy link
Author

Choose a reason for hiding this comment

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

Function main refactored with the following changes:

content = BEGINNING + content.replace(directory + '/', '').rstrip()
content = BEGINNING + content.replace(f'{directory}/', '').rstrip()
Copy link
Author

Choose a reason for hiding this comment

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

Function main refactored with the following changes:

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.

0 participants