X Tutup
Skip to content

Commit 95dc63d

Browse files
committed
adds doc strings for base model functions
1 parent 7e7dee8 commit 95dc63d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

twitter/models.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ def __init__(self, **kwargs):
1717
self.param_defaults = {}
1818

1919
def __str__(self):
20+
""" Returns a string representation of TwitterModel. By default
21+
this is the same as AsJsonString(). """
2022
return self.AsJsonString()
2123

2224
def __eq__(self, other):
@@ -26,6 +28,8 @@ def __ne__(self, other):
2628
return not self.__eq__(other)
2729

2830
def AsJsonString(self):
31+
""" Returns the TwitterModel as a JSON string based on key/value
32+
pairs returned from the AsDict() method. """
2933
return json.dumps(self.AsDict(), sort_keys=True)
3034

3135
def AsDict(self):
@@ -341,7 +345,7 @@ def __repr__(self):
341345
@classmethod
342346
def NewFromJsonDict(cls, data, **kwargs):
343347
from twitter import Status
344-
if data.get('status'):
348+
if data.get('status', None):
345349
status = Status.NewFromJsonDict(data.get('status'))
346350
return super(cls, cls).NewFromJsonDict(data=data, status=status)
347351
else:

0 commit comments

Comments
 (0)
X Tutup