diff options
author | Harry Lees <harry.lees@gmail.com> | 2023-01-31 08:38:34 -0500 |
---|---|---|
committer | mike bayer <mike_mp@zzzcomputing.com> | 2023-01-31 19:45:48 +0000 |
commit | 961f0762304db1db931d399e3b0b35cd99a4b21d (patch) | |
tree | 8e6cef11d3ff7b50643346c8d7b94bebd5e39036 /lib/sqlalchemy/orm/decl_api.py | |
parent | 6d6a17240815b9090a2972607657f93d347167d6 (diff) | |
download | sqlalchemy-961f0762304db1db931d399e3b0b35cd99a4b21d.tar.gz |
Unify doc typing
### Description
<!-- Describe your changes in detail -->
Fixes #9168
This PR replaces common occurrences of [PEP 585](https://peps.python.org/pep-0585/) style type annotations with annotations compatible with older versions of Python.
I searched for instances of the following supported types from the PEP and replaced with their legacy typing couterparts.
* tuple # typing.Tuple
* list # typing.List
* dict # typing.Dict
* set # typing.Set
* frozenset # typing.FrozenSet
* type # typing.Type
```
grep -r "list\[.*\]" ./build --exclude-dir="./build/venv/*" --exclude-dir="./build/output/*" --exclude="changelog_[0-9]*\.rst"
```
I excluded changelog files from being altered, I think some of these could be changed if necessary but others are likely to require manual checking as the change may target the new typing style specifically.
For any examples that included imports, I tried to ensure that the correct typing imports were included and properly ordered.
### Checklist
<!-- go over following points. check them with an `x` if they do apply, (they turn into clickable checkboxes once the PR is submitted, so no need to do everything at once)
-->
This pull request is:
- [x] A documentation / typographical 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: #<issue number>` 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: #<issue number>` in the commit message
- please include tests.
Closes: #9198
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9198
Pull-request-sha: 05ad4651b57c6275b29433e5e76e166344ba6c4c
Change-Id: I41b93b3dee85f9fe00cfbb3d3eb011212795de29
Diffstat (limited to 'lib/sqlalchemy/orm/decl_api.py')
-rw-r--r-- | lib/sqlalchemy/orm/decl_api.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/sqlalchemy/orm/decl_api.py b/lib/sqlalchemy/orm/decl_api.py index a46c1a7fb..4a2d5fa21 100644 --- a/lib/sqlalchemy/orm/decl_api.py +++ b/lib/sqlalchemy/orm/decl_api.py @@ -380,7 +380,7 @@ class declared_attr(interfaces._MappedAttribute[_T], _declared_attr_common): type: Mapped[str] = mapped_column(String(50)) @declared_attr.directive - def __mapper_args__(cls) -> dict[str, Any]: + def __mapper_args__(cls) -> Dict[str, Any]: if cls.__name__ == 'Employee': return { "polymorphic_on":cls.type, |