We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1d84ecb commit c1a258bCopy full SHA for c1a258b
dbldatagen/serialization.py
@@ -1,15 +1,18 @@
1
""" Defines interface contracts."""
2
import sys
3
+from typing import TypeVar
4
5
6
+T = TypeVar("T", bound="SerializableToDict")
7
+
8
class SerializableToDict:
9
""" Serializable objects must implement a `_getConstructorOptions` method
10
which converts the object properties to a Python dictionary whose keys
11
are the named arguments to the class constructor.
12
"""
13
14
@classmethod
- def _fromInitializationDict(cls, options: dict) -> object:
15
+ def _fromInitializationDict(cls: type[T], options: dict) -> T:
16
""" Converts a Python dictionary to an object using the object's constructor.
17
:param options: Python dictionary with class constructor options
18
:return: An instance of the class
0 commit comments