Update this object with the ``package_url`` purl string or PackageURL if there is no pre-existing value for a given purl attribute.
(self, package_url)
| 300 | ).to_string() |
| 301 | |
| 302 | def set_purl(self, package_url): |
| 303 | """ |
| 304 | Update this object with the ``package_url`` purl string or PackageURL if |
| 305 | there is no pre-existing value for a given purl attribute. |
| 306 | """ |
| 307 | if not package_url: |
| 308 | return |
| 309 | |
| 310 | if not isinstance(package_url, PackageURL): |
| 311 | package_url = PackageURL.from_string(package_url) |
| 312 | |
| 313 | for key, value in package_url.to_dict().items(): |
| 314 | self_val = getattr(self, key) |
| 315 | if not self_val and value: |
| 316 | setattr(self, key, value) |
| 317 | |
| 318 | def to_dict(self, **kwargs): |
| 319 | mapping = super().to_dict(**kwargs) |
no test coverage detected