<s> """<STR_LIT>""" <EOL> from twisted . protocols import basic <EOL> import string <EOL> class Finger ( basic . LineReceiver ) : <EOL> def lineReceived ( self , line ) : <EOL> parts = string . split ( line ) <EOL> if not parts : <EOL> parts = [ '<STR_LIT>' ] <EOL> if len ( parts ) == <NUM_LIT:1> : <EOL> slash_w = <NUM_LIT:0> <EOL> else : <EOL> slash_w = <NUM_LIT:1> <EOL> user = parts [ - <NUM_LIT:1> ] <EOL> if '<STR_LIT:@>' in user : <EOL> host_place = string . rfind ( user , '<STR_LIT:@>' ) <EOL> user = user [ : host_place ] <EOL> host = user [ host_place + <NUM_LIT:1> : ] <EOL> return self . forwardQuery ( slash_w , user , host ) <EOL> if user : <EOL> return self . getUser ( slash_w , user ) <EOL> else : <EOL> return self . getDomain ( slash_w ) <EOL> def _refuseMessage ( self , message ) : <EOL> self . transport . write ( message + "<STR_LIT:\n>" ) <EOL> self . transport . loseConnection ( ) <EOL> def forwardQuery ( self , slash_w , user , host ) : <EOL> self . _refuseMessage ( '<STR_LIT>' ) <EOL> def getDomain ( self , slash_w ) : <EOL> self . _refuseMessage ( '<STR_LIT>' ) <EOL> def getUser ( self , slash_w , user ) : <EOL> self . transport . write ( '<STR_LIT>' + user + '<STR_LIT:\n>' ) <EOL> self . _refuseMessage ( '<STR_LIT>' ) </s>
