Summary
`awscli/customizations/emr/createdefaultroles.py` `_construct_result` (lines ~208-224) builds its result via a helper, `_construct_role_and_role_policy_structure`, that takes a mutable list parameter literally named `list` (shadowing the builtin) and mutates it in place across three repetitive calls just to conditionally append a dict.
Proposed change
Replace the mutating helper with a list comprehension/filter over the three `(response, policy)` pairs:
```python
return [
{'Role': response['Role'], 'RolePolicy': policy}
for response, policy in responses_and_policies
if response is not None and response['Role'] is not None
]
```
This removes the builtin-shadowing parameter name and the mutating helper entirely. Pure refactor, no behavior change.
Summary
`awscli/customizations/emr/createdefaultroles.py` `_construct_result` (lines ~208-224) builds its result via a helper, `_construct_role_and_role_policy_structure`, that takes a mutable list parameter literally named `list` (shadowing the builtin) and mutates it in place across three repetitive calls just to conditionally append a dict.
Proposed change
Replace the mutating helper with a list comprehension/filter over the three `(response, policy)` pairs:
```python
return [
{'Role': response['Role'], 'RolePolicy': policy}
for response, policy in responses_and_policies
if response is not None and response['Role'] is not None
]
```
This removes the builtin-shadowing parameter name and the mutating helper entirely. Pure refactor, no behavior change.