summaryrefslogtreecommitdiff
path: root/test/ext/mypy/plain_files/sessionmakers.py
Commit message (Collapse)AuthorAgeFilesLines
* remove reveal_type importMike Bayer2023-02-271-2/+0
| | | | | | this is not really a thing until python 3.11 Change-Id: I4807fb01b718aa1b76dd70c561143acb22ff7b6c
* Create public QueryPropertyDescriptor type for query_propertyFederico Caselli2023-02-261-1/+31
| | | | | | | | | | | Exported the type returned by :meth:`_orm.scoped_session.query_property` using a new public type :class:`.orm.QueryPropertyDescriptor`. Also stated ``scoped_session()`` from ``sqlalchemy.orm`` in the documentation rather than from ``sqlalchemy.orm.scoping``. Fixes: #9338 Change-Id: I77da54891860095edcb1f0625ead99fee89bd76f
* Fix inferred type of async_sessionmakerSam Bull2022-11-211-0/+24
| | | | | | | | | | | | | | | | | | | | | | | Improved the typing for :class:`.sessionmaker` and :class:`.asyncsessionmaker`, so that the default type of their return value will be :class:`.Session` or :class:`.AsyncSession`, without the need to type this explicitly. Previously, Mypy would not automaticaly infer these return types from its generic base. As part of this change, arguments for :class:`.Session`, :class:`.AsyncSession`, :class:`.sessionmaker` and :class:`.asyncsessionmaker` beyond the initial "bind" argument have been made keyword-only, which includes parameters that have always been documented as keyword arguments, such as :paramref:`.Session.autoflush`, :paramref:`.Session.class_`, etc. Pull request courtesy Sam Bull. Closes: #8842 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8842 Pull-request-sha: fa6d1a8468e98b40e12f82ed7ddaddc1fde060ac Change-Id: Iaaabc4572a87489d61617d970f62b9b50db4fac7
* establish sessionmaker and async_sessionmaker as genericMike Bayer2022-05-311-0/+88
This is so that custom Session and AsyncSession classes can be typed for these factories. Added appropriate typevars to `__call__()`, `__enter__()` and other methods so that a custom Session or AsyncSession subclass is carried through. Fixes: #7656 Change-Id: Ia2b8c1f22b4410db26005c3285f6ba3d13d7f0e0