Create syntactically invalid mess that is equal for similar items.
(item, ignore_props=IGNORE_PROPS)
| 104 | |
| 105 | |
| 106 | def 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 | |
| 121 | def _strip_timezones(item): |