Merge pull request #1043 from marcospri/develop_2.0

Support for nested lists/maps for the python client
This commit is contained in:
wing328 2015-08-10 18:30:02 +08:00
commit e78844cb54

View File

@ -247,12 +247,12 @@ class ApiClient(object):
return None
if type(klass) == str:
if 'list[' in klass:
if klass.startswith('list['):
sub_kls = re.match('list\[(.*)\]', klass).group(1)
return [self.__deserialize(sub_data, sub_kls)
for sub_data in data]
if 'dict(' in klass:
if klass.startswith('dict('):
sub_kls = re.match('dict\(([^,]*), (.*)\)', klass).group(2)
return {k: self.__deserialize(v, sub_kls)
for k, v in iteritems(data)}