A PackageURL with a Version class. This class is used to get around bisect module's lack of supplying custom comparator. Get rid of this once we use python 3.10 which supports this. See https://github.com/python/cpython/pull/20556
| 135 | |
| 136 | @total_ordering |
| 137 | class VersionedPackage: |
| 138 | """ |
| 139 | A PackageURL with a Version class. |
| 140 | This class is used to get around bisect module's lack of supplying custom |
| 141 | comparator. Get rid of this once we use python 3.10 which supports this. |
| 142 | See https://github.com/python/cpython/pull/20556 |
| 143 | """ |
| 144 | |
| 145 | def __init__(self, purl: PackageURL): |
| 146 | self.purl = purl |
| 147 | vrc = RANGE_CLASS_BY_SCHEMES.get(purl.type) |
| 148 | self.version = vrc.version_class(purl.version) |
| 149 | |
| 150 | def __eq__(self, other): |
| 151 | return self.version == other.version |
| 152 | |
| 153 | def __lt__(self, other): |
| 154 | return self.version < other.version |
| 155 | |
| 156 | |
| 157 | def update_purl_version(purl, version): |
no outgoing calls
no test coverage detected