git://git.onelab.eu
/
plcapi.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
more ironing in the corner of that 'types' modules
[plcapi.git]
/
PLC
/
Parameter.py
diff --git
a/PLC/Parameter.py
b/PLC/Parameter.py
index
6268fce
..
1144ec8
100644
(file)
--- a/
PLC/Parameter.py
+++ b/
PLC/Parameter.py
@@
-5,7
+5,6
@@
# Copyright (C) 2006 The Trustees of Princeton University
#
# Copyright (C) 2006 The Trustees of Princeton University
#
-from types import *
from PLC.Faults import *
class Parameter:
from PLC.Faults import *
class Parameter:
@@
-15,11
+14,11
@@
class Parameter:
sub-parameters (i.e., dict fields).
"""
sub-parameters (i.e., dict fields).
"""
- def __init__(self, typeval, doc
=
"",
- min
= None, max =
None,
- optional
=
None,
- ro
=
False,
- nullok
=
False):
+ def __init__(self, typeval, 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 = typeval
# Basic type of the parameter. Must be a builtin type
# that can be marshalled by XML-RPC.
self.type = typeval
@@
-80,23
+79,23
@@
def xmlrpc_type(arg):
arg_type = python_type(arg)
arg_type = python_type(arg)
- if arg_type
== NoneType
:
+ if arg_type
is type(None)
:
return "nil"
return "nil"
- elif arg_type
== IntType or arg_type == LongType
:
+ elif arg_type
is int
:
return "int"
return "int"
- elif arg_type
==
bool:
+ elif arg_type
is
bool:
return "boolean"
return "boolean"
- elif arg_type
== FloatType
:
+ elif arg_type
is float
:
return "double"
return "double"
- elif arg_type i
n StringTypes
:
+ elif arg_type i
s 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
is dict
:
return "struct"
elif arg_type == Mixed:
# Not really an XML-RPC type but return "mixed" for
# documentation purposes.
return "mixed"
else:
return "struct"
elif arg_type == Mixed:
# Not really an XML-RPC type but return "mixed" for
# documentation purposes.
return "mixed"
else:
- raise PLCAPIError
, "XML-RPC cannot marshal %s objects" % arg_type
+ raise PLCAPIError
("XML-RPC cannot marshal %s objects" % arg_type)