aws / aws/aws-cli

Refactor: use dict comprehension in _get_endpoint_prefix_to_name_mappings

Open Beginner friendly
#10,570 0 comments 0 reactions 0 assignees View on GitHub
needs-triage
Dominant language
Python
Stars
17.3k
Forks
4.6k
Avg merge
1d 2h
Merged PRs (30d)
13

Description

## 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.

Contributor guide

Open the contributing guide

Research direction

Open awscli/customizations/configure/addmodel.py and inspect _get_endpoint_prefix_to_name_mappings around lines 21-28. Compare the current manual loop with the proposed comprehension and verify that the endpoint-prefix-to-service-name mapping remains unchanged. Done means the function uses the requested comprehension without changing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Refactor
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
90/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.