(self, cls)
return cls
register a class for dumping loading
        - if it has attribute yaml_tag use that to register, else use class name
        - if it has methods to_yaml/from_yaml use those to dump/load else dump attributes
          as mapping
register a class for dumping loading
        - if it has attribute yaml_tag use that to register, else use class name
        - if it has methods to_yaml/from_yaml use those to dump/load else dump attributes
          as mapping
register a class for dumping loading - if it has attribute yaml_tag use that to register else use class name - if it has methods to_yaml / from_yaml use those to dump / load else dump attributes as mapping
def register_class(self, cls):
        # type:(Any) -> Any
        """
        register a class for dumping loading
        - if it has attribute yaml_tag use that to register, else use class name
        - if it has methods to_yaml/from_yaml use those to dump/load else dump attributes
          as mapping
        """
        tag = getattr(cls, "yaml_tag", "!" + cls.__name__)
        try:
            self.representer.add_representer(cls, cls.to_yaml)
        except AttributeError:

            def t_y(representer, data):
                # type: (Any, Any) -> Any
                return representer.represent_yaml_object(
                    tag, data, cls, flow_style=representer.default_flow_style
                )

            self.representer.add_representer(cls, t_y)
        try:
            self.constructor.add_constructor(tag, cls.from_yaml)
        except AttributeError:

            def f_y(constructor, node):
                # type: (Any, Any) -> Any
                return constructor.construct_yaml_object(node, cls)

            self.constructor.add_constructor(tag, f_y)
        return cls
def register_class ( self , cls ) : # type:(Any) -> Any tag = getattr ( cls , "yaml_tag" , "!" + cls . __name__ ) try : self . representer . add_representer ( cls , cls . to_yaml ) except AttributeError : def t_y ( representer , data ) : # type: (Any, Any) -> Any return representer . represent_yaml_object ( tag , data , cls , flow_style = representer . default_flow_style ) self . representer . add_representer ( cls , t_y ) try : self . constructor . add_constructor ( tag , cls . from_yaml ) except AttributeError : def f_y ( constructor , node ) : # type: (Any, Any) -> Any return constructor . construct_yaml_object ( node , cls ) self . constructor . add_constructor ( tag , f_y ) return cls