Skip to content

Refactor: use dict comprehension in _get_endpoint_prefix_to_name_mappings #10570

Description

@Adityaj0

Summary

`_get_endpoint_prefix_to_name_mappings` in `awscli/customizations/configure/addmodel.py` (lines ~21-28) builds a dict manually with an empty-dict-then-loop-assignment pattern, where the loop body does nothing but a single key/value assignment.

Proposed change

Replace with a dict comprehension:
```python
return {
session.get_service_model(service_name).endpoint_prefix: service_name
for service_name in session.get_available_services()
}
```
Pure refactor, no behavior change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions