From: Jochen Kupperschmidt Date: Sat, 14 Oct 2023 19:08:57 +0000 (-0400) Subject: Fix `get_one` return value description X-Git-Tag: rel_2_0_23~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c94ec5f143691c99e3bbfa76945ac382f85bdd48;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Fix `get_one` return value description ### Description The `get_one()` method is described as raising an error if no row is found instead of returning `None` (as `get()` does). Also, the return type hint prohibits `None`. ### Checklist This pull request is: - [x] A documentation / typographical / small typing error fix - Good to go, no issue or tests are needed - [ ] A short code fix - please include the issue number, and create an issue if none exists, which must include a complete example of the issue. one line code fixes without an issue and demonstration will not be accepted. - Please include: `Fixes: #` in the commit message - please include tests. one line code fixes without tests will not be accepted. - [ ] A new feature implementation - please include the issue number, and create an issue if none exists, which must include a complete example of how the feature would look. - Please include: `Fixes: #` in the commit message - please include tests. **Have a nice day!** Closes: #10473 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/10473 Pull-request-sha: 1cd2c2a2df2c91a303e459c8f0c5dc950d8c7b39 Change-Id: Iaf69b05d99f4ed0df922f34f27be0b46c1410f7e --- diff --git a/lib/sqlalchemy/orm/scoping.py b/lib/sqlalchemy/orm/scoping.py index c03cfe8d54..e8dfb8a80a 100644 --- a/lib/sqlalchemy/orm/scoping.py +++ b/lib/sqlalchemy/orm/scoping.py @@ -1099,7 +1099,7 @@ class scoped_session(Generic[_S]): .. versionadded:: 2.0.22 - :return: The object instance, or ``None``. + :return: The object instance. .. seealso:: diff --git a/lib/sqlalchemy/orm/session.py b/lib/sqlalchemy/orm/session.py index e1d2c4947b..e247e0d143 100644 --- a/lib/sqlalchemy/orm/session.py +++ b/lib/sqlalchemy/orm/session.py @@ -3683,7 +3683,7 @@ class Session(_SessionClassMethods, EventTarget): .. versionadded:: 2.0.22 - :return: The object instance, or ``None``. + :return: The object instance. .. seealso::