]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
Apply ruff C category fixes
authorAarni Koskela <akx@iki.fi>
Wed, 18 Jan 2023 18:01:47 +0000 (20:01 +0200)
committerAarni Koskela <akx@iki.fi>
Wed, 18 Jan 2023 19:13:08 +0000 (21:13 +0200)
babel/plural.py
pyproject.toml
tests/messages/test_frontend.py

index 62bb02078b73763d1894ff6839aed8d02583d587..fd0d0da5263c99db6b486fd75bdd92717d91953a 100644 (file)
@@ -115,7 +115,7 @@ class PluralRule:
             rules = rules.items()
         found = set()
         self.abstract: list[tuple[str, Any]] = []
-        for key, expr in sorted(list(rules)):
+        for key, expr in sorted(rules):
             if key not in _plural_tags:
                 raise ValueError(f"unknown tag {key!r}")
             elif key in found:
index aeee57024c30483eb161c6717ae5effe970f0ea0..0a92130a66d01fb6146f9626044bc784e531c262 100644 (file)
@@ -2,6 +2,7 @@
 target-version = "py37"
 select = [
     "B",
+    "C",
 ]
 ignore = [
     "C901",  # Complexity
index e91d02bf7d3fd8ebf09f7a07ec1947149dceee72..8727cb82b45e9f2df0605de04619c43c73d75ff6 100644 (file)
@@ -30,6 +30,12 @@ from babel.messages.frontend import CommandLineInterface, extract_messages, upda
 from babel.util import LOCALTZ
 from babel.messages.pofile import read_po, write_po
 
+TEST_PROJECT_DISTRIBUTION_DATA = {
+    "name": "TestProject",
+    "version": "0.1",
+    "packages": ["project"],
+}
+
 this_dir = os.path.abspath(os.path.dirname(__file__))
 data_dir = os.path.join(this_dir, 'data')
 project_dir = os.path.join(data_dir, 'project')
@@ -47,11 +53,7 @@ class CompileCatalogTestCase(unittest.TestCase):
         self.olddir = os.getcwd()
         os.chdir(data_dir)
 
-        self.dist = Distribution(dict(
-            name='TestProject',
-            version='0.1',
-            packages=['project']
-        ))
+        self.dist = Distribution(TEST_PROJECT_DISTRIBUTION_DATA)
         self.cmd = frontend.compile_catalog(self.dist)
         self.cmd.initialize_options()
 
@@ -77,11 +79,7 @@ class ExtractMessagesTestCase(unittest.TestCase):
         self.olddir = os.getcwd()
         os.chdir(data_dir)
 
-        self.dist = Distribution(dict(
-            name='TestProject',
-            version='0.1',
-            packages=['project']
-        ))
+        self.dist = Distribution(TEST_PROJECT_DISTRIBUTION_DATA)
         self.cmd = frontend.extract_messages(self.dist)
         self.cmd.initialize_options()
 
@@ -350,11 +348,7 @@ class InitCatalogTestCase(unittest.TestCase):
         self.olddir = os.getcwd()
         os.chdir(data_dir)
 
-        self.dist = Distribution(dict(
-            name='TestProject',
-            version='0.1',
-            packages=['project']
-        ))
+        self.dist = Distribution(TEST_PROJECT_DISTRIBUTION_DATA)
         self.cmd = frontend.init_catalog(self.dist)
         self.cmd.initialize_options()