docs/source/conf.py
def build_mapping_tables(app):
    """Build the library mappings tables."""
    env = Environment(loader=FileSystemLoader(f"{DIR_PATH}"))
    template_file = env.get_template("table_template.j2")

    LIST_OF_MAP_DICTS = []
    for attr in dir(lib_mapper):
        if (attr.endswith("MAPPER_REVERSE") or attr.endswith("_MAPPER")) and not (
            attr.startswith("_") or attr.startswith("NETMIKO") or attr.startswith("MAIN")
        ):
            LIST_OF_MAP_DICTS.append(attr)

    for dict_name in LIST_OF_MAP_DICTS:
        lib_name = dict_name.split("_")[0]
        filename = f"{lib_name}_reverse" if "REVERSE" in dict_name else lib_name
        headers = ["NORMALIZED", lib_name] if "REVERSE" in dict_name else [lib_name, "NORMALIZED"]
        rendered_template = template_file.render(lib_names=headers, mappings=getattr(lib_mapper, dict_name))
        with open(f"{DIR_PATH}/netutils/lib_mapping/{filename}_table.rst", "w") as table_file:
            table_file.write(rendered_template)
Build the library mappings tables.
Build the library mappings tables.
Build the library mappings tables .
def build_mapping_tables(app):
    env = Environment(loader=FileSystemLoader(f"{DIR_PATH}"))
    template_file = env.get_template("table_template.j2")
    LIST_OF_MAP_DICTS = []
    for attr in dir(lib_mapper):
        if (attr.endswith("MAPPER_REVERSE") or attr.endswith("_MAPPER")) and not (
            attr.startswith("_") or attr.startswith("NETMIKO") or attr.startswith("MAIN")
        ):
            LIST_OF_MAP_DICTS.append(attr)
    for dict_name in LIST_OF_MAP_DICTS:
        lib_name = dict_name.split("_")[0]
        filename = f"{lib_name}_reverse" if "REVERSE" in dict_name else lib_name
        headers = ["NORMALIZED", lib_name] if "REVERSE" in dict_name else [lib_name, "NORMALIZED"]
        rendered_template = template_file.render(lib_names=headers, mappings=getattr(lib_mapper, dict_name))
        with open(f"{DIR_PATH}/netutils/lib_mapping/{filename}_table.rst", "w") as table_file:
            table_file.write(rendered_template)
def build_mapping_tables ( app ) : env = Environment ( loader = FileSystemLoader ( f"{DIR_PATH}" ) ) template_file = env . get_template ( "table_template.j2" ) LIST_OF_MAP_DICTS = [ ] for attr in dir ( lib_mapper ) : if ( attr . endswith ( "MAPPER_REVERSE" ) or attr . endswith ( "_MAPPER" ) ) and not ( attr . startswith ( "_" ) or attr . startswith ( "NETMIKO" ) or attr . startswith ( "MAIN" ) ) : LIST_OF_MAP_DICTS . append ( attr ) for dict_name in LIST_OF_MAP_DICTS : lib_name = dict_name . split ( "_" ) [ 0 ] filename = f"{lib_name}_reverse" if "REVERSE" in dict_name else lib_name headers = [ "NORMALIZED" , lib_name ] if "REVERSE" in dict_name else [ lib_name , "NORMALIZED" ] rendered_template = template_file . render ( lib_names = headers , mappings = getattr ( lib_mapper , dict_name ) ) with open ( f"{DIR_PATH}/netutils/lib_mapping/{filename}_table.rst" , "w" ) as table_file : table_file . write ( rendered_template )
Build the library mappings tables.
Build the library mappings tables .
"""Build the library mappings tables."""
app