From: Jun Omae Date: Tue, 10 May 2022 08:01:45 +0000 (+0900) Subject: Use `... if expr else ...` X-Git-Tag: v2.10.2~1^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cf1abf100a977e0619e3f64f83905e3dd8676fe1;p=thirdparty%2Fbabel.git Use `... if expr else ...` --- diff --git a/babel/dates.py b/babel/dates.py index c79e9cf6..0b373234 100644 --- a/babel/dates.py +++ b/babel/dates.py @@ -1483,7 +1483,7 @@ class DateTimeFormat(object): widths = [{3: 'abbreviated', 4: 'wide', 5: 'narrow'}[max(3, num)], 'wide', 'narrow', 'abbreviated'] if char == 'a': - period = {0: 'am', 1: 'pm'}[int(self.value.hour >= 12)] + period = 'pm' if self.value.hour >= 12 else 'am' context = 'format' else: period = get_period_id(self.value, locale=self.locale)