|
28 | 28 | if TYPE_CHECKING: |
29 | 29 | from collections.abc import Callable |
30 | 30 | from collections.abc import Iterable |
| 31 | + from collections.abc import Mapping |
31 | 32 |
|
32 | 33 | from lark import Tree |
33 | 34 |
|
@@ -91,7 +92,7 @@ def is_empty(self) -> bool: |
91 | 92 | return False |
92 | 93 |
|
93 | 94 | @abstractmethod |
94 | | - def validate(self, environment: dict[str, Any] | None) -> bool: |
| 95 | + def validate(self, environment: Mapping[str, Any] | None) -> bool: |
95 | 96 | raise NotImplementedError |
96 | 97 |
|
97 | 98 | @abstractmethod |
@@ -132,7 +133,7 @@ def union(self, other: BaseMarker) -> BaseMarker: |
132 | 133 | def is_any(self) -> bool: |
133 | 134 | return True |
134 | 135 |
|
135 | | - def validate(self, environment: dict[str, Any] | None) -> bool: |
| 136 | + def validate(self, environment: Mapping[str, Any] | None) -> bool: |
136 | 137 | return True |
137 | 138 |
|
138 | 139 | def without_extras(self) -> BaseMarker: |
@@ -173,7 +174,7 @@ def union(self, other: BaseMarker) -> BaseMarker: |
173 | 174 | def is_empty(self) -> bool: |
174 | 175 | return True |
175 | 176 |
|
176 | | - def validate(self, environment: dict[str, Any] | None) -> bool: |
| 177 | + def validate(self, environment: Mapping[str, Any] | None) -> bool: |
177 | 178 | return False |
178 | 179 |
|
179 | 180 | def without_extras(self) -> BaseMarker: |
@@ -238,7 +239,7 @@ def constraint(self) -> SingleMarkerConstraint: |
238 | 239 | def _key(self) -> tuple[object, ...]: |
239 | 240 | return self._name, self._constraint |
240 | 241 |
|
241 | | - def validate(self, environment: dict[str, Any] | None) -> bool: |
| 242 | + def validate(self, environment: Mapping[str, Any] | None) -> bool: |
242 | 243 | if environment is None: |
243 | 244 | return True |
244 | 245 |
|
@@ -645,7 +646,7 @@ def union_simplify(self, other: BaseMarker) -> BaseMarker | None: |
645 | 646 |
|
646 | 647 | return None |
647 | 648 |
|
648 | | - def validate(self, environment: dict[str, Any] | None) -> bool: |
| 649 | + def validate(self, environment: Mapping[str, Any] | None) -> bool: |
649 | 650 | return all(m.validate(environment) for m in self._markers) |
650 | 651 |
|
651 | 652 | def without_extras(self) -> BaseMarker: |
@@ -812,7 +813,7 @@ def intersect_simplify(self, other: BaseMarker) -> BaseMarker | None: |
812 | 813 |
|
813 | 814 | return None |
814 | 815 |
|
815 | | - def validate(self, environment: dict[str, Any] | None) -> bool: |
| 816 | + def validate(self, environment: Mapping[str, Any] | None) -> bool: |
816 | 817 | return any(m.validate(environment) for m in self._markers) |
817 | 818 |
|
818 | 819 | def without_extras(self) -> BaseMarker: |
|
0 commit comments