class documentation

class ASTRenderer(BaseRenderer):

View In Hierarchy

Undocumented

Method __getattr__ Provides a default render method for all tokens.
Method render Returns the string representation of the AST.

Inherited from BaseRenderer:

Method __enter__ Make renderer classes into context managers.
Method __exit__ Make renderer classes into context managers.
Method __init__ Undocumented
Method render​_inner Recursively renders child tokens. Joins the rendered strings with no space in between.
Method render​_raw​_text Default render method for RawText. Simply return token.content.
Instance Variable footnotes Undocumented
Instance Variable render​_map maps tokens to their corresponding render functions.
Class Method ​_cls​_to​_func Undocumented
Static Method ​_tokens​_from​_module Helper method; takes a module and returns a list of all token classes specified in module.__all__. Useful when custom tokens are defined in a separate module.
Class Variable ​_parse​_name Undocumented
Instance Variable ​_extras a list of custom tokens to be added to the parsing process.
def __getattr__(self, name):

Provides a default render method for all tokens.

Any token without a custom render method will simply be rendered by self.render_inner.

If name does not start with 'render_', raise AttributeError as normal, for less magic during debugging.

This method would only be called if the attribute requested has not been defined. Defined attributes will not be overridden.

I still think this is heavy wizardry. Let me know if you would like this method removed.

def render(self, token):

Returns the string representation of the AST.

Overrides super().render. Delegates the logic to get_ast.