From dd13fc6e577740bb4e02a6a1470abdf12f412f33 Mon Sep 17 00:00:00 2001 From: Mohammad Amin Tahavori <50955527+mohammadamint@users.noreply.github.com> Date: Sat, 2 Dec 2023 01:12:57 +0100 Subject: [PATCH] linting --- docs/notebooks_convert.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/docs/notebooks_convert.py b/docs/notebooks_convert.py index 6b47812a..60a491c1 100644 --- a/docs/notebooks_convert.py +++ b/docs/notebooks_convert.py @@ -3,7 +3,11 @@ import nbformat import os -path = os.path.abspath(os.path.join(os.path.dirname(__file__),)) +path = os.path.abspath( + os.path.join( + os.path.dirname(__file__), + ) +) def convert_notebook_to_rst(input_file, output_dir, file_name): @@ -20,7 +24,7 @@ def convert_notebook_to_rst(input_file, output_dir, file_name): if not os.path.exists(output_dir): os.mkdir(output_dir) - output_file = os.path.join(output_dir, f"{{file_name}.rst") + output_file = os.path.join(output_dir, f"{file_name}.rst") # Write RST content to the output file with open(output_file, "w", encoding="utf-8") as f: @@ -31,13 +35,12 @@ def convert_notebook_to_rst(input_file, output_dir, file_name): # Copy images to the output folder image_dir = output_dir for image_filename, image_data in resources["outputs"].items(): - image_path = os.path,join(output_dir, image_filename) + image_path = os.path.join(output_dir, image_filename) with open(image_path, "wb") as img_file: img_file.write(image_data) def get_all_ipynb_files(examples_path="notebooks"): - all_files = os.listdir(examples_path) return [ (os.path.join(path, examples_path, file), file.split(".ipynb")[0]) @@ -47,8 +50,9 @@ def get_all_ipynb_files(examples_path="notebooks"): if __name__ == "__main__": - files = get_all_ipynb_files() for file, folder in files: - convert_notebook_to_rst(file, os.path.join(path, source, examples,folder), folder) + convert_notebook_to_rst( + file, os.path.join(path, "source", "examples", folder), folder + )