#NEWLINE# def logArguments( self , codes , msg , codedArgs ) : #NEWLINE# #INDENT# ' Prepares arguments for logger function as per info() below.\n        \n        If codes includes EFM, GFM, HMRC, or SBR-coded error then the code chosen (if a sequence)\n        corresponds to whether EFM, GFM, HMRC, or SBR validation is in effect.\n        ' #NEWLINE# def propValues( properties ) : #NEWLINE# #INDENT# return [ ( ( p [ 0 ] , str ( p [ 1 ] ) ) if ( len ( p ) == 2 ) else ( p [ 0 ] , str ( p [ 1 ] ) , propValues ( p [ 2 ] ) ) ) for p in properties if ( 2 <= len ( p ) <= 3 ) ] #NEWLINE# #UNINDENT# messageCode = self . effectiveMessageCode ( codes ) #NEWLINE# fmtArgs = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# extras = { #NEWLINE# #INDENT# 'messageCode' : messageCode , #NEWLINE# #UNINDENT# } #NEWLINE# modelObjectArgs = ( ) #NEWLINE# for ( argName , argValue ) in codedArgs . items ( ) : #NEWLINE# #INDENT# if ( argName in ( 'modelObject' , 'modelXbrl' , 'modelDocument' ) ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# entryUrl = self . modelDocument . uri #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# entryUrl = self . entryLoadingUrl #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# entryUrl = self . fileSource . url #NEWLINE# #UNINDENT# #UNINDENT# refs = [ ] #NEWLINE# modelObjectArgs = ( argValue if isinstance ( argValue , ( tuple , list , set ) ) else ( argValue , ) ) #NEWLINE# for arg in flattenSequence ( modelObjectArgs ) : #NEWLINE# #INDENT# if ( arg is not None ) : #NEWLINE# #INDENT# if isinstance ( arg , _STR_BASE ) : #NEWLINE# #INDENT# objectUrl = arg #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# objectUrl = arg . modelDocument . uri #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# objectUrl = self . modelDocument . uri #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# objectUrl = self . entryLoadingUrl #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# try : #NEWLINE# #INDENT# file = UrlUtil . relativeUri ( entryUrl , objectUrl ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# file = '' #NEWLINE# #UNINDENT# ref = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if isinstance ( arg , ( ModelObject , ObjectPropertyViewWrapper ) ) : #NEWLINE# #INDENT# _arg = ( arg . modelObject if isinstance ( arg , ObjectPropertyViewWrapper ) else arg ) #NEWLINE# ref [ 'href' ] = ( ( file + '#' ) + XmlUtil . elementFragmentIdentifier ( _arg ) ) #NEWLINE# ref [ 'sourceLine' ] = _arg . sourceline #NEWLINE# ref [ 'objectId' ] = _arg . objectId ( ) #NEWLINE# if self . logRefObjectProperties : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# ref [ 'properties' ] = propValues ( arg . propertyView ) #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# if self . logRefHasPluginProperties : #NEWLINE# #INDENT# refProperties = ref . get ( 'properties' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# for pluginXbrlMethod in pluginClassMethods ( 'Logging.Ref.Properties' ) : #NEWLINE# #INDENT# pluginXbrlMethod ( arg , refProperties , codedArgs ) #NEWLINE# #UNINDENT# if refProperties : #NEWLINE# #INDENT# ref [ 'properties' ] = refProperties #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# ref [ 'href' ] = file #NEWLINE# try : #NEWLINE# #INDENT# ref [ 'sourceLine' ] = arg . sourceline #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# if self . logRefHasPluginAttrs : #NEWLINE# #INDENT# refAttributes = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for pluginXbrlMethod in pluginClassMethods ( 'Logging.Ref.Attributes' ) : #NEWLINE# #INDENT# pluginXbrlMethod ( arg , refAttributes , codedArgs ) #NEWLINE# #UNINDENT# if refAttributes : #NEWLINE# #INDENT# ref [ 'customAttributes' ] = refAttributes #NEWLINE# #UNINDENT# #UNINDENT# refs . append ( ref ) #NEWLINE# #UNINDENT# #UNINDENT# extras [ 'refs' ] = refs #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( argName == 'sourceFileLine' ) : #NEWLINE# #INDENT# ref = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if isinstance ( argValue , ( tuple , list ) ) : #NEWLINE# #INDENT# ref [ 'href' ] = str ( argValue [ 0 ] ) #NEWLINE# if ( ( len ( argValue ) > 1 ) and argValue [ 1 ] ) : #NEWLINE# #INDENT# ref [ 'sourceLine' ] = str ( argValue [ 1 ] ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# ref [ 'href' ] = str ( argValue ) #NEWLINE# #UNINDENT# extras [ 'refs' ] = [ ref ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( argName == 'sourceFileLines' ) : #NEWLINE# #INDENT# refs = [ ] #NEWLINE# for arg in ( argValue if isinstance ( argValue , ( tuple , list ) ) else ( argValue , ) ) : #NEWLINE# #INDENT# ref = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if isinstance ( arg , ( tuple , list ) ) : #NEWLINE# #INDENT# ref [ 'href' ] = str ( arg [ 0 ] ) #NEWLINE# if ( ( len ( arg ) > 1 ) and arg [ 1 ] ) : #NEWLINE# #INDENT# ref [ 'sourceLine' ] = str ( arg [ 1 ] ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# ref [ 'href' ] = str ( arg ) #NEWLINE# #UNINDENT# refs . append ( ref ) #NEWLINE# #UNINDENT# extras [ 'refs' ] = refs #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( argName == 'sourceLine' ) : #NEWLINE# #INDENT# if isinstance ( argValue , _INT_TYPES ) : #NEWLINE# #INDENT# extras [ 'sourceLine' ] = argValue #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( ref not in ( 'exc_info' , 'messageCodes' ) ) : #NEWLINE# #INDENT# if isinstance ( argValue , ( ModelValue . QName , ModelObject , bool , FileNamedStringIO , tuple , list , set ) ) : #NEWLINE# #INDENT# fmtArgs [ argName ] = str ( argValue ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( argValue is None ) : #NEWLINE# #INDENT# fmtArgs [ argName ] = '(none)' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( argValue , _INT_TYPES ) : #NEWLINE# #INDENT# fmtArgs [ argName ] = format_string ( self . modelManager . locale , '%i' , argValue ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( argValue , ( float , Decimal ) ) : #NEWLINE# #INDENT# fmtArgs [ argName ] = format_string ( self . modelManager . locale , '%f' , argValue ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( argValue , dict ) : #NEWLINE# #INDENT# fmtArgs [ argName ] = argValue #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# fmtArgs [ argName ] = str ( argValue ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if ( 'refs' not in extras ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# file = os . path . basename ( self . modelDocument . uri ) #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# file = os . path . basename ( self . entryLoadingUrl ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# file = '' #NEWLINE# #UNINDENT# #UNINDENT# extras [ 'refs' ] = [ { #NEWLINE# #INDENT# 'href' : file , #NEWLINE# #UNINDENT# } ] #NEWLINE# #UNINDENT# for pluginXbrlMethod in pluginClassMethods ( 'Logging.Message.Parameters' ) : #NEWLINE# #INDENT# msg = ( pluginXbrlMethod ( messageCode , msg , modelObjectArgs , fmtArgs ) or msg ) #NEWLINE# #UNINDENT# return ( messageCode , ( ( msg , fmtArgs ) if fmtArgs else ( msg , ) ) , extras )