Repository navigation
Modernisation - #181
Draft
timsavage wants to merge 8 commits into
Draft
Modernisation#181timsavage wants to merge 8 commits into
timsavage wants to merge 8 commits into
Conversation
Replace the custom cached_property implementation with functools.cached_property, updating clear_caches to a standalone clear_cached_properties helper. Refactor chunk to use itertools.islice with input validation. Clean up related _cache workarounds in adapters and resources.
Add __bool__, __len__, __contains__, __getitem__, __iter__, and __enter__/__exit__ to ValidationErrorCollection so it behaves like a mapping and can be used as a context manager that raises on exit. Add helpers add_error, clear, and message_count, and guard add_message and add_resource_message against empty inputs. Type-annotate the class and move the BaseField import behind TYPE_CHECKING. Expand tests to cover all new methods and edge cases.
Add full type annotations, __all__ exports, and docstrings throughout registration.py. Support isolated instances via shared=False to enable deterministic testing. Change field_resolvers from a set to a sorted list so subclass resolvers take precedence by MRO depth. Add clear() and invalidate child-resource cache on new registrations. Improve get_validation_error_handler to accept both exception instances and classes. Add comprehensive tests for all cache methods and module-level aliases.
…dator Add full type annotations, __all__ exports, and __slots__ throughout validators.py. Replace custom IPv4/IPv6 regex validation with ipaddress stdlib. Add BetweenValidator for range checks. Support inverse_match on RegexValidator and decorator usage for simple_validator. Enforce RFC 5321 email length limits (254 total, 64 user, 255 domain). Rewrite tests to follow Arrange, Act, Assert pattern with pytest.raises context managers.
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.
Updates to odin to improve typing, performance and any bugs discovered by an automated review