Anonymous avatar Anonymous committed a824b82

Replaced home-made unordered-list comparison function by set comparison

Comments (0)

Files changed (2)


         current_state = object_list_to_table(columns,
-        if not equal_lists(current_state, state_table):
+        if set(current_state) != set(state_table):
             print 'DB state not valid:'
             print 'Current state:'
             print columns


     result.update([(key, data[key]) for key in attrs])
     return result
-def equal_lists(left, right):
-    """
-    Compares two lists and returs True if they contain the same elements, but
-    doesn't require that they have the same order.
-    """
-    right = list(right)
-    if len(left) != len(right):
-        return False
-    for item in left:
-        if item in right:
-            del right[right.index(item)]
-        else:
-            return False
-    return True
 def object_list_to_table(headings, dict_list):
     Converts objects to table-style list of rows with heading:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.