• 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

72.73
/src/python/pants/vcs/hunk.py
1
# Copyright 2024 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3
from dataclasses import dataclass
2✔
4

5
from pants.engine.collection import Collection
2✔
6

7

8
@dataclass(frozen=True)
2✔
9
class TextBlock:
2✔
10
    """Block of lines in a file.
11

12
    Lines are 1 indexed, `start` is inclusive.
13

14
    TextBlock is used as a part of unified diff hunk, thus it can be empty,
15
    i.e. count can be equal to 0. In the special case when the file is empty
16
    start = 0 and count = 0.
17
    """
18

19
    start: int
2✔
20
    count: int
2✔
21

22
    def __init__(self, start: int, count: int):
2✔
UNCOV
23
        object.__setattr__(self, "start", start)
×
UNCOV
24
        object.__setattr__(self, "count", count)
×
25

UNCOV
26
        self.__post_init__()
×
27

28
    def __post_init__(self):
2✔
UNCOV
29
        if self.count < 0:
×
30
            raise ValueError(f"{self.count=} can't be negative")
×
31

32
    @property
2✔
33
    def end(self) -> int:
2✔
UNCOV
34
        return self.start + self.count
×
35

36

37
class TextBlocks(Collection[TextBlock]):
2✔
38
    pass
2✔
39

40

41
@dataclass(frozen=True)
2✔
42
class Hunk:
2✔
43
    """Hunk of difference in unified format.
44

45
    https://www.gnu.org/software/diffutils/manual/html_node/Detailed-Unified.html
46

47
    In the special case when file is created left = None.
48
    In the special case when file is deleted right = None.
49
    """
50

51
    left: TextBlock | None
2✔
52
    right: TextBlock | None
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