6条回答 默认 最新
weixin_39605414 2020-11-21 16:46关注Original comment by Xin Rong (Bitbucket: ronxin GitHub: ronxin ).
It seems that
ast_utils.mark_text_ranges()generates inaccurate results whenever there is a keyword argument and no positional arguments in a function call.For example,
import ast import ast_utils code = u'f(x=1)' node = ast.parse(code) ast_utils.mark_text_ranges(node, code) func = node.body[0].value.func code[func.col_offset:func.end_col_offset]The output is expected to be
f, but the actual output isf(x.I can submit a pull request for this.
解决 无用评论 打赏 举报