mirror of
				https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
				synced 2025-10-30 02:12:38 +00:00 
			
		
		
		
	lf_report: Use only 4 spaces per indent, this is python, not javascript
Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
This commit is contained in:
		| @@ -1,6 +1,6 @@ | ||||
| #!/usr/bin/env python3 | ||||
|  | ||||
| ''' | ||||
| """ | ||||
| NAME: lf_report.py | ||||
|  | ||||
| PURPOSE: | ||||
| @@ -23,7 +23,7 @@ LICENSE: | ||||
|  | ||||
|  | ||||
| INCLUDE_IN_README | ||||
| ''' | ||||
| """ | ||||
| # CAUTION: adding imports to this file which are not in update_dependencies.py is not advised | ||||
| import os | ||||
| import shutil | ||||
| @@ -33,10 +33,12 @@ import pandas as pd | ||||
| import pdfkit | ||||
| import argparse | ||||
|  | ||||
|  | ||||
| # internal candela references included during intial phases, to be deleted at future date | ||||
| # https://candelatech.atlassian.net/wiki/spaces/LANFORGE/pages/372703360/Scripting+Data+Collection+March+2021 | ||||
| # base report class | ||||
| class lf_report(): | ||||
|  | ||||
| class lf_report: | ||||
|     def __init__(self, | ||||
|                  # _path the report directory under which the report directories will be created. | ||||
|                  _path="/home/lanforge/html-reports", | ||||
| @@ -142,7 +144,8 @@ class lf_report(): | ||||
|         shutil.copy(logo_src_file, logo_dst_file) | ||||
|  | ||||
|     def copy_logo_footer(self): | ||||
|         logo_footer_src_file = str(self.current_path)+'/'+str(self.logo_directory)+'/'+str(self.logo_footer_file_name) | ||||
|         logo_footer_src_file = str(self.current_path) + '/' + str(self.logo_directory) + '/' + str( | ||||
|             self.logo_footer_file_name) | ||||
|         logo_footer_dst_file = str(self.path_date_time) + '/' + str(self.logo_footer_file_name) | ||||
|         # print("logo_footer_src_file: {}".format(logo_footer_src_file)) | ||||
|         # print("logo_footer_dst_file: {}".format(logo_footer_dst_file)) | ||||
| @@ -282,7 +285,6 @@ class lf_report(): | ||||
|             print("write_index_html failed") | ||||
|         return self.write_output_index_html | ||||
|  | ||||
|  | ||||
|     def write_html_with_timestamp(self): | ||||
|         self.write_output_html = "{}/{}-{}".format(self.path_date_time, self.date, self.output_html) | ||||
|         print("write_output_html: {}".format(self.write_output_html)) | ||||
| @@ -294,7 +296,6 @@ class lf_report(): | ||||
|             print("write_html failed") | ||||
|         return self.write_output_html | ||||
|  | ||||
|  | ||||
|     # https://wkhtmltopdf.org/usage/wkhtmltopdf.txt | ||||
|     # page_size A4, A3, Letter, Legal | ||||
|     # orientation Portrait , Landscape | ||||
| @@ -419,7 +420,6 @@ class lf_report(): | ||||
|         ) | ||||
|         self.html += self.banner_html | ||||
|  | ||||
|  | ||||
|     def build_table_title(self): | ||||
|         self.table_title_html = """ | ||||
|                     <!-- Table Title--> | ||||
| @@ -455,7 +455,8 @@ class lf_report(): | ||||
|             os.mkdir(self.path_date_time) | ||||
|  | ||||
|     def build_table(self): | ||||
|         self.dataframe_html = self.dataframe.to_html(index=False, justify='center')  # have the index be able to be passed in. | ||||
|         self.dataframe_html = self.dataframe.to_html(index=False, | ||||
|                                                      justify='center')  # have the index be able to be passed in. | ||||
|         self.html += self.dataframe_html | ||||
|  | ||||
|     def test_setup_table(self, test_setup_data, value): | ||||
| @@ -571,6 +572,7 @@ function copyTextToClipboard(ele) { | ||||
|     def end_content_div(self): | ||||
|         self.html += "\n</div><!-- end contentDiv -->\n" | ||||
|  | ||||
|  | ||||
| # Unit Test | ||||
| if __name__ == "__main__": | ||||
|     parser = argparse.ArgumentParser( | ||||
| @@ -583,10 +585,10 @@ if __name__ == "__main__": | ||||
|     args = parser.parse_args() | ||||
|     print("LANforge manager {lfmgr}".format(lfmgr=args.lfmgr)) | ||||
|  | ||||
|  | ||||
|     # Testing: generate data frame | ||||
|     dataframe = pd.DataFrame({ | ||||
|     'product':['CT521a-264-1ac-1n','CT521a-1ac-1ax','CT522-264-1ac2-1n','CT523c-2ac2-db-10g-cu','CT523c-3ac2-db-10g-cu','CT523c-8ax-ac10g-cu','CT523c-192-2ac2-1ac-10g'], | ||||
|         'product': ['CT521a-264-1ac-1n', 'CT521a-1ac-1ax', 'CT522-264-1ac2-1n', 'CT523c-2ac2-db-10g-cu', | ||||
|                     'CT523c-3ac2-db-10g-cu', 'CT523c-8ax-ac10g-cu', 'CT523c-192-2ac2-1ac-10g'], | ||||
|         'radios': [1, 1, 2, 2, 6, 9, 3], | ||||
|         'MIMO': ['N', 'N', 'N', 'Y', 'Y', 'Y', 'Y'], | ||||
|         'stations': [200, 64, 200, 128, 384, 72, 192], | ||||
| @@ -627,4 +629,3 @@ if __name__ == "__main__": | ||||
|     report.write_pdf() | ||||
|  | ||||
|     print("report path {}".format(report.get_path())) | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Matthew Stidham
					Matthew Stidham