fix(select_values_template): fix pandas/numpy version compatibility i…#392
fix(select_values_template): fix pandas/numpy version compatibility i…#392fangliu117 merged 1 commit intodevfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes pandas/numpy version compatibility issues in the select_values_template by improving warning handling to distinguish between deprecation warnings and operational warnings.
Key changes:
- Enhanced warning filtering to skip deprecation warnings from numpy/pandas
- Improved warning message handling with proper string conversion
- Added explicit warning capture configuration
| ) | ||
| if caught_warnings is not None: | ||
| # Only process warnings that are relevant to the select_values operation | ||
| if caught_warnings: |
There was a problem hiding this comment.
The condition if caught_warnings: is redundant since caught_warnings is always a list when using warnings.catch_warnings(record=True). Consider removing this check or making it more explicit like if len(caught_warnings) > 0:.
| if caught_warnings: | |
| if len(caught_warnings) > 0: |
| if hasattr(warning, 'message'): | ||
| raise ValueError(str(warning.message)) |
There was a problem hiding this comment.
The hasattr(warning, 'message') check is unnecessary and potentially problematic. Warning objects always have a message attribute. This check could mask actual warnings if the attribute check fails unexpectedly.
| if hasattr(warning, 'message'): | |
| raise ValueError(str(warning.message)) | |
| raise ValueError(str(warning.message)) |
…ssue