<s> import string <EOL> import random <EOL> from zope . interface import implements <EOL> from twisted . internet import defer <EOL> from opennsa . interface import IPlugin <EOL> from opennsa import config <EOL> class BasePlugin : <EOL> implements ( IPlugin ) <EOL> """<STR_LIT>""" <EOL> def init ( self , cfg , ctx_factory ) : <EOL> self . cfg = cfg <EOL> self . ctx_factory = ctx_factory <EOL> self . conn_prefix = cfg [ config . NETWORK_NAME ] [ : <NUM_LIT:2> ] . upper ( ) + '<STR_LIT:->' <EOL> def connectionRequest ( self , header , connection_id , global_reservation_id , description , criteria ) : <EOL> return defer . succeed ( None ) <EOL> def createConnectionId ( self ) : <EOL> connection_id = self . conn_prefix + '<STR_LIT>' . join ( [ random . choice ( string . hexdigits [ : <NUM_LIT:16> ] ) for _ in range ( <NUM_LIT:10> ) ] ) <EOL> return defer . succeed ( connection_id ) <EOL> def prunePaths ( self , paths ) : <EOL> return defer . succeed ( paths ) <EOL> def connectionCreated ( self , connection ) : <EOL> return defer . succeed ( None ) <EOL> def connectionTerminated ( self , connection ) : <EOL> return defer . succeed ( None ) </s>
