MCPcopy
hub / github.com/pimutils/vdirsyncer / normalize_item

Function normalize_item

vdirsyncer/vobject.py:106–118  ·  view source on GitHub ↗

Create syntactically invalid mess that is equal for similar items.

(item, ignore_props=IGNORE_PROPS)

Source from the content-addressed store, hash-verified

104
105
106def normalize_item(item, ignore_props=IGNORE_PROPS):
107 '''Create syntactically invalid mess that is equal for similar items.'''
108 if not isinstance(item, Item):
109 item = Item(item)
110
111 item = _strip_timezones(item)
112
113 x = _Component('TEMP', item.raw.splitlines(), [])
114 for prop in IGNORE_PROPS:
115 del x[prop]
116
117 x.props.sort()
118 return '\r\n'.join(filter(bool, (line.strip() for line in x.props)))
119
120
121def _strip_timezones(item):

Callers 8

assert_item_equalsFunction · 0.90
hash_itemFunction · 0.85
test_recurring_eventsMethod · 0.85
test_listFunction · 0.85

Calls 4

ItemClass · 0.85
_strip_timezonesFunction · 0.85
_ComponentClass · 0.85
joinMethod · 0.80

Tested by 6

test_recurring_eventsMethod · 0.68
test_listFunction · 0.68