diff --git a/ruff.toml b/ruff.toml index 17e243bec0..5ebeee3197 100644 --- a/ruff.toml +++ b/ruff.toml @@ -12,36 +12,29 @@ ignore = [ "C90", "COM812", "D10", - "DTZ005", "EM", "FA", "FIX", "FBT", "ISC001", "N817", - "PERF203", "PERF401", "PLR0912", - "PLR0913", "PLR0915", "PLR2004", "PLW2901", "PT", "PTH", - "RUF012", "S101", "S310", "S314", - "S324", "S320", "S603", "S607", "T20", "TD002", "TD003", - "TRY002", "TRY003", - "TRY004", "UP038", "W505" ] @@ -54,3 +47,6 @@ max-doc-length = 72 [lint.pydocstyle] convention = "pep257" + +[lint.pylint] +max-args = 8 diff --git a/source/tools/fontbuilder2/font_loader.py b/source/tools/fontbuilder2/font_loader.py index 2eb92b8bd9..3c78e421cb 100644 --- a/source/tools/fontbuilder2/font_loader.py +++ b/source/tools/fontbuilder2/font_loader.py @@ -1,7 +1,10 @@ # Adapted from http://cairographics.org/freetypepython/ +# ruff: noqa: TRY002 + import ctypes import sys +from typing import ClassVar import cairo @@ -40,7 +43,7 @@ _surface = cairo.ImageSurface(cairo.FORMAT_A8, 0, 0) class PycairoContext(ctypes.Structure): - _fields_ = [ + _fields_: ClassVar = [ ("PyObject_HEAD", ctypes.c_byte * object.__basicsize__), ("ctx", ctypes.c_void_p), ("base", ctypes.c_void_p), diff --git a/source/tools/i18n/i18n_helper/catalog.py b/source/tools/i18n/i18n_helper/catalog.py index ce72d16fc9..46f676f73c 100644 --- a/source/tools/i18n/i18n_helper/catalog.py +++ b/source/tools/i18n/i18n_helper/catalog.py @@ -1,6 +1,6 @@ """Wrapper around babel Catalog / .po handling.""" -from datetime import datetime +from datetime import UTC, datetime from babel.messages.catalog import Catalog as BabelCatalog from babel.messages.pofile import read_po, write_po @@ -10,7 +10,7 @@ class Catalog(BabelCatalog): """Wraps a BabelCatalog for convenience.""" def __init__(self, *args, project=None, copyright_holder=None, **other_kwargs): - date = datetime.now() + date = datetime.now(tz=UTC) super().__init__( *args, header_comment=( diff --git a/source/tools/spirv/compile.py b/source/tools/spirv/compile.py index e5170a1ad7..a2b4e67743 100755 --- a/source/tools/spirv/compile.py +++ b/source/tools/spirv/compile.py @@ -46,7 +46,7 @@ def execute(command): def calculate_hash(path): assert os.path.isfile(path) with open(path, "rb") as handle: - return hashlib.sha1(handle.read()).hexdigest() + return hashlib.sha256(handle.read()).hexdigest() def resolve_if(defines, expression): diff --git a/source/tools/xmlvalidator/validate_grammar.py b/source/tools/xmlvalidator/validate_grammar.py index c7e10426d3..bc671badd7 100755 --- a/source/tools/xmlvalidator/validate_grammar.py +++ b/source/tools/xmlvalidator/validate_grammar.py @@ -201,7 +201,7 @@ class RelaxNGValidator: try: doc = lxml.etree.parse(str(file[1])) relaxng.assertValid(doc) - except Exception: + except (lxml.etree.DocumentInvalid, lxml.etree.XMLSyntaxError): error_count = error_count + 1 self.logger.exception(file[1])