Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit10d9ac6

Browse files
committed
Remove _class_attribute and missed _strptime_attribute
1 parente0ec86d commit10d9ac6

File tree

3 files changed

+2
-23
lines changed

3 files changed

+2
-23
lines changed

‎github3/gists/comment.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,7 @@ def _update_attributes(self, comment):
6464
self.created_at=self._strptime(comment['created_at'])
6565
self.id=comment['id']
6666
self.updated_at=self._strptime(comment['updated_at'])
67-
self.user=self._class_attribute(
68-
comment,'user',users.ShortUser,self,
69-
)
67+
self.user=users.ShortUser(comment['user'],self)
7068

7169
def_repr(self):
7270
return'<Gist Comment [{0}]>'.format(self.user.login)

‎github3/models.py‎

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -94,25 +94,6 @@ def _get_attribute(cls, data, attribute, fallback=None):
9494
returnfallback
9595
returnresult
9696

97-
@classmethod
98-
def_class_attribute(cls,data,attribute,cl,*args,**kwargs):
99-
"""Return the attribute from the json data and instantiate the class.
100-
101-
:param dict data: dictionary used to put together the model or None
102-
:param str attribute: key of the attribute
103-
:param class cl: class that will be instantiated
104-
:returns: instantiated class or None
105-
:rtype: object or None
106-
"""
107-
value=cls._get_attribute(data,attribute)
108-
ifvalue:
109-
returncl(
110-
value,
111-
*args,
112-
**kwargs
113-
)
114-
returnvalue
115-
11697
@classmethod
11798
def_strptime_attribute(cls,data,attribute):
11899
"""Get a datetime object from a dict, return None if it wan't found.

‎github3/repos/release.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ def _update_attributes(self, asset):
367367
self.name=asset['name']
368368
self.size=asset['size']
369369
self.state=asset['state']
370-
self.updated_at=self._strptime_attribute(asset,'updated_at')
370+
self.updated_at=self._strptime(asset['updated_at'])
371371

372372
def_repr(self):
373373
return'<Asset [{0}]>'.format(self.name)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp