@@ -159,7 +159,8 @@ def _format_resource_changes_and_deletion_summary(self) -> bool:
159159 DeploymentStacksWhatIfResultFormatter .CHANGE_CERTAINTY_PRIORITIES .get (
160160 x .change_certainty , 1 ) if not x .id else 0 , # Extension resources: then by certainty
161161 x .type if x .extension else "" , # Extension resources: then by type
162- self ._format_ext_resource_identifiers (x .identifiers ) if x .identifiers else "" # Extension resources: then by identifiers
162+ # Extension resources: then by identifiers
163+ self ._format_ext_resource_identifiers (x .identifiers ) if x .identifiers else ""
163164 ))
164165
165166 if self ._format_resource_changes (resource_changes_sorted ):
@@ -253,7 +254,8 @@ def _format_resource_deletions_summary(
253254 if not has_potential_deletions and str_lower_eq (
254255 delete_change .change_certainty , StackModels .DeploymentStacksWhatIfChangeCertainty .POTENTIAL ):
255256 self .builder .append (">> " ).append_line (
256- f"Potential Deletions { self ._get_num_potential_resource_changes (delete_changes , i )} total (Learn more at https://aka.ms/whatIfPotentialChanges)" ,
257+ f"Potential Deletions { self ._get_num_potential_resource_changes (delete_changes , i )} total"
258+ " (Learn more at https://aka.ms/whatIfPotentialChanges)" ,
257259 Color .RED )
258260 has_potential_deletions = True
259261
@@ -299,11 +301,13 @@ def _format_diagnostics(self) -> bool:
299301
300302 diagnostics_sorted = sorted (
301303 self .what_if_props .diagnostics ,
302- key = lambda x : (DeploymentStacksWhatIfResultFormatter .DIAGNOSTIC_LEVEL_PRIORITIES .get (x .level , 0 ), x .code or "" ))
304+ key = lambda x : (
305+ DeploymentStacksWhatIfResultFormatter .DIAGNOSTIC_LEVEL_PRIORITIES .get (x .level , 0 ),
306+ x .code or "" ))
303307
304308 self .builder .append_line (f"Diagnostics ({ len (diagnostics_sorted )} ):" )
305309
306- for i , diagnostic in enumerate ( diagnostics_sorted ) :
310+ for diagnostic in diagnostics_sorted :
307311 self ._format_diagnostic (diagnostic )
308312
309313 return True
@@ -410,17 +414,19 @@ def _format_primitive_change(
410414 if not primitive_change :
411415 return False
412416
413- change_type = (primitive_change .change_type if hasattr (primitive_change , "change_type" ) else None ) or (
414- StackModels .DeploymentStacksWhatIfPropertyChangeType .NO_EFFECT if primitive_change .before == primitive_change .after
415- else StackModels .DeploymentStacksWhatIfPropertyChangeType .MODIFY )
417+ change_type = primitive_change .change_type if hasattr (primitive_change , "change_type" ) else None
418+ change_type = (change_type or (StackModels .DeploymentStacksWhatIfPropertyChangeType .NO_EFFECT
419+ if primitive_change .before == primitive_change .after
420+ else StackModels .DeploymentStacksWhatIfPropertyChangeType .MODIFY ))
416421
417422 property_path = self ._get_change_path (primitive_change , parent_path )
418423 symbol , color = self ._get_change_type_formatting (change_type )
419424
420425 self .builder .append (f"{ symbol } " if is_array_item else f"{ symbol } { property_path } : " , color )
421426 if str_lower_eq (change_type , StackModels .DeploymentStacksWhatIfPropertyChangeType .MODIFY ):
422427 self .builder .append_line (
423- f"{ self ._format_primitive_value (primitive_change .before )} => { self ._format_primitive_value (primitive_change .after )} " )
428+ f"{ self ._format_primitive_value (primitive_change .before )} "
429+ f" => { self ._format_primitive_value (primitive_change .after )} " )
424430 else :
425431 value = primitive_change .before if str_lower_eq (
426432 change_type , StackModels .DeploymentStacksWhatIfPropertyChangeType .DELETE ) else primitive_change .after
@@ -461,7 +467,7 @@ def _get_change_path(change, parent_path: t.Optional[str] = None) -> str:
461467 return parent_path
462468
463469 @staticmethod
464- def _get_value_type_from_change (
470+ def _get_value_type_from_change ( # pylint: disable=too-many-return-statements
465471 change : t .Union [
466472 StackModels .DeploymentStacksChangeBase ,
467473 StackModels .DeploymentStacksChangeDeltaRecord ,
@@ -493,7 +499,8 @@ def _get_num_potential_resource_changes(
493499 ) -> int :
494500 count = 0
495501 for i in range (start_index , len (resource_changes )):
496- if str_lower_eq (resource_changes [i ].change_certainty , StackModels .DeploymentStacksWhatIfChangeCertainty .POTENTIAL ):
502+ if str_lower_eq (
503+ resource_changes [i ].change_certainty , StackModels .DeploymentStacksWhatIfChangeCertainty .POTENTIAL ):
497504 count += 1
498505 else :
499506 break
@@ -527,7 +534,9 @@ def _format_resource_class_header(change: StackModels.DeploymentStacksWhatIfReso
527534 secret_version = item ['keyVaultReference' ].get ('secretVersion' , None )
528535 kv_id = item ['keyVaultReference' ].get ('keyVault' , {}).get ('id' , None )
529536 version_suffix = f"@{ secret_version } " if secret_version else ""
530- config_parts .append (f"{ prop } =<Secret '{ secret_name } '{ version_suffix } in key vault '{ kv_id } '>" )
537+
538+ config_parts .append (
539+ f"{ prop } =<Secret '{ secret_name } '{ version_suffix } in key vault '{ kv_id } '>" )
531540 else :
532541 config_parts .append (f"{ prop } ={ json .dumps (item .get ('value' , None ))} " )
533542
0 commit comments