File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
vulnerabilities/importers Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -184,12 +184,16 @@ def advisory_data(self) -> Iterable[AdvisoryData]:
184184
185185def get_purl (pkg_type : str , github_name : str ) -> Optional [PackageURL ]:
186186 """
187- Return a PackageURL by splitting the `github_name` using the `pkg_type` convention.
188- Return None and log an error if we can not split or it is an unknown package type.
189- >>> get_purl("maven", "org.apache.commons:commons-lang3")
190- PackageURL(type="maven", namespace="org.apache.commons", name="commons-lang3")
191- >>> get_purl("composer", "foo/bar")
192- PackageURL(type="composer", namespace="foo", name="bar")
187+ Return a PackageURL by splitting the `github_name` using the `pkg_type`
188+ convention. Return None and log an error if we can not split or it is an
189+ unknown package type.
190+
191+ For example::
192+ >>> expected = PackageURL(type='maven', namespace='org.apache.commons', name='commons-lang3')
193+ >>> assert get_purl("maven", "org.apache.commons:commons-lang3") == expected
194+
195+ >>> expected = PackageURL(type="composer", namespace="foo", name="bar")
196+ >>> assert get_purl("composer", "foo/bar") == expected
193197 """
194198 if pkg_type == "maven" :
195199 if ":" not in github_name :
You can’t perform that action at this time.
0 commit comments