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

pantsbuild / pants / 24055979590

06 Apr 2026 11:17PM UTC coverage: 52.37% (-40.5%) from 92.908%
24055979590

Pull #23225

github

web-flow
Merge 67474653c into 542ca048d
Pull Request #23225: Add --test-show-all-batch-targets to expose all targets in batched pytest

6 of 17 new or added lines in 2 files covered. (35.29%)

23030 existing lines in 605 files now uncovered.

31643 of 60422 relevant lines covered (52.37%)

1.05 hits per line

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

64.0
/src/python/pants/util/frozendict.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
2✔
5

6
from collections.abc import Callable, ItemsView, Iterable, Mapping, ValuesView
2✔
7
from typing import TypeVar, cast, overload
2✔
8

9
from pants.engine.internals.native_engine import FrozenDict as FrozenDict
2✔
10
from pants.util.memo import memoized_method
2✔
11

12
K = TypeVar("K")
2✔
13
V = TypeVar("V")
2✔
14
T = TypeVar("T")
2✔
15

16

17
class LazyFrozenDict(FrozenDict[K, V]):
2✔
18
    """A lazy version of `FrozenDict` where the values are not loaded until referenced."""
19

20
    @overload
21
    def __new__(
22
        cls, __items: Iterable[tuple[K, Callable[[], V]]], **kwargs: Callable[[], V]
23
    ) -> LazyFrozenDict[K, V]: ...
24

25
    @overload
26
    def __new__(
27
        cls, __other: Mapping[K, Callable[[], V]], **kwargs: Callable[[], V]
28
    ) -> LazyFrozenDict[K, V]: ...
29

30
    @overload
31
    def __new__(cls, **kwargs: Callable[[], V]) -> LazyFrozenDict[K, V]: ...
32

33
    def __new__(
2✔
34
        cls,
35
        *item: Mapping[K, Callable[[], V]] | Iterable[tuple[K, Callable[[], V]]],
36
        **kwargs: Callable[[], V],
37
    ) -> LazyFrozenDict[K, V]:
UNCOV
38
        return super().__new__(cls, *item, **kwargs)  # type: ignore[arg-type]
×
39

40
    def __getitem__(self, k: K) -> V:
2✔
UNCOV
41
        return self._get_value(k)
×
42

43
    @overload
44
    def get(self, key: K, /) -> V | None: ...
45
    @overload
46
    def get(self, key: K, /, default: T = ...) -> V | T: ...
47

48
    def get(self, key: K, /, default: T | None = None) -> V | T | None:
2✔
49
        try:
×
50
            return self._get_value(key)
×
51
        except KeyError:
×
52
            return default
×
53

54
    @memoized_method
2✔
55
    def _get_value(self, k: K) -> V:
2✔
UNCOV
56
        return cast("Callable[[], V]", super().__getitem__(k))()
×
57

58
    def items(self) -> ItemsView[K, V]:
2✔
UNCOV
59
        return ItemsView(self)
×
60

61
    def values(self) -> ValuesView[V]:
2✔
UNCOV
62
        return ValuesView(self)
×
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