]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Add type annotations to `postgresql.array`
authorDenis Laxalde <denis@laxalde.org>
Fri, 14 Mar 2025 21:01:50 +0000 (17:01 -0400)
committerFederico Caselli <cfederico87@gmail.com>
Sat, 15 Mar 2025 15:21:27 +0000 (16:21 +0100)
commit75c8e112c9362f89787d8fc25a6a200700052450
tree0bd011433f4cca3d3cb4aa0ce1afd15690f85394
parentbceff0e9e60ee0e4ab3c9268f1234c6b644c36e2
Add type annotations to `postgresql.array`

Improved static typing for `postgresql.array()` by making the type parameter (the type of array's elements) inferred from the `clauses` and `type_` arguments while also ensuring they are consistent.

Also completed type annotations of `postgresql.ARRAY` following commit 0bf7e02afbec557eb3a5607db407f27deb7aac77 and added type annotations for functions `postgresql.Any()` and `postgresql.All()`.

Finally, fixed shadowing `typing.Any` by the `Any()` function through aliasing as `typing_Any`.

Related to #6810

Closes: #12384
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/12384
Pull-request-sha: 78eea29f1de850afda036502974521969629de7e

Change-Id: I5d35d15ec8ba4d58eeb9bf00abb710e2e585731f
lib/sqlalchemy/dialects/postgresql/array.py
lib/sqlalchemy/dialects/postgresql/json.py
test/typing/plain_files/dialects/postgresql/pg_stuff.py