Учитывая следующий код Python:
import git
try:
raise git.exc.GitCommandError("dummy", "foo")
except git.exc.GitCommandError as exc:
print(exc)
pylint жалуется
************* Module test
[...irrelevant errors removed...]
test.py:4:7: E1101: Instance of 'GitError' has no 'GitCommandError' member (no-member)
test.py:4:7: E1101: Instance of 'Exception' has no 'GitCommandError' member (no-member)
test.py:5:7: E1101: Instance of 'Exception' has no 'GitCommandError' member (no-member)
test.py:5:7: E1101: Instance of 'GitError' has no 'GitCommandError' member (no-member)
---------------------------------------------------------------------
Your code has been rated at -36.00/10 (previous run: 4.00/10, -40.00)
Код работает нормально, я не понимаю ошибки.git.exc - не исключение, а модуль:
> python3
Python 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import git
>>> git.exc
<module 'git.exc' from '/tmp/tmp.ULCyvtUQWx/testenv/lib/python3.5/site-packages/GitPython-2.1.11-py3.5.egg/git/exc.py'>
версия pylint - 2.3.1.Мне интересно, это просто ошибка в pylint или я что-то упустил ...
Обновление: Использование git.GitCommandError вместо git.exc.GitCommandError непо той же причине выдает ту же ошибку.Хотя последний является первоначальным названием класса.