aio-libs / aio-libs/aiojobs

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

Ouverte
#565 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Python
Étoiles
929
Forks
68
Merge moyen
1 min
PR mergées (30 j)
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]`.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.