Revision 1de7fd6d snf-common/synnefo/lib/utils.py

b/snf-common/synnefo/lib/utils.py
68 68

  
69 69
  t1 = float(seconds) + (float(microseconds) * 0.000001)
70 70
  return datetime.datetime.fromtimestamp(t1)
71

  
72

  
73
def case_unique(iterable):
74
    """
75
    Compare case uniquness across iterable contents. Return diff.
76

  
77
    >>> case_compare(['a','b','c'])
78
    []
79
    >>> case_compaer(['a','A','b','c'])
80
    ['A']
81
    """
82
    icase = set(map(unicode.lower, iterable))
83
    same = len(icase) == len(iterable)
84
    if not same:
85
        return list(set(iterable) - set(icase))
86

  
87
    return []
88

  

Also available in: Unified diff