You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Declare a variable such as self.children: OrderedSet[Context] = OrderedSet()
Current behavior
pylint emits a warning:
context/_context_impl.py:26: [E1136(unsubscriptable-object), Context.__init__] Value 'OrderedSet' is unsubscriptable
Expected behavior
No warning should be emitted, and my IDE (pycharm 2017.2.1) seems to be inferring the types correctly.
The OrderedSet class extends collections.MutableSet, so I would expect it to work out of the box.
pylint --version output
pylint 1.7.2,
astroid 1.5.3
Python 3.6.2 (default, Aug 11 2017, 11:59:59)
[GCC 7.1.1 20170622 (Red Hat 7.1.1-3)]
The text was updated successfully, but these errors were encountered:
I was wrong, pycharm does emit a warning: Class 'type' does not define '__getitem__', so the '[]' operator cannot be used on its instances.
So I guess this must be fixed in OrderedSet ?
Pylint is correct here, OrderedSet does not implement __getitem__ for classes, so that code will in fact raise an error when evaluated. This does not happen currently since annotations are not evaluated.
Steps to reproduce
self.children: OrderedSet[Context] = OrderedSet()
Current behavior
pylint emits a warning:
Expected behavior
No warning should be emitted, and my IDE (pycharm 2017.2.1) seems to be inferring the types correctly.
The
OrderedSet
class extendscollections.MutableSet
, so I would expect it to work out of the box.pylint --version output
The text was updated successfully, but these errors were encountered: