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

Function get_urls

src/packagedcode/pypi.py:2554–2672  ·  view source on GitHub ↗

Return a mapping of standard URLs and a mapping of extra-data URls for URLs of this package: - standard URLs are for URL attributes known in PackageData - extra_data for other URLs (possibly updating extra_data if provided).

(metainfo, name, version, poetry=False)

Source from the content-addressed store, hash-verified

2552
2553
2554def get_urls(metainfo, name, version, poetry=False):
2555 """
2556 Return a mapping of standard URLs and a mapping of extra-data URls for URLs
2557 of this package:
2558 - standard URLs are for URL attributes known in PackageData
2559 - extra_data for other URLs (possibly updating extra_data if provided).
2560 """
2561 # Misc URLs to possibly track
2562 # Project-URL: Release notes
2563 # Project-URL: Release Notes
2564 # Project-URL: Changelog
2565 # Project-URL: Changes
2566 #
2567 # Project-URL: Further Documentation
2568 # Project-URL: Packaging tutorial
2569 # Project-URL: Docs
2570 # Project-URL: Docs: RTD
2571 # Project-URL: Documentation
2572 # Project-URL: Documentation (dev)
2573 # Project-URL: Wiki
2574 #
2575 # Project-URL: Chat
2576 # Project-URL: Chat: Gitter
2577 # Project-URL: Mailing lists
2578 # Project-URL: Twitter
2579 #
2580 # Project-URL: Travis CI
2581 # Project-URL: Coverage: codecov
2582 # Project-URL: CI
2583 # Project-URL: CI: Azure Pipelines
2584 # Project-URL: CI: Shippable
2585 #
2586 # Project-URL: Tidelift
2587 # Project-URL: Code of Conduct
2588 # Project-URL: Donate
2589 # Project-URL: Funding
2590 # Project-URL: Ko-fi
2591 # Project-URL: Twine documentation
2592 # Project-URL: Twine source
2593 # Project-URL: Say Thanks!
2594
2595 extra_data = {}
2596 urls = get_pypi_urls(name, version)
2597
2598 def add_url(_url, _utype=None, _attribute=None):
2599 """
2600 Add ``_url`` to ``urls`` as _``_attribute`` or to ``extra_data`` as
2601 ``_utype`` if already defined or no ``_attribute`` is provided.
2602 """
2603 if _url:
2604 if _attribute and _attribute not in urls:
2605 urls[_attribute] = _url
2606 elif _utype:
2607 extra_data[_utype] = _url
2608
2609 # get first as this is the most common one
2610 homepage_url = (
2611 get_attribute(metainfo, 'Home-page')

Callers 6

parseMethod · 0.70
parseMethod · 0.70
parseMethod · 0.70
parse_metadataFunction · 0.70
parseMethod · 0.70
parseMethod · 0.70

Calls 4

get_pypi_urlsFunction · 0.85
get_attributeFunction · 0.85
add_urlFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected