Skip to content

Commit

Permalink
Do not use IAstroidChecker for pylint versions >= 2.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
QuantuMope committed Sep 18, 2024
1 parent 0283006 commit 0df30f5
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tools/codestyle/docstring_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,16 @@
# limitations under the License.
"""DocstringChecker is used to check python doc string's style."""

import six
import astroid

from pylint.checkers import BaseChecker, utils
from pylint.interfaces import IAstroidChecker
from pylint.checkers import BaseChecker
# Newer versions of pylint (>= 2.5.0) do not have IAstroidChecker
try:
from pylint.interfaces import IAstroidChecker

IASTROID_CHECKER_AVAILABLE = True
except ImportError:
IASTROID_CHECKER_AVAILABLE = False

from collections import defaultdict
import re
Expand Down Expand Up @@ -112,7 +117,8 @@ class DocstringChecker(BaseChecker):
"""DosstringChecker is pylint checker to
check docstring style.
"""
__implements__ = (IAstroidChecker, )
if IASTROID_CHECKER_AVAILABLE:
__implements__ = (IAstroidChecker, )

POSITIONAL_MESSAGE_ID = 'str-used-on-positional-format-argument'
KEYWORD_MESSAGE_ID = 'str-used-on-keyword-format-argument'
Expand Down

0 comments on commit 0df30f5

Please sign in to comment.