-
Notifications
You must be signed in to change notification settings - Fork 9
Interface and implements raises an error when using a union with a parametrized generic #56
Comments
Current check for optional type hints relied on `isinstance`. However, several type hints such as `List[str]` cannot be used with it. Replaced it with a `is type(None)` check instead. Fixes #56
Hello! Thanks for the bug report and happy you like it. :) It's indeed the |
Current check for optional type hints relied on `isinstance`. However, several type hints such as `List[str]` cannot be used with it. Replaced it with a `is type(None)` check instead. Fixes #56
Current check for optional type hints relied on `isinstance`. However, several type hints such as `List[str]` cannot be used with it. Replaced it with a `is type(None)` check instead. Fixes #56
Fixed with |
By the way, So The documentation needs some rework on those topics. ^^ |
And if you have any comments on the library, I'd love to hear them! |
Thanks! Just tested it, the fix seems to be working. I do have one question, but I'm going to open a new issue for it ^^ |
Hi, first i just wanted to say that i really like antidote, a really refreshing take on DI in Python :D
I encountered today an error, when defining an interface, and its implementation, with a method that has a parameter that consists of a union of a subscripted generic (like
list[str]
), it throws the following error:I created a simple reproducible example that shows that error:
It seems that the library is calling a
isinstance
check on thelist[str]
type in theis_optional
method, so there might be required a check, if that type is a generic type, maybe with aget_args
call?The text was updated successfully, but these errors were encountered: