def sort_dependencies(self, dependencies: List[Dependency], activated: DependencyGraph, conflicts: Dict[str, List[Conflict]]): return sorted(dependencies, key=lambda d: [ 0 if activated.vertex_named(d.name).payload else 1, 0 if d.allows_prereleases() else 1, 0 if d.name in conflicts else 1, 0 if activated.vertex_named(d.name).payload else len( self.search_for(d)) ])
def __init__(self, package: Package, pool: Pool, io): self._package = package self._pool = pool self._io = io self._python_constraint = package.python_constraint self._base_dg = DependencyGraph() self._search_for = {}
def base(self): if self._base is not None: return self._base graph = DependencyGraph() for r in self._fixture['base']: self.add_dependencies_to_graph(graph, None, r) self._base = graph return self._base
def result(self): if self._result is not None: return self._result graph = DependencyGraph() for resolved in self._fixture['resolved']: self.add_dependencies_to_graph(graph, None, resolved) self._result = graph return self._result
def __init__( self, package, # type: Package pool, # type: Pool io): self._package = package self._pool = pool self._io = io self._python_constraint = package.python_constraint self._base_dg = DependencyGraph() self._search_for = {} self._constraints = {} super(Provider, self).__init__(debug=self._io.is_debug())
def is_requirement_satisfied_by(self, requirement: Dependency, activated: DependencyGraph, package: Package) -> bool: """ Determines whether the given requirement is satisfied by the given spec, in the context of the current activated dependency graph. """ if isinstance(requirement, Package): return requirement == package if not requirement.accepts(package): return False if package.is_prerelease() and not requirement.allows_prereleases(): vertex = activated.vertex_named(package.name) if not any([r.allows_prereleases() for r in vertex.requirements]): return False return self._package.python_constraint.matches( package.python_constraint)
def graph(): graph = DependencyGraph() return graph