<s> from __future__ import unicode_literals <EOL> from . helpers import use_appropriate_encoding <EOL> class Channel ( object ) : <EOL> def __init__ ( self , account , channel_info ) : <EOL> self . _account = account <EOL> self . channel_tag = channel_info . get ( "<STR_LIT>" ) <EOL> for attr in ( "<STR_LIT:name>" , "<STR_LIT:description>" , "<STR_LIT>" , "<STR_LIT>" ) : <EOL> setattr ( self , attr , channel_info . get ( attr ) ) <EOL> def push_note ( self , title , body ) : <EOL> data = { "<STR_LIT:type>" : "<STR_LIT>" , "<STR_LIT:title>" : title , "<STR_LIT:body>" : body } <EOL> return self . _push ( data ) <EOL> def push_address ( self , name , address ) : <EOL> data = { "<STR_LIT:type>" : "<STR_LIT:address>" , "<STR_LIT:name>" : name , "<STR_LIT:address>" : address } <EOL> return self . _push ( data ) <EOL> def push_list ( self , title , items ) : <EOL> data = { "<STR_LIT:type>" : "<STR_LIT:list>" , "<STR_LIT:title>" : title , "<STR_LIT>" : items } <EOL> return self . _push ( data ) <EOL> def push_link ( self , title , url , body = None ) : <EOL> data = { "<STR_LIT:type>" : "<STR_LIT>" , "<STR_LIT:title>" : title , "<STR_LIT:url>" : url , "<STR_LIT:body>" : body } <EOL> return self . _push ( data ) <EOL> def push_file ( self , file_name , file_url , file_type , body = None ) : <EOL> return self . _account . push_file ( file_name , file_url , file_type , body , channel = self ) <EOL> def _push ( self , data ) : <EOL> data [ "<STR_LIT>" ] = self . channel_tag <EOL> return self . _account . _push ( data ) <EOL> @ use_appropriate_encoding <EOL> def __str__ ( self ) : <EOL> return "<STR_LIT>" . format ( self . name , self . channel_tag ) <EOL> def __repr__ ( self ) : <EOL> return self . __str__ ( ) </s>
