fix: address Pydantic v2 deprecation warnings in tests/remove trailing whitespace (Pylint C0303)#87
Open
briansumma wants to merge 3 commits intoNorthShoreAutomation:mainfrom
Conversation
- Replace class Config with ConfigDict in FieldResponse model - Fix serialization warnings in Resolution and TimeCode classes - Update typing for Resolution and TimeCode fields in Keyframe model - Improve create_asset_filesets deprecation notice - Add model_validate method for dict handling in relevant models - Add shell script to remove trailing whitespace in files These changes eliminate the following pytest warnings: - "Support for class-based `config` is deprecated" - "create_asset_filesets is deprecated" - "Pydantic serializer warnings" Part of ongoing maintenance to ensure compatibility with Pydantic v2.
Remove trailing whitespace from multiple files to comply with Pylint rule C0303. This change improves code quality and readability while maintaining consistent formatting across the codebase. Files affected: - pythonik/specs/collection.py - pythonik/specs/base.py - pythonik/specs/files.py - pythonik/tests/test_assets.py - pythonik/tests/test_base_url.py - pythonik/tests/test_metadata.py - pythonik/models/assets/collections.py Added script: - remove_trailing_spaces.sh: Utility to automatically fix trailing whitespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR addresses several deprecation warnings that were appearing in the pytest output:
Pydantic class-based config deprecation:
class Configwithmodel_config = ConfigDict()in theFieldResponsemodelConfigDictfrom pydanticPydantic serializer warnings for Resolution and TimeCode:
model_validateclass methods to properly handle dict inputsKeyframemodel to accept either model instances or dictionariescreate_asset_filesets deprecation warning:
Added whitespace cleanup utility:
remove_trailing_spaces.shscript to clean up trailing whitespace in filesWhy these changes are needed
These changes eliminate all deprecation warnings from the test output while maintaining backward compatibility. This makes the test output cleaner and prepares the codebase for future Pydantic updates. The whitespace cleanup script helps maintain consistent code formatting.
Testing done
All tests pass with no warnings:
Follow-up work
Notes for reviewer
model_validatemethods ensure proper handling of both dict inputs and model instances