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

pantsbuild / pants / 18517631058

15 Oct 2025 04:18AM UTC coverage: 69.207% (-11.1%) from 80.267%
18517631058

Pull #22745

github

web-flow
Merge 642a76ca1 into 99919310e
Pull Request #22745: [windows] Add windows support in the stdio crate.

53815 of 77759 relevant lines covered (69.21%)

2.42 hits per line

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

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

4
from __future__ import annotations
7✔
5

6
from collections.abc import Callable, Iterable
7✔
7
from dataclasses import dataclass
7✔
8
from typing import Any, TypeVar, cast
7✔
9

10
from pants.base.exiter import ExitCode
7✔
11
from pants.build_graph.build_configuration import BuildConfiguration
7✔
12
from pants.engine.environment import EnvironmentName
7✔
13
from pants.engine.internals.scheduler import SchedulerSession
7✔
14
from pants.engine.internals.selectors import Params
7✔
15
from pants.engine.rules import QueryRule
7✔
16
from pants.engine.unions import UnionRule, union
7✔
17
from pants.help.help_info_extracter import AllHelpInfo
7✔
18

19
T = TypeVar("T")
7✔
20

21

22
@union(in_scope_types=[EnvironmentName])
7✔
23
@dataclass(frozen=True)
7✔
24
class ExplorerServerRequest:
7✔
25
    address: str
7✔
26
    port: int
7✔
27
    request_state: RequestState
7✔
28

29
    @classmethod
7✔
30
    def rules_for_implementation(cls, impl: type):
7✔
31
        return (
×
32
            UnionRule(cls, impl),
33
            QueryRule(ExplorerServer, (impl, EnvironmentName)),
34
        )
35

36

37
@dataclass(frozen=True)
7✔
38
class ExplorerServer:
7✔
39
    main: Callable[[], ExitCode]
7✔
40

41
    def run(self) -> ExitCode:
7✔
42
        # Work around a mypy issue with a callable attribute.  Related to
43
        # https://github.com/python/mypy/issues/6910.  What has me bugged out is why we don't see
44
        # this issue with `WorkunitsCallbackFactory.callback_factory` too, for instance.
45
        main = cast("Callable[[], ExitCode]", getattr(self, "main"))
×
46
        return main()
×
47

48

49
@dataclass(frozen=True)
7✔
50
class RequestState:
7✔
51
    all_help_info: AllHelpInfo
7✔
52
    build_configuration: BuildConfiguration
7✔
53
    scheduler_session: SchedulerSession
7✔
54
    env_name: EnvironmentName
7✔
55

56
    def product_request(
7✔
57
        self,
58
        product: type[T],
59
        subjects: Iterable[Any] = (),
60
        poll: bool = False,
61
        timeout: float | None = None,
62
    ) -> T:
63
        result = self.scheduler_session.product_request(
×
64
            product,
65
            [Params(*subjects, self.env_name)],
66
            poll=poll,
67
            timeout=timeout,
68
        )
69
        assert len(result) == 1
×
70
        return cast(T, result[0])
×
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

© 2025 Coveralls, Inc