Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
replacing f"{}/{}" with ps.path.join

Co-authored-by: Pierre Francois <[email protected]>
  • Loading branch information
mohammadamint and Bachibouzouk authored Dec 1, 2023
1 parent 442fdcb commit 8d39969
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/notebooks_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,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 = f"{output_dir}/{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:
Expand All @@ -31,7 +31,7 @@ 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 = f"{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)

Expand All @@ -40,7 +40,7 @@ def get_all_ipynb_files(examples_path="notebooks"):

all_files = os.listdir(examples_path)
return [
(f"{path}/{examples_path}/{file}", file.split(".ipynb")[0])
(os.path.join(path, examples_path, file), file.split(".ipynb")[0])
for file in all_files
if file.endswith("ipynb")
]
Expand All @@ -51,4 +51,4 @@ def get_all_ipynb_files(examples_path="notebooks"):
files = get_all_ipynb_files()

for file, folder in files:
convert_notebook_to_rst(file, f"{path}/source/examples/{folder}", folder)
convert_notebook_to_rst(file, os.path.join(path, source, examples,folder), folder)

0 comments on commit 8d39969

Please sign in to comment.