mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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:
committed by
Rob Crittenden
parent
6202a7d85b
commit
b58ec49da9
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user