Merged
Conversation
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The partial() wrapper was not needed since asc and desc can be referenced directly as callables. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The future=True option is deprecated in SQLAlchemy 2.0 and is now the default behavior. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The list comprehension already produces a list, making the or [] fallback unnecessary. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The scoped_session.remove() call could fail if the database connection is already closed during garbage collection. Wrapping in try/except with debug logging prevents errors during interpreter shutdown. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replaces list comprehension with any() generator expression to short-circuit on first invalid model instead of iterating all items. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Consolidates duplicated PK inspection logic from BaseRepository._model_pk() and result_presenters._pk_from_result_object() into a single get_model_pk_name() function in common.py. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Verifies that exceptions from scoped_session.remove() are caught and logged during cleanup, preventing errors during garbage collection. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use Callable instead of type since asc/desc are functions, not types. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.
Code Improvements
This PR contains several minor code quality improvements:
Remove duplicate license header - Removed duplicate partial MIT license block in
_repository/abstract.pyRemove unnecessary
partialwrapper - Thepartial()wrapper in_filter_order_bywas not needed sinceascanddesccan be referenced directly as callablesRemove deprecated
future=Trueengine option - This option is deprecated in SQLAlchemy 2.0 and is now the default behaviorRemove redundant
or []fallback - Incursor_paginated_find, the list comprehension already produces a list, making theor []fallback unnecessaryAdd exception handling to
SessionHandler.__del__- Thescoped_session.remove()call could fail if the database connection is already closed during garbage collection. Wrapping in try/except withdebug logging prevents errors during interpreter shutdown
Use
any()for more efficient model validation - Replaces list comprehension withany()generator expression to short-circuit on first invalid model instead of iterating all itemsExtract shared primary key utility function - Consolidates duplicated PK inspection logic from
BaseRepository._model_pk()andresult_presenters._pk_from_result_object()into a singleget_model_pk_name()function incommon.py