<s> from interfaces import IConchUser <EOL> from error import ConchError <EOL> from ssh . connection import OPEN_UNKNOWN_CHANNEL_TYPE <EOL> from twisted . python import log <EOL> from zope import interface <EOL> class ConchUser : <EOL> interface . implements ( IConchUser ) <EOL> def __init__ ( self ) : <EOL> self . channelLookup = { } <EOL> self . subsystemLookup = { } <EOL> def lookupChannel ( self , channelType , windowSize , maxPacket , data ) : <EOL> klass = self . channelLookup . get ( channelType , None ) <EOL> if not klass : <EOL> raise ConchError ( OPEN_UNKNOWN_CHANNEL_TYPE , "<STR_LIT>" ) <EOL> else : <EOL> return klass ( remoteWindow = windowSize , <EOL> remoteMaxPacket = maxPacket , <EOL> data = data , avatar = self ) <EOL> def lookupSubsystem ( self , subsystem , data ) : <EOL> log . msg ( repr ( self . subsystemLookup ) ) <EOL> klass = self . subsystemLookup . get ( subsystem , None ) <EOL> if not klass : <EOL> return False <EOL> return klass ( data , avatar = self ) <EOL> def gotGlobalRequest ( self , requestType , data ) : <EOL> requestType = requestType . replace ( '<STR_LIT:->' , '<STR_LIT:_>' ) <EOL> f = getattr ( self , "<STR_LIT>" % requestType , None ) <EOL> if not f : <EOL> return <NUM_LIT:0> <EOL> return f ( data ) </s>
