Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactoring python code for alias loader #9235

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

advaitpatel
Copy link

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

This PR introduces several optimizations to the Alias Loader and Command Injector components of the AWS CLI.

  • Added a caching mechanism to avoid redundant file parsing when the alias file remains unchanged. Utilized file modification timestamps (os.path.getmtime) to determine if re-parsing is necessary.
  • Replaced shlex.split with re.split in _get_alias_args to optimize alias argument parsing.
  • Refactored _cleanup_alias_values to use dictionary comprehensions, improving readability and performance.
  • Incorporated concurrent.futures.ThreadPoolExecutor to parallelize the injection of aliases into the command table.
  • Modified ExternalAliasCommand to avoid shell=True by leveraging list-based command invocation, improving security and performance.

@advaitpatel
Copy link
Author

Hello @kdaily @jonathan343 @hssyoo - can I please get a review on this? TIA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant