aio-libs / aio-libs/aiojobs

Consider using `TypedDict` for 2nd `ExceptionHandler` parameter

Open
#565 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
929
Forks
68
Avg merge
1m
Merged PRs (30d)
2

Description

The `ExceptionHandler` type is currently defined as taking a `dict[str, Any]` as its 2nd parameter:

https://github.com/aio-libs/aiojobs/blob/70fe9e5dfd83bb5a9d0ce8d75bea2832b674da68/aiojobs/_scheduler.py#L29

But the docs explain that the set of keys of this dictionary is actually static:

https://github.com/aio-libs/aiojobs/blob/70fe9e5dfd83bb5a9d0ce8d75bea2832b674da68/docs/api.rst?plain=1#L161-L168

So it would be better for type-safety (and things that come with it like IDE completion) if this used a [`TypedDict`](https://docs.python.org/3/library/typing.html#typing.TypedDict) instead of a generic `dict[str, Any]`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.