pylint: Skip false-positive invalid-sequence-index

Pylint doesn't handle flow control and thus, doesn't understand
that a key of type `str` is not reachable at this point:

> ipalib/base.py:472: [E1126(invalid-sequence-index),
  NameSpace.__getitem__] Sequence index is not an int, slice, or instance
  with __index__)

Note: I faced this error on Python3.9 and didn't see it using
Python3.10.

Fixes: https://pagure.io/freeipa/issue/9117
Signed-off-by: Stanislav Levin <slev@altlinux.org>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
Stanislav Levin authored and Rob Crittenden committed 2022-03-14 10:44:55 -04:00
1 parent 6202a7d85b
commit b58ec49da9
1 file changed
+1 -1
+1 -1
View File
@@ -469,7 +469,7 @@ class NameSpace(ReadOnly):
if isinstance(key, str):
return self.__map[key]
if type(key) in (int, slice):
return self.__members[key]
return self.__members[key] # pylint: disable=invalid-sequence-index
raise TypeError(
TYPE_ERROR % ('key', (str, int, slice, 'object with __name__'),
key, type(key))