Skip to content

Commit cd766b7

Browse files
committed
Fix minor pep8 complaints
1 parent 2476453 commit cd766b7

4 files changed

Lines changed: 14 additions & 7 deletions

File tree

babel/messages/catalog.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
'TranslationError',
3838
]
3939

40+
4041
def get_close_matches(word, possibilities, n=3, cutoff=0.6):
4142
"""A modified version of ``difflib.get_close_matches``.
4243
@@ -48,7 +49,7 @@ def get_close_matches(word, possibilities, n=3, cutoff=0.6):
4849
if not 0.0 <= cutoff <= 1.0: # pragma: no cover
4950
raise ValueError(f"cutoff must be in [0.0, 1.0]: {cutoff!r}")
5051
result = []
51-
s = SequenceMatcher(autojunk=False) # only line changed from difflib.py
52+
s = SequenceMatcher(autojunk=False) # only line changed from difflib.py
5253
s.set_seq2(word)
5354
for x in possibilities:
5455
s.set_seq1(x)

babel/messages/extract.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -325,15 +325,20 @@ def extract_from_file(
325325
options, strip_comment_tags))
326326

327327

328-
def _match_messages_against_spec(lineno: int, messages: list[str|None], comments: list[str],
329-
fileobj: _FileObj, spec: tuple[int|tuple[int, str], ...]):
328+
def _match_messages_against_spec(
329+
lineno: int,
330+
messages: list[str | None],
331+
comments: list[str],
332+
fileobj: _FileObj,
333+
spec: tuple[int | tuple[int, str], ...],
334+
):
330335
translatable = []
331336
context = None
332337

333338
# last_index is 1 based like the keyword spec
334339
last_index = len(messages)
335340
for index in spec:
336-
if isinstance(index, tuple): # (n, 'c')
341+
if isinstance(index, tuple): # (n, 'c')
337342
context = messages[index[0] - 1]
338343
continue
339344
if last_index < index:
@@ -622,9 +627,7 @@ def extract_python(
622627
elif tok == NAME and value in keywords:
623628
funcname = value
624629

625-
if (current_fstring_start is not None
626-
and tok not in {FSTRING_START, FSTRING_MIDDLE}
627-
):
630+
if current_fstring_start is not None and tok not in {FSTRING_START, FSTRING_MIDDLE}:
628631
# In Python 3.12, tokens other than FSTRING_* mean the
629632
# f-string is dynamic, so we don't wan't to extract it.
630633
# And if it's FSTRING_END, we've already handled it above.

tests/messages/test_pofile.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -974,6 +974,7 @@ def test_enclosed_filenames_in_location_comment(self):
974974
catalog2 = pofile.read_po(buf)
975975
assert True is catalog.is_identical(catalog2)
976976

977+
977978
class PofileFunctionsTestCase(unittest.TestCase):
978979

979980
def test_unescape(self):

tests/test_numbers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,7 @@ def test_format_decimal():
420420
with pytest.raises(numbers.UnsupportedNumberingSystemError):
421421
numbers.format_decimal(12345.5, locale='en_US', numbering_system="unknown")
422422

423+
423424
@pytest.mark.parametrize('input_value, expected_value', [
424425
('10000', '10,000'),
425426
('1', '1'),
@@ -759,6 +760,7 @@ def test_parse_number():
759760
with pytest.raises(numbers.UnsupportedNumberingSystemError):
760761
numbers.parse_number('1.099,98', locale='en', numbering_system="unsupported")
761762

763+
762764
@pytest.mark.parametrize('string', [
763765
'1 099',
764766
'1\xa0099',

0 commit comments

Comments
 (0)