def ast_from_class(self, klass, modname=None):
        """get astroid for the given class"""
        if modname is None:
            try:
                modname = klass.__module__
            except AttributeError as exc:
                raise exceptions.AstroidBuildingError(
                    "Unable to get module for class {class_name}.",
                    cls=klass,
                    class_repr=safe_repr(klass),
                    modname=modname,
                ) from exc
        modastroid = self.ast_from_module_name(modname)
        return modastroid.getattr(klass.__name__)[0]
def ast_from_class ( self , klass , modname = None ) : if modname is None : try : modname = klass . __module__ except AttributeError as exc : raise exceptions . AstroidBuildingError ( "Unable to get module for class {class_name}." , cls = klass , class_repr = safe_repr ( klass ) , modname = modname , ) from exc modastroid = self . ast_from_module_name ( modname ) return modastroid . getattr ( klass . __name__ ) [ 0 ]
get astroid for the given class