-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
add_objprint and the type checker #106
Comments
Could you give me an example? |
from objprint import *
@add_objprint
class Goo:
f1: int = 2
f2: str = "kuku"
# ISSUE: pylance error: "Expected 1 more positional argument"
o = Goo()
# ISSUE: f1 is not recognized as a field of o, but printed
print(o.f1) Both issues disapear if |
@adrian-herscu This only happens when def add_objprint(
orig_class: Optional[Type] = None,
format: str = "string", **kwargs) -> Union[Type, Callable[[Type], Type]]:
pass
# change
def add_objprint(
orig_class: Optional[Type] = None,
format: str = "string", **kwargs) -> Union[Type, Callable]:
pass Strong constraints can cause errors in pylance. It can be constraint not hint. |
Thanks for the investigation, but the solution is not ideal. Removing |
Fixed in #113 |
When adding add_objprint to a class, it severely interferes with the (pylance) type checker.
The text was updated successfully, but these errors were encountered: