Skip to content

Improve robustness by safely accessing metadata using dict.get#175

Open
tejasnarwade wants to merge 3 commits intosunpy:mainfrom
tejasnarwade:improve-rpw-metadata-safety
Open

Improve robustness by safely accessing metadata using dict.get#175
tejasnarwade wants to merge 3 commits intosunpy:mainfrom
tejasnarwade:improve-rpw-metadata-safety

Conversation

@tejasnarwade
Copy link

@tejasnarwade tejasnarwade commented Mar 17, 2026

This PR improves robustness in RPWSpectrogram by replacing direct dictionary access (meta["instrument"]) with meta.get("instrument").

This prevents potential KeyError exceptions when the "instrument" key is missing, making the code more resilient to incomplete metadata.
This was small change but still i think prevention is better than cure so i pushed the pr
The behavior remains unchanged when the key is present.

PR Description
AI Assistance Disclosure
AI tools were used for:

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding
  • No AI tools were used**

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