remove old/python2 references to types like IntType and the like
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Tue, 9 Apr 2019 20:05:29 +0000 (22:05 +0200)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Tue, 9 Apr 2019 20:05:29 +0000 (22:05 +0200)
sfa/storage/parameter.py
sfa/util/method.py

index bd9d3b5..2d6d068 100644 (file)
@@ -5,7 +5,7 @@
 # Copyright (C) 2006 The Trustees of Princeton University
 #
 
 # Copyright (C) 2006 The Trustees of Princeton University
 #
 
-from types import NoneType, IntType, LongType, FloatType, DictType, TupleType, ListType
+#from types import NoneType, IntType, LongType, FloatType, DictType, TupleType, ListType
 from sfa.util.faults import SfaAPIError
 
 
 from sfa.util.faults import SfaAPIError
 
 
@@ -86,17 +86,17 @@ def xmlrpc_type(arg):
 
     if arg_type == NoneType:
         return "nil"
 
     if arg_type == NoneType:
         return "nil"
-    elif arg_type == IntType or arg_type == LongType:
+    elif arg_type == int:
         return "int"
     elif arg_type == bool:
         return "boolean"
         return "int"
     elif arg_type == bool:
         return "boolean"
-    elif arg_type == FloatType:
+    elif arg_type == float:
         return "double"
         return "double"
-    elif issubclass(arg_type, str):
+    elif arg_type == str:
         return "string"
         return "string"
-    elif arg_type == ListType or arg_type == TupleType:
+    elif arg_type in (list, tuple):
         return "array"
         return "array"
-    elif arg_type == DictType:
+    elif arg_type == dict:
         return "struct"
     elif arg_type == Mixed:
         # Not really an XML-RPC type but return "mixed" for
         return "struct"
     elif arg_type == Mixed:
         # Not really an XML-RPC type but return "mixed" for
index b3d7d1a..7329036 100644 (file)
@@ -4,7 +4,6 @@
 #
 
 import time
 #
 
 import time
-from types import IntType, LongType
 import textwrap
 
 from sfa.util.sfalogging import logger
 import textwrap
 
 from sfa.util.sfalogging import logger
@@ -243,7 +242,7 @@ class Method:
 
         # Integers and long integers are also special types. Accept
         # either int or long types if an int or long is expected.
 
         # Integers and long integers are also special types. Accept
         # either int or long types if an int or long is expected.
-        elif expected_type in (IntType, LongType) and isinstance(value, (IntType, LongType)):
+        elif expected_type is int and isinstance(value, int):
             pass
 
         elif not isinstance(value, expected_type):
             pass
 
         elif not isinstance(value, expected_type):