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())