Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- out_files = list(itertools.chain(*unpaired_files))
- for items in itertools.product(*new_files):
- if items and self._compare_multiple_dicts_except(all_exceptions, *items):
- def _compare_multiple_dicts_except(self, exceptions, *dicts):
- keys = []
- for d in dicts:
- keys.append(
- sorted([key for key in d.keys() if key not in exceptions]))
- if not all(x == keys[0] for x in keys):
- return False
- for key in keys[0]:
- items = [d[key] for d in dicts]
- if not all(x == items[0] for x in items):
- return False
- return True
- >>> _compare_multiple_dicts_except(['a', 'b'], {'a': 1, 'c': 3, 'd': 4}, {'a': 2, 'c': 3, 'd': 4})
- True
- >>> _compare_multiple_dicts_except(['a', 'b'], {'a': 1, 'c': 3, 'd': 4}, {'c': 4, 'd': 4})
- False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement