Fix bug in bfxapi.rest.endpoints.merchant sub-package.

This commit is contained in:
Davide Casale
2023-02-12 23:26:44 +01:00
parent e5b0c1af9c
commit f0d14a230f
4 changed files with 48 additions and 39 deletions

View File

@@ -14,12 +14,15 @@ def compose(*decorators):
def partial(cls):
def __init__(self, **kwargs):
for key, value in kwargs.items():
self.__setattr__(key, value)
for annotation in self.__annotations__.keys():
if annotation not in kwargs:
self.__setattr__(annotation, None)
else: self.__setattr__(annotation, kwargs[annotation])
kwargs.pop(annotation, None)
if len(kwargs) != 0:
raise TypeError(f"{cls.__name__}.__init__() got an unexpected keyword argument '{list(kwargs.keys())[0]}'")
cls.__init__ = __init__