summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAarni Koskela <akx@iki.fi>2023-01-18 20:01:47 +0200
committerAarni Koskela <akx@iki.fi>2023-01-18 21:13:08 +0200
commit47072d2c96390f5e5daae9e96d5dc30ae2d704ec (patch)
treef935696f4238bcb18a81223f1c35c54be1fbdb86
parentf5ef6d06f961865ff9dbb3ff9d3fc81f0bbe8fd1 (diff)
downloadbabel-47072d2c96390f5e5daae9e96d5dc30ae2d704ec.tar.gz
Apply ruff C category fixes
-rw-r--r--babel/plural.py2
-rw-r--r--pyproject.toml1
-rw-r--r--tests/messages/test_frontend.py24
3 files changed, 11 insertions, 16 deletions
diff --git a/babel/plural.py b/babel/plural.py
index 62bb020..fd0d0da 100644
--- a/babel/plural.py
+++ b/babel/plural.py
@@ -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:
diff --git a/pyproject.toml b/pyproject.toml
index aeee570..0a92130 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -2,6 +2,7 @@
target-version = "py37"
select = [
"B",
+ "C",
]
ignore = [
"C901", # Complexity
diff --git a/tests/messages/test_frontend.py b/tests/messages/test_frontend.py
index e91d02b..8727cb8 100644
--- a/tests/messages/test_frontend.py
+++ b/tests/messages/test_frontend.py
@@ -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()