<s> import sys <EOL> import threading <EOL> import logging <EOL> from . . import Client , __version__ <EOL> from . import _args <EOL> class IRCCat ( Client ) : <EOL> """<STR_LIT>""" <EOL> def _send ( self , data ) : <EOL> sys . stdout . write ( data ) <EOL> super ( ) . _send ( data ) <EOL> def process_stdin_forever ( self ) : <EOL> """<STR_LIT>""" <EOL> while True : <EOL> line = sys . stdin . readline ( ) <EOL> if not line : <EOL> break <EOL> self . raw ( line ) <EOL> def on_raw ( self , message ) : <EOL> print ( message . _raw ) <EOL> super ( ) . on_raw ( message ) <EOL> def on_ctcp_version ( self , source , target , contents ) : <EOL> self . ctcp_reply ( source , '<STR_LIT>' , '<STR_LIT>' . format ( __version__ ) ) <EOL> def main ( ) : <EOL> logging . basicConfig ( format = '<STR_LIT>' ) <EOL> irccat = _args . client_from_args ( '<STR_LIT>' , default_nick = '<STR_LIT>' , description = '<STR_LIT>' , cls = IRCCat ) <EOL> thread = None <EOL> if irccat . connected : <EOL> thread = threading . Thread ( target = irccat . handle_forever ) <EOL> thread . start ( ) <EOL> irccat . process_stdin_forever ( ) <EOL> irccat . quit ( '<STR_LIT>' ) <EOL> if thread : <EOL> thread . join ( ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) </s>
