Skip to content

Minor refactor #370

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 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
'Refactored by Sourcery'
  • Loading branch information
Sourcery AI committed May 7, 2023
commit ba47765bd37f98c8d2e57b5cb952a9f0d12e9dcf
5 changes: 1 addition & 4 deletions tools/generate_contents.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ def get_notebook_title(nb_file):

def gen_contents(directory=None):
for nb in iter_notebooks():
if directory:
nb_url = os.path.join(directory, nb)
else:
nb_url = nb
nb_url = os.path.join(directory, nb) if directory else nb
chapter, section, title = REG.match(nb).groups()
title = get_notebook_title(nb)
if section == '00':
Expand Down
4 changes: 2 additions & 2 deletions website/copy_notebooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ def copy_notebooks():

nbformat.write(content, os.path.join(NB_DEST_DIR, nb))

pagefile = os.path.join(PAGE_DEST_DIR, base + '.md')
htmlfile = base.lower() + '.html'
pagefile = os.path.join(PAGE_DEST_DIR, f'{base}.md')
htmlfile = f'{base.lower()}.html'
with open(pagefile, 'w') as f:
f.write(PAGEFILE.format(title=title,
htmlfile=htmlfile,
Expand Down