Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
markusressel committed Sep 27, 2024
1 parent bf5886e commit c8163ec
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
19 changes: 17 additions & 2 deletions keel_telegram_bot/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,24 @@ def approval_to_str(data: Approval) -> str:


def resource_to_str(r: Resource) -> str:
image_lines = list(map(lambda x: f" {x}", r.images))
identifier_lines = [" Identifier: " + r.identifier]
policy_lines = [" Policy: " + r.policy.value]

if len(r.images) > 1:
image_lines = list(map(lambda x: f" {x}", r.images))
image_lines = [" Images:"] + image_lines
else:
image_lines = [" Image: " + r.images[0]]

label_lines = list(map(lambda x: f" {x}: {r.labels[x]}", r.labels))
label_lines = [" Labels:"] + label_lines

return "\n".join(
[f"> {r.namespace}/{r.name} P: {r.policy.value}"] + image_lines
[f"> {r.namespace}/{r.name}"]
+ identifier_lines
+ policy_lines
+ image_lines
+ label_lines
)


Expand Down
1 change: 1 addition & 0 deletions tests/test_dummy.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,5 @@ def test_resource_format(self):
})

result = resource_to_str(resource)
print("")
print(result)

0 comments on commit c8163ec

Please sign in to comment.