Xqt has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1249938?usp=email )

Change subject: tests: replace unmaintained flake8-tuple with ruff "COM"
......................................................................

tests: replace unmaintained flake8-tuple with ruff "COM"

flake8-tuple has not been maintained for 6 years. Instead of replacing
it with flake8-commas, ruff is used, which provides automatic fixes.
Rule "COM812" is not activated due to false positives.

Update some issues found by these two rules.

Change-Id: I69aa831646249a6d4de8b6cddcdbb785b11f4097
---
M .pre-commit-config.yaml
M pyproject.toml
M scripts/template.py
M tests/api_tests.py
4 files changed, 5 insertions(+), 7 deletions(-)

Approvals:
  Xqt: Verified; Looks good to me, approved




diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index e709bc2..732d677 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -114,7 +114,6 @@
           - flake8-bugbear>=24.12.12
           - flake8-mock-x2
           - flake8-print>=5.0.0
-          - flake8-tuple>=0.4.1
           - pep8-naming>=0.15.1
   - repo: https://github.com/pre-commit/mirrors-mypy
     rev: v1.19.1
diff --git a/pyproject.toml b/pyproject.toml
index b7cf995..7df3481 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -198,7 +198,7 @@


 [tool.ruff.lint]
-select = ["C4", "D", "Q", "RSE"]
+select = ["C4", "COM818", "COM819", "D", "Q", "RSE"]
 ignore = ["D105", "D211", "D213", "D214", "D301", "D401", "D404", "D406", 
"D407", "D412", "D413", "D416", "D417"]

 [tool.ruff.lint.per-file-ignores]
diff --git a/scripts/template.py b/scripts/template.py
index 143b0fc..2ceb6ba 100755
--- a/scripts/template.py
+++ b/scripts/template.py
@@ -164,20 +164,19 @@
         replacements = []
         exceptions = {}
         builder = textlib.MultiTemplateMatchBuilder(self.site)
+        inside_tags_exceptions = ['ref', 'gallery', 'poem', 'pagelist']
         for old, new in self.templates.items():
             template_regex = builder.pattern(old)

             if self.opt.subst and self.opt.remove:
                 replacements.append((template_regex,
                                      r'{{subst:%s\g<parameters>}}' % new))
-                exceptions['inside-tags'] = ['ref', 'gallery', 'poem',
-                                             'pagelist', ]
+                exceptions['inside-tags'] = inside_tags_exceptions
             elif self.opt.subst:
                 replacements.append(
                     (template_regex, r'{{%s:%s\g<parameters>}}' %
                      (self.opt.subst, old)))
-                exceptions['inside-tags'] = ['ref', 'gallery', 'poem',
-                                             'pagelist', ]
+                exceptions['inside-tags'] = inside_tags_exceptions
             elif self.opt.remove:
                 separate_line_regex = re.compile(
                     fr'^[*#:]* *{template_regex.pattern} *\n',
diff --git a/tests/api_tests.py b/tests/api_tests.py
index eeeea24..bf50c77 100755
--- a/tests/api_tests.py
+++ b/tests/api_tests.py
@@ -622,7 +622,7 @@
                                      parameters={'titles': 'test'})
         for namespace in (0, 1, None):
             with self.subTest(namespace=namespace), \
-                    self.assertRaises(TypeError, ):
+                    self.assertRaises(TypeError):
                 self.gen.set_namespace(namespace)

     def test_namespace_param_is_not_settable(self) -> None:

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1249938?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I69aa831646249a6d4de8b6cddcdbb785b11f4097
Gerrit-Change-Number: 1249938
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to