mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-07 17:10:21 +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.
This commit is contained in:
parent
0d24ac4996
commit
347253be2f
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