Skip to content

Commit

Permalink
Update the pylint plugin to latest astro version
Browse files Browse the repository at this point in the history
* The pylint plugin is now working with the latest pylint version 3.2.7
  • Loading branch information
Quasar6X committed Sep 11, 2024
1 parent 34eee2d commit fdef123
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Contributors
* Ivan Pakeev ``@ipakeev``
* Abdeldjalil Hezouat ``@Abdeldjalil-H``
* Andrea Magistà ``@vlakius``
* Daniel Szucs ``@Quasar6X``

Special Thanks
==============
Expand Down
9 changes: 5 additions & 4 deletions tortoise/contrib/pylint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit fdef123

Please sign in to comment.