mirror of
https://github.com/kennethreitz/python-github3.git
synced 2026-06-05 23:10:17 +00:00
Smarter to_python
This commit is contained in:
+6
-4
@@ -58,16 +58,18 @@ def to_python(obj,
|
||||
|
||||
if int_keys:
|
||||
for in_key in int_keys:
|
||||
obj.__dict__[in_key] = int(in_dict.get(in_key))
|
||||
if (in_dict is not None) and (in_dict.get(in_key) is not None):
|
||||
obj.__dict__[in_key] = int(in_dict.get(in_key))
|
||||
|
||||
if bool_keys:
|
||||
for in_key in bool_keys:
|
||||
obj.__dict__[in_key] = bool(in_dict.get(in_key))
|
||||
if in_dict.get(in_key) is not None:
|
||||
obj.__dict__[in_key] = bool(in_dict.get(in_key))
|
||||
|
||||
if object_map:
|
||||
|
||||
for (k, v) in object_map.items():
|
||||
obj.__dict__[k] = v.new_from_dict(in_dict.get(k))
|
||||
if in_dict.get(k):
|
||||
obj.__dict__[k] = v.new_from_dict(in_dict.get(k))
|
||||
|
||||
obj.__dict__.update(kwargs)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user