]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
python: linting fixes
authorAleš Mrázek <ales.mrazek@nic.cz>
Wed, 9 Oct 2024 20:27:56 +0000 (22:27 +0200)
committerAleš Mrázek <ales.mrazek@nic.cz>
Thu, 17 Oct 2024 12:39:47 +0000 (14:39 +0200)
python/knot_resolver/utils/modeling/base_schema.py

index 13539fe04a8255c3271c90b2ee1193a2218d8bf7..574da9512e06a97d265fd9f314a70bcf0de36804 100644 (file)
@@ -185,13 +185,13 @@ def _describe_type(typ: Type[Any]) -> Dict[Any, Any]:
     elif is_none_type(typ):
         return {"type": "null"}
 
-    elif typ == int:
+    elif typ is int:
         return {"type": "integer"}
 
-    elif typ == bool:
+    elif typ is bool:
         return {"type": "boolean"}
 
-    elif typ == str:
+    elif typ is str:
         return {"type": "string"}
 
     elif is_literal(typ):
@@ -221,7 +221,7 @@ def _describe_type(typ: Type[Any]) -> Dict[Any, Any]:
                 key.__str__ is not BaseValueType.__str__
             ), "To support derived 'BaseValueType', __str__ must be implemented."
         else:
-            assert key == str, "We currently do not support any other keys then strings"
+            assert key is str, "We currently do not support any other keys then strings"
 
         return {"type": "object", "additionalProperties": _describe_type(val)}
 
@@ -428,19 +428,19 @@ class ObjectMapper:
             raise DataValidationError(f"unexpected value 'None' for type {tp}", object_path)
 
         # int
-        elif tp == int:
+        elif tp is int:
             return self._create_int(obj, object_path)
 
         # str
-        elif tp == str:
+        elif tp is str:
             return self._create_str(obj, object_path)
 
         # bool
-        elif tp == bool:
+        elif tp is bool:
             return self._create_bool(obj, object_path)
 
         # float
-        elif tp == float:
+        elif tp is float:
             raise NotImplementedError(
                 "Floating point values are not supported in the object mapper."
                 " Please implement them and be careful with type coercions"