|
8 | 8 | import os |
9 | 9 | import platform |
10 | 10 | import sys |
11 | | -from typing import AbstractSet, Callable, Literal, Mapping, TypedDict, Union, cast |
| 11 | +from collections.abc import Set as AbstractSet |
| 12 | +from typing import TYPE_CHECKING, Callable, Literal, TypedDict, Union, cast |
12 | 13 |
|
13 | 14 | from ._parser import MarkerAtom, MarkerList, Op, Value, Variable |
14 | 15 | from ._parser import parse_marker as _parse_marker |
15 | 16 | from ._tokenizer import ParserSyntaxError |
16 | 17 | from .specifiers import InvalidSpecifier, Specifier |
17 | 18 | from .utils import canonicalize_name |
18 | 19 |
|
| 20 | +if TYPE_CHECKING: |
| 21 | + from collections.abc import Mapping |
| 22 | + |
19 | 23 | __all__ = [ |
20 | 24 | "Environment", |
21 | 25 | "EvaluateContext", |
@@ -459,14 +463,15 @@ def evaluate( |
459 | 463 | "dict[str, str | AbstractSet[str]]", default_environment() |
460 | 464 | ) |
461 | 465 | if context == "lock_file": |
462 | | - current_environment.update( |
463 | | - extras=frozenset(), dependency_groups=frozenset() |
464 | | - ) |
| 466 | + current_environment |= { |
| 467 | + "extras": frozenset(), |
| 468 | + "dependency_groups": frozenset(), |
| 469 | + } |
465 | 470 | elif context == "metadata": |
466 | 471 | current_environment["extra"] = "" |
467 | 472 |
|
468 | 473 | if environment is not None: |
469 | | - current_environment.update(environment) |
| 474 | + current_environment |= environment |
470 | 475 | if "extra" in current_environment: |
471 | 476 | # The API used to allow setting extra to None. We need to handle |
472 | 477 | # this case for backwards compatibility. Also skip running |
|
0 commit comments