(self, prospective: Version, spec: str)
| 374 | return operator_callable |
| 375 | |
| 376 | def _compare_compatible(self, prospective: Version, spec: str) -> bool: |
| 377 | |
| 378 | # Compatible releases have an equivalent combination of >= and ==. That |
| 379 | # is that ~=2.2 is equivalent to >=2.2,==2.*. This allows us to |
| 380 | # implement this in terms of the other specifiers instead of |
| 381 | # implementing it ourselves. The only thing we need to do is construct |
| 382 | # the other specifiers. |
| 383 | |
| 384 | # We want everything but the last item in the version, but we want to |
| 385 | # ignore suffix segments. |
| 386 | prefix = _version_join( |
| 387 | list(itertools.takewhile(_is_not_suffix, _version_split(spec)))[:-1] |
| 388 | ) |
| 389 | |
| 390 | # Add the prefix notation to the end of our string |
| 391 | prefix += ".*" |
| 392 | |
| 393 | return self._get_operator(">=")(prospective, spec) and self._get_operator("==")( |
| 394 | prospective, prefix |
| 395 | ) |
| 396 | |
| 397 | def _compare_equal(self, prospective: Version, spec: str) -> bool: |
| 398 |
nothing calls this directly
no test coverage detected