@@ -106,7 +106,8 @@ def generate_report(self, output_dir: str = SECTIONS_DIR) -> None:
106106 )
107107 else :
108108 self .report .logger .info (
109- f"Output directory for static content already existed: '{ self .static_dir } '"
109+ "Output directory for static content already existed: "
110+ f"{ self .static_dir } "
110111 )
111112
112113 try :
@@ -186,7 +187,8 @@ def generate_report(self, output_dir: str = SECTIONS_DIR) -> None:
186187 # Create a Page object for each subsection and
187188 # add it to the home page content
188189 report_manag_content .append (
189- f"{ section_name_var } _overview = st.Page('{ subsection_file_path } ', title='Overview { section .title } ')"
190+ f"{ section_name_var } _overview = st.Page('{ subsection_file_path } '"
191+ f", title='Overview { section .title } ')"
190192 )
191193 subsection_page_vars .append (f"{ section_name_var } _overview" )
192194
@@ -195,10 +197,12 @@ def generate_report(self, output_dir: str = SECTIONS_DIR) -> None:
195197 subsection_name_var = make_valid_identifier (subsection .title )
196198 if not subsection_name_var .isidentifier ():
197199 self .report .logger .warning (
198- f"Subsection name '{ subsection_name_var } ' is not a valid identifier."
200+ f"Subsection name '{ subsection_name_var } ' "
201+ " is not a valid identifier."
199202 )
200203 raise ValueError (
201- f"Subsection name is not a valid Python identifier: { subsection_name_var } "
204+ "Subsection name is not a valid Python identifier: "
205+ f"{ subsection_name_var } "
202206 )
203207 subsection_file_path = (
204208 Path (section_name_var ) / f"{ subsection_name_var } .py"
@@ -207,13 +211,15 @@ def generate_report(self, output_dir: str = SECTIONS_DIR) -> None:
207211 # Create a Page object for each subsection and
208212 # add it to the home page content
209213 report_manag_content .append (
210- f"{ subsection_name_var } = st.Page('{ subsection_file_path } ', title='{ subsection .title } ')"
214+ f"{ subsection_name_var } = st.Page('{ subsection_file_path } ', "
215+ f"title='{ subsection .title } ')"
211216 )
212217 subsection_page_vars .append (subsection_name_var )
213218
214219 # Add all subsection Page objects to the corresponding section
215220 report_manag_content .append (
216- f"sections_pages['{ section .title } '] = [{ ', ' .join (subsection_page_vars )} ]\n "
221+ f"sections_pages['{ section .title } '] = "
222+ f"[{ ', ' .join (subsection_page_vars )} ]\n "
217223 )
218224
219225 # Add navigation object to the home page content
@@ -305,7 +311,8 @@ def run_report(self, output_dir: str = SECTIONS_DIR) -> None:
305311 else :
306312 # If autorun is False, print instructions for manual execution
307313 self .report .logger .info (
308- f"All the scripts to build the Streamlit app are available at { output_dir } "
314+ "All the scripts to build the Streamlit app are available at "
315+ f"{ output_dir } "
309316 )
310317 self .report .logger .info (
311318 "To run the Streamlit app, use the following command:"
@@ -314,8 +321,9 @@ def run_report(self, output_dir: str = SECTIONS_DIR) -> None:
314321 f"streamlit run { Path (output_dir ) / self .REPORT_MANAG_SCRIPT } "
315322 )
316323 msg = (
317- f"\n All the scripts to build the Streamlit app are available at: { output_dir } \n \n "
318- f"To run the Streamlit app, use the following command:\n \n "
324+ "\n All the scripts to build the Streamlit app are available at: "
325+ f"{ output_dir } \n \n "
326+ "To run the Streamlit app, use the following command:\n \n "
319327 f"\t streamlit run { Path (output_dir ) / self .REPORT_MANAG_SCRIPT } "
320328 )
321329 print (msg )
@@ -403,7 +411,8 @@ def _generate_home_section(
403411 )
404412 if self .report .graphical_abstract :
405413 home_content .append (
406- f"\n st.image('{ self .report .graphical_abstract } ', use_column_width=True)"
414+ f"\n st.image('{ self .report .graphical_abstract } ', "
415+ "use_column_width=True)"
407416 )
408417
409418 # add components content to page (if any)
@@ -446,7 +455,8 @@ def _generate_sections(self, output_dir: str) -> None:
446455 try :
447456 for section in self .report .sections [1 :]:
448457 self .report .logger .debug (
449- f"Processing section '{ section .id } ': '{ section .title } ' - { len (section .subsections )} subsection(s)"
458+ f"Processing section '{ section .id } ': '{ section .title } ' - "
459+ f"{ len (section .subsections )} subsection(s)"
450460 )
451461
452462 if section .components :
@@ -500,8 +510,10 @@ def _generate_sections(self, output_dir: str) -> None:
500510 )
501511 except Exception as subsection_error :
502512 self .report .logger .error (
503- f"Error processing subsection '{ subsection .id } ' '{ subsection .title } ' "
504- f"in section '{ section .id } ' '{ section .title } ': { str (subsection_error )} "
513+ f"Error processing subsection '{ subsection .id } '"
514+ f" '{ subsection .title } ' "
515+ f"in section '{ section .id } ' '{ section .title } ':"
516+ f" { str (subsection_error )} "
505517 )
506518 raise
507519
@@ -606,7 +618,8 @@ def _generate_plot_content(self, plot) -> List[str]:
606618 if plot .plot_type == r .PlotType .STATIC :
607619 plot_rel_path = get_relative_file_path (plot .file_path )
608620 plot_content .append (
609- f"\n st.image('{ plot_rel_path .as_posix ()} ', caption='{ plot .caption } ', use_column_width=True)\n "
621+ f"\n st.image('{ plot_rel_path .as_posix ()} ', "
622+ f" caption='{ plot .caption } ', use_column_width=True)\n "
610623 )
611624 elif plot .plot_type == r .PlotType .PLOTLY :
612625 plot_content .append (self ._generate_plot_code (plot ))
@@ -659,7 +672,8 @@ def _generate_plot_content(self, plot) -> List[str]:
659672 self .report .logger .warning (f"Unsupported plot type: { plot .plot_type } " )
660673 except Exception as e :
661674 self .report .logger .error (
662- f"Error generating content for '{ plot .plot_type } ' plot '{ plot .id } ' '{ plot .title } ': { str (e )} "
675+ f"Error generating content for '{ plot .plot_type } ' plot '{ plot .id } ' "
676+ f"'{ plot .title } ': { str (e )} "
663677 )
664678 raise
665679
@@ -750,7 +764,10 @@ def _generate_dataframe_content(self, dataframe) -> List[str]:
750764 file_extension == fmt .value_with_dot for fmt in r .DataFrameFormat
751765 ):
752766 self .report .logger .error (
753- f"Unsupported file extension: { file_extension } . Supported extensions are: { ', ' .join (fmt .value for fmt in r .DataFrameFormat )} ."
767+ f"Unsupported file extension: { file_extension } . "
768+ "Supported extensions are: {}." .format (
769+ ", " .join (fmt .value for fmt in r .DataFrameFormat )
770+ )
754771 )
755772 # return [] # Skip execution if unsupported file extension
756773 # Should it not return here?
@@ -787,7 +804,8 @@ def _generate_dataframe_content(self, dataframe) -> List[str]:
787804 r .DataFrameFormat .XLSX .value_with_dot ,
788805 ]:
789806 dataframe_content .append (
790- f"""df = pd.{ read_function .__name__ } ('{ dataframe .file_path } ', sheet_name=selected_sheet)\n """
807+ f"df = pd.{ read_function .__name__ } ('{ dataframe .file_path } ',"
808+ " sheet_name=selected_sheet)\n "
791809 )
792810 else :
793811 dataframe_content .append (
@@ -819,7 +837,8 @@ def _generate_dataframe_content(self, dataframe) -> List[str]:
819837 )
820838 except Exception as e :
821839 self .report .logger .error (
822- f"Error generating content for DataFrame: { dataframe .title } . Error: { str (e )} "
840+ f"Error generating content for DataFrame: { dataframe .title } . "
841+ f"Error: { str (e )} "
823842 )
824843 raise
825844
@@ -880,7 +899,8 @@ def _generate_markdown_content(self, markdown) -> List[str]:
880899 )
881900 except Exception as e :
882901 self .report .logger .error (
883- f"Error generating content for Markdown: { markdown .title } . Error: { str (e )} "
902+ f"Error generating content for Markdown: { markdown .title } . "
903+ f"Error: { str (e )} "
884904 )
885905 raise
886906
@@ -998,7 +1018,8 @@ def _generate_apicall_content(self, apicall) -> List[str]:
9981018 )
9991019
10001020 self .report .logger .info (
1001- f"Successfully generated content for APICall '{ apicall .title } ' using method '{ apicall .method } '"
1021+ f"Successfully generated content for APICall '{ apicall .title } ' "
1022+ f"using method '{ apicall .method } '"
10021023 )
10031024 return apicall_content
10041025
0 commit comments