@@ -83,40 +83,6 @@ def as_json(self):
8383 """
8484 return jsonlib .dumps (self ._json_data )
8585
86- @classmethod
87- def _get_attribute (cls , data , attribute , fallback = None ):
88- """Return the attribute from the json data.
89-
90- :param dict data: dictionary used to put together the model
91- :param str attribute: key of the attribute
92- :param any fallback: return value if original return value is falsy
93- :returns: value paired with key in dict, fallback
94- """
95- if data is None or not isinstance (data , dict ):
96- return None
97- result = data .get (attribute )
98- if result is None :
99- return fallback
100- return result
101-
102- @classmethod
103- def _strptime_attribute (cls , data , attribute ):
104- """Get a datetime object from a dict, return None if it wan't found.
105-
106- This is equivalent to calling::
107-
108- cls._strptime(data[attribute]) if attribute in data else None
109-
110- :param dict data: dictionary used to put together the model
111- :param str attribute: key of the attribute
112- :returns: timezone-aware datetime object
113- :rtype: datetime
114- """
115- result = cls ._get_attribute (data , attribute )
116- if result :
117- return cls ._strptime (result )
118- return result
119-
12086 @classmethod
12187 def _strptime (cls , time_str ):
12288 """Convert an ISO 8601 formatted string to a datetime object.
0 commit comments