diff options
author | robot-contrib <robot-contrib@yandex-team.com> | 2023-11-10 11:52:54 +0300 |
---|---|---|
committer | robot-contrib <robot-contrib@yandex-team.com> | 2023-11-10 12:15:35 +0300 |
commit | b6522f79bc39f42a3fb6140f97058220502a1012 (patch) | |
tree | 3838b4eefc695cdeb098f0131510a7c931b9ceab | |
parent | 3c8377f192205959ee2f9b7e7259276c4b8ae934 (diff) | |
download | ydb-b6522f79bc39f42a3fb6140f97058220502a1012.tar.gz |
Update contrib/python/asttokens to 2.4.1
-rw-r--r-- | contrib/python/asttokens/.dist-info/METADATA | 8 | ||||
-rw-r--r-- | contrib/python/asttokens/asttokens/astroid_compat.py | 6 | ||||
-rw-r--r-- | contrib/python/asttokens/asttokens/mark_tokens.py | 8 | ||||
-rw-r--r-- | contrib/python/asttokens/asttokens/version.py | 2 | ||||
-rw-r--r-- | contrib/python/asttokens/ya.make | 2 |
5 files changed, 17 insertions, 9 deletions
diff --git a/contrib/python/asttokens/.dist-info/METADATA b/contrib/python/asttokens/.dist-info/METADATA index bed8746816..233cd9355a 100644 --- a/contrib/python/asttokens/.dist-info/METADATA +++ b/contrib/python/asttokens/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: asttokens -Version: 2.4.0 +Version: 2.4.1 Summary: Annotate AST trees with source code positions Home-page: https://github.com/gristlabs/asttokens Author: Dmitry Sagalovskiy, Grist Labs @@ -32,9 +32,13 @@ Classifier: Programming Language :: Python :: Implementation :: PyPy License-File: LICENSE Requires-Dist: six >=1.12.0 Requires-Dist: typing ; python_version < "3.5" +Provides-Extra: astroid +Requires-Dist: astroid <2,>=1 ; (python_version < "3") and extra == 'astroid' +Requires-Dist: astroid <4,>=2 ; (python_version >= "3") and extra == 'astroid' Provides-Extra: test -Requires-Dist: astroid ; extra == 'test' Requires-Dist: pytest ; extra == 'test' +Requires-Dist: astroid <2,>=1 ; (python_version < "3") and extra == 'test' +Requires-Dist: astroid <4,>=2 ; (python_version >= "3") and extra == 'test' ASTTokens ========= diff --git a/contrib/python/asttokens/asttokens/astroid_compat.py b/contrib/python/asttokens/asttokens/astroid_compat.py index 3ba5e8dc64..9af3e17e02 100644 --- a/contrib/python/asttokens/asttokens/astroid_compat.py +++ b/contrib/python/asttokens/asttokens/astroid_compat.py @@ -3,12 +3,16 @@ try: # astroid_node_classes should be whichever module has the NodeNG class from astroid.nodes import NodeNG + from astroid.nodes import BaseContainer except Exception: try: from astroid import node_classes as astroid_node_classes from astroid.node_classes import NodeNG + from astroid.node_classes import _BaseContainer as BaseContainer except Exception: # pragma: no cover astroid_node_classes = None NodeNG = None + BaseContainer = None -__all__ = ["astroid_node_classes", "NodeNG"] + +__all__ = ["astroid_node_classes", "NodeNG", "BaseContainer"] diff --git a/contrib/python/asttokens/asttokens/mark_tokens.py b/contrib/python/asttokens/asttokens/mark_tokens.py index 32b42d7276..f5a8ac41ca 100644 --- a/contrib/python/asttokens/asttokens/mark_tokens.py +++ b/contrib/python/asttokens/asttokens/mark_tokens.py @@ -24,7 +24,7 @@ import six from . import util from .asttokens import ASTTokens from .util import AstConstant -from .astroid_compat import astroid_node_classes as nc +from .astroid_compat import astroid_node_classes as nc, BaseContainer as AstroidBaseContainer if TYPE_CHECKING: from .util import AstNode @@ -229,7 +229,7 @@ class MarkTokens(object): # type: (AstNode, util.Token, util.Token) -> Tuple[util.Token, util.Token] # With astroid, nodes that start with a doc-string can have an empty body, in which case we # need to adjust the last token to include the doc string. - if not node.body and getattr(node, 'doc', None): # type: ignore[union-attr] + if not node.body and (getattr(node, 'doc_node', None) or getattr(node, 'doc', None)): # type: ignore[union-attr] last_token = self._code.find_token(last_token, token.STRING) # Include @ from decorator @@ -312,7 +312,7 @@ class MarkTokens(object): # In Python3.8 parsed tuples include parentheses when present. def handle_tuple_nonempty(self, node, first_token, last_token): # type: (AstNode, util.Token, util.Token) -> Tuple[util.Token, util.Token] - assert isinstance(node, ast.Tuple) or isinstance(node, nc._BaseContainer) + assert isinstance(node, ast.Tuple) or isinstance(node, AstroidBaseContainer) # It's a bare tuple if the first token belongs to the first child. The first child may # include extraneous parentheses (which don't create new nodes), so account for those too. child = node.elts[0] @@ -331,7 +331,7 @@ class MarkTokens(object): def visit_tuple(self, node, first_token, last_token): # type: (AstNode, util.Token, util.Token) -> Tuple[util.Token, util.Token] - assert isinstance(node, ast.Tuple) or isinstance(node, nc._BaseContainer) + assert isinstance(node, ast.Tuple) or isinstance(node, AstroidBaseContainer) if not node.elts: # An empty tuple is just "()", and we need no further info. return (first_token, last_token) diff --git a/contrib/python/asttokens/asttokens/version.py b/contrib/python/asttokens/asttokens/version.py index 3d67cd6bb4..54499df347 100644 --- a/contrib/python/asttokens/asttokens/version.py +++ b/contrib/python/asttokens/asttokens/version.py @@ -1 +1 @@ -__version__ = "2.4.0" +__version__ = "2.4.1" diff --git a/contrib/python/asttokens/ya.make b/contrib/python/asttokens/ya.make index f1f28641dd..5ade3ab2f6 100644 --- a/contrib/python/asttokens/ya.make +++ b/contrib/python/asttokens/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(2.4.0) +VERSION(2.4.1) LICENSE(Apache-2.0) |