diff --git a/src/poetry/mixology/term.py b/src/poetry/mixology/term.py index a8b83b80273..736cb72b4fb 100644 --- a/src/poetry/mixology/term.py +++ b/src/poetry/mixology/term.py @@ -1,5 +1,7 @@ from __future__ import annotations +import functools + from typing import TYPE_CHECKING from poetry.mixology.set_relation import SetRelation @@ -46,6 +48,7 @@ def satisfies(self, other: Term) -> bool: and self.relation(other) == SetRelation.SUBSET ) + @functools.lru_cache(maxsize=None) def relation(self, other: Term) -> int: """ Returns the relationship between the package versions @@ -108,6 +111,7 @@ def relation(self, other: Term) -> int: # not foo ^1.5.0 is a superset of not foo ^1.0.0 return SetRelation.OVERLAPPING + @functools.lru_cache(maxsize=None) def intersect(self, other: Term) -> Term | None: """ Returns a Term that represents the packages