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

pantsbuild / pants / 21465010194

29 Jan 2026 03:55AM UTC coverage: 80.275% (+0.005%) from 80.27%
21465010194

push

github

web-flow
Use Depot hosted runners instead of GHA hosted runners. (#22993)

Depot have kindly offered use of their runners as in-kind sponsorship.

78810 of 98175 relevant lines covered (80.28%)

3.36 hits per line

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

92.31
/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
12✔
6
from colors import cyan, green, magenta, red, yellow
12✔
7

8

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

12

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

16
    def __init__(self, color: bool) -> None:
12✔
17
        self._color = color
4✔
18

19
        def noop(x, **_):
4✔
20
            return x
4✔
21

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

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

41
    @property
12✔
42
    def color(self) -> bool:
12✔
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

© 2026 Coveralls, Inc