kpops 3.2.1__tar.gz → 3.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {kpops-3.2.1 → kpops-3.2.2}/PKG-INFO +1 -1
- {kpops-3.2.1 → kpops-3.2.2}/kpops/__init__.py +1 -1
- {kpops-3.2.1 → kpops-3.2.2}/kpops/components/base_components/base_defaults_component.py +0 -2
- {kpops-3.2.1 → kpops-3.2.2}/kpops/utils/yaml.py +35 -9
- {kpops-3.2.1 → kpops-3.2.2}/pyproject.toml +1 -1
- {kpops-3.2.1 → kpops-3.2.2}/LICENSE +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/README.md +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/cli/__init__.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/cli/custom_formatter.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/cli/exception.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/cli/main.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/cli/options.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/cli/registry.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/__init__.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/helm_wrapper/__init__.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/helm_wrapper/dry_run_handler.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/helm_wrapper/exception.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/helm_wrapper/helm.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/helm_wrapper/helm_diff.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/helm_wrapper/model.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/helm_wrapper/utils.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/kafka_connect/__init__.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/kafka_connect/connect_wrapper.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/kafka_connect/exception.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/kafka_connect/kafka_connect_handler.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/kafka_connect/model.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/kafka_connect/timeout.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/kubernetes/__init__.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/kubernetes/model.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/schema_handler/__init__.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/schema_handler/schema_handler.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/schema_handler/schema_provider.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/topic/__init__.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/topic/exception.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/topic/handler.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/topic/model.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/topic/proxy_wrapper.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/topic/utils.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/utils/__init__.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/component_handlers/utils/exception.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/components/__init__.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/components/base_components/__init__.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/components/base_components/helm_app.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/components/base_components/kafka_app.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/components/base_components/kafka_connector.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/components/base_components/kubernetes_app.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/components/base_components/models/__init__.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/components/base_components/models/from_section.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/components/base_components/models/resource.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/components/base_components/models/to_section.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/components/base_components/pipeline_component.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/components/streams_bootstrap/__init__.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/components/streams_bootstrap/app_type.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/components/streams_bootstrap/producer/__init__.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/components/streams_bootstrap/producer/model.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/components/streams_bootstrap/producer/producer_app.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/components/streams_bootstrap/streams/__init__.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/components/streams_bootstrap/streams/model.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/components/streams_bootstrap/streams/streams_app.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/config.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/pipeline.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/utils/__init__.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/utils/colorify.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/utils/dict_differ.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/utils/dict_ops.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/utils/docstring.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/utils/environment.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/utils/gen_schema.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/utils/pydantic.py +0 -0
- {kpops-3.2.1 → kpops-3.2.2}/kpops/utils/types.py +0 -0
|
@@ -88,8 +88,6 @@ class BaseDefaultsComponent(DescConfigModel, ABC):
|
|
|
88
88
|
tmp_self = cls(**values, enrich=False)
|
|
89
89
|
values = tmp_self.model_dump(mode="json", by_alias=True)
|
|
90
90
|
values = cls.substitute_in_component(tmp_self.config, **values)
|
|
91
|
-
# HACK: why is double substitution necessary for test_substitute_in_component
|
|
92
|
-
values = cls.substitute_in_component(tmp_self.config, **values)
|
|
93
91
|
self.__init__(
|
|
94
92
|
enrich=False,
|
|
95
93
|
validate=True,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import json
|
|
1
2
|
from collections.abc import Mapping
|
|
2
3
|
from pathlib import Path
|
|
3
4
|
from typing import Any
|
|
@@ -44,14 +45,22 @@ def substitute(input: str, substitution: Mapping[str, Any] | None = None) -> str
|
|
|
44
45
|
return ImprovedTemplate(input).safe_substitute(**prepare_substitution(substitution))
|
|
45
46
|
|
|
46
47
|
|
|
48
|
+
def _diff_substituted_str(s1: str, s2: str):
|
|
49
|
+
"""Compare 2 strings, raise exception if not equal.
|
|
50
|
+
|
|
51
|
+
:param s1: String to compare
|
|
52
|
+
:param s2: String to compare
|
|
53
|
+
:raises ValueError: An infinite loop condition detected. Check substitution variables.
|
|
54
|
+
"""
|
|
55
|
+
if s1 != s2:
|
|
56
|
+
msg = "An infinite loop condition detected. Check substitution variables."
|
|
57
|
+
raise ValueError(msg)
|
|
58
|
+
|
|
59
|
+
|
|
47
60
|
def substitute_nested(input: str, **kwargs) -> str:
|
|
48
61
|
"""Allow for multiple substitutions to be passed.
|
|
49
62
|
|
|
50
63
|
Will make as many passes as needed to substitute all possible placeholders.
|
|
51
|
-
A ceiling is set to avoid infinite loops.
|
|
52
|
-
|
|
53
|
-
HINT: If :param input: is a ``Mapping`` that you converted into ``str``,
|
|
54
|
-
You can pass it as a string, and as a ``Mapping`` to enable self-reference.
|
|
55
64
|
|
|
56
65
|
:Example:
|
|
57
66
|
|
|
@@ -63,26 +72,43 @@ def substitute_nested(input: str, **kwargs) -> str:
|
|
|
63
72
|
}
|
|
64
73
|
>>> input = "${a}, ${b}, ${c}, ${d}"
|
|
65
74
|
>>> print("Substituted string: " + substitute_nested(input, **substitution))
|
|
66
|
-
0, 0, 0, 0
|
|
75
|
+
"0, 0, 0, 0"
|
|
67
76
|
|
|
68
77
|
:param input: The raw input containing $-placeholders
|
|
69
78
|
:param **kwargs: Substitutions
|
|
70
|
-
:raises
|
|
79
|
+
:raises ValueError: An infinite loop condition detected. Check substitution variables.
|
|
71
80
|
:return: Substituted input string
|
|
72
81
|
"""
|
|
73
82
|
if not kwargs:
|
|
74
83
|
return input
|
|
84
|
+
kwargs = substitute_in_self(kwargs)
|
|
75
85
|
old_str, new_str = "", substitute(input, kwargs)
|
|
76
86
|
steps = set()
|
|
77
87
|
while new_str not in steps:
|
|
78
88
|
steps.add(new_str)
|
|
79
89
|
old_str, new_str = new_str, substitute(new_str, kwargs)
|
|
80
|
-
|
|
81
|
-
msg = "An infinite loop condition detected. Check substitution variables."
|
|
82
|
-
raise ValueError(msg)
|
|
90
|
+
_diff_substituted_str(new_str, old_str)
|
|
83
91
|
return old_str
|
|
84
92
|
|
|
85
93
|
|
|
94
|
+
def substitute_in_self(input: dict[str, Any]) -> dict[str, Any]:
|
|
95
|
+
"""Substitute all self-references in mapping.
|
|
96
|
+
|
|
97
|
+
Will make as many passes as needed to substitute all possible placeholders.
|
|
98
|
+
|
|
99
|
+
:param input: Mapping containing $-placeholders
|
|
100
|
+
:raises ValueError: An infinite loop condition detected. Check substitution variables.
|
|
101
|
+
:return: Substituted input mapping as dict
|
|
102
|
+
"""
|
|
103
|
+
old_str, new_str = "", substitute(json.dumps(input), input)
|
|
104
|
+
steps = set()
|
|
105
|
+
while new_str not in steps:
|
|
106
|
+
steps.add(new_str)
|
|
107
|
+
old_str, new_str = new_str, substitute(new_str, json.loads(new_str))
|
|
108
|
+
_diff_substituted_str(new_str, old_str)
|
|
109
|
+
return json.loads(old_str)
|
|
110
|
+
|
|
111
|
+
|
|
86
112
|
def print_yaml(data: Mapping | str, *, substitution: dict | None = None) -> None:
|
|
87
113
|
"""Print YAML object with syntax highlighting.
|
|
88
114
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|