Revision 92389be9 lib/utils/algo.py

b/lib/utils/algo.py
95 95
  return list(dup)
96 96

  
97 97

  
98
#pylint: disable=W0142 (use of *-magic in argument list)
99
def GetRepeatedKeys(*dicts):
100
  """Return the set of keys defined multiple times in the given dicts.
101

  
102
  >>> GetRepeatedKeys({"foo": 1, "bar": 2},
103
  ...                 {"foo": 5, "baz": 7}
104
  ...                )
105
  set("foo")
106

  
107
  @type dicts: dict
108
  @param dicts: The dictionaries to check for duplicate keys.
109
  @rtype: set
110
  @return: Keys used more than once across all dicts
111

  
112
  """
113
  if len(dicts) < 2:
114
    return set()
115

  
116
  keys = []
117
  for dictionary in dicts:
118
    keys.extend(dictionary)
119

  
120
  return set(FindDuplicates(keys))
121

  
122

  
98 123
def _NiceSortTryInt(val):
99 124
  """Attempts to convert a string to an integer.
100 125

  

Also available in: Unified diff