| 307 | |
| 308 | |
| 309 | def includes( |
| 310 | specifier, # type: Union[str, SpecifierSet] |
| 311 | candidate, # type: Union[str, SpecifierSet] |
| 312 | ): |
| 313 | # type: (...) -> bool |
| 314 | |
| 315 | included_range = as_range(specifier) |
| 316 | if isinstance(included_range, UnsatisfiableSpecifierSet): |
| 317 | return False |
| 318 | |
| 319 | candidate_range = as_range(candidate) |
| 320 | if isinstance(candidate_range, UnsatisfiableSpecifierSet): |
| 321 | return False |
| 322 | |
| 323 | if isinstance(included_range, ArbitraryEquality) or isinstance( |
| 324 | candidate_range, ArbitraryEquality |
| 325 | ): |
| 326 | return included_range == candidate_range |
| 327 | |
| 328 | return candidate_range in included_range |