Given a class like this:
class MyBlock(XBlock):
my_bool = xblock.fields.Boolean(...)
I want mypy to understand this:
type(MyBlock.my_bool) # --> xblock.fields.Boolean
type(instance_of_my_block.my_bool) # --> bool
We can kinda hack around it right now by doing this:
class MyBlock(XBlock):
my_bool: bool = xblock.fields.Boolean(...)
but that annotation isn't entirely correct, because the class-level attribute will always be an instance of xblock.fields.Field.
We should see what django-stubs does in order to make this work for Django models, which are in a similar situation.
Given a class like this:
I want mypy to understand this:
We can kinda hack around it right now by doing this:
but that annotation isn't entirely correct, because the class-level attribute will always be an instance of
xblock.fields.Field.We should see what django-stubs does in order to make this work for Django models, which are in a similar situation.