diff --git a/plugins/aws/fix_plugin_aws/resource/base.py b/plugins/aws/fix_plugin_aws/resource/base.py index 1c3f92357..93b1064cb 100644 --- a/plugins/aws/fix_plugin_aws/resource/base.py +++ b/plugins/aws/fix_plugin_aws/resource/base.py @@ -29,7 +29,6 @@ Cloud, EdgeType, Finding, - Assessment, ModelReference, PhantomBaseResource, BaseOrganizationalRoot, @@ -478,8 +477,8 @@ def __init__( self.last_run_started_at = last_run_started_at self.created_at = utc() self.__builder_cache = {region.safe_name: self} - self._assessment_findings: Dict[AssessmentKey, ResourceFindings] = assessment_findings or defaultdict( - lambda: defaultdict(list) + self._assessment_findings = ( + assessment_findings if assessment_findings is not None else defaultdict(lambda: defaultdict(list)) ) if last_run_started_at: diff --git a/plugins/aws/fix_plugin_aws/resource/inspector.py b/plugins/aws/fix_plugin_aws/resource/inspector.py index ec81854d9..9dc76062d 100644 --- a/plugins/aws/fix_plugin_aws/resource/inspector.py +++ b/plugins/aws/fix_plugin_aws/resource/inspector.py @@ -6,10 +6,7 @@ from boto3.exceptions import Boto3Error from fix_plugin_aws.resource.base import AwsResource, AwsApiSpec, GraphBuilder -from fix_plugin_aws.resource.ec2 import AwsEc2Instance -from fix_plugin_aws.resource.ecr import AwsEcrRepository -from fix_plugin_aws.resource.lambda_ import AwsLambdaFunction -from fixlib.baseresources import Assessment, ModelReference, PhantomBaseResource, Severity, Finding +from fixlib.baseresources import Assessment, PhantomBaseResource, Severity, Finding from fixlib.types import Json from fixlib.json_bender import Bender, S, ForallBend, Bend, F @@ -345,9 +342,6 @@ class AwsInspectorFinding(AwsResource, PhantomBaseResource): _kind_service: ClassVar[str] = service_name _metadata: ClassVar[Dict[str, Any]] = {"icon": "log", "group": "management"} _docs_url: ClassVar[str] = "https://docs.aws.amazon.com/inspector/latest/user/findings-understanding.html" - _reference_kinds: ClassVar[ModelReference] = { - "successors": {"default": [AwsEc2Instance.kind, AwsEcrRepository.kind, AwsLambdaFunction.kind]}, - } _aws_metadata: ClassVar[Dict[str, Any]] = { "provider_link_tpl": "https://{region_id}.console.aws.amazon.com/inspector/v2/home?region={region_id}#/findings/all", } @@ -454,6 +448,11 @@ def collect_resources(cls, builder: GraphBuilder) -> None: def check_type_and_adjust_id( class_type: Optional[str], class_id: Optional[str] ) -> Tuple[Optional[str], Optional[str]]: + # to avoid circular import, defined here + from fix_plugin_aws.resource.ec2 import AwsEc2Instance + from fix_plugin_aws.resource.ecr import AwsEcrRepository + from fix_plugin_aws.resource.lambda_ import AwsLambdaFunction + if not class_id or not class_type: return None, None match class_type: