From 4a8b3d26188b12b959182e06424bddd7388d1c8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Sz=C5=B1cs?= Date: Wed, 2 Oct 2024 13:47:14 +0200 Subject: [PATCH] Update the pylint plugin to latest astroid version (#1708) * The pylint plugin is now working with the latest pylint version 3.2.7 --- CONTRIBUTORS.rst | 1 + tortoise/contrib/pylint/__init__.py | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 145a5b92c..2846f2bb3 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -59,6 +59,7 @@ Contributors * Ivan Pakeev ``@ipakeev`` * Abdeldjalil Hezouat ``@Abdeldjalil-H`` * Andrea Magistà ``@vlakius`` +* Daniel Szucs ``@Quasar6X`` Special Thanks ============== diff --git a/tortoise/contrib/pylint/__init__.py b/tortoise/contrib/pylint/__init__.py index 68bd2dea0..fdf71ff46 100644 --- a/tortoise/contrib/pylint/__init__.py +++ b/tortoise/contrib/pylint/__init__.py @@ -6,15 +6,14 @@ from astroid import MANAGER, inference_tip, nodes from astroid.exceptions import AstroidError -from astroid.node_classes import AnnAssign, Assign -from astroid.nodes import ClassDef +from astroid.nodes import AnnAssign, Assign, ClassDef from pylint.lint import PyLinter MODELS: Dict[str, ClassDef] = {} FUTURE_RELATIONS: Dict[str, list] = {} -def register(linter: PyLinter) -> None: +def register(linter: PyLinter) -> None: # pylint: disable=unused-argument """ Reset state every time this is called, since we now get new AST to transform. """ @@ -107,7 +106,9 @@ def transform_model(cls: ClassDef) -> None: MANAGER.ast_from_module_name("tortoise.models").lookup("MetaInfo")[1][0].instantiate_class() ] if "id" not in cls.locals: - cls.locals["id"] = [nodes.ClassDef("id", None)] + cls.locals["id"] = [ + nodes.ClassDef("id", None, None, None, end_lineno=None, end_col_offset=None) + ] def is_model_field(cls: ClassDef) -> bool: