Skip to content

Improve query parameter normalization and boolean parsing utilities - #1538

Open
Shashank23123458867504 wants to merge 1 commit into
mskcc:masterfrom
Shashank23123458867504:refactor/improve-query-utils
Open

Improve query parameter normalization and boolean parsing utilities#1538
Shashank23123458867504 wants to merge 1 commit into
mskcc:masterfrom
Shashank23123458867504:refactor/improve-query-utils

Conversation

@Shashank23123458867504

Copy link
Copy Markdown

Summary

This PR refactors the query utility functions to improve readability, maintainability, and robustness while preserving the existing behaviour.

Changes

  • Removed redundant import alias for deepcopy
  • Added type hints for better code clarity and IDE support
  • Replaced type(...) == list with isinstance(...)
  • Iterated over dictionary items using .items() to avoid repeated lookups
  • Improved variable naming for better readability
  • Used endswith("[]") for safer query parameter normalization
  • Added docstrings for utility functions
  • Replaced logger.error() with logger.exception() to capture complete stack traces
  • Improved str2bool() by trimming whitespace and supporting additional truthy values

Testing

  • Verified existing query normalization behavior remains unchanged.
  • Tested list and scalar query parameters.
  • Tested comma-separated query values.
  • Tested boolean parsing with various string representations.

Impact

This change is a non-functional refactor that improves code quality, readability, and debugging without modifying the existing functionality.

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