<s> __author__ = '<STR_LIT>' <EOL> def extract_fields ( json ) : <EOL> """<STR_LIT>""" <EOL> return json . get ( '<STR_LIT>' ) or json <EOL> class Object ( dict ) : <EOL> """<STR_LIT>""" <EOL> def get_field ( self , name ) : <EOL> """<STR_LIT>""" <EOL> return self . get ( name ) <EOL> class Person ( Object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , fields ) : <EOL> fields = fields . get ( '<STR_LIT>' ) or fields <EOL> super ( Person , self ) . __init__ ( fields ) <EOL> def get_id ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . get_field ( '<STR_LIT:id>' ) <EOL> def get_display_name ( self ) : <EOL> """<STR_LIT>""" <EOL> display_name = self . get_field ( '<STR_LIT>' ) <EOL> if display_name : <EOL> return display_name <EOL> names = self . get_field ( '<STR_LIT:name>' ) <EOL> if names : <EOL> return '<STR_LIT>' % ( names [ '<STR_LIT>' ] , names [ '<STR_LIT>' ] ) <EOL> return '<STR_LIT>' <EOL> @ staticmethod <EOL> def parse_json ( json ) : <EOL> """<STR_LIT>""" <EOL> return Person ( extract_fields ( json ) ) <EOL> class Group ( Object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , data ) : <EOL> if data != None : <EOL> data = data . get ( '<STR_LIT>' ) or data <EOL> super ( Group , self ) . __init__ ( data ) <EOL> def get_title ( self ) : <EOL> return self [ '<STR_LIT:title>' ] ; <EOL> def get_id ( self ) : <EOL> return self [ '<STR_LIT:id>' ] <EOL> @ staticmethod <EOL> def parse_json ( json ) : <EOL> return Group ( extract_fields ( json ) ) <EOL> class StatusMood ( Object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , data ) : <EOL> super ( StatusMood , self ) . __init__ ( data ) <EOL> @ staticmethod <EOL> def parse_json ( json ) : <EOL> return StatusMood ( extract_fields ( json ) ) <EOL> class StatusMoodComments ( Object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , data ) : <EOL> super ( StatusMoodComments , self ) . __init__ ( data ) <EOL> @ staticmethod <EOL> def parse_json ( json ) : <EOL> return StatusMoodComments ( extract_fields ( json ) ) <EOL> class ProfileComments ( Object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , data ) : <EOL> super ( ProfileComments , self ) . __init__ ( data ) <EOL> @ staticmethod <EOL> def parse_json ( json ) : <EOL> return ProfileComments ( extract_fields ( json ) ) <EOL> class Album ( Object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , data ) : <EOL> if data != None : <EOL> data = data . get ( '<STR_LIT>' ) or data <EOL> super ( Album , self ) . __init__ ( data ) <EOL> @ staticmethod <EOL> def parse_json ( json ) : <EOL> return Album ( extract_fields ( json ) ) <EOL> class MediaItem ( Object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , data ) : <EOL> if data != None : <EOL> data = data . get ( '<STR_LIT>' ) or data <EOL> super ( MediaItem , self ) . __init__ ( data ) <EOL> @ staticmethod <EOL> def parse_json ( json ) : <EOL> return MediaItem ( extract_fields ( json ) ) <EOL> class Notification ( Object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , data ) : <EOL> super ( Notification , self ) . __init__ ( data ) <EOL> @ staticmethod <EOL> def parse_json ( json ) : <EOL> return Notification ( extract_fields ( json ) ) <EOL> class AppData ( Object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , data ) : <EOL> super ( AppData , self ) . __init__ ( data ) <EOL> @ staticmethod <EOL> def parse_json ( json ) : <EOL> return AppData ( extract_fields ( json ) ) <EOL> class Activity ( Object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , data ) : <EOL> if data != None : <EOL> data = data . get ( '<STR_LIT>' ) or data <EOL> super ( Activity , self ) . __init__ ( data ) <EOL> @ staticmethod <EOL> def parse_json ( json ) : <EOL> return Activity ( extract_fields ( json ) ) <EOL> class Collection ( list ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , items , start , total ) : <EOL> for v in items : <EOL> self . append ( v ) <EOL> self . startIndex = start <EOL> self . totalResults = total <EOL> @ staticmethod <EOL> def parse_json ( json , cls ) : <EOL> """<STR_LIT>""" <EOL> start = json . get ( '<STR_LIT>' ) <EOL> total = json . get ( '<STR_LIT>' ) <EOL> items = [ ] <EOL> json_list = json . get ( '<STR_LIT>' ) or json . get ( '<STR_LIT:list>' ) <EOL> if json_list != None : <EOL> for fields in json_list : <EOL> items . append ( cls ( fields ) ) <EOL> return Collection ( items , start , total ) </s>
