mirror of
https://github.com/b4tman/sync_ics2gcal
synced 2025-01-21 23:38:58 +00:00
lint sync
This commit is contained in:
parent
0161d65c16
commit
0f9a8d7a74
@ -59,7 +59,9 @@ class CalendarSync():
|
|||||||
|
|
||||||
def filter_updated(event_tuple):
|
def filter_updated(event_tuple):
|
||||||
new, old = event_tuple
|
new, old = event_tuple
|
||||||
return dateutil.parser.parse(new['updated']) > dateutil.parser.parse(old['updated'])
|
new_date = dateutil.parser.parse(new['updated'])
|
||||||
|
old_date = dateutil.parser.parse(old['updated'])
|
||||||
|
return new_date > old_date
|
||||||
|
|
||||||
self.to_update = list(filter(filter_updated, self.to_update))
|
self.to_update = list(filter(filter_updated, self.to_update))
|
||||||
|
|
||||||
@ -91,7 +93,8 @@ class CalendarSync():
|
|||||||
event_date = dateutil.parser.parse(event_date)
|
event_date = dateutil.parser.parse(event_date)
|
||||||
if compare_dates:
|
if compare_dates:
|
||||||
date_cmp = datetime.date(date.year, date.month, date.day)
|
date_cmp = datetime.date(date.year, date.month, date.day)
|
||||||
event_date = datetime.date(event_date.year, event_date.month, event_date.day)
|
event_date = datetime.date(
|
||||||
|
event_date.year, event_date.month, event_date.day)
|
||||||
|
|
||||||
return op(event_date, date_cmp)
|
return op(event_date, date_cmp)
|
||||||
|
|
||||||
@ -157,8 +160,12 @@ class CalendarSync():
|
|||||||
# exclude outdated events from 'to_update' list, by 'updated' field
|
# exclude outdated events from 'to_update' list, by 'updated' field
|
||||||
self._filter_events_to_update()
|
self._filter_events_to_update()
|
||||||
|
|
||||||
self.logger.info('prepared to sync: ( insert: %d, update: %d, delete: %d )',
|
self.logger.info(
|
||||||
len(self.to_insert), len(self.to_update), len(self.to_delete))
|
'prepared to sync: ( insert: %d, update: %d, delete: %d )',
|
||||||
|
len(self.to_insert),
|
||||||
|
len(self.to_update),
|
||||||
|
len(self.to_delete)
|
||||||
|
)
|
||||||
|
|
||||||
def apply(self):
|
def apply(self):
|
||||||
"""apply sync (insert, update, delete), using prepared lists of events
|
"""apply sync (insert, update, delete), using prepared lists of events
|
||||||
|
Loading…
x
Reference in New Issue
Block a user