MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / get_description

Function get_description

src/packagedcode/pypi.py:1884–1902  ·  view source on GitHub ↗

Return a list of keywords found in a ``metainfo`` object or mapping.

(metainfo, location=None)

Source from the content-addressed store, hash-verified

1882
1883
1884def get_description(metainfo, location=None):
1885 """
1886 Return a list of keywords found in a ``metainfo`` object or mapping.
1887 """
1888 description = None
1889 # newer metadata versions use the payload for the description
1890 if hasattr(metainfo, 'get_payload'):
1891 description = metainfo.get_payload()
1892 description = description and description.strip() or None
1893 if not description:
1894 # legacymetadata versions use the Description for the description
1895 description = get_attribute(metainfo, 'Description')
1896 if not description and location:
1897 # older metadata versions can use a DESCRIPTION.rst file
1898 description = get_legacy_description(location=fileutils.parent_directory(location))
1899
1900 summary = get_attribute(metainfo, 'Summary')
1901 description = clean_description(description)
1902 return build_description(summary, description)
1903
1904
1905def clean_description(description):

Callers 3

parse_metadataFunction · 0.85
parseMethod · 0.85
parseMethod · 0.85

Calls 4

build_descriptionFunction · 0.90
get_attributeFunction · 0.85
get_legacy_descriptionFunction · 0.85
clean_descriptionFunction · 0.85

Tested by

no test coverage detected