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

pantsbuild / pants / 19381742489

15 Nov 2025 12:52AM UTC coverage: 49.706% (-30.6%) from 80.29%
19381742489

Pull #22890

github

web-flow
Merge d961abf79 into 42e1ebd41
Pull Request #22890: Updated all python subsystem constraints to 3.14

4 of 5 new or added lines in 5 files covered. (80.0%)

14659 existing lines in 485 files now uncovered.

31583 of 63540 relevant lines covered (49.71%)

0.79 hits per line

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

95.12
/src/python/pants/option/scope.py
1
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3

4
from dataclasses import dataclass
2✔
5
from typing import Any, Optional, cast
2✔
6

7
from pants.option.option_value_container import OptionValueContainer
2✔
8

9
GLOBAL_SCOPE = ""
2✔
10
GLOBAL_SCOPE_CONFIG_SECTION = "GLOBAL"
2✔
11

12

13
def normalize_scope(scope: str):
2✔
14
    return scope.lower().replace("-", "_")
2✔
15

16

17
@dataclass(frozen=True)
2✔
18
class Scope:
2✔
19
    """An options scope."""
20

21
    scope: str
2✔
22

23

24
@dataclass(frozen=True, order=True)
2✔
25
class ScopeInfo:
2✔
26
    """Information about a scope."""
27

28
    scope: str
2✔
29
    subsystem_cls: type[Any] | None = None
2✔
30
    # A ScopeInfo may have a deprecated_scope (from its associated subsystem_cls), which represents
31
    # a previous/deprecated name for a current/non-deprecated ScopeInfo. It may also be directly
32
    # deprecated via this `removal_version`, which allows for the deprecation of an entire scope.
33
    removal_version: str | None = None
2✔
34
    removal_hint: str | None = None
2✔
35

36
    # Command line goal scope flag.
37
    is_goal: bool = False
2✔
38

39
    # Builtin goals, such as `help` and `version` etc.
40
    is_builtin: bool = False
2✔
41

42
    # Auxiliary goals, such as the `experimental-bsp` goal.
43
    is_auxiliary: bool = False
2✔
44

45
    @property
2✔
46
    def description(self) -> str:
2✔
UNCOV
47
        return cast(str, self._subsystem_cls_attr("help"))
×
48

49
    @property
2✔
50
    def deprecated_scope(self) -> str | None:
2✔
51
        return cast(Optional[str], self._subsystem_cls_attr("deprecated_options_scope"))
2✔
52

53
    @property
2✔
54
    def deprecated_scope_removal_version(self) -> str | None:
2✔
UNCOV
55
        return cast(
×
56
            Optional[str],
57
            self._subsystem_cls_attr("deprecated_options_scope_removal_version"),
58
        )
59

60
    @property
2✔
61
    def scope_aliases(self) -> tuple[str, ...]:
2✔
62
        """BuiltinGoal subsystems may define aliases."""
63
        return cast(tuple[str, ...], self._subsystem_cls_attr("aliases", ()))
2✔
64

65
    def _subsystem_cls_attr(self, name: str, default=None):
2✔
66
        return getattr(self.subsystem_cls, name, default) if self.subsystem_cls else default
2✔
67

68

69
@dataclass(frozen=True)
2✔
70
class OptionsParsingSettings:
2✔
71
    """Information derived from options bootstrapping used to parse full options."""
72

73
    known_scope_infos: tuple[ScopeInfo, ...]
2✔
74
    allow_unknown_options: bool
2✔
75

76

77
@dataclass(frozen=True)
2✔
78
class ScopedOptions:
2✔
79
    """A wrapper around options selected for a particular Scope."""
80

81
    scope: Scope
2✔
82
    options: OptionValueContainer
2✔
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