run pylint on the following:
from typing import Collection
class NewCollection(Collection):
pass
E0239: Inheriting 'Collection', which is not a class. (inherit-non-class)
Don't raise an error. Collection is a class:
$ pipenv run python
Python 3.7.0 (default, Jun 28 2018, 08:12:18)
[GCC 8.1.1 20180502 (Red Hat 8.1.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from typing import Collection
>>> type(Collection)
<class 'typing._GenericAlias'>
>>>
pylint 2.1.1
astroid 2.0.4
Python 3.7.0 (default, Jun 28 2018, 08:12:18)
[GCC 8.1.1 20180502 (Red Hat 8.1.1-1)]
Edit: I have reproduced this on master (9734baeb)
This appears to happen with all (or most) of the generics in typing. Not specific to Collection
Thanks for reporting a bug!
Not reproducible in the current version. The related issue 2568 with typing generic is still a problem, though.
I can still reproduce it on master:
$ pipenv run pylint test.py
************* Module testtest.py:3:0: E0239: Inheriting 'Collection', which is not a class. (inherit-non-class)
--------------------------------------------------------------------Your code has been rated at -6.67/10 (previous run: -6.67/10, +0.00)
$ cat test.py -p
from typing import Collection
class NewCollection(Collection):
pass
$ pipenv graph
pylint==2.4.0.dev0
- astroid [required: >=2.2.0,<3, installed: 2.2.5]
- lazy-object-proxy [required: Any, installed: 1.4.1]
- six [required: Any, installed: 1.12.0]
- typed-ast [required: >=1.3.0, installed: 1.3.5]
- wrapt [required: Any, installed: 1.11.1]
- isort [required: >=4.2.5,<5, installed: 4.3.20]
- mccabe [required: >=0.6,<0.7, installed: 0.6.1]
Most helpful comment
I can still reproduce it on master: