def _identify_candidate(self, candidate: Candidate) -> tuple: url = getattr(candidate.req, "url", None) return ( candidate.identify(), candidate.version if not url else None, url_without_fragments(url) if url else None, candidate.req.editable, )
def is_satisfied_by(self, requirement: Requirement, candidate: Candidate) -> bool: if isinstance(requirement, PythonRequirement): return is_python_satisfied_by(requirement, candidate) elif candidate.identify() in self.overrides: return True if not requirement.is_named: return not candidate.req.is_named and url_without_fragments( candidate.req.url) == url_without_fragments(requirement.url) version = candidate.version or candidate.metadata.version # Allow prereleases if: 1) it is not specified in the tool settings or # 2) the candidate doesn't come from PyPI index. allow_prereleases = (self.allow_prereleases in (True, None) or not candidate.req.is_named) return requirement.specifier.contains(version, allow_prereleases)