99import sys
1010from collections .abc import Iterable
1111from datetime import datetime
12+ from operator import attrgetter
1213from pathlib import Path
1314from typing import Final , NamedTuple
1415
@@ -32,15 +33,11 @@ class CaptureTuple(NamedTuple):
3233 file_path : Path
3334
3435
35- def _by_service_name (e : CaptureTuple ):
36- return e .service_name
37-
38-
3936service_names_aliases : dict [str , str ] = {"web" : "webserver" }
4037
4138
4239def generate_markdown_table (
43- * catpured_files : Iterable [CaptureTuple ],
40+ * captured_files : Iterable [CaptureTuple ],
4441) -> str :
4542 title = ("Name" , "Files" , " " )
4643 lines = ["-" * 10 ] * len (title )
@@ -49,8 +46,8 @@ def generate_markdown_table(
4946 table += _to_row (lines )
5047
5148 found = itertools .groupby (
52- sorted (itertools .chain (* catpured_files ), key = _by_service_name ),
53- key = _by_service_name ,
49+ sorted (itertools .chain (* captured_files ), key = attrgetter ( "service_name" ) ),
50+ key = attrgetter ( "service_name" ) ,
5451 )
5552
5653 for name , service_files in found :
@@ -88,7 +85,6 @@ def generate_markdown_table(
8885 )
8986
9087 table += _to_row (["" * 10 ] * len (title ))
91-
9288 return table
9389
9490
0 commit comments