From d0bae507995abc66e9b4497e2d08dbba3624cf6b Mon Sep 17 00:00:00 2001 From: Stanislav Levin Date: Thu, 17 Feb 2022 12:23:01 +0300 Subject: [PATCH] pylint: Fix consider-iterating-dictionary > Emitted when the keys of a dictionary are iterated through the ``.keys()`` method or when ``.keys()`` is used for a membership check. It is enough to iterate through the dictionary itself, ``for key in dictionary``. For membership checks, ``if key in dictionary`` is faster. See https://github.com/PyCQA/pylint/issues/4069 Fixes: https://github.com/fleet-commander/fc-admin/issues/279 Signed-off-by: Stanislav Levin --- admin/fleetcommander/database.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/fleetcommander/database.py b/admin/fleetcommander/database.py index 72d8cecd..b6b26d77 100644 --- a/admin/fleetcommander/database.py +++ b/admin/fleetcommander/database.py @@ -98,7 +98,7 @@ def __setitem__(self, key, value): self.__delitem__(key) valuetype = type(value).__name__ - if valuetype not in list(self._SUPPORTED_TYPES.keys()): + if valuetype not in self._SUPPORTED_TYPES: raise ValueError("Type %s is not supported by SQLiteDict" % valuetype) if valuetype in self._SERIALIZED_TYPES: