def document_uris_from_links(link_dicts, claimant):
    document_uris = []
    for link in link_dicts:

        # Disregard self-claim URLs as they're added separately later.
        if link.keys() == ['href'] and link['href'] == claimant:
            continue

        # Disregard doi links as these are being added separately from the
        # highwire and dc metadata later on.
        if link.keys() == ['href'] and link['href'].startswith('doi:'):
            continue

        # Disregard Highwire PDF links as these are being added separately from
        # the highwire metadata later on.
        if set(link.keys()) == set(['href', 'type']):
            if link['type'] == 'application/pdf':
                continue

        uri_ = link['href']
        type_ = None

        # Handle rel="..." links.
        if type_ is None and link.get('rel') is not None:
            type_ = 'rel-{}'.format(link['rel'])

        # The "type" item in link dicts becomes content_type in DocumentURIs.
        content_type = None
        if link.get('type'):
            content_type = link['type']

        document_uris.append({
            'claimant': claimant,
            'uri': uri_,
            'type': type_,
            'content_type': content_type,
        })

    return document_uris
Return document URI dicts for the given document.link data.
dataset/ETHPy150Open hypothesis/h/h/api/parse_document_claims.py/document_uris_from_links