mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-01 15:20:11 +01:00
clients/tests: support Util.replace_text_sort_list() helper
This will be necessary to sort a list of text that contains text to
replace. The use case is to get all UUIDs from the server, but some
of these UUIDs are dynamic. So, in order to have a fixed sort order,
we need to handle sorting the list, based on the replacement.
(cherry picked from commit 347253be2f)
This commit is contained in:
parent
1a20c9b2b5
commit
64f103416f
1 changed files with 6 additions and 0 deletions
|
|
@ -309,6 +309,12 @@ class Util:
|
|||
bb = bb.decode('utf-8')
|
||||
return bb
|
||||
|
||||
@staticmethod
|
||||
def replace_text_sort_list(lst, replace_arr):
|
||||
lst = [ (Util.replace_text(elem, replace_arr), elem) for elem in lst ]
|
||||
lst = sorted(lst)
|
||||
lst = [ tup[1] for tup in lst ]
|
||||
return list(lst)
|
||||
|
||||
@staticmethod
|
||||
def debug_dbus_interface():
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue