small type checking fix & expresion fix

This commit is contained in:
Adolfo Gómez García 2021-04-28 10:47:35 +02:00
parent 47ef12ef6a
commit 2a2a2b2ad0

View File

@ -57,14 +57,14 @@ freqs: typing.Tuple[typing.Tuple[str, str], ...] = (
(WEEKDAYS, _('Weekdays')), (WEEKDAYS, _('Weekdays')),
) )
frq_to_rrl: typing.Dict[str, int] = { frq_to_rrl: typing.Mapping[str, int] = {
'YEARLY': rules.YEARLY, 'YEARLY': rules.YEARLY,
'MONTHLY': rules.MONTHLY, 'MONTHLY': rules.MONTHLY,
'WEEKLY': rules.WEEKLY, 'WEEKLY': rules.WEEKLY,
'DAILY': rules.DAILY, 'DAILY': rules.DAILY,
} }
frq_to_mins: typing.Dict[str, int] = { frq_to_mins: typing.Mapping[str, int] = {
'YEARLY': 366 * 24 * 60, 'YEARLY': 366 * 24 * 60,
'MONTHLY': 31 * 24 * 60, 'MONTHLY': 31 * 24 * 60,
'WEEKLY': 7 * 24 * 60, 'WEEKLY': 7 * 24 * 60,
@ -78,7 +78,7 @@ dunits: typing.Tuple[typing.Tuple[str, str], ...] = (
('WEEKS', _('Weeks')), ('WEEKS', _('Weeks')),
) )
dunit_to_mins: typing.Dict[str, int] = { dunit_to_mins: typing.Mapping[str, int] = {
'MINUTES': 1, 'MINUTES': 1,
'HOURS': 60, 'HOURS': 60,
'DAYS': 60 * 24, 'DAYS': 60 * 24,
@ -129,7 +129,7 @@ class CalendarRule(UUIDModel):
self.interval = 1 self.interval = 1
end = datetime.datetime.combine( end = datetime.datetime.combine(
self.end if self.end is not None else datetime.datetime.max.date(), self.end if self.end else datetime.datetime.max.date(),
datetime.datetime.max.time(), datetime.datetime.max.time(),
) )