Due to the limitations of json, there is no distinction in the protocol for different types of numbers (i.e. float vs int)
This means that when parsing the response field of a number from the RPC, if it's a 'double' field (or documented as 'float' in this library), it may not always return a float. This typically happens when a 'double' number as defined in the rpc is either flat 0 or 1.
This can result in some edge case issues where applications actually depend on this number to be of a particular type, and/or not flip between int and float
For any value that's documented as a float, this library should explicitly 'cast' it as a float to avoid this inconsistent typing.
Description
Due to the limitations of json, there is no distinction in the protocol for different types of numbers (i.e. float vs int)
This means that when parsing the response field of a number from the RPC, if it's a 'double' field (or documented as 'float' in this library), it may not always return a float. This typically happens when a 'double' number as defined in the rpc is either flat 0 or 1.
For example:
This is inconsistent with the documented types. I.e. for this example: https://github.com/trim21/transmission-rpc/blob/57c064f6b740b67be1ed7c5afad5ce18476616f4/transmission_rpc/torrent.py#L562
This can result in some edge case issues where applications actually depend on this number to be of a particular type, and/or not flip between
int
andfloat
For any value that's documented as a float, this library should explicitly 'cast' it as a float to avoid this inconsistent typing.
i.e.