@@ -16,7 +16,7 @@ class QuartoReportView(r.ReportView):
1616 """
1717
1818 BASE_DIR = "quarto_report"
19- STATIC_FILES_DIR = os . path . join (BASE_DIR , "static" )
19+ STATIC_FILES_DIR = Path (BASE_DIR ) / "static"
2020
2121 def __init__ (self , report : r .Report , report_type : r .ReportType ):
2222 super ().__init__ (report = report , report_type = report_type )
@@ -124,9 +124,7 @@ def generate_report(
124124 report_formatted_imports = "\n " .join (report_unique_imports )
125125
126126 # Write the navigation and general content to a Python file
127- with open (
128- os .path .join (output_dir , f"{ self .BASE_DIR } .qmd" ), "w"
129- ) as quarto_report :
127+ with open (Path (output_dir ) / f"{ self .BASE_DIR } .qmd" , "w" ) as quarto_report :
130128 quarto_report .write (yaml_header )
131129 quarto_report .write (
132130 f"""\n ```{{python}}
@@ -156,15 +154,15 @@ def run_report(self, output_dir: str = BASE_DIR) -> None:
156154 """
157155 try :
158156 subprocess .run (
159- ["quarto" , "render" , os . path . join (output_dir , f"{ self .BASE_DIR } .qmd" ) ],
157+ ["quarto" , "render" , Path (output_dir ) / f"{ self .BASE_DIR } .qmd" ],
160158 check = True ,
161159 )
162160 if self .report_type == r .ReportType .JUPYTER :
163161 subprocess .run (
164162 [
165163 "quarto" ,
166164 "convert" ,
167- os . path . join (output_dir , f"{ self .BASE_DIR } .qmd" ) ,
165+ Path (output_dir ) / f"{ self .BASE_DIR } .qmd" ,
168166 ],
169167 check = True ,
170168 )
@@ -227,7 +225,7 @@ def _create_yaml_header(self) -> str:
227225 <a href="https://github.com/Multiomics-Analytics-Group/vuegen" target="_blank">
228226 <img src="https://raw.githubusercontent.com/Multiomics-Analytics-Group/vuegen/main/docs/images/vuegen_logo.svg" alt="VueGen" width="65px">
229227 </a>
230- | © 2025 <a href="https://github.com/Multiomics-Analytics-Group" target="_blank">Multiomics Network Analytics Group (MoNA)</a>
228+ | Copyright 2025 <a href="https://github.com/Multiomics-Analytics-Group" target="_blank">Multiomics Network Analytics Group (MoNA)</a>
231229 </footer>""" ,
232230 r .ReportType .PDF : """
233231 pdf:
@@ -273,7 +271,7 @@ def _create_yaml_header(self) -> str:
273271 <a href="https://github.com/Multiomics-Analytics-Group/vuegen" target="_blank">
274272 <img src="https://raw.githubusercontent.com/Multiomics-Analytics-Group/vuegen/main/docs/images/vuegen_logo.svg" alt="VueGen" width="65px">
275273 </a>
276- | © 2025 <a href="https://github.com/Multiomics-Analytics-Group" target="_blank">Multiomics Network Analytics Group (MoNA)</a>
274+ | Copyright 2025 <a href="https://github.com/Multiomics-Analytics-Group" target="_blank">Multiomics Network Analytics Group (MoNA)</a>
277275 </footer>""" ,
278276 r .ReportType .PPTX : """
279277 pptx:
@@ -304,7 +302,7 @@ def _create_yaml_header(self) -> str:
304302 <a href="https://github.com/Multiomics-Analytics-Group/vuegen" target="_blank">
305303 <img src="../docs/images/vuegen_logo.svg" alt="VueGen" width="65px">
306304 </a>
307- | © 2025 <a href="https://github.com/Multiomics-Analytics-Group" target="_blank">Multiomics Network Analytics Group (MoNA)</a>
305+ | Copyright 2025 <a href="https://github.com/Multiomics-Analytics-Group" target="_blank">Multiomics Network Analytics Group (MoNA)</a>
308306 </footer>""" ,
309307 }
310308 # Create a key based on the report type and format
@@ -413,13 +411,9 @@ def _generate_plot_content(
413411
414412 # Define plot path
415413 if is_report_static :
416- static_plot_path = os .path .join (
417- static_dir , f"{ plot .title .replace (' ' , '_' )} .png"
418- )
414+ static_plot_path = Path (static_dir ) / f"{ plot .title .replace (' ' , '_' )} .png"
419415 else :
420- html_plot_file = os .path .join (
421- static_dir , f"{ plot .title .replace (' ' , '_' )} .html"
422- )
416+ html_plot_file = Path (static_dir ) / f"{ plot .title .replace (' ' , '_' )} .html"
423417
424418 # Add content for the different plot types
425419 try :
@@ -431,7 +425,7 @@ def _generate_plot_content(
431425 plot_content .append (self ._generate_plot_code (plot ))
432426 if is_report_static :
433427 plot_content .append (
434- f"""fig_plotly.write_image("{ os . path . abspath ( static_plot_path )} ")\n ```\n """
428+ f"""fig_plotly.write_image("{ static_plot_path . resolve ( )} ")\n ```\n """
435429 )
436430 plot_content .append (self ._generate_image_content (static_plot_path ))
437431 else :
@@ -440,7 +434,7 @@ def _generate_plot_content(
440434 plot_content .append (self ._generate_plot_code (plot ))
441435 if is_report_static :
442436 plot_content .append (
443- f"""fig_altair.save("{ os . path . abspath ( static_plot_path )} ")\n ```\n """
437+ f"""fig_altair.save("{ static_plot_path . resolve ( )} ")\n ```\n """
444438 )
445439 plot_content .append (self ._generate_image_content (static_plot_path ))
446440 else :
@@ -513,7 +507,7 @@ def _generate_plot_code(self, plot, output_file="") -> str:
513507plot_json = response.text\n """
514508 else : # If it's a local file
515509 plot_code += f"""
516- with open('{ os . path . join (".." , plot .file_path ) } ', 'r') as plot_file:
510+ with open('{ Path (".." ) / plot .file_path } ', 'r') as plot_file:
517511 plot_json = plot_file.read()\n """
518512 # Add specific code for each visualization tool
519513 if plot .plot_type == r .PlotType .PLOTLY :
@@ -527,7 +521,7 @@ def _generate_plot_code(self, plot, output_file="") -> str:
527521 if is_url (plot .file_path ) and plot .file_path .endswith (".html" ):
528522 iframe_src = output_file
529523 else :
530- iframe_src = os . path . join (".." , output_file )
524+ iframe_src = Path (".." ) / output_file
531525
532526 # Embed the HTML file in an iframe
533527 plot_code = f"""
@@ -573,7 +567,7 @@ def _generate_dataframe_content(self, dataframe, is_report_static) -> List[str]:
573567 }
574568 try :
575569 # Check if the file extension matches any DataFrameFormat value
576- file_extension = os . path . splitext (dataframe .file_path )[ 1 ] .lower ()
570+ file_extension = Path (dataframe .file_path ). suffix .lower ()
577571 if not any (
578572 file_extension == fmt .value_with_dot for fmt in r .DataFrameFormat
579573 ):
@@ -585,7 +579,7 @@ def _generate_dataframe_content(self, dataframe, is_report_static) -> List[str]:
585579 file_path = (
586580 dataframe .file_path
587581 if is_url (dataframe .file_path )
588- else os . path . join (".." , dataframe .file_path )
582+ else Path (".." ) / dataframe .file_path
589583 )
590584
591585 # Load the DataFrame using the correct function
@@ -648,7 +642,7 @@ def _generate_markdown_content(self, markdown) -> List[str]:
648642 else : # If it's a local file
649643 markdown_content .append (
650644 f"""
651- with open('{ os . path . join (".." , markdown .file_path ) } ', 'r') as markdown_file:
645+ with open('{ Path (".." ) / markdown .file_path } ', 'r') as markdown_file:
652646 markdown_content = markdown_file.read()\n """
653647 )
654648
@@ -694,7 +688,7 @@ def _generate_html_content(self, html) -> List[str]:
694688 iframe_src = (
695689 html .file_path
696690 if is_url (html .file_path )
697- else os . path . join (".." , html .file_path )
691+ else Path (".." ) / html .file_path
698692 )
699693 iframe_code = f"""
700694<div style="text-align: center;">
@@ -769,11 +763,9 @@ def _show_dataframe(
769763 dataframe_content = []
770764 if is_report_static :
771765 # Generate path for the DataFrame image
772- df_image = os .path .join (
773- static_dir , f"{ dataframe .title .replace (' ' , '_' )} .png"
774- )
766+ df_image = Path (static_dir ) / f"{ dataframe .title .replace (' ' , '_' )} .png"
775767 dataframe_content .append (
776- f"df.dfi.export('{ os . path . abspath (df_image )} ', max_rows=10, max_cols=5)\n ```\n "
768+ f"df.dfi.export('{ Path (df_image ). resolve ( )} ', max_rows=10, max_cols=5)\n ```\n "
777769 )
778770 # Use helper method to add centered image content
779771 dataframe_content .append (self ._generate_image_content (df_image ))
0 commit comments