From ba47765bd37f98c8d2e57b5cb952a9f0d12e9dcf Mon Sep 17 00:00:00 2001 From: Sourcery AI <> Date: Sun, 7 May 2023 19:03:53 +0000 Subject: [PATCH] 'Refactored by Sourcery' --- tools/generate_contents.py | 5 +---- website/copy_notebooks.py | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/tools/generate_contents.py b/tools/generate_contents.py index 705677fa5..28dbb714e 100644 --- a/tools/generate_contents.py +++ b/tools/generate_contents.py @@ -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': diff --git a/website/copy_notebooks.py b/website/copy_notebooks.py index b60299847..4e0ef5b26 100644 --- a/website/copy_notebooks.py +++ b/website/copy_notebooks.py @@ -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,