Skip to content

Sourcery refactored master branch#13

Open
sourcery-ai[bot] wants to merge 1 commit into
masterfrom
sourcery/master
Open

Sourcery refactored master branch#13
sourcery-ai[bot] wants to merge 1 commit into
masterfrom
sourcery/master

Conversation

@sourcery-ai

@sourcery-ai sourcery-ai Bot commented Oct 31, 2023

Copy link
Copy Markdown

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 SurendraRedd October 31, 2023 16:38
Comment on lines -17 to +27
# Checks if filename is compliant with Jekyll blog posts
if _re_blog_date.match(nb_path.name): return nb_path.with_suffix('.md').name.replace(' ', '-')

else:
clean_name = _re_numdash.sub('', nb_path.with_suffix('.md').name).replace(' ', '-')
if _re_blog_date.match(nb_path.name):
if _re_blog_date.match(nb_path.name): return nb_path.with_suffix('.md').name.replace(' ', '-')
clean_name = _re_numdash.sub('', nb_path.with_suffix('.md').name).replace(' ', '-')

# Gets the file's last modified time and and append YYYY-MM-DD- to the beginning of the filename
mdate = os.path.getmtime(nb_path) - 86400 # subtract one day b/c dates in the future break Jekyll
dtnm = datetime.fromtimestamp(mdate).strftime("%Y-%m-%d-") + clean_name
assert _re_blog_date.match(dtnm), f'{dtnm} is not a valid name, filename must be pre-pended with YYYY-MM-DD-'
# push this into a set b/c _nb2htmlfname gets called multiple times per conversion
if warnings: warnings.add((nb_path, dtnm))
return dtnm
# Gets the file's last modified time and and append YYYY-MM-DD- to the beginning of the filename
mdate = os.path.getmtime(nb_path) - 86400 # subtract one day b/c dates in the future break Jekyll
dtnm = datetime.fromtimestamp(mdate).strftime("%Y-%m-%d-") + clean_name
assert _re_blog_date.match(dtnm), f'{dtnm} is not a valid name, filename must be pre-pended with YYYY-MM-DD-'
# push this into a set b/c _nb2htmlfname gets called multiple times per conversion
if warnings: warnings.add((nb_path, dtnm))
return dtnm

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function rename_for_jekyll refactored with the following changes:

This removes the following comments ( why? ):

# Checks if filename is compliant with Jekyll blog posts

Comment on lines -5 to +6
assert draft_url, 'Was not able to find Draft URL in the logs:\n{}'.format(logs)
print("::set-output name=draft_url::{}".format(draft_url))
assert draft_url, f'Was not able to find Draft URL in the logs:\n{logs}'
print(f"::set-output name=draft_url::{draft_url}")

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Lines 5-6 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