Changes between Version 55 and Version 56 of pyson
- Timestamp:
- 09/09/21 14:22:24 (3 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
pyson
v55 v56 57 57 The following types are recognised and handled separately: 58 58 59 NoneType, int, float, bool, str, complex, range, bytes, bytearray, datetime, [https://tracinsy.ewi.tudelft.nl/pubtrac/Utilities/wiki/uri URI], UUID, Decimal, dict, list 59 NoneType, int, float, bool, str, complex, range, bytes, bytearray, datetime, [https://tracinsy.ewi.tudelft.nl/pubtrac/Utilities/wiki/uri URI], UUID, Decimal, dict, list, Exceptions (see below) 60 60 61 61 The dict and list are treated even more special as we also support the List[TYPE] and Dict[KEYTYPE, VALUETYPE] types. … … 64 64 65 65 You can use {{{ Union[X, NoneType] }}} where {{{NoneType=type(None)}}} if the object can also be None. So for exmple you can use {{{reservationBid:Union[Bid,type(None)] = None}}}. Do not use the mypy.NoneType which is an entirely different class. We do not support {{{ Union[X,Y] }}} where both X and Y are not NoneType. 66 67 ===Exceptions 68 Exceptions are handled as follows: 69 Serialization of an exception gives {{{ {"message":"...", "cause": EX, "stackTrace":[]} }}} where EX is either None or another serialized exception. This format tries to maximize compatibility with the jackson way of serializing exceptions. The "stackTrace" field is always empty because python does not include the stacktrace with exceptions; it's there only for compatibility of the format with java. Note that the type of the exception is not included (as in jackson). 70 Deserialization takes a dict with at least a "message" field. The constructor of the provided class is called with this message, so make sure that your exception constructor takes the message as the constructor argument. If the dict contains a cause, the cause is also parsed recursively, as general Exception, and attribute {{{__cause__}}} of the exception is filled with the result. 66 71 67 72 == Annotations