8000 Update github3.repos.repo for consistency · pythonthings/github3.py@7e5a00b · GitHub
[go: up one dir, main page]

Skip to content

Commit 7e5a00b

Browse filesBrowse files
committed
Update github3.repos.repo for consistency
1 parent 5814c53 commit 7e5a00b

File tree

3 files changed

+1072
-653
lines changed

3 files changed

+1072
-653
lines changed

github3/models.py

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)
0