Commit bb32ad22 by Sébastien Eustace

Fix compatibility with Python <3.6

parent 2e70578d
......@@ -282,6 +282,9 @@ class Dependency(object):
return self._name == other.name and self._constraint == other.constraint
def __ne__(self, other):
return not self == other
def __hash__(self):
return hash((self._name, self._pretty_constraint))
......
from collections import OrderedDict
from typing import Any
from typing import Dict
from typing import List
......@@ -23,13 +25,13 @@ class PartialSolution:
self._assignments = [] # type: List[Assignment]
# The decisions made for each package.
self._decisions = {} # type: Dict[str, Any]
self._decisions = OrderedDict() # type: Dict[str, Any]
# The intersection of all positive Assignments for each package, minus any
# negative Assignments that refer to that package.
#
# This is derived from self._assignments.
self._positive = {} # type: Dict[str, Term]
self._positive = OrderedDict() # type: Dict[str, Term]
# The union of all negative [Assignment]s for each package.
#
......@@ -37,7 +39,7 @@ class PartialSolution:
# map.
#
# This is derived from self._assignments.
self._negative = {} # type: Dict[str, Dict[str, Term]]
self._negative = OrderedDict() # type: Dict[str, Dict[str, Term]]
self._attempted_solutions = 1
self._backtracking = False
......
# -*- coding: utf-8 -*-
from poetry.packages import Dependency
from .set_relation import SetRelation
class Term:
class Term(object):
"""
A statement about a package which is true or false for a given selection of
package versions.
......
# -*- coding: utf-8 -*-
import time
from typing import Dict
......@@ -11,7 +12,6 @@ from poetry.semver.semver import VersionRange
from .failure import SolveFailure
from .incompatibility import Incompatibility
from .incompatibility_cause import ConflictCause
from .incompatibility_cause import DependencyCause
from .incompatibility_cause import NoVersionsCause
from .incompatibility_cause import PackageNotFoundCause
from .incompatibility_cause import RootCause
......
......@@ -365,6 +365,9 @@ class Version(VersionRange):
and self._build == other.build
)
def __ne__(self, other):
return not self == other
def __str__(self):
return self._text
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment