traits
traits copied to clipboard
Traits stubs complains about untyped containers
In the following example:
from traits.api import Dict, HasTraits, List, Set
class Test(HasTraits):
example_list = List()
example_dict = Dict()
example_set = Set()
Mypy gives the following errors:
test_list_stub.py:6: error: Need type annotation for 'example_list'
test_list_stub.py:8: error: Need type annotation for 'example_dict'
test_list_stub.py:10: error: Need type annotation for 'example_set'
Found 3 errors in 1 file (checked 1 source file)
These are legitimate uses (equivalent to List(Any)
, etc.) but I don't think we want people to have to add the explicit Any
, particularly given that Dict(Str)
works (which is equivalent to Dict(Str, Any)
).