INNER CODE UNIT · Python

list_items

fralau/mkdocs-macros-plugin · mkdocs_macros/context.py:45

def list_items(obj):
    """
    Returns a list of key,value pairs for the content of an object
    Creates an abstraction layer so that we do not have to worry.
    """
    try:
        return obj.items()
    except AttributeError:
        # it's an object
        return obj.__dict__.items()
    except TypeError:
        # it's a list: enumerate
        return enumerate(list(obj))


def get_first_para(s) -> str:
    "Get the first para of a docstring"
    first_lines = []

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…