Skip to content

Commit

Permalink
Fixed more linting errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
mauritsvanrees committed Sep 3, 2021
1 parent a2d3446 commit 51480fc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 13 deletions.
3 changes: 2 additions & 1 deletion src/zope/i18n/format.py
Expand Up @@ -189,7 +189,8 @@ def parse(self, text, pattern=None, asObject=True):
return tzinfo.localize(
datetime.datetime.combine(
datetime.date.today(),
datetime.time(*[e or 0 for e in ordered[3:]]))).timetz()
datetime.time(*[e or 0 for e in ordered[3:]]))
).timetz()
return datetime.time(
*[e or 0 for e in ordered[3:]], **{'tzinfo': tzinfo}
)
Expand Down
10 changes: 6 additions & 4 deletions src/zope/i18n/locales/tests/test_xmlfactory.py
Expand Up @@ -36,9 +36,11 @@ def runTest(self):

# Making sure all number format patterns parse
# for category in (u'decimal', u'scientific', u'percent', u'currency'):
# for length in getattr(locale.numbers, category+'Formats').values():
# for length in getattr(
# locale.numbers, category + 'Formats'
# ).values():
# for format in length.formats.values():
# self.assert_(parseNumberPattern(format.pattern) is not None)
# self.assertIsNotNone(parseNumberPattern(format.pattern)

# Making sure all datetime patterns parse
# for calendar in locale.dates.calendars.values():
Expand All @@ -47,8 +49,8 @@ def runTest(self):
# calendar, category + 'Formats'
# ).values():
# for format in length.formats.values():
# self.assert_(
# parseDateTimePattern(format.pattern) is not None
# self.assertIsNotNone(
# parseDateTimePattern(format.pattern)
# )


Expand Down
11 changes: 6 additions & 5 deletions src/zope/i18n/locales/xmlfactory.py
Expand Up @@ -381,8 +381,8 @@ def _extractMonths(self, months_node, calendar):

defaultMonthContext_node = months_node.getElementsByTagName('default')
if defaultMonthContext_node:
calendar.defaultMonthContext = defaultMonthContext_node[0].getAttribute(
'type')
calendar.defaultMonthContext = defaultMonthContext_node[
0].getAttribute('type')

monthContext_nodes = months_node.getElementsByTagName('monthContext')
if not monthContext_nodes:
Expand Down Expand Up @@ -525,8 +525,8 @@ def _extractDays(self, days_node, calendar):

defaultDayContext_node = days_node.getElementsByTagName('default')
if defaultDayContext_node:
calendar.defaultDayContext = defaultDayContext_node[0].getAttribute(
'type')
calendar.defaultDayContext = defaultDayContext_node[
0].getAttribute('type')

dayContext_nodes = days_node.getElementsByTagName('dayContext')
if not dayContext_nodes:
Expand Down Expand Up @@ -904,7 +904,8 @@ def _extractCalendars(self, dates_node):
for formatsName, lengthName, formatName in (
('dateFormats', 'dateFormatLength', 'dateFormat'),
('timeFormats', 'timeFormatLength', 'timeFormat'),
('dateTimeFormats', 'dateTimeFormatLength', 'dateTimeFormat')):
('dateTimeFormats', 'dateTimeFormatLength',
'dateTimeFormat')):

formats_nodes = cal_node.getElementsByTagName(formatsName)
if formats_nodes:
Expand Down
9 changes: 6 additions & 3 deletions src/zope/i18n/tests/test_formats.py
Expand Up @@ -787,7 +787,8 @@ def testParseThousandSeparatorPatterns(self):
self.assertEqual(
parseNumberPattern('#,##,##0.###;-#,##,##0.###'),
((None, '', None, '#####0', '###', '', None, '', None, (3, 2, 0)),
(None, '-', None, '#####0', '###', '', None, '', None, (3, 2, 0))))
(None, '-', None, '#####0', '###', '', None, '', None,
(3, 2, 0))))

self.assertEqual(
parseNumberPattern('#,##0.##;-#,##0.##'),
Expand All @@ -812,7 +813,8 @@ def testParseThousandSeparatorPatterns(self):
self.assertEqual(
parseNumberPattern('##,##,##0.###;-##,##,##0.###'),
((None, '', None, '######0', '###', '', None, '', None, (3, 2, 0)),
(None, '-', None, '######0', '###', '', None, '', None, (3, 2, 0))))
(None, '-', None, '######0', '###', '', None, '', None,
(3, 2, 0))))

self.assertEqual(
parseNumberPattern('##,##0.##;-##,##0.##'),
Expand Down Expand Up @@ -862,7 +864,8 @@ def testParseThousandSeparatorPatterns(self):
self.assertEqual(
parseNumberPattern('##,##,##0.00;-##,##,##0.00'),
((None, '', None, '######0', '00', '', None, '', None, (3, 2, 0)),
(None, '-', None, '######0', '00', '', None, '', None, (3, 2, 0))))
(None, '-', None, '######0', '00', '', None, '', None,
(3, 2, 0))))

self.assertEqual(
parseNumberPattern('###0.00;-###0.00'),
Expand Down

0 comments on commit 51480fc

Please sign in to comment.