]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
types: fixing type detection
authorVasek Sraier <git@vakabus.cz>
Tue, 30 Mar 2021 18:40:01 +0000 (20:40 +0200)
committerAleš Mrázek <ales.mrazek@nic.cz>
Fri, 8 Apr 2022 14:17:52 +0000 (16:17 +0200)
This is just weird. The previous version was working without issues
on pretty much every system except for our integration testing tool.
This seems to fix it. But I still don't understand, how it really works.

manager/knot_resolver_manager/utils/types.py

index b0b4f42e49633db283dd7254c0578ddc4b04892b..0ce8f6c867f1c80b4a8c0222f3d558fab1aac636 100644 (file)
@@ -11,15 +11,15 @@ def is_optional(tp: Any) -> bool:
 
 
 def is_dict(tp: Any) -> bool:
-    return getattr(tp, "__origin__", None) == Dict
+    return getattr(tp, "__origin__", None) in (Dict, dict)
 
 
 def is_list(tp: Any) -> bool:
-    return getattr(tp, "__origin__", None) == List
+    return getattr(tp, "__origin__", None) in (List, list)
 
 
 def is_tuple(tp: Any) -> bool:
-    return getattr(tp, "__origin__", None) == Tuple
+    return getattr(tp, "__origin__", None) in (Tuple, tuple)
 
 
 def is_union(tp: Any) -> bool: