git://git.onelab.eu
/
sfa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
remove old/python2 references to types like IntType and the like
[sfa.git]
/
sfa
/
storage
/
parameter.py
diff --git
a/sfa/storage/parameter.py
b/sfa/storage/parameter.py
index
6737d0b
..
2d6d068
100644
(file)
--- a/
sfa/storage/parameter.py
+++ b/
sfa/storage/parameter.py
@@
-5,9
+5,10
@@
# Copyright (C) 2006 The Trustees of Princeton University
#
# Copyright (C) 2006 The Trustees of Princeton University
#
-
from types import NoneType, IntType, LongType, FloatType, StringTypes
, 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
+
class Parameter:
"""
Typed value wrapper. Use in accepts and returns to document method
class Parameter:
"""
Typed value wrapper. Use in accepts and returns to document method
@@
-15,11
+16,11
@@
class Parameter:
sub-parameters (i.e., dict fields).
"""
sub-parameters (i.e., dict fields).
"""
- def __init__(self, type, doc
=
"",
- min
= None, max =
None,
- optional
=
None,
- ro
=
False,
- nullok
=
False):
+ def __init__(self, type, doc
=
"",
+ min
=None, max=
None,
+ optional
=
None,
+ ro
=
False,
+ nullok
=
False):
# Basic type of the parameter. Must be a builtin type
# that can be marshalled by XML-RPC.
self.type = type
# Basic type of the parameter. Must be a builtin type
# that can be marshalled by XML-RPC.
self.type = type
@@
-49,6
+50,7
@@
class Parameter:
def __repr__(self):
return repr(self.type)
def __repr__(self):
return repr(self.type)
+
class Mixed(tuple):
"""
A list (technically, a tuple) of types. Use in accepts and returns
class Mixed(tuple):
"""
A list (technically, a tuple) of types. Use in accepts and returns
@@
-73,6
+75,7
@@
def python_type(arg):
else:
return type(arg)
else:
return type(arg)
+
def xmlrpc_type(arg):
"""
Returns the XML-RPC type of the specified argument, which may be a
def xmlrpc_type(arg):
"""
Returns the XML-RPC type of the specified argument, which may be a
@@
-83,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 arg_type
in StringTypes
:
+ 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