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

pantsbuild / pants / 21552830208

31 Jan 2026 11:40PM UTC coverage: 80.277% (-0.05%) from 80.324%
21552830208

Pull #23062

github

web-flow
Merge 808a9786c into 2c4dcf9cf
Pull Request #23062: Remove support for Get

18 of 25 new or added lines in 4 files covered. (72.0%)

17119 existing lines in 541 files now uncovered.

78278 of 97510 relevant lines covered (80.28%)

3.36 hits per line

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

87.1
/src/python/pants/engine/addresses.py
1
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3

4
from __future__ import annotations
12✔
5

6
from collections.abc import Iterable, Sequence
12✔
7
from dataclasses import dataclass
12✔
8

9
from pants.build_graph.address import Address as Address
12✔
10
from pants.build_graph.address import AddressInput as AddressInput  # noqa: F401: rexport.
12✔
11
from pants.build_graph.address import BuildFileAddress as BuildFileAddress  # noqa: F401: rexport.
12✔
12
from pants.build_graph.address import (  # noqa: F401: rexport.
12✔
13
    BuildFileAddressRequest as BuildFileAddressRequest,
14
)
15
from pants.build_graph.address import MaybeAddress as MaybeAddress  # noqa: F401: rexport.
12✔
16
from pants.build_graph.address import ResolveError
12✔
17
from pants.engine.collection import Collection
12✔
18
from pants.util.strutil import bullet_list
12✔
19

20

21
def assert_single_address(addresses: Sequence[Address]) -> None:
12✔
22
    """Assert that exactly one address must be contained in the collection."""
UNCOV
23
    if len(addresses) == 0:
8✔
24
        raise ResolveError("No targets were matched.")
×
UNCOV
25
    if len(addresses) > 1:
8✔
26
        raise ResolveError(
×
27
            "Expected a single target, but was given multiple targets.\n\n"
28
            f"Did you mean one of these?\n\n{bullet_list(address.spec for address in addresses)}"
29
        )
30

31

32
class Addresses(Collection[Address]):
12✔
33
    def expect_single(self) -> Address:
12✔
34
        assert_single_address(self)
×
35
        return self[0]
×
36

37

38
@dataclass(frozen=True)
12✔
39
class UnparsedAddressInputs:
12✔
40
    """Raw addresses that have not been parsed yet.
41

42
    You can convert these into fully normalized `Addresses` and `Targets` like this:
43

44
        await resolve_unparsed_address_inputs(UnparsedAddressInputs(["//:tgt1", "//:tgt2"], owning_address=None), **implicitly())
45
        await resolve_targets(**implicitly(UnparsedAddressInputs([...], owning_address=Address("original")))
46

47
    This is intended for contexts where the user specifies addresses outside of the `dependencies`
48
    field, such as through an option or a special field on a target that is not normal
49
    `dependencies`. You should not use this to resolve the `dependencies` field; use
50
    `await resolve_dependencies(DependenciesRequest(..), **implicitly())` for that.
51

52
    If the addresses are coming from a target's fields, set `owning_address` so that relative
53
    references like `:sibling` work properly.
54

55
    Unlike the `dependencies` field, this type does not work with `!` and `!!` ignores.
56

57
    Set `description_of_origin` to a value like "CLI arguments" or "the `dependencies` field
58
    from {tgt.address}". It is used for better error messages.
59
    """
60

61
    values: tuple[str, ...]
12✔
62
    relative_to: str | None
12✔
63
    description_of_origin: str
12✔
64
    skip_invalid_addresses: bool
12✔
65

66
    def __init__(
12✔
67
        self,
68
        values: Iterable[str],
69
        *,
70
        owning_address: Address | None,
71
        description_of_origin: str,
72
        skip_invalid_addresses: bool = False,
73
    ) -> None:
UNCOV
74
        object.__setattr__(self, "values", tuple(values))
1✔
UNCOV
75
        object.__setattr__(
1✔
76
            self, "relative_to", owning_address.spec_path if owning_address else None
77
        )
UNCOV
78
        object.__setattr__(self, "description_of_origin", description_of_origin)
1✔
UNCOV
79
        object.__setattr__(self, "skip_invalid_addresses", skip_invalid_addresses)
1✔
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