• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pantsbuild / pants / 20547517512

28 Dec 2025 02:22AM UTC coverage: 71.791% (-8.5%) from 80.281%
20547517512

Pull #22967

github

web-flow
Merge d6d6f3ecf into f52ab6675
Pull Request #22967: Updated `pex` to 2.76.1

4 of 4 new or added lines in 2 files covered. (100.0%)

2867 existing lines in 120 files now uncovered.

24452 of 34060 relevant lines covered (71.79%)

7.96 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.29
/src/python/pants/build_graph/address.py
1
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3

4
from __future__ import annotations
10✔
5

6
import dataclasses
10✔
7
from collections.abc import Iterable
10✔
8
from dataclasses import dataclass
10✔
9

10
from pants.base.exceptions import MappingError
10✔
11
from pants.engine.engine_aware import EngineAwareParameter
10✔
12
from pants.engine.internals.native_engine import (  # noqa: F401
10✔
13
    BANNED_CHARS_IN_GENERATED_NAME as BANNED_CHARS_IN_GENERATED_NAME,
14
)
15
from pants.engine.internals.native_engine import (  # noqa: F401
10✔
16
    BANNED_CHARS_IN_PARAMETERS as BANNED_CHARS_IN_PARAMETERS,
17
)
18
from pants.engine.internals.native_engine import (  # noqa: F401
10✔
19
    BANNED_CHARS_IN_TARGET_NAME as BANNED_CHARS_IN_TARGET_NAME,
20
)
21
from pants.engine.internals.native_engine import Address as Address  # noqa: F401
10✔
22
from pants.engine.internals.native_engine import AddressInput as AddressInput  # noqa: F401
10✔
23
from pants.engine.internals.native_engine import (  # noqa: F401
10✔
24
    AddressParseException as AddressParseException,
25
)
26
from pants.engine.internals.native_engine import (  # noqa: F401
10✔
27
    InvalidAddressError as InvalidAddressError,
28
)
29
from pants.engine.internals.native_engine import (  # noqa: F401
10✔
30
    InvalidParametersError as InvalidParametersError,
31
)
32
from pants.engine.internals.native_engine import (  # noqa: F401
10✔
33
    InvalidSpecPathError as InvalidSpecPathError,
34
)
35
from pants.engine.internals.native_engine import (  # noqa: F401
10✔
36
    InvalidTargetNameError as InvalidTargetNameError,
37
)
38
from pants.engine.internals.native_engine import (  # noqa: F401
10✔
39
    UnsupportedWildcardError as UnsupportedWildcardError,
40
)
41
from pants.util.strutil import bullet_list, softwrap
10✔
42

43

44
@dataclass(frozen=True)
10✔
45
class BuildFileAddressRequest(EngineAwareParameter):
10✔
46
    """A request to find the BUILD file path for an address."""
47

48
    address: Address
10✔
49
    description_of_origin: str = dataclasses.field(hash=False, compare=False)
10✔
50

51
    def debug_hint(self) -> str:
10✔
52
        return self.address.spec
×
53

54

55
@dataclass(frozen=True)
10✔
56
class BuildFileAddress:
10✔
57
    """An address, along with the relative file path of its BUILD file."""
58

59
    address: Address
10✔
60
    rel_path: str
10✔
61

62

63
class ResolveError(MappingError):
10✔
64
    """Indicates an error resolving targets."""
65

66
    @classmethod
10✔
67
    def did_you_mean(
10✔
68
        cls,
69
        bad_address: Address,
70
        *,
71
        description_of_origin: str,
72
        known_names: Iterable[str],
73
        namespace: str,
74
    ) -> ResolveError:
UNCOV
75
        return cls(
×
76
            softwrap(
77
                f"""
78
                The address {bad_address} from {description_of_origin} does not exist.
79

80
                The target name ':{bad_address.target_name}' is not defined in the directory
81
                {namespace}. Did you mean one of these target names?\n
82
                """
83
                + bullet_list(f":{name}" for name in known_names)
84
            )
85
        )
86

87

88
@dataclass(frozen=True)
10✔
89
class MaybeAddress:
10✔
90
    """A target address, or an error if it could not be created.
91

92
    Note that this does not validate the address's target actually exists. It only validates that
93
    the address is well-formed and that its spec_path exists.
94

95
    Reminder: you may need to catch errors when creating the input `AddressInput` if the address is
96
    not well-formed.
97
    """
98

99
    val: Address | ResolveError
10✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc