Skip to content

Commit 379c0bf

Browse files
committed
bpo-44235: fix nit style
1 parent ef0d7a0 commit 379c0bf

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Lib/gettext.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
(?P<INVALID>\w+|.) # invalid token
8383
""", re.VERBOSE|re.DOTALL)
8484

85+
8586
def _tokenize(plural):
8687
for mo in re.finditer(_token_pattern, plural):
8788
kind = mo.lastgroup
@@ -93,12 +94,14 @@ def _tokenize(plural):
9394
yield value
9495
yield ''
9596

97+
9698
def _error(value):
9799
if value:
98100
return ValueError('unexpected token in plural form: %s' % value)
99101
else:
100102
return ValueError('unexpected end of plural form')
101103

104+
102105
_binary_ops = (
103106
('||',),
104107
('&&',),
@@ -110,6 +113,7 @@ def _error(value):
110113
_binary_ops = {op: i for i, ops in enumerate(_binary_ops, 1) for op in ops}
111114
_c2py_ops = {'||': 'or', '&&': 'and', '/': '//'}
112115

116+
113117
def _parse(tokens, priority=-1):
114118
result = ''
115119
nexttok = next(tokens)
@@ -159,9 +163,10 @@ def _parse(tokens, priority=-1):
159163

160164
return result, nexttok
161165

166+
162167
def _as_int(n):
163168
try:
164-
i = round(n)
169+
_ = round(n)
165170
except TypeError:
166171
raise TypeError('Plural value must be an integer, got %s' %
167172
(n.__class__.__name__,)) from None
@@ -171,6 +176,7 @@ def _as_int(n):
171176
DeprecationWarning, 4)
172177
return n
173178

179+
174180
def c2py(plural):
175181
"""Gets a C expression as used in PO files for plural forms and returns a
176182
Python function that implements an equivalent expression.
@@ -249,7 +255,6 @@ def _expand_lang(loc):
249255
return ret
250256

251257

252-
253258
class NullTranslations:
254259
def __init__(self, fp=None):
255260
self._info = {}
@@ -495,10 +500,10 @@ def find(domain, localedir=None, languages=None, all=False):
495500
return result
496501

497502

498-
499503
# a mapping between absolute .mo file path and Translation object
500504
_translations = {}
501505

506+
502507
def translation(domain, localedir=None, languages=None,
503508
class_=None, fallback=False):
504509
if class_ is None:
@@ -538,7 +543,6 @@ def install(domain, localedir=None, *, names=None):
538543
t.install(names)
539544

540545

541-
542546
# a mapping b/w domains and locale directories
543547
_localedirs = {}
544548
# current global domain, `messages' used for compatibility w/ GNU gettext

0 commit comments

Comments
 (0)