@@ -12,8 +12,7 @@ def __str__(self):
1212 return self .AsJsonString ()
1313
1414 def __eq__ (self , other ):
15- return other and \
16- self .AsDict () == other .AsDict ()
15+ return other and self .AsDict () == other .AsDict ()
1716
1817 def __ne__ (self , other ):
1918 return not self .__eq__ (other )
@@ -220,24 +219,40 @@ class UserStatus(TwitterModel):
220219 """ A class representing the UserStatus structure. This is an abbreviated
221220 form of the twitter.User object. """
222221
222+ connections = {'following' : False ,
223+ 'followed_by' : False ,
224+ 'following_received' : False ,
225+ 'following_requested' : False ,
226+ 'blocking' : False ,
227+ 'muting' : False }
228+
223229 def __init__ (self , ** kwargs ):
224230 self .param_defaults = {
225231 'name' : None ,
226232 'id' : None ,
227233 'id_str' : None ,
228234 'screen_name' : None ,
229- 'following' : None ,
230- 'followed_by' : None }
235+ 'following' : False ,
236+ 'followed_by' : False ,
237+ 'following_received' : False ,
238+ 'following_requested' : False ,
239+ 'blocking' : False ,
240+ 'muting' : False }
231241
232242 for (param , default ) in self .param_defaults .items ():
233243 setattr (self , param , kwargs .get (param , default ))
234244
245+ if 'connections' in kwargs :
246+ for param in self .connections :
247+ if param in kwargs ['connections' ]:
248+ setattr (self , param , True )
249+
235250 def __repr__ (self ):
236- return "UserStatus(ID={uid}, Name={sn}, Following={fng}, Followed={fed})" .format (
251+ conns = [param for param in self .connections if getattr (self , param )]
252+ return "UserStatus(ID={uid}, Name={sn}, Connections=[{conn}])" .format (
237253 uid = self .id ,
238254 sn = self .screen_name ,
239- fng = self .following ,
240- fed = self .followed_by )
255+ conn = ", " .join (conns ))
241256
242257
243258class User (TwitterModel ):
0 commit comments