From: Aarni Koskela Date: Wed, 18 Jan 2023 18:01:47 +0000 (+0200) Subject: Apply ruff C category fixes X-Git-Tag: v2.12.0~19^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=47072d2c96390f5e5daae9e96d5dc30ae2d704ec;p=thirdparty%2Fbabel.git Apply ruff C category fixes --- diff --git a/babel/plural.py b/babel/plural.py index 62bb0207..fd0d0da5 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 aeee5702..0a92130a 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 e91d02bf..8727cb82 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()