def __call__(self, loader: 'Loader',
                 node: yaml.Node) -> Generator[Any, None, None]:
        """Construct an object from a yaml node.

        This constructs an object of the user-defined type that this \
        is the constructor for. It is registered with the yaml library, \
        and called by it. Recursion is handled by calling the yaml \
        library, so we only need to construct an object using the keys \
        and values of the given MappingNode, and those values have been \
        converted recursively for us.

        Since Python does not do type checks, we do a type check \
        manually, to ensure that the class's constructor gets the types \
        it expects. This avoids confusing errors, but moreover is a \
        security features that ensures that regardless of the content \
        of the YAML file, we produce the objects that the programmer \
        defined and expects.

        Note that this yields rather than returns, in a somewhat odd \
        way. That's directly from the PyYAML/ruamel.yaml documentation.

        Args:
            loader: The yatiml.loader that is creating this object.
            node: The node to construct from.

        Yields:
            The incomplete constructed object.
        """
        logger.debug('Constructing an object of type {}'.format(
            self.class_.__name__))
        if not isinstance(node, yaml.MappingNode):
            raise RecognitionError(
                ('{}{}Expected a MappingNode. There'
                 ' is probably something wrong with your yatiml_savorize()'
                 ' function.').format(node.start_mark, os.linesep))

        # figure out which keys are extra and strip them of tags
        # to prevent constructing objects we haven't type checked
        argspec = inspect.getfullargspec(self.class_.__init__)
        self.__strip_extra_attributes(node, argspec.args)

        # create object and let yaml lib construct subobjects
        new_obj = self.class_.__new__(self.class_)  # type: ignore
        yield new_obj
        mapping = CommentedMap()
        loader.construct_mapping(node, mapping, deep=True)

        # Convert ruamel.yaml's round-trip types to list and OrderedDict,
        # recursively for each attribute value in our mapping. Note that
        # mapping itself is still a CommentedMap.
        for key, value in mapping.copy().items():
            if (isinstance(value, CommentedMap)
                    or isinstance(value, CommentedSeq)):
                mapping[key] = self.__to_plain_containers(value)

        # do type check
        self.__check_no_missing_attributes(node, mapping)
        self.__type_check_attributes(node, mapping, argspec)

        # construct object, this should work now
        try:
            logger.debug('Calling __init__')
            if 'yatiml_extra' in argspec.args:
                attrs = self.__split_off_extra_attributes(
                    mapping, argspec.args)
                new_obj.__init__(**attrs)

            else:
                new_obj.__init__(**mapping)

        except TypeError:  # pragma: no cover
            raise RecognitionError(
                ('{}{}Could not construct object of class {}'
                 ' from {}. This is a bug in YAtiML, please report.'.format(
                     node.start_mark, os.linesep, self.class_.__name__, node)))
        logger.debug('Done constructing {}'.format(self.class_.__name__))
def __call__ ( self , loader : 'Loader' , node : yaml . Node ) -> Generator [ Any , None , None ] : logger . debug ( 'Constructing an object of type {}' . format ( self . class_ . __name__ ) ) if not isinstance ( node , yaml . MappingNode ) : raise RecognitionError ( ( '{}{}Expected a MappingNode. There' ' is probably something wrong with your yatiml_savorize()' ' function.' ) . format ( node . start_mark , os . linesep ) ) argspec = inspect . getfullargspec ( self . class_ . __init__ ) self . __strip_extra_attributes ( node , argspec . args ) new_obj = self . class_ . __new__ ( self . class_ ) yield new_obj mapping = CommentedMap ( ) loader . construct_mapping ( node , mapping , deep = True ) for key , value in mapping . copy ( ) . items ( ) : if ( isinstance ( value , CommentedMap ) or isinstance ( value , CommentedSeq ) ) : mapping [ key ] = self . __to_plain_containers ( value ) self . __check_no_missing_attributes ( node , mapping ) self . __type_check_attributes ( node , mapping , argspec ) try : logger . debug ( 'Calling __init__' ) if 'yatiml_extra' in argspec . args : attrs = self . __split_off_extra_attributes ( mapping , argspec . args ) new_obj . __init__ ( ** attrs ) else : new_obj . __init__ ( ** mapping ) except TypeError : raise RecognitionError ( ( '{}{}Could not construct object of class {}' ' from {}. This is a bug in YAtiML, please report.' . format ( node . start_mark , os . linesep , self . class_ . __name__ , node ) ) ) logger . debug ( 'Done constructing {}' . format ( self . class_ . __name__ ) )
Construct an object from a yaml node.

        This constructs an object of the user-defined type that this \
        is the constructor for. It is registered with the yaml library, \
        and called by it. Recursion is handled by calling the yaml \
        library, so we only need to construct an object using the keys \
        and values of the given MappingNode, and those values have been \
        converted recursively for us.

        Since Python does not do type checks, we do a type check \
        manually, to ensure that the class's constructor gets the types \
        it expects. This avoids confusing errors, but moreover is a \
        security features that ensures that regardless of the content \
        of the YAML file, we produce the objects that the programmer \
        defined and expects.

        Note that this yields rather than returns, in a somewhat odd \
        way. That's directly from the PyYAML/ruamel.yaml documentation.

        Args:
            loader: The yatiml.loader that is creating this object.
            node: The node to construct from.

        Yields:
            The incomplete constructed object.