mf2util.py
def interpret_feed(parsed, source_url, base_href=None, hfeed=None,
                   want_json=False, fetch_mf2_func=None):
    """Interpret a source page as an h-feed or as an top-level collection
    of h-entries.

    :param dict parsed: the result of parsing a mf2 document
    :param str source_url: the URL of the source document (used for authorship
        discovery)
    :param str base_href: (optional) the href value of the base tag
    :param dict hfedd: (optional) the h-feed to be parsed. If provided,
        this will be used instead of the first h-feed on the page.
    :param callable fetch_mf2_func: (optional) function to fetch mf2 parsed
      output for a given URL.
    :return: a dict containing 'entries', a list of entries, and possibly other
        feed properties (like 'name').
    """
    result = {}
    # find the first feed if it wasn't provided
    if not hfeed:
        hfeed = find_first_entry(parsed, ['h-feed'])

    if hfeed:
        names = hfeed['properties'].get('name')
        if names:
            result['name'] = names[0]
        children = hfeed.get('children', [])
    # just use the top level 'items' as the feed children
    else:
        children = parsed.get('items', [])

    entries = []
    for child in children:
        entry = interpret(
            parsed, source_url, base_href, item=child,
            use_rel_syndication=False, want_json=want_json,
            fetch_mf2_func=fetch_mf2_func)
        if entry:
            entries.append(entry)
    result['entries'] = entries
    return result
Interpret a source page as an h-feed or as an top-level collection
    of h-entries.

    :param dict parsed: the result of parsing a mf2 document
    :param str source_url: the URL of the source document (used for authorship
        discovery)
    :param str base_href: (optional) the href value of the base tag
    :param dict hfedd: (optional) the h-feed to be parsed. If provided,
        this will be used instead of the first h-feed on the page.
    :param callable fetch_mf2_func: (optional) function to fetch mf2 parsed
      output for a given URL.
    :return: a dict containing 'entries', a list of entries, and possibly other
        feed properties (like 'name').
    
Interpret a source page as an h-feed or as an top-level collection
of h-entries.
Interpret a source page as an h - feed or as an top - level collection of h - entries .
def interpret_feed(parsed, source_url, base_href=None, hfeed=None,
                   want_json=False, fetch_mf2_func=None):
    result = {}
    if not hfeed:
        hfeed = find_first_entry(parsed, ['h-feed'])
    if hfeed:
        names = hfeed['properties'].get('name')
        if names:
            result['name'] = names[0]
        children = hfeed.get('children', [])
    else:
        children = parsed.get('items', [])
    entries = []
    for child in children:
        entry = interpret(
            parsed, source_url, base_href, item=child,
            use_rel_syndication=False, want_json=want_json,
            fetch_mf2_func=fetch_mf2_func)
        if entry:
            entries.append(entry)
    result['entries'] = entries
    return result
def interpret_feed ( parsed , source_url , base_href = None , hfeed = None , want_json = False , fetch_mf2_func = None ) : result = { } if not hfeed : hfeed = find_first_entry ( parsed , [ 'h-feed' ] ) if hfeed : names = hfeed [ 'properties' ] . get ( 'name' ) if names : result [ 'name' ] = names [ 0 ] children = hfeed . get ( 'children' , [ ] ) else : children = parsed . get ( 'items' , [ ] ) entries = [ ] for child in children : entry = interpret ( parsed , source_url , base_href , item = child , use_rel_syndication = False , want_json = want_json , fetch_mf2_func = fetch_mf2_func ) if entry : entries . append ( entry ) result [ 'entries' ] = entries return result
Interpret a source page as an h-feed or as an top-level collection
of h-entries.
Interpret a source page as an h - feed or as an top - level collection of h - entries .
"""Interpret a source page as an h-feed or as an top-level collection
    of h-entries.

    :param dict parsed: the result of parsing a mf2 document
    :param str source_url: the URL of the source document (used for authorship
        discovery)
    :param str base_href: (optional) the href value of the base tag
    :param dict hfedd: (optional) the h-feed to be parsed. If provided,
        this will be used instead of the first h-feed on the page.
    :param callable fetch_mf2_func: (optional) function to fetch mf2 parsed
      output for a given URL.
    :return: a dict containing 'entries', a list of entries, and possibly other
        feed properties (like 'name').
    """ # find the first feed if it wasn't provided # just use the top level 'items' as the feed children
a dict containing 'entries', a list of entries, and possibly other
feed properties (like 'name').
a dict containing ' entries ' a list of entries and possibly other feed properties ( like ' name ' ) .
parsed
the result of parsing a mf2 document
the result of parsing a mf2 document
source_url
the URL of the source document (used for authorship
discovery)
the URL of the source document ( used for authorship discovery )
base_href
(optional) the href value of the base tag
( optional ) the href value of the base tag
hfeed
want_json
fetch_mf2_func
(optional) function to fetch mf2 parsed
output for a given URL.
( optional ) function to fetch mf2 parsed output for a given URL .
hfedd
(optional) the h-feed to be parsed. If provided,
this will be used instead of the first h-feed on the page.
( optional ) the h - feed to be parsed . If provided this will be used instead of the first h - feed on the page .