-
-
Notifications
You must be signed in to change notification settings - Fork 945
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Annotate abstract.py
#1522
Annotate abstract.py
#1522
Conversation
for more information, see https://pre-commit.ci
Why is there a bot that commits on my branch... |
d500c39
to
c588c27
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please rebase & try to reduce the usage of Any types https://sethmlarson.dev/blog/tests-arent-enough-case-study-after-adding-types-to-urllib3#anything-but-any
kombu/abstract.py
Outdated
|
||
def unpickle_dict(cls, kwargs): | ||
def unpickle_dict( | ||
cls: Type[_ObjectType], kwargs: Dict[str, Any] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This Any
is alright.
kombu/abstract.py
Outdated
@@ -23,9 +37,9 @@ class Object: | |||
Supports automatic kwargs->attributes handling, and cloning. | |||
""" | |||
|
|||
attrs = () | |||
attrs: Tuple[Tuple[str, Any], ...] = () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thing here is that each attr
can really be Any
, and str
is the name of the attr
. It looks fine as well.
def as_dict(self, recurse=False): | ||
def f(obj, type): | ||
def as_dict(self, recurse: bool = False) -> Dict[str, Any]: | ||
def f(obj: Any, type: Callable[[Any], Any]) -> Any: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the only place that we can try to improve... I'm not sure what can be a good replacement tho...
rebased 👍 |
Related to #1511