Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix redefining aliases that uses import typing #26

Closed

Conversation

aklajnert
Copy link

This is an attempt to solve #25. I'm not sure if that's the best solution, however, it works and it's pretty easy.

The problem was that actual node object had 3 children: typing (Leaf), .Optional (Node) and [str] (Node), and expected object only 2 children: typing.Optional (Leaf), [str] (Node), which made them not equal. No idea why the same file is parsed differently, but the proposed solution ignores that problem.

@aklajnert
Copy link
Author

Actually it doesn't work for more complex types, and the usage of typing.* seems to not be the factor that causes the issue:

Expected: 'Union[str, bytes, None, List[Union[str, bytes]], Tuple[Union[str, bytes], ...]]', 
actual:   'Union[ str, bytes, None, List[Union[str, bytes]], Tuple[Union[str, bytes], ...],\n]'

I'll try to figure it out later. Any hints on how to tackle that @ambv?

@aklajnert aklajnert closed this Oct 15, 2020
@aklajnert aklajnert deleted the fix_redefining_typing_aliases branch May 16, 2021 05:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant