#NEWLINE# def __call__( self , value , defMode = True , maxChunkSize = 0 ) : #NEWLINE# #INDENT# if ( ( not defMode ) and ( not self . supportIndefLength ) ) : #NEWLINE# #INDENT# raise error . PyAsn1Error ( 'Indefinite length encoding not supported by this codec' ) #NEWLINE# #UNINDENT# ( ( debug . logger & debug . flagEncoder ) and debug . logger ( ( 'encoder called in %sdef mode, chunk size %s for type %s, value:\n%s' % ( ( ( ( not defMode ) and 'in' ) or '' ) , maxChunkSize , value . prettyPrintType ( ) , value . prettyPrint ( ) ) ) ) ) #NEWLINE# tagSet = value . getTagSet ( ) #NEWLINE# if ( len ( tagSet ) > 1 ) : #NEWLINE# #INDENT# concreteEncoder = explicitlyTaggedItemEncoder #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( value . typeId is not None ) and ( value . typeId in self . __typeMap ) ) : #NEWLINE# #INDENT# concreteEncoder = self . __typeMap [ value . typeId ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( tagSet in self . __tagMap ) : #NEWLINE# #INDENT# concreteEncoder = self . __tagMap [ tagSet ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# tagSet = value . baseTagSet #NEWLINE# if ( tagSet in self . __tagMap ) : #NEWLINE# #INDENT# concreteEncoder = self . __tagMap [ tagSet ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise Error ( ( 'No encoder for %s' % ( value , ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# ( ( debug . logger & debug . flagEncoder ) and debug . logger ( ( 'using value codec %s chosen by %s' % ( concreteEncoder . __class__ . __name__ , tagSet ) ) ) ) #NEWLINE# substrate = concreteEncoder . encode ( self , value , defMode , maxChunkSize ) #NEWLINE# ( ( debug . logger & debug . flagEncoder ) and debug . logger ( ( 'built %s octets of substrate: %s\nencoder completed' % ( len ( substrate ) , debug . hexdump ( substrate ) ) ) ) ) #NEWLINE# return substrate