diff options
author | Sardorbek Imomaliev <sardorbek.imomaliev@gmail.com> | 2018-12-14 14:30:54 +0700 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2018-12-14 08:30:54 +0100 |
commit | 735618916c63ba2f8b647fbd45dcf2456343836c (patch) | |
tree | 44a629d4c0cfe1ab9e144375098754bf00be07dc | |
parent | 117ec26657e7d79b4d29e228394088453faa2527 (diff) | |
download | pylint-git-735618916c63ba2f8b647fbd45dcf2456343836c.tar.gz |
Fix docs to work with astroide>2.x (#2646)
-rw-r--r-- | CONTRIBUTORS.txt | 2 | ||||
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | doc/how_tos/transform_plugins.rst | 6 |
3 files changed, 7 insertions, 3 deletions
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 0aaf8c6cf..8fd702f00 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -255,3 +255,5 @@ contributors: * Pablo Galindo Salgado: contributor Fix false positive 'Non-iterable value' with async comprehensions. + +* Sardorbek Imomaliev: contributor @@ -7,6 +7,8 @@ What's New in Pylint 2.3.0? Release date: TBA +* Fix how to docs using astroid ``astroid<2.x`` + * Add ``no-else-raise`` warning (R1720) Close #2558 diff --git a/doc/how_tos/transform_plugins.rst b/doc/how_tos/transform_plugins.rst index 67422a7e7..d3919fd20 100644 --- a/doc/how_tos/transform_plugins.rst +++ b/doc/how_tos/transform_plugins.rst @@ -77,13 +77,13 @@ Module, Class, Function etc. In our case we need to transform a class. It can be if cls.name == 'WarningMessage': import warnings for f in warnings.WarningMessage._WARNING_DETAILS: - cls.locals[f] = [astroid.Class(f, None)] + cls.locals[f] = [astroid.ClassDef(f, None)] - MANAGER.register_transform(astroid.Class, transform) + MANAGER.register_transform(astroid.ClassDef, transform) Let's go through the plugin. First, we need to register a class transform, which is done via the ``register_transform`` function in ``MANAGER``. It takes the node -type and function as parameters. We need to change a class, so we use ``astroid.Class``. +type and function as parameters. We need to change a class, so we use ``astroid.ClassDef``. We also pass a ``transform`` function which does the actual transformation. ``transform`` function is simple as well. If the class is ``WarningMessage`` then we |