From 0615b90364979e63bda9c841f083662a7773dd9e Mon Sep 17 00:00:00 2001 From: Pocoder Date: Wed, 1 Feb 2023 20:42:26 +0100 Subject: [PATCH] add info logging about structuring unknown class --- src/client/primitives/base.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/client/primitives/base.py b/src/client/primitives/base.py index 297be928..9b74ac9e 100644 --- a/src/client/primitives/base.py +++ b/src/client/primitives/base.py @@ -8,6 +8,7 @@ ] import inspect +import logging import typing from copy import copy from enum import Enum @@ -27,6 +28,8 @@ E = TypeVar('E', bound=Enum) +logger = logging.getLogger(__file__) + class VariantRegistry: @@ -53,11 +56,13 @@ def register(self, type_: type, value: E) -> type: def generate_subtype(self, type_: type, value: E) -> type: if not self.extendable: - raise NotImplementedError() + raise NotImplementedError("Only extendable VariantRegistry can generate subtype") generated_type_name = '_Generated' + value.value.title() + type_.__name__ BaseTolokaObjectMetaclass(generated_type_name, (type_,), {}, spec_value=value) - + logger.error(f'{generated_type_name} class was generated. Probably it is a new functionality on the platform.\n' + 'If you want it to be supported by toloka-kit faster ' + 'you can make feature request here: https://github.com/Toloka/toloka-kit/issues/new/choose.') return self.registered_classes[value] def __getitem__(self, value: E) -> type: