blob: f9337f6b98fc3a4828b80944841c60e7ce2dea0d (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
"""Module for dictifying objects"""
from typing import Any, Protocol
class Dictifiable(Protocol):# pylint: disable=[too-few-public-methods]
"""Type annotation for generic object with a `dictify` method."""
def dictify(self):
"""Convert the object to a dict"""
def dictify(obj: Dictifiable) -> dict[str, Any]:
"""Turn `obj` to a dict representation."""
return obj.dictify()
|