-
Notifications
You must be signed in to change notification settings - Fork 0
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
Sourcery refactored main branch #1
base: main
Are you sure you want to change the base?
Conversation
return ( | ||
today_version + f".{dev_num}", | ||
today_version + f".dev{dev_num+1}", | ||
) | ||
return ( | ||
today_version, | ||
today_version + ".dev1", | ||
) | ||
return f'{today_version}.{dev_num}', f'{today_version}.dev{dev_num + 1}' | ||
return today_version, f'{today_version}.dev1' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function _determine_versions
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
if not foreground: | ||
foreground = fallbacks["foreground"] | ||
else: | ||
foreground = f"#{foreground}" | ||
|
||
foreground = fallbacks["foreground"] if not foreground else f"#{foreground}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function get_pygments_style_colors
refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp
)
if "hide-toc" in file_meta: | ||
return True | ||
elif "toc" not in context: | ||
if "hide-toc" in file_meta or "toc" not in context or not context["toc"]: | ||
return True | ||
elif not context["toc"]: | ||
return True | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function _compute_hide_toc
refactored with the following changes:
- Merge duplicate blocks in conditional (
merge-duplicate-blocks
) - Remove redundant conditional (
remove-redundant-if
)
index = static.index("_static/" + asset) | ||
index = static.index(f'_static/{asset}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function _add_asset_hashes
refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation
)
lines = [] | ||
if not block.strip("\n"): | ||
return StringList() | ||
|
||
lines.append("````````{tab} Markdown (MyST)") | ||
lines.append("```````md") | ||
lines = ['````````{tab} Markdown (MyST)', '```````md'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function _md_demo
refactored with the following changes:
- Merge extend into list declaration (
merge-list-extend
) - Move assignment closer to its usage within a block (
move-assign-in-block
) - Merge consecutive list appends into a single extend (
merge-list-appends-into-extend
)
lines = [] | ||
if not block.strip(): | ||
return StringList() | ||
|
||
lines.append("````````{tab} reStructuredText") | ||
lines.append("```````{eval-rst}") | ||
lines.append(".. code-block:: rest") | ||
lines.append("") | ||
lines = [ | ||
'````````{tab} reStructuredText', | ||
'```````{eval-rst}', | ||
'.. code-block:: rest', | ||
'', | ||
] | ||
|
||
lines.extend(indent(block, " ").splitlines()) | ||
lines.append("") | ||
lines.extend(block.splitlines()) | ||
lines.append("```````") | ||
lines.append("````````") | ||
|
||
lines.extend(("```````", "````````")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function _rst_demo
refactored with the following changes:
- Merge extend into list declaration (
merge-list-extend
) - Move assignment closer to its usage within a block (
move-assign-in-block
) - Merge consecutive list appends into a single extend (
merge-list-appends-into-extend
)
Branch
main
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
main
branch, then run:Help us improve this pull request!