use itemgetter to sort list of available modules

This commit is contained in:
2023-08-23 10:57:44 +02:00
parent c77832da6d
commit bb175eff5f

View File

@ -6,6 +6,7 @@ import re
import shutil import shutil
from datetime import date, datetime, timedelta from datetime import date, datetime, timedelta
from operator import itemgetter, attrgetter
from pytablewriter import AsciiDocTableWriter from pytablewriter import AsciiDocTableWriter
@ -101,7 +102,7 @@ def db_check_diff(current_pmodule_state, Pmodules_db_path, Pmodules_states):
) )
old_db = set(" ".join(i.split()) for i in old_pmodule_state.splitlines()) old_db = set(" ".join(i.split()) for i in old_pmodule_state.splitlines())
all_module_list = list(current_db) all_module_list = list(current_db)
all_module_list = sorted(all_module_list, key=lambda row: row[0]) all_module_list = sorted(all_module_list, key=itemgetter(0))
# We have to check the differences between the pmodule states. # We have to check the differences between the pmodule states.
if compare_states_sha(current_pmodule_state, old_pmodule_state, current_sha): if compare_states_sha(current_pmodule_state, old_pmodule_state, current_sha):