-
Notifications
You must be signed in to change notification settings - Fork 224
Closed as not planned
Labels
duplicateThis issue or pull request already exists elsewhereThis issue or pull request already exists elsewhere
Description
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) # --> boolWe 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.
Metadata
Metadata
Assignees
Labels
duplicateThis issue or pull request already exists elsewhereThis issue or pull request already exists elsewhere