enthought / enthought/traits

Traits stubs complains about untyped containers

Open
#1,237 0 comments 0 reactions 0 assignees View on GitHub
component: typing stubs priority: low type: bug
Dominant language
Python
Stars
462
Forks
90
PR merge metrics
No merged PRs in 30d

Description

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)`).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.