Skip to content

Commit 81fa7bc

Browse files
style: apply black formatting
1 parent 4ef1ac8 commit 81fa7bc

2 files changed

Lines changed: 13 additions & 12 deletions

File tree

splunk_matrix_update.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def get_all_major_minor_versions(images: List[Dict]) -> List[str]:
111111
"""
112112
seen = set()
113113
for image in images:
114-
if re.match(r'^\d+\.\d+\.\d+$', image["name"]):
114+
if re.match(r"^\d+\.\d+\.\d+$", image["name"]):
115115
parts = image["name"].split(".")
116116
seen.add(f"{parts[0]}.{parts[1]}")
117117
return list(seen)
@@ -147,7 +147,7 @@ def get_supported_date(major_minor: str) -> str:
147147
escaped = re.escape(major_minor)
148148
# Match the version cell, skip the release-date cell, capture the EOL-date cell.
149149
# (?!\d) prevents "10.4" matching "10.40".
150-
pattern = rf'<td>{escaped}(?!\d)</td>\s*<td>[^<]*</td>\s*<td>([^<]+)</td>'
150+
pattern = rf"<td>{escaped}(?!\d)</td>\s*<td>[^<]*</td>\s*<td>([^<]+)</td>"
151151
match = re.search(pattern, response.text, re.IGNORECASE)
152152
if not match:
153153
return "UNKNOWN"

tests/test_splunk_matrix_update.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ def test_get_supported_date_returns_unknown_when_version_not_found():
9393

9494

9595
def test_get_supported_date_returns_unknown_on_http_error():
96-
with patch("splunk_matrix_update.requests.get", return_value=_mock_response("", 500)):
96+
with patch(
97+
"splunk_matrix_update.requests.get", return_value=_mock_response("", 500)
98+
):
9799
assert get_supported_date("10.4") == "UNKNOWN"
98100

99101

@@ -171,18 +173,14 @@ def test_remove_expired_versions_removes_past_eol():
171173

172174

173175
def test_remove_expired_versions_keeps_unknown():
174-
config = make_config(
175-
"[10.2]\nVERSION = 10.2.2\nSUPPORTED = UNKNOWN\n"
176-
)
176+
config = make_config("[10.2]\nVERSION = 10.2.2\nSUPPORTED = UNKNOWN\n")
177177
result = remove_expired_versions(config)
178178
assert result is False
179179
assert config.has_section("10.2")
180180

181181

182182
def test_remove_expired_versions_returns_false_when_nothing_removed():
183-
config = make_config(
184-
"[10.2]\nVERSION = 10.2.2\nSUPPORTED = 2028-01-15\n"
185-
)
183+
config = make_config("[10.2]\nVERSION = 10.2.2\nSUPPORTED = 2028-01-15\n")
186184
result = remove_expired_versions(config)
187185
assert result is False
188186
assert config.has_section("10.2")
@@ -211,7 +209,9 @@ def test_update_general_section_returns_false_when_unchanged():
211209
assert result is False
212210

213211

214-
def test_update_splunk_version_adds_new_minor_and_updates_general(tmp_path, monkeypatch):
212+
def test_update_splunk_version_adds_new_minor_and_updates_general(
213+
tmp_path, monkeypatch
214+
):
215215
# Arrange: config with only 9.3, Docker Hub has 9.3.x and 10.4.x
216216
conf_path = tmp_path / "splunk_matrix.conf"
217217
conf_path.write_text(
@@ -231,8 +231,9 @@ def test_update_splunk_version_adds_new_minor_and_updates_general(tmp_path, monk
231231
{"name": "aabbccddee11", "images": [{"digest": "sha256-9311"}]},
232232
]
233233

234-
with patch("splunk_matrix_update.get_images_details", return_value=docker_images), \
235-
patch("splunk_matrix_update.get_supported_date", return_value="2028-06-15"):
234+
with patch(
235+
"splunk_matrix_update.get_images_details", return_value=docker_images
236+
), patch("splunk_matrix_update.get_supported_date", return_value="2028-06-15"):
236237
result = update_splunk_version()
237238

238239
assert result == "True"

0 commit comments

Comments
 (0)