Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: extract and narrow orm.object_session() #17582

Merged
merged 2 commits into from
Feb 11, 2025

Conversation

miketheman
Copy link
Member

Since object_session(...) can return None, we need to help mypy have confidence that the session is indeed there.

One way to narrow the type is to assert that it's not None, and therefore should not alert about union-attr problems.

Includes a couple of renames, and variable extraction where relevant.

Since `object_session(...)` can return `None`, we need to help mypy have
confidence that the session is indeed there.

One way to narrow the type is to assert that it's not `None`, and
therefore should not alert about `union-attr` problems.

Includes a couple of renames, and variable extraction where relevant.

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
@miketheman miketheman requested a review from a team as a code owner February 10, 2025 22:23
@miketheman
Copy link
Member Author

Extracted from #17519 - focused only on the changes to support object_session narrowing.

@miketheman miketheman added the testing Test infrastructure and individual tests label Feb 10, 2025
@miketheman miketheman merged commit 74b7a87 into pypi:main Feb 11, 2025
20 checks passed
@miketheman miketheman deleted the miketheman/orm-session branch February 11, 2025 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing Test infrastructure and individual tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants