t3rn0 / ast-comments

Extension to the built-in ast module. Finds comments in source code and adds them to the parsed tree.
MIT License
31 stars 10 forks source link

Imports from `typing` eclypse imports from AST #22

Closed dvarrazzo closed 1 year ago

dvarrazzo commented 1 year ago

Hello,

This line:

https://github.com/t3rn0/ast-comments/blob/d5d6ed1f8409c4a7c9706a9b320b7f6a324a298c/ast_comments.py#L7

Causes typing objects to eclypse the ast objects imported in from ast import *. As a consequence checking for objects to be Dict, List, Tuple fails to perform the expected check.

>>> import ast
>>> import ast_comments
>>> ast.Str is ast_comments.Str
True
>>> ast.Dict is ast_comments.Dict
False
>>> ast_comments.Str
<class 'ast.Str'>
>>> ast_comments.Dict
typing.Dict
t3rn0 commented 1 year ago

Hi. I'll work on it as soon as possible right after dealing with this one (#21)

t3rn0 commented 1 year ago

Published 1.1.2 with changes concerning this issue.