2323from .run_spdx_extractor import get_spdx_downloads
2424from ._scan_item import SourceItem
2525from fosslight_util .oss_item import ScannerItem
26+ from typing import Tuple
2627
2728SRC_SHEET_NAME = 'SRC_FL_Source'
2829SCANOSS_HEADER = {SRC_SHEET_NAME : ['ID' , 'Source Path' , 'OSS Name' ,
3940RESULT_KEY = "Scan Result"
4041
4142
42- def main ():
43+ def main () -> None :
4344 global logger
4445 _result_log = {}
4546
@@ -121,7 +122,7 @@ def main():
121122 sys .exit (1 )
122123
123124
124- def count_files (path_to_scan , path_to_exclude ) :
125+ def count_files (path_to_scan : str , path_to_exclude : list ) -> Tuple [ int , int ] :
125126 total_files = 0
126127 excluded_files = 0
127128 abs_path_to_exclude = [os .path .abspath (os .path .join (path_to_scan , path )) for path in path_to_exclude ]
@@ -138,9 +139,14 @@ def count_files(path_to_scan, path_to_exclude):
138139 return total_files , excluded_files
139140
140141
141- def create_report_file (_start_time , merged_result , license_list , scanoss_result , selected_scanner , need_license = False ,
142- output_path = "" , output_files = [], output_extensions = [], correct_mode = True , correct_filepath = "" ,
143- path_to_scan = "" , path_to_exclude = []):
142+ def create_report_file (
143+ _start_time : str , merged_result : list ,
144+ license_list : list , scanoss_result : list ,
145+ selected_scanner : str , need_license : bool = False ,
146+ output_path : str = "" , output_files : list = [],
147+ output_extensions : list = [], correct_mode : bool = True ,
148+ correct_filepath : str = "" , path_to_scan : str = "" , path_to_exclude : list = []
149+ ) -> 'ScannerItem' :
144150 """
145151 Create report files for given scanned result.
146152
@@ -227,7 +233,7 @@ def create_report_file(_start_time, merged_result, license_list, scanoss_result,
227233 return scan_item
228234
229235
230- def merge_results (scancode_result = [], scanoss_result = [], spdx_downloads = {}):
236+ def merge_results (scancode_result : list = [], scanoss_result : list = [], spdx_downloads : dict = {}) -> list :
231237 """
232238 Merge scanner results and spdx parsing result.
233239 :param scancode_result: list of scancode results in SourceItem.
@@ -257,9 +263,14 @@ def merge_results(scancode_result=[], scanoss_result=[], spdx_downloads={}):
257263 return scancode_result
258264
259265
260- def run_scanners (path_to_scan , output_file_name = "" , write_json_file = False , num_cores = - 1 , called_by_cli = True ,
261- print_matched_text = False , formats = [], time_out = 120 , correct_mode = True , correct_filepath = "" ,
262- selected_scanner = 'all' , path_to_exclude = []):
266+ def run_scanners (
267+ path_to_scan : str , output_file_name : str = "" ,
268+ write_json_file : bool = False , num_cores : int = - 1 ,
269+ called_by_cli : bool = True , print_matched_text : bool = False ,
270+ formats : list = [], time_out : int = 120 ,
271+ correct_mode : bool = True , correct_filepath : str = "" ,
272+ selected_scanner : str = 'all' , path_to_exclude : list = []
273+ ) -> Tuple [bool , str , 'ScannerItem' , list , list ]:
263274 """
264275 Run Scancode and scanoss.py for the given path.
265276
0 commit comments