reader
reader copied to clipboard
Typing cleanup
Clean typing stuff. Might be able to use pyupgrade for this.
To do:
- [x]
from __future__ import annotations
(and the changes it enables) - [ ] don't depend on typing_extensions at runtime (example)
- [x] typing.Self (supported by mypy master, but not by 0.991)
- [x] show types for data objects in docs
- [x] ~~move TagFilter, {Feed,Entry}Filter options to _storage (todo)~~ no, used by _search as well, just remove todo
- [ ] make DEFAULT_RESERVED_NAME_SCHEME public
- [ ] move reader.core.*Hook to types
To not do:
- Consolidate (public) aliases under reader.typing (Flask does it)?
- No, reader.types is likely good enough (but maybe consolidate them in one place in the file).
-
import typing as t
,import typing_extensions as te
(Flask does it)?- Fewer imports, but makes code look kinda ugly.
-
Also,
When adding types, the convention is to import types using the form
from typing import Union
(as opposed to doing justimport typing
orimport typing as t
orfrom typing import *
).