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

pantsbuild / pants / 20632486505

01 Jan 2026 04:21AM UTC coverage: 43.231% (-37.1%) from 80.281%
20632486505

Pull #22962

github

web-flow
Merge 08d5c63b0 into f52ab6675
Pull Request #22962: Bump the gha-deps group across 1 directory with 6 updates

26122 of 60424 relevant lines covered (43.23%)

0.86 hits per line

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

0.0
/src/python/pants/backend/codegen/python_format_string/target_types.py
1
# Copyright 2025 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3
import logging
×
4

5
from pants.core.goals.package import OutputPathField
×
6
from pants.engine.target import (
×
7
    COMMON_TARGET_FIELDS,
8
    DictStringToStringField,
9
    MultipleSourcesField,
10
    SingleSourceField,
11
    Target,
12
    TargetFilesGenerator,
13
)
14

15
logger = logging.getLogger(__name__)
×
16

17

18
class PythonFormatStringSourceField(SingleSourceField):
×
19
    pass
×
20

21

22
class PythonFormatStringValuesField(DictStringToStringField):
×
23
    alias = "values"
×
24
    required = True
×
25
    help = "Dictionary of key/value pairs to substitute."
×
26

27

28
class PythonFormatStringOutputPathField(OutputPathField):
×
29
    def value_or_default(self, *, file_ending: str | None) -> str:
×
30
        if self.address.is_generated_target:
×
31
            if self.address.is_parametrized:
×
32
                return f"{self.address.filename}.{file_ending}{self.address.parameters_repr}"
×
33
            return f"{self.address.filename}.{file_ending}"
×
34
        return super().value_or_default(file_ending=file_ending)
×
35

36

37
class PythonFormatStringTarget(Target):
×
38
    alias = "python_format_string"
×
39
    help = "Substitutes values into a file. See k8s backend documentation for details."
×
40
    core_fields = (
×
41
        *COMMON_TARGET_FIELDS,
42
        PythonFormatStringSourceField,
43
        PythonFormatStringValuesField,
44
        PythonFormatStringOutputPathField,
45
    )
46

47

48
class PythonFormatStringsSourcesField(MultipleSourcesField):
×
49
    help = "See k8s backend documentatiom."
×
50

51

52
class PythonFormatStringTargetGenerator(TargetFilesGenerator):
×
53
    alias = "python_format_strings"
×
54
    generated_target_cls = PythonFormatStringTarget
×
55
    help = "Substitutes values into files. See k8s backend documentation for details."
×
56
    core_fields = (
×
57
        *COMMON_TARGET_FIELDS,
58
        PythonFormatStringsSourcesField,
59
    )
60
    copied_fields = COMMON_TARGET_FIELDS
×
61
    moved_fields = (PythonFormatStringValuesField,)
×
62

63

64
def target_types():
×
65
    return (
×
66
        PythonFormatStringTarget,
67
        PythonFormatStringTargetGenerator,
68
    )
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