]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
Fix minor pep8 complaints
authorAarni Koskela <akx@iki.fi>
Mon, 13 Jan 2025 11:28:58 +0000 (13:28 +0200)
committerAarni Koskela <akx@iki.fi>
Tue, 14 Jan 2025 07:52:31 +0000 (09:52 +0200)
babel/messages/catalog.py
babel/messages/extract.py
tests/messages/test_pofile.py
tests/test_numbers.py

index 3e7bb9e2860180d30c7f8b40a2de712578c00950..060b0eb79d4c6ca4e626d5409fed558edce8952b 100644 (file)
@@ -37,6 +37,7 @@ __all__ = [
     'TranslationError',
 ]
 
+
 def get_close_matches(word, possibilities, n=3, cutoff=0.6):
     """A modified version of ``difflib.get_close_matches``.
 
@@ -48,7 +49,7 @@ def get_close_matches(word, possibilities, n=3, cutoff=0.6):
     if not 0.0 <= cutoff <= 1.0:  # pragma: no cover
         raise ValueError(f"cutoff must be in [0.0, 1.0]: {cutoff!r}")
     result = []
-    s = SequenceMatcher(autojunk=False) # only line changed from difflib.py
+    s = SequenceMatcher(autojunk=False)  # only line changed from difflib.py
     s.set_seq2(word)
     for x in possibilities:
         s.set_seq1(x)
index 94221df75c1b8358f94c22b3217b22f8e473c34d..921e5c2ce88998de39e7067d2caa90daf7c90b05 100644 (file)
@@ -325,15 +325,20 @@ def extract_from_file(
                             options, strip_comment_tags))
 
 
-def _match_messages_against_spec(lineno: int, messages: list[str|None], comments: list[str],
-                                 fileobj: _FileObj, spec: tuple[int|tuple[int, str], ...]):
+def _match_messages_against_spec(
+    lineno: int,
+    messages: list[str | None],
+    comments: list[str],
+    fileobj: _FileObj,
+    spec: tuple[int | tuple[int, str], ...],
+):
     translatable = []
     context = None
 
     # last_index is 1 based like the keyword spec
     last_index = len(messages)
     for index in spec:
-        if isinstance(index, tuple): # (n, 'c')
+        if isinstance(index, tuple):  # (n, 'c')
             context = messages[index[0] - 1]
             continue
         if last_index < index:
@@ -622,9 +627,7 @@ def extract_python(
         elif tok == NAME and value in keywords:
             funcname = value
 
-        if (current_fstring_start is not None
-            and tok not in {FSTRING_START, FSTRING_MIDDLE}
-        ):
+        if current_fstring_start is not None and tok not in {FSTRING_START, FSTRING_MIDDLE}:
             # In Python 3.12, tokens other than FSTRING_* mean the
             # f-string is dynamic, so we don't wan't to extract it.
             # And if it's FSTRING_END, we've already handled it above.
index ab7c7f4b4958dd095f6b45ca47cc14b40aa94e41..9d43073629bc116b9a99a481a87ecf2c30c13f1c 100644 (file)
@@ -974,6 +974,7 @@ class RoundtripPoTestCase(unittest.TestCase):
         catalog2 = pofile.read_po(buf)
         assert True is catalog.is_identical(catalog2)
 
+
 class PofileFunctionsTestCase(unittest.TestCase):
 
     def test_unescape(self):
index f3e2dec79f6b4e23f7200d2a8949b664cf7ffedf..e64fcfb75e97c6226184fcfc3ead5fbca220b67a 100644 (file)
@@ -420,6 +420,7 @@ def test_format_decimal():
     with pytest.raises(numbers.UnsupportedNumberingSystemError):
         numbers.format_decimal(12345.5, locale='en_US', numbering_system="unknown")
 
+
 @pytest.mark.parametrize('input_value, expected_value', [
     ('10000', '10,000'),
     ('1', '1'),
@@ -759,6 +760,7 @@ def test_parse_number():
     with pytest.raises(numbers.UnsupportedNumberingSystemError):
         numbers.parse_number('1.099,98', locale='en', numbering_system="unsupported")
 
+
 @pytest.mark.parametrize('string', [
     '1 099',
     '1\xa0099',