Skip to content

Commit

Permalink
@bisgaard-itis review: key fun and wording
Browse files Browse the repository at this point in the history
  • Loading branch information
pcrespov committed Nov 21, 2024
1 parent 18c2170 commit d395dff
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions scripts/echo_services_markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import sys
from collections.abc import Iterable
from datetime import datetime
from operator import attrgetter
from pathlib import Path
from typing import Final, NamedTuple

Expand All @@ -32,15 +33,11 @@ class CaptureTuple(NamedTuple):
file_path: Path


def _by_service_name(e: CaptureTuple):
return e.service_name


service_names_aliases: dict[str, str] = {"web": "webserver"}


def generate_markdown_table(
*catpured_files: Iterable[CaptureTuple],
*captured_files: Iterable[CaptureTuple],
) -> str:
title = ("Name", "Files", " ")
lines = ["-" * 10] * len(title)
Expand All @@ -49,8 +46,8 @@ def generate_markdown_table(
table += _to_row(lines)

found = itertools.groupby(
sorted(itertools.chain(*catpured_files), key=_by_service_name),
key=_by_service_name,
sorted(itertools.chain(*captured_files), key=attrgetter("service_name")),
key=attrgetter("service_name"),
)

for name, service_files in found:
Expand Down Expand Up @@ -88,7 +85,6 @@ def generate_markdown_table(
)

table += _to_row(["" * 10] * len(title))

return table


Expand Down

0 comments on commit d395dff

Please sign in to comment.