-
Notifications
You must be signed in to change notification settings - Fork 0
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
AttributeError
(Module.doc
) with release of pylint==3.0.0
and astroid==3.0.0
#2
Comments
The error happens because pylint-quotes/pylint_quotes/checker.py Line 159 in c9aae00
variable astroid/astroid/nodes/scoped_nodes/scoped_nodes.py class Module(LocalsDictNodeNG):
"""Class representing an :class:`ast.Module` node. and class
astroid/astroid/nodes/scoped_nodes/scoped_nodes.py @property
def doc(self) -> str | None:
"""The module docstring."""
warnings.warn(
"The 'Module.doc' attribute is deprecated, "
"use 'Module.doc_node' instead.",
DeprecationWarning,
stacklevel=2,
)
return self._doc and later removed in Astroid
Like the deprecation warning says solution is to use pylint-quotes/pylint_quotes/checker.py Line 159 in c9aae00
we need to use Remark:Even though type of astroid/astroid/nodes/scoped_nodes/scoped_nodes.py @decorators_mod.deprecate_arguments(doc="Use the postinit arg 'doc_node' instead")
def __init__(
self,
name: str,
doc: str | None = None,
file: str | None = None,
path: list[str] | None = None,
package: bool | None = None,
parent: None = None,
pure_python: bool | None = True,
) -> None:
⋮
⋮
self._doc = doc
"""The module docstring."""
⋮
⋮
self.doc_node: Const | None = None
"""The doc node associated with this node."""
⋮
⋮
def postinit(self, body=None, *, doc_node: Const | None = None):
"""Do some setup after initialisation.
:param body: The contents of the module.
:type body: list(NodeNG) or None
:param doc_node: The doc node associated with this node.
"""
self.body = body
self.doc_node = doc_node
if doc_node:
self._doc = doc_node.value both atributes are optional, |
Bug description
When parsing the following
utils.py
:The following error occurs with newer Pylint (
>=3.0.0
) and Astroid (>=3.0.0
):Pylint version
OS / Environment
win32 (Windows)
Script used
I used the following script to produce the error for debugging purposes, but the same error occurs when running Pylint in command line or using Pylint extension in Visual Studio Code:
The text was updated successfully, but these errors were encountered: