<s> """<STR_LIT>""" <EOL> import twitter <EOL> from functools import wraps <EOL> from pyweet . oauth import get_oauth <EOL> def get_twit ( func ) : <EOL> """<STR_LIT>""" <EOL> @ wraps ( func ) <EOL> def _get_twit ( * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> settings = kwargs . get ( "<STR_LIT>" , { } ) <EOL> _twit = None <EOL> def _lookup_uid ( twit ) : <EOL> """<STR_LIT>""" <EOL> uid = twit . users . lookup ( screen_name = settings [ "<STR_LIT:user>" ] ) [ <NUM_LIT:0> ] [ "<STR_LIT:id>" ] <EOL> settings . update ( { "<STR_LIT>" : uid } ) <EOL> if not "<STR_LIT>" in kwargs or kwargs [ "<STR_LIT>" ] is None : <EOL> oauth = get_oauth ( ) <EOL> if settings . get ( "<STR_LIT>" ) and ( settings . get ( "<STR_LIT>" ) or <EOL> settings . get ( "<STR_LIT:user>" ) ) : <EOL> if settings . get ( "<STR_LIT:user>" ) : <EOL> twit_rest = twitter . Twitter ( auth = oauth ) <EOL> _lookup_uid ( twit_rest ) <EOL> twit = twitter . TwitterStream ( auth = oauth ) <EOL> else : <EOL> twit = twitter . Twitter ( auth = oauth ) <EOL> settings [ "<STR_LIT>" ] = False <EOL> if settings . get ( "<STR_LIT:user>" ) : <EOL> _lookup_uid ( twit ) <EOL> _twit = twit <EOL> else : <EOL> _twit = kwargs [ "<STR_LIT>" ] <EOL> kwargs . update ( { "<STR_LIT>" : _twit , "<STR_LIT>" : settings } ) <EOL> return func ( * args , ** kwargs ) <EOL> return _get_twit </s>
