def save_attribute(elements, module_path):
    """ Recursively save attributes with module name and signature. """
    for elem, signature in elements.items():
        if isinstance(signature, dict):  # Submodule case
            save_attribute(signature, module_path + (elem,))
        elif signature.isattribute():
            assert elem not in attributes  # we need unicity
            attributes[elem] = (module_path, signature,)
        elif isinstance(signature, Class):
            save_attribute(signature.fields, module_path + (elem,))
def save_attribute ( elements , module_path ) : for elem , signature in elements . items ( ) : if isinstance ( signature , dict ) : save_attribute ( signature , module_path + ( elem , ) ) elif signature . isattribute ( ) : assert elem not in attributes attributes [ elem ] = ( module_path , signature , ) elif isinstance ( signature , Class ) : save_attribute ( signature . fields , module_path + ( elem , ) )
Recursively save attributes with module name and signature.