equal
deleted
inserted
replaced
1 # -*- coding: utf-8 -*- |
1 # -*- coding: utf-8 -*- |
2 import collections |
2 import collections |
|
3 import unicodedata |
3 |
4 |
4 |
5 |
5 ### |
6 ### |
6 # allow to declare a property as a decorator |
7 # allow to declare a property as a decorator |
7 ### |
8 ### |
316 '''od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive |
317 '''od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive |
317 while comparison to a regular mapping is order-insensitive. |
318 while comparison to a regular mapping is order-insensitive. |
318 |
319 |
319 ''' |
320 ''' |
320 if isinstance(other, OrderedDict): |
321 if isinstance(other, OrderedDict): |
321 return len(self)==len(other) and self.items() == other.items() |
322 return len(self) == len(other) and self.items() == other.items() |
322 return dict.__eq__(self, other) |
323 return dict.__eq__(self, other) |
323 |
324 |
324 def __ne__(self, other): |
325 def __ne__(self, other): |
325 return not self == other |
326 return not self == other |
326 |
327 |
337 def viewitems(self): |
338 def viewitems(self): |
338 "od.viewitems() -> a set-like object providing a view on od's items" |
339 "od.viewitems() -> a set-like object providing a view on od's items" |
339 return ItemsView(self) |
340 return ItemsView(self) |
340 ## end of http://code.activestate.com/recipes/576693/ }}} |
341 ## end of http://code.activestate.com/recipes/576693/ }}} |
341 |
342 |
|
343 def remove_accents(str): |
|
344 nkfd_form = unicodedata.normalize('NFKD', unicode(str)) |
|
345 return u"".join([c for c in nkfd_form if not unicodedata.combining(c)]) |