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

Function _get_dep_packs

src/packagedcode/nuget.py:51–80  ·  view source on GitHub ↗

Yield DependentPackage found in a NuGet ``deps`` mapping or list of mappings.

(deps, extra_data)

Source from the content-addressed store, hash-verified

49
50
51def _get_dep_packs(deps, extra_data):
52 """
53 Yield DependentPackage found in a NuGet ``deps`` mapping or list of mappings.
54 """
55 if not deps:
56 return
57
58 if isinstance(deps, dict):
59 # wrap the mapping in a list
60 deps = [deps]
61
62 for dep in deps:
63 extra = dict(extra_data) or {}
64 include = dep.get('@include')
65 if include:
66 extra['include'] = include
67 exclude = dep.get('@exclude')
68 if exclude:
69 extra['exclude'] = exclude
70
71 yield models.DependentPackage(
72 purl=str(PackageURL(type='nuget', name=dep.get('@id'))),
73 # this is a range, not a version
74 extracted_requirement=dep.get('@version'),
75 scope='dependency',
76 is_runtime=True,
77 is_optional=False,
78 is_pinned=False,
79 extra_data=extra,
80 )
81
82
83def get_urls(name, version, **kwargs):

Callers 1

get_dependenciesFunction · 0.85

Calls 1

getMethod · 0.65

Tested by

no test coverage detected