Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the pylint plugin to latest astroid version #1708

Merged
merged 1 commit into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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