aws / aws/aws-cli

Refactor: drop redundant list() wrapper around sorted() in formatter.py/text.py

Open Beginner friendly
#10,568 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

\`awscli/formatter.py:209-210\` (\`TableFormatter._group_scalar_keys_from_list\`) and \`awscli/text.py:91\` (\`_all_scalar_keys\`) wrap \`sorted(...)\` in \`list(...)\`, e.g. \`headers = list(sorted(headers))\`. \`sorted()\` already returns a \`list\`, so the wrapper is a needless no-op call.

## Proposed change

Drop the redundant \`list()\` wrapper in both locations: \`headers = sorted(headers)\`, \`more = sorted(more)\`, \`return sorted(keys_seen)\`. Pure refactor, no behavior change.

Contributor guide

Open the contributing guide

Research direction

Open awscli/formatter.py at TableFormatter._group_scalar_keys_from_list and awscli/text.py at _all_scalar_keys. Confirm the three specified sorted() calls and remove only their redundant list() wrappers; done means the refactor is limited to those locations with no behavior change.

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.