14
14
15
15
import cfnlint .conditions
16
16
import cfnlint .helpers
17
- from cfnlint ._typing import CheckValueFn , Path
17
+ from cfnlint ._typing import CheckValueFn
18
+ from cfnlint ._typing import Path as CfnPath
18
19
from cfnlint .context import Context , ParameterSet , create_context_for_template
19
20
from cfnlint .context .conditions .exceptions import Unsatisfiable
20
21
from cfnlint .decode .node import dict_node , list_node
@@ -357,7 +358,7 @@ def get_directives(self) -> dict[str, list[str]]:
357
358
return results
358
359
359
360
# pylint: disable=dangerous-default-value
360
- def _search_deep_keys (self , searchText : str | re .Pattern , cfndict , path : Path ):
361
+ def _search_deep_keys (self , searchText : str | re .Pattern , cfndict , path : CfnPath ):
361
362
"""Search deep for keys and get their values.
362
363
363
364
Args:
@@ -371,7 +372,7 @@ def _search_deep_keys(self, searchText: str | re.Pattern, cfndict, path: Path):
371
372
keys = []
372
373
if isinstance (cfndict , dict ):
373
374
for key in cfndict :
374
- pathprop : Path = path [:]
375
+ pathprop : CfnPath = path [:]
375
376
pathprop .append (key )
376
377
if isinstance (searchText , str ):
377
378
if key == searchText :
@@ -511,7 +512,9 @@ def _get_cfn_path(
511
512
512
513
yield from _get_cfn_path (path , self .template , context )
513
514
514
- def get_condition_values (self , template , path : Path | None ) -> list [dict [str , Any ]]:
515
+ def get_condition_values (
516
+ self , template , path : CfnPath | None
517
+ ) -> list [dict [str , Any ]]:
515
518
"""
516
519
Evaluates conditions in the provided CloudFormation template and returns the values.
517
520
@@ -568,7 +571,7 @@ def get_condition_values(self, template, path: Path | None) -> list[dict[str, An
568
571
569
572
return matches
570
573
571
- def get_values (self , obj , key , path : Path | None = None ):
574
+ def get_values (self , obj , key , path : CfnPath | None = None ):
572
575
"""
573
576
Logic for getting the value of a key in the provided object.
574
577
@@ -694,7 +697,7 @@ def get_sub_parameters(self, sub_string):
694
697
695
698
return results
696
699
697
- def get_location_yaml (self , text : Any , path : Path ):
700
+ def get_location_yaml (self , text : Any , path : CfnPath ):
698
701
"""
699
702
Get the location information for the given YAML text and path.
700
703
@@ -750,7 +753,7 @@ def check_value(
750
753
self ,
751
754
obj : dict [str , Any ],
752
755
key : str ,
753
- path : Path ,
756
+ path : CfnPath ,
754
757
check_value : CheckValueFn | None = None ,
755
758
check_ref : CheckValueFn | None = None ,
756
759
check_get_att : CheckValueFn | None = None ,
@@ -859,7 +862,9 @@ def check_value(
859
862
860
863
return matches
861
864
862
- def is_resource_available (self , path : Path , resource : str ) -> list [dict [str , bool ]]:
865
+ def is_resource_available (
866
+ self , path : CfnPath , resource : str
867
+ ) -> list [dict [str , bool ]]:
863
868
"""
864
869
Compares a path to a resource to see if it is available.
865
870
@@ -911,7 +916,7 @@ def is_resource_available(self, path: Path, resource: str) -> list[dict[str, boo
911
916
return results
912
917
913
918
def get_object_without_nested_conditions (
914
- self , obj : dict | list , path : Path , region : str | None = None
919
+ self , obj : dict | list , path : CfnPath , region : str | None = None
915
920
):
916
921
"""
917
922
Get a list of object values without conditions included.
@@ -1136,7 +1141,7 @@ def get_object_without_conditions(self, obj, property_names=None, region=None):
1136
1141
1137
1142
def get_condition_scenarios_below_path (
1138
1143
self ,
1139
- path : Path ,
1144
+ path : CfnPath ,
1140
1145
include_if_in_function : bool = False ,
1141
1146
region : str | None = None ,
1142
1147
) -> list [dict [str , bool ]]:
@@ -1238,7 +1243,7 @@ def get_conditions_from_property(value):
1238
1243
def get_conditions_from_path (
1239
1244
self ,
1240
1245
text : Any ,
1241
- path : Path ,
1246
+ path : CfnPath ,
1242
1247
include_resource_conditions : bool = True ,
1243
1248
include_if_in_function : bool = True ,
1244
1249
only_last : bool = False ,
@@ -1282,7 +1287,7 @@ def get_conditions_from_path(
1282
1287
def _get_conditions_from_path (
1283
1288
self ,
1284
1289
text : Any ,
1285
- path : Path ,
1290
+ path : CfnPath ,
1286
1291
include_if_in_function : bool = True ,
1287
1292
only_last : bool = False ,
1288
1293
) -> dict [str , set [bool ]]:
0 commit comments