From 2fd1bd17a662bd16baafff36044b98615d45a25f Mon Sep 17 00:00:00 2001 From: Etienne Trimaille Date: Thu, 10 Aug 2023 09:09:32 +0200 Subject: [PATCH] Fix some flake8 issues --- QuickOSM/core/query_factory.py | 4 ++-- QuickOSM/core/utilities/json_encoder.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/QuickOSM/core/query_factory.py b/QuickOSM/core/query_factory.py index 42510dc0..ca5494fb 100644 --- a/QuickOSM/core/query_factory.py +++ b/QuickOSM/core/query_factory.py @@ -161,11 +161,11 @@ def _check_parameters(self) -> bool: :raise QueryFactoryException: """ - if type(self._query_type) != QueryType: + if not isinstance(self._query_type, QueryType): raise QueryFactoryException(tr('Wrong query type.')) for osmObject in self._osm_objects: - if type(osmObject) != OsmType: + if not isinstance(osmObject, OsmType): raise QueryFactoryException(tr('Wrong OSM object.')) if self._query_type == QueryType.AroundArea: diff --git a/QuickOSM/core/utilities/json_encoder.py b/QuickOSM/core/utilities/json_encoder.py index 308b0665..6a8a30cf 100644 --- a/QuickOSM/core/utilities/json_encoder.py +++ b/QuickOSM/core/utilities/json_encoder.py @@ -16,9 +16,9 @@ class EnumEncoder(json.JSONEncoder): """Override the json encoder to serialize enum.""" def default(self, obj): """Function of serialization.""" - if type(obj) in [LayerType, Format, MultiType]: + if isinstance(obj, (LayerType, Format, MultiType)): return {"__enum__": str(obj)} - if type(obj) == QgsRectangle: + if isinstance(obj, QgsRectangle): extent = [ str(obj.xMinimum()), str(obj.yMinimum()), str(obj.xMaximum()), str(obj.yMaximum())