mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-08 11:46:35 +00:00
style: settle the formatter rewrites of the instructions replay
ruff reflows the guide_role signature and its two call sites, the same for three test modules, and the YAML formatter prepends the document marker to the machine's compose file. These files were created one commit too late to be caught by the previous formatting pass. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
70d7ddf5fc
commit
3dd4f0abb1
5 files changed
+23
-10
No files matched your search
@@ -16,9 +16,7 @@ from plugins.lookup.deployment import running_apps
|
||||
from utils.roles.validation.invokable import list_invokable_app_ids
|
||||
|
||||
|
||||
def guide_role(
|
||||
application_id: str, running: list[str], invokable: list[str]
|
||||
) -> str:
|
||||
def guide_role(application_id: str, running: list[str], invokable: list[str]) -> str:
|
||||
"""Return the app whose guide is replayed, ``application_id`` when it is alone.
|
||||
|
||||
Args:
|
||||
@@ -39,5 +37,9 @@ class LookupModule(LookupBase):
|
||||
**kwargs: Any,
|
||||
) -> list[str]:
|
||||
vars_ = variables or getattr(self._templar, "available_variables", {}) or {}
|
||||
application_id = str(terms[0]) if terms else str(vars_.get("application_id", ""))
|
||||
return [guide_role(application_id, running_apps(vars_), list_invokable_app_ids())]
|
||||
application_id = (
|
||||
str(terms[0]) if terms else str(vars_.get("application_id", ""))
|
||||
)
|
||||
return [
|
||||
guide_role(application_id, running_apps(vars_), list_invokable_app_ids())
|
||||
]
|
||||
@@ -1,3 +1,4 @@
|
||||
---
|
||||
services:
|
||||
machine:
|
||||
build:
|
||||
|
||||
@@ -9,7 +9,9 @@ INVOKABLE = ["web-app-docs", "web-app-nextcloud", "svc-db-postgres", "dsk-gnt-cl
|
||||
class TestGuideRole(unittest.TestCase):
|
||||
def test_the_first_invokable_peer_wins(self):
|
||||
self.assertEqual(
|
||||
guide_role("web-app-docs", ["web-app-docs", "web-app-nextcloud"], INVOKABLE),
|
||||
guide_role(
|
||||
"web-app-docs", ["web-app-docs", "web-app-nextcloud"], INVOKABLE
|
||||
),
|
||||
"web-app-nextcloud",
|
||||
)
|
||||
|
||||
@@ -20,14 +22,18 @@ class TestGuideRole(unittest.TestCase):
|
||||
)
|
||||
|
||||
def test_the_asking_role_alone_names_itself(self):
|
||||
self.assertEqual(guide_role("web-app-docs", ["web-app-docs"], INVOKABLE), "web-app-docs")
|
||||
self.assertEqual(
|
||||
guide_role("web-app-docs", ["web-app-docs"], INVOKABLE), "web-app-docs"
|
||||
)
|
||||
|
||||
def test_an_empty_round_names_the_asking_role(self):
|
||||
self.assertEqual(guide_role("web-app-docs", [], INVOKABLE), "web-app-docs")
|
||||
|
||||
def test_the_round_order_decides_between_two_peers(self):
|
||||
self.assertEqual(
|
||||
guide_role("web-app-docs", ["svc-db-postgres", "dsk-gnt-claude"], INVOKABLE),
|
||||
guide_role(
|
||||
"web-app-docs", ["svc-db-postgres", "dsk-gnt-claude"], INVOKABLE
|
||||
),
|
||||
"svc-db-postgres",
|
||||
)
|
||||
|
||||
|
||||
@@ -49,7 +49,9 @@ class QueueFixture(LibraryFixture):
|
||||
directory = self.library.translations / version
|
||||
directory.mkdir(parents=True, exist_ok=True)
|
||||
(directory / "languages.json").write_text(
|
||||
json.dumps({"known": {code: code for code in translated}, "translated": translated}),
|
||||
json.dumps(
|
||||
{"known": {code: code for code in translated}, "translated": translated}
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
|
||||
@@ -80,7 +80,9 @@ class TestFetch(unittest.TestCase):
|
||||
mock.patch.object(extract.urllib.request, "urlopen", side_effect=answers),
|
||||
mock.patch.object(extract.time, "sleep"),
|
||||
):
|
||||
self.assertEqual(extract.fetch("http://x/", timeout=60, poll=0), "<p>ok</p>")
|
||||
self.assertEqual(
|
||||
extract.fetch("http://x/", timeout=60, poll=0), "<p>ok</p>"
|
||||
)
|
||||
|
||||
def test_a_build_that_never_finishes_times_out(self) -> None:
|
||||
with (
|
||||
|
||||
Reference in new issue
Block a user