2424
2525import json
2626from pathlib import Path
27- from typing import List , TypedDict
27+ from typing import List , Optional , TypedDict
2828
2929import importlib_resources
3030from jsonschema import validate
3131
3232from .scanossbase import ScanossBase
33- from .utils .file import JSON_ERROR_FILE_NOT_FOUND , JSON_ERROR_FILE_EMPTY , validate_json_file
33+ from .utils .file import (
34+ JSON_ERROR_FILE_EMPTY ,
35+ JSON_ERROR_FILE_NOT_FOUND ,
36+ validate_json_file ,
37+ )
3438
3539DEFAULT_SCANOSS_JSON_FILE = Path ('scanoss.json' )
3640
@@ -96,7 +100,7 @@ def __init__(
96100 if filepath :
97101 self .load_json_file (filepath )
98102
99- def load_json_file (self , filepath : ' str | None' = None , scan_root : ' str | None' = None ) -> 'ScanossSettings' :
103+ def load_json_file (self , filepath : Optional [ str ] = None , scan_root : Optional [ str ] = None ) -> 'ScanossSettings' :
100104 """
101105 Load the scan settings file. If no filepath is provided, scanoss.json will be used as default.
102106
@@ -118,7 +122,7 @@ def load_json_file(self, filepath: 'str | None' = None, scan_root: 'str | None'
118122
119123 result = validate_json_file (json_file )
120124 if not result .is_valid :
121- if result .error_code == JSON_ERROR_FILE_NOT_FOUND or result . error_code == JSON_ERROR_FILE_EMPTY :
125+ if result .error_code in ( JSON_ERROR_FILE_NOT_FOUND , JSON_ERROR_FILE_EMPTY ) :
122126 self .print_msg (
123127 f'WARNING: The supplied settings file "{ filepath } " was not found or is empty. Skipping...'
124128 )
@@ -235,7 +239,7 @@ def _get_sbom_assets(self):
235239 include_bom_entries = self ._remove_duplicates (self .normalize_bom_entries (self .get_bom_include ()))
236240 replace_bom_entries = self ._remove_duplicates (self .normalize_bom_entries (self .get_bom_replace ()))
237241 self .print_debug (
238- f"Scan type set to 'identify'. Adding { len (include_bom_entries ) + len (replace_bom_entries )} components as context to the scan. \n "
242+ f"Scan type set to 'identify'. Adding { len (include_bom_entries ) + len (replace_bom_entries )} components as context to the scan. \n " # noqa: E501
239243 f'From Include list: { [entry ["purl" ] for entry in include_bom_entries ]} \n '
240244 f'From Replace list: { [entry ["purl" ] for entry in replace_bom_entries ]} \n '
241245 )
0 commit comments