python: type generated client using Self (#16693)

* python: type generated client using Self

This doesn't offer a clear win but this helps for:

* Using modern types and making the typing intent clearer
* Decreasing the need for `from __future__ import annotations`, since a
  class can now refer to itself without using its name
* Using more `cls` to automatically refer to the class, instead of
  respecifying the class name every time

Self is available from Python 3.11 and is provided in typing_extensions
(since 4.0.0) as a fallback for older versions

See: https://peps.python.org/pep-0673/
See: https://github.com/python/typing_extensions/blob/main/CHANGELOG.md#added-in-version-400

* generate code
This commit is contained in:
Jonathan Ballet
2023-10-01 17:31:39 +02:00
committed by GitHub
parent bd1caf69cb
commit cec5b8965a
195 changed files with 1723 additions and 824 deletions

View File

@@ -28,7 +28,6 @@ REQUIRES = [
"urllib3 >= 1.25.3, < 2.1.0",
"python-dateutil",
"pydantic >= 2",
"aenum",
"typing-extensions >= 4.7.1",
]