-
Notifications
You must be signed in to change notification settings - Fork 5
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
REL: set version to 0.5.0 #77
Conversation
@jorenham @KotlinIsland I am seeing some |
basedpyright reports no failures |
baedmypy 2.8.1 reports no failures |
I'll probably just pin basedmypy for this release, we can figure out what's going on after that |
I believe this has to do with @KotlinIsland 's change in the bundled typeshed so that |
perhaps we could introduce a |
it may well be that we are relying on some undefined behaviour, or have incorrectly typed something, so I'd rather check that before changing the config |
the issue is that the behavior of getting attrs is underspecified within the typesystem, even for the most trivial of cases: class A:
a = 1
getattr(A, 'a') # Any |
It also can't even do this: class A:
def __getattr__(self, attr: str, /) -> int:
return 42
a = A()
reveal_type(getattr(a, "any")) # Type of "getattr(a, "any")" is "Any"
|
right, so what would be the advisable way to deal with this downstream? |
because |
PR welcome I guess 😉 (no pressure) |
sorry, what is your preferred action here?
if by downstream you are refering to this project, then i recommend writing your own an alternative, that is more safe would be to cast each and every attr that is gotten to the expected type. i prefer this approach as it is more descriptive and type safe than using name = cast(str, getattr(entity, "name")) |
the cast approach looks fine to me! |
No description provided.