Skip to content

Commit 46c7513

Browse files
committed
Apply suggested style changes
1 parent a11ecfb commit 46c7513

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

Lib/calendar.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -140,22 +140,14 @@ def __len__(self):
140140
month_name = _localized_month('%B')
141141
month_abbr = _localized_month('%b')
142142

143-
# Check if the platform supports %OB and %Ob specifiers
144-
def _supports_alternative_month_names():
145-
try:
146-
datetime.date(2001, 1, 1).strftime('%OB')
147-
datetime.date(2001, 1, 1).strftime('%Ob')
148-
except ValueError:
149-
return False
150-
return True
151-
152143
# On platforms that support the %OB and %Ob specifiers, it is used to get the
153144
# standalone form of the month name. This is required for some languages
154145
# such as Greek, Slavic, and Baltic languages.
155-
if _supports_alternative_month_names():
146+
try:
156147
alt_month_name = _localized_month('%OB')
157148
alt_month_abbr = _localized_month('%Ob')
158-
else:
149+
except ValueError:
150+
# The platform does not support the %OB and %Ob specifiers.
159151
alt_month_name = month_name
160152
alt_month_abbr = month_abbr
161153

Lib/test/test_calendar.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,8 +546,8 @@ def test_days(self):
546546
self.assertEqual(value[::-1], list(reversed(value)))
547547

548548
def test_months(self):
549-
for attr in ["month_name", "month_abbr", "alt_month_name",
550-
"alt_month_abbr"]:
549+
for attr in ("month_name", "month_abbr", "alt_month_name",
550+
"alt_month_abbr"):
551551
value = getattr(calendar, attr)
552552
self.assertEqual(len(value), 13)
553553
self.assertEqual(len(value[:]), 13)

0 commit comments

Comments
 (0)