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

pantsbuild / pants / 20332790708

18 Dec 2025 09:48AM UTC coverage: 64.992% (-15.3%) from 80.295%
20332790708

Pull #22949

github

web-flow
Merge f730a56cd into 407284c67
Pull Request #22949: Add experimental uv resolver for Python lockfiles

54 of 97 new or added lines in 5 files covered. (55.67%)

8270 existing lines in 295 files now uncovered.

48990 of 75379 relevant lines covered (64.99%)

1.81 hits per line

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

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

4

5
from colors import color as ansicolor
5✔
6
from colors import cyan, green, magenta, red, yellow
5✔
7

8

9
def _orange(s: str, **kwargs):
5✔
10
    return ansicolor(s, "orange", **kwargs)
×
11

12

13
class MaybeColor:
5✔
14
    """A mixin to allow classes to optionally colorize their output."""
15

16
    def __init__(self, color: bool) -> None:
5✔
UNCOV
17
        self._color = color
×
18

UNCOV
19
        def noop(x, **_):
×
UNCOV
20
            return x
×
21

UNCOV
22
        self.maybe_color = ansicolor if color else noop
×
UNCOV
23
        self.maybe_cyan = cyan if color else noop
×
UNCOV
24
        self.maybe_green = green if color else noop
×
UNCOV
25
        self.maybe_orange = _orange if color else noop
×
UNCOV
26
        self.maybe_red = red if color else noop
×
UNCOV
27
        self.maybe_magenta = magenta if color else noop
×
UNCOV
28
        self.maybe_yellow = yellow if color else noop
×
29

30
    def _format_did_you_mean_matches(self, did_you_mean: list[str]) -> str:
5✔
UNCOV
31
        if len(did_you_mean) == 1:
×
UNCOV
32
            formatted_candidates = self.maybe_cyan(did_you_mean[0])
×
UNCOV
33
        elif len(did_you_mean) == 2:
×
UNCOV
34
            formatted_candidates = " or ".join(self.maybe_cyan(g) for g in did_you_mean)
×
35
        else:
UNCOV
36
            formatted_candidates = (
×
37
                f"{', '.join(self.maybe_cyan(g) for g in did_you_mean[:-1])}, or {did_you_mean[-1]}"
38
            )
UNCOV
39
        return str(formatted_candidates)
×
40

41
    @property
5✔
42
    def color(self) -> bool:
5✔
43
        return self._color
×
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