<s> '''<STR_LIT>''' <EOL> import os , sys , time , logging <EOL> from collections import defaultdict <EOL> from threading import Timer <EOL> from arelle . ModelFormulaObject import ( ModelParameter , ModelInstance , ModelVariableSet , <EOL> ModelFormula , ModelTuple , ModelVariable , ModelFactVariable , <EOL> ModelVariableSetAssertion , ModelConsistencyAssertion , <EOL> ModelExistenceAssertion , ModelValueAssertion , ModelAssertionSeverity , <EOL> ModelPrecondition , ModelConceptName , Trace , <EOL> Aspect , aspectModels , ModelAspectCover , <EOL> ModelMessage ) <EOL> from arelle . ModelRenderingObject import ( ModelRuleDefinitionNode , ModelRelationshipDefinitionNode , ModelFilterDefinitionNode ) <EOL> from arelle . ModelObject import ( ModelObject ) <EOL> from arelle . ModelValue import ( qname , QName ) <EOL> from arelle import ( XbrlConst , XmlUtil , ModelXbrl , ModelDocument , XPathParser , XPathContext , FunctionXs , <EOL> ValidateXbrlDimensions ) <EOL> arcroleChecks = { <EOL> XbrlConst . equalityDefinition : ( None , <EOL> XbrlConst . qnEqualityDefinition , <EOL> "<STR_LIT>" ) , <EOL> XbrlConst . assertionSet : ( XbrlConst . qnAssertionSet , <EOL> ( XbrlConst . qnAssertion , XbrlConst . qnVariableSetAssertion ) , <EOL> "<STR_LIT>" ) , <EOL> XbrlConst . assertionUnsatisfiedSeverity : <EOL> ( ( XbrlConst . qnAssertion , XbrlConst . qnVariableSetAssertion ) , <EOL> ( XbrlConst . qnAssertionSeverityError , XbrlConst . qnAssertionSeverityWarning , XbrlConst . qnAssertionSeverityOk ) , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ) , <EOL> XbrlConst . variableSet : ( XbrlConst . qnVariableSet , <EOL> ( XbrlConst . qnVariableVariable , XbrlConst . qnParameter ) , <EOL> "<STR_LIT>" ) , <EOL> XbrlConst . variableSetFilter : ( XbrlConst . qnVariableSet , <EOL> XbrlConst . qnVariableFilter , <EOL> "<STR_LIT>" ) , <EOL> XbrlConst . variableFilter : ( XbrlConst . qnFactVariable , <EOL> XbrlConst . qnVariableFilter , <EOL> "<STR_LIT>" ) , <EOL> XbrlConst . booleanFilter : ( XbrlConst . qnVariableFilter , <EOL> XbrlConst . qnVariableFilter , <EOL> "<STR_LIT>" ) , <EOL> XbrlConst . consistencyAssertionFormula : ( XbrlConst . qnConsistencyAssertion , <EOL> None , <EOL> "<STR_LIT>" ) , <EOL> XbrlConst . functionImplementation : ( XbrlConst . qnCustomFunctionSignature , <EOL> XbrlConst . qnCustomFunctionImplementation , <EOL> "<STR_LIT>" ) , <EOL> XbrlConst . tableBreakdown : ( XbrlConst . qnTableTable , <EOL> XbrlConst . qnTableBreakdown , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ) , <EOL> XbrlConst . tableBreakdownTree : ( XbrlConst . qnTableBreakdown , <EOL> ( XbrlConst . qnTableClosedDefinitionNode , <EOL> XbrlConst . qnTableAspectNode ) , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ) , <EOL> XbrlConst . tableDefinitionNodeSubtree : ( XbrlConst . qnTableDefinitionNode , <EOL> XbrlConst . qnTableDefinitionNode , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> ( XbrlConst . qnTableConceptRelationshipNode , <EOL> XbrlConst . qnTableDimensionRelationshipNode ) , <EOL> None , <EOL> "<STR_LIT>" , <EOL> None ) , <EOL> XbrlConst . tableFilter : ( XbrlConst . qnTableTable , <EOL> XbrlConst . qnVariableFilter , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ) , <EOL> XbrlConst . tableParameter : ( XbrlConst . qnTableTable , <EOL> XbrlConst . qnParameter , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ) , <EOL> XbrlConst . tableAspectNodeFilter : ( XbrlConst . qnTableAspectNode , <EOL> XbrlConst . qnVariableFilter , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ) , <EOL> XbrlConst . tableBreakdownMMDD : ( XbrlConst . qnTableTableMMDD , <EOL> XbrlConst . qnTableBreakdownMMDD , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ) , <EOL> XbrlConst . tableBreakdownTreeMMDD : ( XbrlConst . qnTableBreakdownMMDD , <EOL> ( XbrlConst . qnTableClosedDefinitionNodeMMDD , <EOL> XbrlConst . qnTableAspectNodeMMDD ) , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ) , <EOL> XbrlConst . tableDefinitionNodeSubtreeMMDD : ( XbrlConst . qnTableDefinitionNodeMMDD , <EOL> XbrlConst . qnTableDefinitionNodeMMDD , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> ( XbrlConst . qnTableConceptRelationshipNodeMMDD , <EOL> XbrlConst . qnTableDimensionRelationshipNodeMMDD ) , <EOL> None , <EOL> "<STR_LIT>" , <EOL> None ) , <EOL> XbrlConst . tableFilterMMDD : ( XbrlConst . qnTableTableMMDD , <EOL> XbrlConst . qnVariableFilter , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ) , <EOL> XbrlConst . tableParameterMMDD : ( XbrlConst . qnTableTableMMDD , <EOL> XbrlConst . qnParameter , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ) , <EOL> XbrlConst . tableAspectNodeFilterMMDD : ( XbrlConst . qnTableAspectNodeMMDD , <EOL> XbrlConst . qnVariableFilter , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ) , <EOL> XbrlConst . tableBreakdown201305 : ( XbrlConst . qnTableTable201305 , <EOL> XbrlConst . qnTableBreakdown201305 , <EOL> "<STR_LIT>" ) , <EOL> XbrlConst . tableBreakdownTree201305 : ( XbrlConst . qnTableBreakdown201305 , <EOL> ( XbrlConst . qnTableClosedDefinitionNode201305 , <EOL> XbrlConst . qnTableAspectNode201305 ) , <EOL> "<STR_LIT>" ) , <EOL> XbrlConst . tableDefinitionNodeSubtree201305 : ( XbrlConst . qnTableClosedDefinitionNode201305 , <EOL> XbrlConst . qnTableClosedDefinitionNode201305 , <EOL> "<STR_LIT>" ) , <EOL> XbrlConst . tableFilter201305 : ( XbrlConst . qnTableTable201305 , <EOL> XbrlConst . qnVariableFilter , <EOL> "<STR_LIT>" ) , <EOL> XbrlConst . tableAspectNodeFilter201305 : ( XbrlConst . qnTableAspectNode201305 , <EOL> XbrlConst . qnVariableFilter , <EOL> "<STR_LIT>" ) , <EOL> XbrlConst . tableBreakdown201301 : ( XbrlConst . qnTableTable201301 , <EOL> ( XbrlConst . qnTableClosedDefinitionNode201301 , <EOL> XbrlConst . qnTableFilterNode201301 , <EOL> XbrlConst . qnTableSelectionNode201301 , <EOL> XbrlConst . qnTableTupleNode201301 ) , <EOL> "<STR_LIT>" ) , <EOL> XbrlConst . tableAxis2011 : ( XbrlConst . qnTableTable2011 , <EOL> ( XbrlConst . qnTablePredefinedAxis2011 , <EOL> XbrlConst . qnTableFilterAxis2011 , <EOL> XbrlConst . qnTableSelectionAxis2011 , <EOL> XbrlConst . qnTableTupleAxis2011 ) , <EOL> "<STR_LIT>" ) , <EOL> XbrlConst . tableFilter201301 : ( XbrlConst . qnTableTable201301 , <EOL> XbrlConst . qnVariableFilter , <EOL> "<STR_LIT>" ) , <EOL> XbrlConst . tableFilter2011 : ( XbrlConst . qnTableTable2011 , <EOL> XbrlConst . qnVariableFilter , <EOL> "<STR_LIT>" ) , <EOL> XbrlConst . tableDefinitionNodeSubtree201301 : ( XbrlConst . qnTableClosedDefinitionNode201301 , <EOL> XbrlConst . qnTableClosedDefinitionNode201301 , <EOL> "<STR_LIT>" ) , <EOL> XbrlConst . tableAxisSubtree2011 : ( XbrlConst . qnTablePredefinedAxis2011 , <EOL> XbrlConst . qnTablePredefinedAxis2011 , <EOL> "<STR_LIT>" ) , <EOL> XbrlConst . tableFilterNodeFilter2011 : ( XbrlConst . qnTableFilterNode201301 , <EOL> XbrlConst . qnVariableFilter , <EOL> "<STR_LIT>" ) , <EOL> XbrlConst . tableAxisFilter2011 : ( XbrlConst . qnTableFilterAxis2011 , <EOL> XbrlConst . qnVariableFilter , <EOL> "<STR_LIT>" ) , <EOL> XbrlConst . tableAxisFilter201205 : ( XbrlConst . qnTableFilterAxis2011 , <EOL> XbrlConst . qnVariableFilter , <EOL> "<STR_LIT>" ) , <EOL> XbrlConst . tableTupleContent201301 : ( ( XbrlConst . qnTableTupleNode201301 , <EOL> XbrlConst . qnTableTupleAxis2011 ) , <EOL> ( XbrlConst . qnTableRuleNode201301 , <EOL> XbrlConst . qnTableRuleAxis2011 ) , <EOL> "<STR_LIT>" ) , <EOL> } <EOL> def checkBaseSet ( val , arcrole , ELR , relsSet ) : <EOL> if arcrole in arcroleChecks : <EOL> arcroleCheck = arcroleChecks [ arcrole ] <EOL> notFromQname = notToQname = notFromErrCode = notToErrCode = None <EOL> if len ( arcroleCheck ) == <NUM_LIT:3> : <EOL> fromQname , toQname , fromErrCode = arcroleCheck <EOL> toErrCode = fromErrCode <EOL> elif len ( arcroleCheck ) == <NUM_LIT:4> : <EOL> fromQname , toQname , fromErrCode , toErrCode = arcroleCheck <EOL> elif len ( arcroleCheck ) == <NUM_LIT:8> : <EOL> fromQname , toQname , fromErrCode , toErrCode , notFromQname , notToQname , notFromErrCode , notToErrCode = arcroleCheck <EOL> else : <EOL> raise Exception ( "<STR_LIT>" + str ( arcroleCheck ) ) <EOL> level = "<STR_LIT>" if fromErrCode . endswith ( "<STR_LIT>" ) else "<STR_LIT>" <EOL> for modelRel in relsSet . modelRelationships : <EOL> fromMdlObj = modelRel . fromModelObject <EOL> toMdlObj = modelRel . toModelObject <EOL> if fromQname : <EOL> if ( fromMdlObj is None or <EOL> ( not val . modelXbrl . isInSubstitutionGroup ( fromMdlObj . elementQname , fromQname ) and <EOL> fromMdlObj . elementQname . namespaceURI in val . modelXbrl . namespaceDocs ) ) : <EOL> val . modelXbrl . log ( level , fromErrCode , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = modelRel , xlinkFrom = modelRel . fromLabel , xlinkTo = modelRel . toLabel , element = fromQname ) <EOL> elif notFromQname and val . modelXbrl . isInSubstitutionGroup ( fromMdlObj . elementQname , notFromQname ) : <EOL> val . modelXbrl . log ( level , notFromErrCode , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = modelRel , xlinkFrom = modelRel . fromLabel , xlinkTo = modelRel . toLabel , element = fromQname ) <EOL> if toQname : <EOL> if ( toMdlObj is None or <EOL> ( not val . modelXbrl . isInSubstitutionGroup ( toMdlObj . elementQname , toQname ) and <EOL> toMdlObj . elementQname . namespaceURI in val . modelXbrl . namespaceDocs ) ) : <EOL> val . modelXbrl . log ( level , toErrCode , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = modelRel , xlinkFrom = modelRel . fromLabel , xlinkTo = modelRel . toLabel , element = toQname ) <EOL> elif notToQname and val . modelXbrl . isInSubstitutionGroup ( fromMdlObj . elementQname , notToQname ) : <EOL> val . modelXbrl . log ( level , notFromErrCode , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = modelRel , xlinkFrom = modelRel . fromLabel , xlinkTo = modelRel . toLabel , element = fromQname ) <EOL> if arcrole == XbrlConst . functionImplementation : <EOL> for relFrom , rels in relsSet . fromModelObjects ( ) . items ( ) : <EOL> if len ( rels ) > <NUM_LIT:1> : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = [ relFrom ] + rels , name = relFrom . name ) <EOL> for relTo , rels in relsSet . toModelObjects ( ) . items ( ) : <EOL> if len ( rels ) > <NUM_LIT:1> : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = [ relTo ] + rels , xlinkLabel = relTo . xlinkLabel ) <EOL> elif arcrole == XbrlConst . assertionUnsatisfiedSeverity : <EOL> for relFrom , rels in relsSet . fromModelObjects ( ) . items ( ) : <EOL> if len ( rels ) > <NUM_LIT:1> : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = [ relFrom ] + rels , xlinkLabel = relFrom . xlinkLabel ) <EOL> def executeCallTest ( val , name , callTuple , testTuple ) : <EOL> if callTuple : <EOL> XPathParser . initializeParser ( val . modelXbrl . modelManager ) <EOL> try : <EOL> val . modelXbrl . modelManager . showStatus ( _ ( "<STR_LIT>" ) ) <EOL> callExprStack = XPathParser . parse ( val , callTuple [ <NUM_LIT:0> ] , callTuple [ <NUM_LIT:1> ] , name + "<STR_LIT>" , Trace . CALL ) <EOL> xpathContext = XPathContext . create ( val . modelXbrl , sourceElement = callTuple [ <NUM_LIT:1> ] ) <EOL> result = xpathContext . evaluate ( callExprStack ) <EOL> xpathContext . inScopeVars [ qname ( '<STR_LIT:result>' , noPrefixIsNoNamespace = True ) ] = result <EOL> val . modelXbrl . info ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = callTuple [ <NUM_LIT:1> ] , name = name , result = str ( result ) ) <EOL> if testTuple : <EOL> val . modelXbrl . modelManager . showStatus ( _ ( "<STR_LIT>" ) ) <EOL> testExprStack = XPathParser . parse ( val , testTuple [ <NUM_LIT:0> ] , testTuple [ <NUM_LIT:1> ] , name + "<STR_LIT>" , Trace . CALL ) <EOL> testResult = xpathContext . effectiveBooleanValue ( None , xpathContext . evaluate ( testExprStack ) ) <EOL> if testResult : <EOL> val . modelXbrl . info ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = testTuple [ <NUM_LIT:1> ] , name = name , result = str ( testResult ) ) <EOL> else : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = testTuple [ <NUM_LIT:1> ] , name = name , result = str ( testResult ) ) <EOL> xpathContext . close ( ) <EOL> except XPathContext . XPathException as err : <EOL> val . modelXbrl . error ( err . code , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = callTuple [ <NUM_LIT:1> ] , name = name , error = err . message , errorSource = err . sourceErrorIndication ) <EOL> val . modelXbrl . modelManager . showStatus ( _ ( "<STR_LIT>" ) , <NUM_LIT> ) <EOL> def validate ( val , xpathContext = None , parametersOnly = False , statusMsg = '<STR_LIT>' , compileOnly = False ) : <EOL> for e in ( "<STR_LIT>" , "<STR_LIT>" ) : <EOL> if e in val . modelXbrl . errors : <EOL> val . modelXbrl . info ( "<STR_LIT:info>" , _ ( "<STR_LIT>" ) , <EOL> modelObject = val . modelXbrl , error = e ) <EOL> return <EOL> val . modelXbrl . profileStat ( ) <EOL> formulaOptions = val . modelXbrl . modelManager . formulaOptions <EOL> if XPathParser . initializeParser ( val . modelXbrl . modelManager ) : <EOL> val . modelXbrl . profileStat ( _ ( "<STR_LIT>" ) ) <EOL> val . modelXbrl . modelManager . showStatus ( statusMsg ) <EOL> val . modelXbrl . profileActivity ( ) <EOL> initialErrorCount = val . modelXbrl . logCount . get ( logging . _checkLevel ( '<STR_LIT>' ) , <NUM_LIT:0> ) <EOL> parameterQnames = set ( ) <EOL> instanceQnames = set ( ) <EOL> parameterDependencies = { } <EOL> instanceDependencies = defaultdict ( set ) <EOL> dependencyResolvedParameters = set ( ) <EOL> orderedParameters = [ ] <EOL> orderedInstances = [ ] <EOL> for paramQname , modelParameter in val . modelXbrl . qnameParameters . items ( ) : <EOL> if isinstance ( modelParameter , ModelParameter ) : <EOL> modelParameter . compile ( ) <EOL> parameterDependencies [ paramQname ] = modelParameter . variableRefs ( ) <EOL> parameterQnames . add ( paramQname ) <EOL> if isinstance ( modelParameter , ModelInstance ) : <EOL> instanceQnames . add ( paramQname ) <EOL> resolvedAParameter = True <EOL> while ( resolvedAParameter ) : <EOL> resolvedAParameter = False <EOL> for paramQname in parameterQnames : <EOL> if paramQname not in dependencyResolvedParameters and len ( parameterDependencies [ paramQname ] - dependencyResolvedParameters ) == <NUM_LIT:0> : <EOL> dependencyResolvedParameters . add ( paramQname ) <EOL> orderedParameters . append ( paramQname ) <EOL> resolvedAParameter = True <EOL> for paramQname in parameterQnames : <EOL> if paramQname not in dependencyResolvedParameters : <EOL> circularOrUndefDependencies = parameterDependencies [ paramQname ] - dependencyResolvedParameters <EOL> undefinedVars = circularOrUndefDependencies - parameterQnames <EOL> paramsCircularDep = circularOrUndefDependencies - undefinedVars <EOL> if len ( undefinedVars ) > <NUM_LIT:0> : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = val . modelXbrl . qnameParameters [ paramQname ] , <EOL> name = paramQname , dependencies = "<STR_LIT:U+002CU+0020>" . join ( ( str ( v ) for v in undefinedVars ) ) ) <EOL> if len ( paramsCircularDep ) > <NUM_LIT:0> : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = val . modelXbrl . qnameParameters [ paramQname ] , <EOL> name = paramQname , dependencies = "<STR_LIT:U+002CU+0020>" . join ( ( str ( d ) for d in paramsCircularDep ) ) ) <EOL> val . modelXbrl . profileActivity ( "<STR_LIT>" , minTimeToShow = <NUM_LIT:1.0> ) <EOL> for custFnSig in val . modelXbrl . modelCustomFunctionSignatures . values ( ) : <EOL> if custFnSig is not None : <EOL> custFnQname = custFnSig . functionQname <EOL> if custFnQname . namespaceURI == XbrlConst . xfi : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = custFnSig , name = custFnQname , namespace = custFnQname . namespaceURI ) <EOL> _outputType = custFnSig . outputType <EOL> if _outputType and _outputType . namespaceURI == XbrlConst . xsd and not FunctionXs . isXsType ( _outputType . localName ) : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = custFnSig , name = custFnQname , type = _outputType ) <EOL> for _inputType in custFnSig . inputTypes : <EOL> if _inputType and _inputType . namespaceURI == XbrlConst . xsd and not FunctionXs . isXsType ( _inputType . localName ) : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = custFnSig , name = custFnQname , type = _inputType ) <EOL> for modelRel in val . modelXbrl . relationshipSet ( XbrlConst . functionImplementation ) . fromModelObject ( custFnSig ) : <EOL> custFnImpl = modelRel . toModelObject <EOL> custFnSig . customFunctionImplementation = custFnImpl <EOL> if len ( custFnImpl . inputNames ) != len ( custFnSig . inputTypes ) : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = custFnSig , name = custFnQname , <EOL> parameterCountSignature = len ( custFnSig . inputTypes ) , parameterCountImplementation = len ( custFnImpl . inputNames ) ) <EOL> for custFnImpl in val . modelXbrl . modelCustomFunctionImplementations : <EOL> if not val . modelXbrl . relationshipSet ( XbrlConst . functionImplementation ) . toModelObject ( custFnImpl ) : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = custFnSig , xlinkLabel = custFnImpl . xlinkLabel ) <EOL> custFnImpl . compile ( ) <EOL> val . modelXbrl . profileActivity ( "<STR_LIT>" , minTimeToShow = <NUM_LIT:1.0> ) <EOL> if xpathContext is None : <EOL> xpathContext = XPathContext . create ( val . modelXbrl ) <EOL> xpathContext . parameterQnames = parameterQnames <EOL> for paramQname in orderedParameters : <EOL> modelParameter = val . modelXbrl . qnameParameters [ paramQname ] <EOL> if not isinstance ( modelParameter , ModelInstance ) : <EOL> asType = modelParameter . asType <EOL> if asType and asType . namespaceURI == XbrlConst . xsd and not FunctionXs . isXsType ( asType . localName ) : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = modelParameter , name = paramQname , type = asType ) <EOL> asLocalName = asType . localName if asType else "<STR_LIT:string>" <EOL> try : <EOL> if val . parameters and paramQname in val . parameters : <EOL> paramDataType , paramValue = val . parameters [ paramQname ] <EOL> typeLocalName = paramDataType . localName if paramDataType else "<STR_LIT:string>" <EOL> value = FunctionXs . call ( xpathContext , None , typeLocalName , [ paramValue ] ) <EOL> result = FunctionXs . call ( xpathContext , None , asLocalName , [ value ] ) <EOL> if formulaOptions . traceParameterInputValue : <EOL> val . modelXbrl . info ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = modelParameter , name = paramQname , input = result ) <EOL> xpathContext . inScopeVars [ paramQname ] = result <EOL> elif modelParameter . isRequired : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = modelParameter , name = paramQname ) <EOL> elif not modelParameter . selectProg : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = modelParameter , name = paramQname ) <EOL> else : <EOL> result = modelParameter . evaluate ( xpathContext , asType ) <EOL> if formulaOptions . traceParameterExpressionResult : <EOL> val . modelXbrl . info ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = modelParameter , name = paramQname , result = result ) <EOL> xpathContext . inScopeVars [ paramQname ] = result <EOL> except XPathContext . XPathException as err : <EOL> val . modelXbrl . error ( "<STR_LIT>" if err . code == "<STR_LIT>" else err . code , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = modelParameter , name = paramQname , error = err . message , <EOL> messageCodes = ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> '''<STR_LIT>''' <EOL> val . modelXbrl . profileActivity ( "<STR_LIT>" , minTimeToShow = <NUM_LIT:1.0> ) <EOL> val . modelXbrl . profileStat ( _ ( "<STR_LIT>" ) ) <EOL> val . modelXbrl . modelFormulaEqualityDefinitions = { } <EOL> for modelRel in val . modelXbrl . relationshipSet ( XbrlConst . equalityDefinition ) . modelRelationships : <EOL> typedDomainElt = modelRel . fromModelObject <EOL> modelEqualityDefinition = modelRel . toModelObject <EOL> if typedDomainElt in val . modelXbrl . modelFormulaEqualityDefinitions : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = modelRel . arcElement , typedDomain = typedDomainElt . qname , <EOL> equalityDefinition1 = modelEqualityDefinition . xlinkLabel , <EOL> equalityDefinition2 = val . modelXbrl . modelFormulaEqualityDefinitions [ typedDomainElt ] . xlinkLabel ) <EOL> else : <EOL> modelEqualityDefinition . compile ( ) <EOL> val . modelXbrl . modelFormulaEqualityDefinitions [ typedDomainElt ] = modelEqualityDefinition <EOL> if parametersOnly : <EOL> return <EOL> for modelVariableSet in val . modelXbrl . modelVariableSets : <EOL> modelVariableSet . compile ( ) <EOL> val . modelXbrl . profileStat ( _ ( "<STR_LIT>" ) ) <EOL> produceOutputXbrlInstance = False <EOL> instanceProducingVariableSets = defaultdict ( list ) <EOL> for modelVariableSet in val . modelXbrl . modelVariableSets : <EOL> varSetInstanceDependencies = set ( ) <EOL> if isinstance ( modelVariableSet , ModelFormula ) : <EOL> instanceQname = None <EOL> for modelRel in val . modelXbrl . relationshipSet ( XbrlConst . formulaInstance ) . fromModelObject ( modelVariableSet ) : <EOL> instance = modelRel . toModelObject <EOL> if isinstance ( instance , ModelInstance ) : <EOL> if instanceQname is None : <EOL> instanceQname = instance . instanceQname <EOL> modelVariableSet . fromInstanceQnames = { instanceQname } <EOL> else : <EOL> val . modelXbrl . info ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = modelVariableSet , xlinkLabel = modelVariableSet . xlinkLabel , <EOL> instanceTo = instanceQname , instanceTo2 = instance . instanceQname ) <EOL> if instanceQname is None : <EOL> instanceQname = XbrlConst . qnStandardOutputInstance <EOL> instanceQnames . add ( instanceQname ) <EOL> modelVariableSet . fromInstanceQnames = None <EOL> modelVariableSet . outputInstanceQname = instanceQname <EOL> if getattr ( val , "<STR_LIT>" , False ) : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = modelVariableSet , xlinkLabel = modelVariableSet . xlinkLabel ) <EOL> else : <EOL> instanceQname = None <EOL> modelVariableSet . countSatisfied = <NUM_LIT:0> <EOL> modelVariableSet . countNotSatisfied = <NUM_LIT:0> <EOL> checkValidationMessages ( val , modelVariableSet ) <EOL> instanceProducingVariableSets [ instanceQname ] . append ( modelVariableSet ) <EOL> modelVariableSet . outputInstanceQname = instanceQname <EOL> if modelVariableSet . aspectModel not in ( "<STR_LIT>" , "<STR_LIT>" ) : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = modelVariableSet , xlinkLabel = modelVariableSet . xlinkLabel , aspectModel = modelVariableSet . aspectModel ) <EOL> modelVariableSet . hasConsistencyAssertion = False <EOL> nameVariables = { } <EOL> qnameRels = { } <EOL> definedNamesSet = set ( ) <EOL> for modelRel in val . modelXbrl . relationshipSet ( XbrlConst . variableSet ) . fromModelObject ( modelVariableSet ) : <EOL> varqname = modelRel . variableQname <EOL> if varqname : <EOL> qnameRels [ varqname ] = modelRel <EOL> toVariable = modelRel . toModelObject <EOL> if varqname not in definedNamesSet : <EOL> definedNamesSet . add ( varqname ) <EOL> if varqname not in nameVariables : <EOL> nameVariables [ varqname ] = toVariable <EOL> elif nameVariables [ varqname ] != toVariable : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = toVariable , xlinkLabel = modelVariableSet . xlinkLabel , name = varqname ) <EOL> fromInstanceQnames = None <EOL> for instRel in val . modelXbrl . relationshipSet ( XbrlConst . instanceVariable ) . toModelObject ( toVariable ) : <EOL> fromInstance = instRel . fromModelObject <EOL> if isinstance ( fromInstance , ModelInstance ) : <EOL> fromInstanceQname = fromInstance . instanceQname <EOL> varSetInstanceDependencies . add ( fromInstanceQname ) <EOL> instanceDependencies [ instanceQname ] . add ( fromInstanceQname ) <EOL> if fromInstanceQnames is None : fromInstanceQnames = set ( ) <EOL> fromInstanceQnames . add ( fromInstanceQname ) <EOL> if fromInstanceQnames is None : <EOL> varSetInstanceDependencies . add ( XbrlConst . qnStandardInputInstance ) <EOL> if instanceQname : instanceDependencies [ instanceQname ] . add ( XbrlConst . qnStandardInputInstance ) <EOL> toVariable . fromInstanceQnames = fromInstanceQnames <EOL> else : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = modelRel , xlinkLabel = modelVariableSet . xlinkLabel , name = modelRel . variablename ) <EOL> checkVariablesScopeVisibleQnames ( val , nameVariables , definedNamesSet , modelVariableSet ) <EOL> definedNamesSet |= parameterQnames <EOL> variableDependencies = { } <EOL> for modelRel in val . modelXbrl . relationshipSet ( XbrlConst . variableSet ) . fromModelObject ( modelVariableSet ) : <EOL> variable = modelRel . toModelObject <EOL> if isinstance ( variable , ( ModelParameter , ModelVariable ) ) : <EOL> varqname = modelRel . variableQname <EOL> depVars = variable . variableRefs ( ) <EOL> variableDependencies [ varqname ] = depVars <EOL> if len ( depVars ) > <NUM_LIT:0> and formulaOptions . traceVariablesDependencies : <EOL> val . modelXbrl . info ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = modelVariableSet , xlinkLabel = modelVariableSet . xlinkLabel , <EOL> name = varqname , dependencies = depVars ) <EOL> definedNamesSet . add ( varqname ) <EOL> if isinstance ( variable , ModelFactVariable ) : <EOL> variable . hasNoVariableDependencies = len ( depVars - parameterQnames ) == <NUM_LIT:0> <EOL> for depVar in XPathParser . variableReferencesSet ( variable . fallbackValueProg , variable ) : <EOL> if depVar in qnameRels and isinstance ( qnameRels [ depVar ] . toModelObject , ModelVariable ) : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = variable , xlinkLabel = modelVariableSet . xlinkLabel , <EOL> fallbackValue = variable . fallbackValue , dependency = depVar ) <EOL> checkFilterAspectModel ( val , modelVariableSet , variable . filterRelationships , xpathContext ) <EOL> orderedNameSet = set ( ) <EOL> orderedNameList = [ ] <EOL> orderedAVariable = True <EOL> while ( orderedAVariable ) : <EOL> orderedAVariable = False <EOL> for varqname , depVars in variableDependencies . items ( ) : <EOL> if varqname not in orderedNameSet and len ( depVars - parameterQnames - orderedNameSet ) == <NUM_LIT:0> : <EOL> orderedNameList . append ( varqname ) <EOL> orderedNameSet . add ( varqname ) <EOL> orderedAVariable = True <EOL> if varqname in instanceQnames : <EOL> varSetInstanceDependencies . add ( varqname ) <EOL> instanceDependencies [ instanceQname ] . add ( varqname ) <EOL> elif isinstance ( nameVariables . get ( varqname ) , ModelInstance ) : <EOL> instqname = nameVariables [ varqname ] . instanceQname <EOL> varSetInstanceDependencies . add ( instqname ) <EOL> instanceDependencies [ instanceQname ] . add ( instqname ) <EOL> for varqname , depVars in variableDependencies . items ( ) : <EOL> if varqname not in orderedNameSet : <EOL> circularOrUndefVars = depVars - parameterQnames - orderedNameSet <EOL> undefinedVars = circularOrUndefVars - definedNamesSet <EOL> varsCircularDep = circularOrUndefVars - undefinedVars <EOL> if len ( undefinedVars ) > <NUM_LIT:0> : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = modelVariableSet , xlinkLabel = modelVariableSet . xlinkLabel , <EOL> nameFrom = varqname , nameTo = undefinedVars ) <EOL> if len ( varsCircularDep ) > <NUM_LIT:0> : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = modelVariableSet , xlinkLabel = modelVariableSet . xlinkLabel , <EOL> nameFrom = varqname , nameTo = varsCircularDep ) <EOL> for varSetDepVarQname in modelVariableSet . variableRefs ( ) : <EOL> if varSetDepVarQname not in definedNamesSet and varSetDepVarQname not in parameterQnames : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = modelVariableSet , xlinkLabel = modelVariableSet . xlinkLabel , <EOL> name = varSetDepVarQname ) <EOL> if varSetDepVarQname in instanceQnames : <EOL> varSetInstanceDependencies . add ( varSetDepVarQname ) <EOL> instanceDependencies [ instanceQname ] . add ( varSetDepVarQname ) <EOL> elif isinstance ( nameVariables . get ( varSetDepVarQname ) , ModelInstance ) : <EOL> instqname = nameVariables [ varSetDepVarQname ] . instanceQname <EOL> varSetInstanceDependencies . add ( instqname ) <EOL> instanceDependencies [ instanceQname ] . add ( instqname ) <EOL> if formulaOptions . traceVariablesOrder : <EOL> val . modelXbrl . info ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = modelVariableSet , xlinkLabel = modelVariableSet . xlinkLabel , dependencies = orderedNameList ) <EOL> if ( formulaOptions . traceVariablesDependencies and len ( varSetInstanceDependencies ) > <NUM_LIT:0> and <EOL> varSetInstanceDependencies != { XbrlConst . qnStandardInputInstance } ) : <EOL> val . modelXbrl . info ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = modelVariableSet , xlinkLabel = modelVariableSet . xlinkLabel , dependencies = varSetInstanceDependencies ) <EOL> modelVariableSet . orderedVariableRelationships = [ ] <EOL> for varqname in orderedNameList : <EOL> if varqname in qnameRels : <EOL> modelVariableSet . orderedVariableRelationships . append ( qnameRels [ varqname ] ) <EOL> orderedNameSet . clear ( ) <EOL> del orderedNameList [ : ] <EOL> if isinstance ( modelVariableSet , ModelExistenceAssertion ) : <EOL> for depVar in XPathParser . variableReferencesSet ( modelVariableSet . testProg , modelVariableSet ) : <EOL> if depVar in qnameRels and isinstance ( qnameRels [ depVar ] . toModelObject , ModelVariable ) : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = modelVariableSet , xlinkLabel = modelVariableSet . xlinkLabel , name = depVar ) <EOL> checkValidationMessageVariables ( val , modelVariableSet , qnameRels , xpathContext . parameterQnames ) <EOL> if isinstance ( modelVariableSet , ModelFormula ) : <EOL> for consisAsserRel in val . modelXbrl . relationshipSet ( XbrlConst . consistencyAssertionFormula ) . toModelObject ( modelVariableSet ) : <EOL> consisAsser = consisAsserRel . fromModelObject <EOL> if isinstance ( consisAsser , ModelConsistencyAssertion ) : <EOL> checkValidationMessages ( val , consisAsser ) <EOL> checkValidationMessageVariables ( val , consisAsser , qnameRels , xpathContext . parameterQnames ) <EOL> modelVariableSet . preconditions = [ ] <EOL> for modelRel in val . modelXbrl . relationshipSet ( XbrlConst . variableSetPrecondition ) . fromModelObject ( modelVariableSet ) : <EOL> precondition = modelRel . toModelObject <EOL> if isinstance ( precondition , ModelPrecondition ) : <EOL> modelVariableSet . preconditions . append ( precondition ) <EOL> for modelRel in val . modelXbrl . relationshipSet ( XbrlConst . variableSetFilter ) . fromModelObject ( modelVariableSet ) : <EOL> varSetFilter = modelRel . toModelObject <EOL> if modelRel . isCovered : <EOL> val . modelXbrl . warning ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = varSetFilter , xlinkLabel = modelVariableSet . xlinkLabel , filterLabel = varSetFilter . xlinkLabel ) <EOL> modelRel . _isCovered = False <EOL> for depVar in varSetFilter . variableRefs ( ) : <EOL> if depVar in qnameRels and isinstance ( qnameRels [ depVar ] . toModelObject , ModelVariable ) : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = varSetFilter , xlinkLabel = modelVariableSet . xlinkLabel , filterLabel = varSetFilter . xlinkLabel , name = depVar ) <EOL> if isinstance ( modelVariableSet , ModelFormula ) : <EOL> checkFormulaRules ( val , modelVariableSet , nameVariables ) <EOL> nameVariables . clear ( ) <EOL> qnameRels . clear ( ) <EOL> definedNamesSet . clear ( ) <EOL> variableDependencies . clear ( ) <EOL> varSetInstanceDependencies . clear ( ) <EOL> val . modelXbrl . profileActivity ( "<STR_LIT>" , minTimeToShow = <NUM_LIT:1.0> ) <EOL> for modelTable in val . modelXbrl . modelRenderingTables : <EOL> modelTable . fromInstanceQnames = None <EOL> if modelTable . aspectModel not in ( "<STR_LIT>" , "<STR_LIT>" ) : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = modelTable , xlinkLabel = modelTable . xlinkLabel , aspectModel = modelTable . aspectModel ) <EOL> modelTable . compile ( ) <EOL> checkTableRules ( val , xpathContext , modelTable ) <EOL> val . modelXbrl . profileActivity ( "<STR_LIT>" , minTimeToShow = <NUM_LIT:1.0> ) <EOL> orderedInstancesSet = set ( ) <EOL> stdInpInst = { XbrlConst . qnStandardInputInstance } <EOL> orderedInstancesList = [ ] <EOL> orderedAnInstance = True <EOL> while ( orderedAnInstance ) : <EOL> orderedAnInstance = False <EOL> for instqname , depInsts in instanceDependencies . items ( ) : <EOL> if instqname and instqname not in orderedInstancesSet and len ( depInsts - stdInpInst - orderedInstancesSet ) == <NUM_LIT:0> : <EOL> orderedInstancesList . append ( instqname ) <EOL> orderedInstancesSet . add ( instqname ) <EOL> orderedAnInstance = True <EOL> for independentInstance in _DICT_SET ( instanceProducingVariableSets . keys ( ) ) - _DICT_SET ( orderedInstancesList ) : <EOL> orderedInstancesList . append ( independentInstance ) <EOL> orderedInstancesSet . add ( independentInstance ) <EOL> if None not in orderedInstancesList : <EOL> orderedInstancesList . append ( None ) <EOL> for instqname , depInsts in instanceDependencies . items ( ) : <EOL> if instqname not in orderedInstancesSet : <EOL> missingDependentInstances = depInsts - stdInpInst <EOL> if val . parameters : missingDependentInstances -= _DICT_SET ( val . parameters . keys ( ) ) <EOL> if instqname : <EOL> if missingDependentInstances : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = val . modelXbrl , <EOL> name = instqname , dependencies = missingDependentInstances ) <EOL> elif instqname == XbrlConst . qnStandardOutputInstance : <EOL> orderedInstancesSet . add ( instqname ) <EOL> orderedInstancesList . append ( instqname ) <EOL> '''<STR_LIT>''' <EOL> elif instqname in depInsts : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = val . modelXbrl , name = instqname ) <EOL> if formulaOptions . traceVariablesOrder and len ( orderedInstancesList ) > <NUM_LIT:1> : <EOL> val . modelXbrl . info ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = val . modelXbrl , dependencies = orderedInstancesList ) <EOL> for modelRel in val . modelXbrl . relationshipSet ( XbrlConst . consistencyAssertionFormula ) . modelRelationships : <EOL> if ( modelRel . fromModelObject is not None and modelRel . toModelObject is not None and <EOL> isinstance ( modelRel . toModelObject , ModelFormula ) ) : <EOL> consisAsser = modelRel . fromModelObject <EOL> consisAsser . countSatisfied = <NUM_LIT:0> <EOL> consisAsser . countNotSatisfied = <NUM_LIT:0> <EOL> if consisAsser . hasProportionalAcceptanceRadius and consisAsser . hasAbsoluteAcceptanceRadius : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = consisAsser , xlinkLabel = consisAsser . xlinkLabel ) <EOL> consisAsser . orderedVariableRelationships = [ ] <EOL> for consisParamRel in val . modelXbrl . relationshipSet ( XbrlConst . consistencyAssertionParameter ) . fromModelObject ( consisAsser ) : <EOL> if isinstance ( consisParamRel . toModelObject , ModelVariable ) : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = consisAsser , xlinkLabel = consisAsser . xlinkLabel , <EOL> elementTo = consisParamRel . toModelObject . localName , xlinkLabelTo = consisParamRel . toModelObject . xlinkLabel ) <EOL> elif isinstance ( consisParamRel . toModelObject , ModelParameter ) : <EOL> consisAsser . orderedVariableRelationships . append ( consisParamRel ) <EOL> consisAsser . compile ( ) <EOL> modelRel . toModelObject . hasConsistencyAssertion = True <EOL> val . modelXbrl . profileActivity ( "<STR_LIT>" , minTimeToShow = <NUM_LIT:1.0> ) <EOL> xpathContext . defaultDimensionAspects = set ( val . modelXbrl . qnameDimensionDefaults . keys ( ) ) <EOL> xpathContext . dimensionsAspectUniverse = xpathContext . defaultDimensionAspects <EOL> for cntx in val . modelXbrl . contexts . values ( ) : <EOL> xpathContext . dimensionsAspectUniverse |= _DICT_SET ( cntx . qnameDims . keys ( ) ) <EOL> for instanceQname in instanceQnames : <EOL> if ( instanceQname not in ( XbrlConst . qnStandardInputInstance , XbrlConst . qnStandardOutputInstance ) and <EOL> val . parameters and instanceQname in val . parameters ) : <EOL> for namedInstance in val . parameters [ instanceQname ] [ <NUM_LIT:1> ] : <EOL> ValidateXbrlDimensions . loadDimensionDefaults ( namedInstance ) <EOL> xpathContext . defaultDimensionAspects |= _DICT_SET ( namedInstance . qnameDimensionDefaults . keys ( ) ) <EOL> xpathContext . dimensionsAspectUniverse |= _DICT_SET ( namedInstance . qnameDimensionDefaults . keys ( ) ) <EOL> for cntx in namedInstance . contexts . values ( ) : <EOL> xpathContext . dimensionsAspectUniverse |= _DICT_SET ( cntx . qnameDims . keys ( ) ) <EOL> for instanceQname , modelVariableSets in instanceProducingVariableSets . items ( ) : <EOL> for modelVariableSet in modelVariableSets : <EOL> for varScopeRel in val . modelXbrl . relationshipSet ( XbrlConst . variablesScope ) . toModelObject ( modelVariableSet ) : <EOL> if varScopeRel . fromModelObject is not None : <EOL> sourceVariableSet = varScopeRel . fromModelObject <EOL> if sourceVariableSet . outputInstanceQname != instanceQname : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = modelVariableSet , <EOL> xlinkLabel1 = sourceVariableSet . xlinkLabel , instance1 = sourceVariableSet . outputInstanceQname , <EOL> xlinkLabel2 = modelVariableSet . xlinkLabel , instance2 = modelVariableSet . outputInstanceQname ) <EOL> if sourceVariableSet . aspectModel != modelVariableSet . aspectModel : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = modelVariableSet , <EOL> xlinkLabel1 = sourceVariableSet . xlinkLabel , aspectModel1 = sourceVariableSet . aspectModel , <EOL> xlinkLabel2 = modelVariableSet . xlinkLabel , aspectModel2 = modelVariableSet . aspectModel ) <EOL> val . modelXbrl . profileActivity ( "<STR_LIT>" , minTimeToShow = <NUM_LIT:1.0> ) <EOL> val . modelXbrl . profileStat ( _ ( "<STR_LIT>" ) ) <EOL> if ( initialErrorCount < val . modelXbrl . logCount . get ( logging . _checkLevel ( '<STR_LIT>' ) , <NUM_LIT:0> ) or <EOL> compileOnly or <EOL> getattr ( val , "<STR_LIT>" , False ) ) : <EOL> return <EOL> if instanceQnames : <EOL> val . modelXbrl . modelManager . showStatus ( _ ( "<STR_LIT>" ) ) <EOL> schemaRefs = [ val . modelXbrl . modelDocument . relativeUri ( referencedDoc . uri ) <EOL> for referencedDoc in val . modelXbrl . modelDocument . referencesDocument . keys ( ) <EOL> if referencedDoc . type == ModelDocument . Type . SCHEMA ] <EOL> outputXbrlInstance = None <EOL> for instanceQname in instanceQnames : <EOL> if instanceQname == XbrlConst . qnStandardInputInstance : <EOL> continue <EOL> if val . parameters and instanceQname in val . parameters : <EOL> namedInstance = val . parameters [ instanceQname ] [ <NUM_LIT:1> ] <EOL> else : <EOL> uri = val . modelXbrl . modelDocument . filepath [ : - <NUM_LIT:4> ] + "<STR_LIT>" <EOL> if instanceQname != XbrlConst . qnStandardOutputInstance : <EOL> uri = uri + "<STR_LIT:->" + instanceQname . localName <EOL> uri = uri + "<STR_LIT>" <EOL> namedInstance = ModelXbrl . create ( val . modelXbrl . modelManager , <EOL> newDocumentType = ModelDocument . Type . INSTANCE , <EOL> url = uri , <EOL> schemaRefs = schemaRefs , <EOL> isEntry = True ) <EOL> ValidateXbrlDimensions . loadDimensionDefaults ( namedInstance ) <EOL> xpathContext . inScopeVars [ instanceQname ] = namedInstance <EOL> if instanceQname == XbrlConst . qnStandardOutputInstance : <EOL> outputXbrlInstance = namedInstance <EOL> val . modelXbrl . profileActivity ( "<STR_LIT>" , minTimeToShow = <NUM_LIT:1.0> ) <EOL> val . modelXbrl . profileStat ( _ ( "<STR_LIT>" ) ) <EOL> timeFormulasStarted = time . time ( ) <EOL> val . modelXbrl . modelManager . showStatus ( _ ( "<STR_LIT>" ) ) <EOL> runIDs = ( formulaOptions . runIDs or '<STR_LIT>' ) . replace ( '<STR_LIT:|>' , '<STR_LIT:U+0020>' ) . split ( ) <EOL> if runIDs : <EOL> val . modelXbrl . info ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelXbrl = val . modelXbrl , ids = '<STR_LIT:U+002CU+0020>' . join ( runIDs ) ) <EOL> try : <EOL> if hasattr ( val , "<STR_LIT>" ) and val . maxFormulaRunTime > <NUM_LIT:0> : <EOL> maxFormulaRunTimeTimer = Timer ( val . maxFormulaRunTime * <NUM_LIT> , xpathContext . runTimeExceededCallback ) <EOL> maxFormulaRunTimeTimer . start ( ) <EOL> else : <EOL> maxFormulaRunTimeTimer = None <EOL> from arelle . FormulaEvaluator import init as formulaEvaluatorInit , evaluate <EOL> formulaEvaluatorInit ( ) <EOL> val . modelXbrl . profileActivity ( "<STR_LIT>" , minTimeToShow = <NUM_LIT:1.0> ) <EOL> for instanceQname in orderedInstancesList : <EOL> for modelVariableSet in instanceProducingVariableSets [ instanceQname ] : <EOL> if not val . modelXbrl . relationshipSet ( XbrlConst . variablesScope ) . toModelObject ( modelVariableSet ) : <EOL> if ( not runIDs or <EOL> modelVariableSet . id in runIDs or <EOL> ( modelVariableSet . hasConsistencyAssertion and <EOL> any ( modelRel . fromModelObject . id in runIDs <EOL> for modelRel in val . modelXbrl . relationshipSet ( XbrlConst . consistencyAssertionFormula ) . toModelObject ( modelVariableSet ) <EOL> if isinstance ( modelRel . fromModelObject , ModelConsistencyAssertion ) ) ) ) : <EOL> try : <EOL> varSetId = ( modelVariableSet . id or modelVariableSet . xlinkLabel ) <EOL> val . modelXbrl . profileActivity ( "<STR_LIT>" + varSetId , minTimeToShow = <NUM_LIT> ) <EOL> val . modelXbrl . modelManager . showStatus ( _ ( "<STR_LIT>" ) . format ( varSetId ) ) <EOL> val . modelXbrl . profileActivity ( "<STR_LIT>" + varSetId , minTimeToShow = <NUM_LIT:1.0> ) <EOL> evaluate ( xpathContext , modelVariableSet ) <EOL> val . modelXbrl . profileStat ( modelVariableSet . localName + "<STR_LIT:_>" + varSetId ) <EOL> except XPathContext . XPathException as err : <EOL> val . modelXbrl . error ( err . code , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = modelVariableSet , variableSet = str ( modelVariableSet ) , error = err . message ) <EOL> if maxFormulaRunTimeTimer : <EOL> maxFormulaRunTimeTimer . cancel ( ) <EOL> except XPathContext . RunTimeExceededException : <EOL> val . modelXbrl . info ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = val . modelXbrl , mins = val . maxFormulaRunTime ) <EOL> asserTests = { } <EOL> for exisValAsser in val . modelXbrl . modelVariableSets : <EOL> if isinstance ( exisValAsser , ModelVariableSetAssertion ) and ( not runIDs or exisValAsser . id in runIDs ) : <EOL> asserTests [ exisValAsser . id ] = ( exisValAsser . countSatisfied , exisValAsser . countNotSatisfied ) <EOL> if formulaOptions . traceAssertionResultCounts : <EOL> val . modelXbrl . info ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = exisValAsser , <EOL> assertionType = "<STR_LIT>" if isinstance ( exisValAsser , ModelExistenceAssertion ) else "<STR_LIT>" , <EOL> id = exisValAsser . id , satisfiedCount = exisValAsser . countSatisfied , notSatisfiedCount = exisValAsser . countNotSatisfied ) <EOL> for modelRel in val . modelXbrl . relationshipSet ( XbrlConst . consistencyAssertionFormula ) . modelRelationships : <EOL> if modelRel . fromModelObject is not None and modelRel . toModelObject is not None and isinstance ( modelRel . toModelObject , ModelFormula ) and ( not runIDs or modelRel . fromModelObject . id in runIDs ) : <EOL> consisAsser = modelRel . fromModelObject <EOL> asserTests [ consisAsser . id ] = ( consisAsser . countSatisfied , consisAsser . countNotSatisfied ) <EOL> if formulaOptions . traceAssertionResultCounts : <EOL> val . modelXbrl . info ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = consisAsser , id = consisAsser . id , <EOL> satisfiedCount = consisAsser . countSatisfied , notSatisfiedCount = consisAsser . countNotSatisfied ) <EOL> if asserTests : <EOL> val . modelXbrl . log ( None , "<STR_LIT>" , None , assertionResults = asserTests ) ; <EOL> if outputXbrlInstance : <EOL> if val . modelXbrl . formulaOutputInstance : <EOL> val . modelXbrl . formulaOutputInstance . close ( ) <EOL> val . modelXbrl . formulaOutputInstance = outputXbrlInstance <EOL> val . modelXbrl . modelManager . showStatus ( _ ( "<STR_LIT>" ) , <NUM_LIT> ) <EOL> instanceProducingVariableSets . clear ( ) <EOL> parameterQnames . clear ( ) <EOL> instanceQnames . clear ( ) <EOL> parameterDependencies . clear ( ) <EOL> instanceDependencies . clear ( ) <EOL> dependencyResolvedParameters . clear ( ) <EOL> orderedInstancesSet . clear ( ) <EOL> del orderedParameters , orderedInstances , orderedInstancesList <EOL> xpathContext . close ( ) <EOL> val . modelXbrl . profileStat ( _ ( "<STR_LIT>" ) , time . time ( ) - timeFormulasStarted ) <EOL> def checkVariablesScopeVisibleQnames ( val , nameVariables , definedNamesSet , modelVariableSet ) : <EOL> for visibleVarSetRel in val . modelXbrl . relationshipSet ( XbrlConst . variablesScope ) . toModelObject ( modelVariableSet ) : <EOL> varqname = visibleVarSetRel . variableQname <EOL> if varqname : <EOL> if varqname not in nameVariables : <EOL> nameVariables [ varqname ] = visibleVarSetRel . fromModelObject <EOL> if varqname not in definedNamesSet : <EOL> definedNamesSet . add ( varqname ) <EOL> visibleVarSet = visibleVarSetRel . fromModelObject <EOL> for modelRel in val . modelXbrl . relationshipSet ( XbrlConst . variableSet ) . fromModelObject ( visibleVarSet ) : <EOL> varqname = modelRel . variableQname <EOL> if varqname : <EOL> if varqname not in nameVariables : <EOL> nameVariables [ varqname ] = modelRel . toModelObject <EOL> if varqname not in definedNamesSet : <EOL> definedNamesSet . add ( varqname ) <EOL> checkVariablesScopeVisibleQnames ( val , nameVariables , definedNamesSet , visibleVarSet ) <EOL> def checkFilterAspectModel ( val , variableSet , filterRelationships , xpathContext , uncoverableAspects = None ) : <EOL> result = set ( ) <EOL> if uncoverableAspects is None : <EOL> oppositeAspectModel = ( _DICT_SET ( { '<STR_LIT>' , '<STR_LIT>' } ) - _DICT_SET ( { variableSet . aspectModel } ) ) . pop ( ) <EOL> try : <EOL> uncoverableAspects = aspectModels [ oppositeAspectModel ] - aspectModels [ variableSet . aspectModel ] <EOL> except KeyError : <EOL> return result <EOL> acfAspectsCovering = { } <EOL> for varFilterRel in filterRelationships : <EOL> _filter = varFilterRel . toModelObject <EOL> isAllAspectCoverFilter = False <EOL> if isinstance ( _filter , ModelAspectCover ) : <EOL> for aspect in _filter . aspectsCovered ( None , xpathContext ) : <EOL> if aspect in acfAspectsCovering : <EOL> otherFilterCover , otherFilterLabel = acfAspectsCovering [ aspect ] <EOL> if otherFilterCover != varFilterRel . isCovered : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = variableSet , xlinkLabel = variableSet . xlinkLabel , filterLabel = _filter . xlinkLabel , <EOL> aspect = str ( aspect ) if isinstance ( aspect , QName ) else Aspect . label [ aspect ] , <EOL> filterLabel2 = otherFilterLabel ) <EOL> else : <EOL> acfAspectsCovering [ aspect ] = ( varFilterRel . isCovered , _filter . xlinkLabel ) <EOL> isAllAspectCoverFilter = _filter . isAll <EOL> if True : <EOL> try : <EOL> aspectsCovered = _filter . aspectsCovered ( None ) <EOL> if ( not isAllAspectCoverFilter and <EOL> ( any ( isinstance ( aspect , QName ) for aspect in aspectsCovered ) and Aspect . DIMENSIONS in uncoverableAspects <EOL> or ( aspectsCovered & uncoverableAspects ) ) ) : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = variableSet , xlinkLabel = variableSet . xlinkLabel , aspectModel = variableSet . aspectModel , <EOL> filterName = _filter . localName , filterLabel = _filter . xlinkLabel ) <EOL> result |= aspectsCovered <EOL> except Exception : <EOL> pass <EOL> if hasattr ( _filter , "<STR_LIT>" ) : <EOL> result |= checkFilterAspectModel ( val , variableSet , _filter . filterRelationships , xpathContext , uncoverableAspects ) <EOL> return result <EOL> def checkFormulaRules ( val , formula , nameVariables ) : <EOL> if not ( formula . hasRule ( Aspect . CONCEPT ) or formula . source ( Aspect . CONCEPT ) ) : <EOL> if XmlUtil . hasDescendant ( formula , XbrlConst . formula , "<STR_LIT>" ) : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = formula , xlinkLabel = formula . xlinkLabel ) <EOL> else : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = formula , xlinkLabel = formula . xlinkLabel ) <EOL> if not isinstance ( formula , ModelTuple ) : <EOL> if ( not ( formula . hasRule ( Aspect . SCHEME ) or formula . source ( Aspect . SCHEME ) ) or <EOL> not ( formula . hasRule ( Aspect . VALUE ) or formula . source ( Aspect . VALUE ) ) ) : <EOL> if XmlUtil . hasDescendant ( formula , XbrlConst . formula , "<STR_LIT>" ) : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = formula , xlinkLabel = formula . xlinkLabel ) <EOL> else : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = formula , xlinkLabel = formula . xlinkLabel ) <EOL> if not ( formula . hasRule ( Aspect . PERIOD_TYPE ) or formula . source ( Aspect . PERIOD_TYPE ) ) : <EOL> if XmlUtil . hasDescendant ( formula , XbrlConst . formula , "<STR_LIT>" ) : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = formula , xlinkLabel = formula . xlinkLabel ) <EOL> else : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = formula , xlinkLabel = formula . xlinkLabel ) <EOL> concept = val . modelXbrl . qnameConcepts . get ( formula . evaluateRule ( None , Aspect . CONCEPT ) ) <EOL> if concept is None : <EOL> sourceFactVar = nameVariables . get ( formula . source ( Aspect . CONCEPT ) ) <EOL> if isinstance ( sourceFactVar , ModelFactVariable ) : <EOL> for varFilterRels in ( formula . groupFilterRelationships , sourceFactVar . filterRelationships ) : <EOL> for varFilterRel in varFilterRels : <EOL> _filter = varFilterRel . toModelObject <EOL> if isinstance ( _filter , ModelConceptName ) : <EOL> for conceptQname in _filter . conceptQnames : <EOL> concept = val . modelXbrl . qnameConcepts . get ( conceptQname ) <EOL> if concept is not None and concept . isNumeric : <EOL> break <EOL> if concept is not None : <EOL> if concept . isNumeric : <EOL> if not ( formula . hasRule ( Aspect . MULTIPLY_BY ) or formula . hasRule ( Aspect . DIVIDE_BY ) or formula . source ( Aspect . UNIT ) ) : <EOL> if XmlUtil . hasDescendant ( formula , XbrlConst . formula , "<STR_LIT>" ) : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = formula , xlinkLabel = formula . xlinkLabel ) <EOL> else : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = formula , xlinkLabel = formula . xlinkLabel ) <EOL> elif ( formula . hasRule ( Aspect . MULTIPLY_BY ) or formula . hasRule ( Aspect . DIVIDE_BY ) or <EOL> formula . source ( Aspect . UNIT , acceptFormulaSource = False ) ) : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = formula , xlinkLabel = formula . xlinkLabel , concept = concept . qname ) <EOL> aspectPeriodType = formula . evaluateRule ( None , Aspect . PERIOD_TYPE ) <EOL> if ( ( concept . periodType == "<STR_LIT>" and aspectPeriodType == "<STR_LIT>" ) or <EOL> ( concept . periodType == "<STR_LIT>" and aspectPeriodType in ( "<STR_LIT>" , "<STR_LIT>" ) ) ) : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = formula , xlinkLabel = formula . xlinkLabel , concept = concept . qname , aspectPeriodType = aspectPeriodType , conceptPeriodType = concept . periodType ) <EOL> for eltName , dim , badUsageErr , missingSavErr in ( ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <EOL> ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ) : <EOL> for dimElt in XmlUtil . descendants ( formula , XbrlConst . formula , eltName ) : <EOL> dimQname = qname ( dimElt , dimElt . get ( "<STR_LIT>" ) ) <EOL> dimConcept = val . modelXbrl . qnameConcepts . get ( dimQname ) <EOL> if dimQname and ( dimConcept is None or ( not dimConcept . isExplicitDimension if dim == "<STR_LIT>" else not dimConcept . isTypedDimension ) ) : <EOL> val . modelXbrl . error ( badUsageErr , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = formula , xlinkLabel = formula . xlinkLabel , dimensionType = dim , dimension = dimQname , <EOL> messageCodes = ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> elif not XmlUtil . hasChild ( dimElt , XbrlConst . formula , "<STR_LIT:*>" ) and not formula . source ( Aspect . DIMENSIONS , dimElt ) : <EOL> val . modelXbrl . error ( missingSavErr , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = formula , xlinkLabel = formula . xlinkLabel , dimensionType = dim , dimension = dimQname , <EOL> messageCodes = ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> if formula . aspectModel == "<STR_LIT>" : <EOL> unexpectedElts = XmlUtil . descendants ( formula , XbrlConst . formula , ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> if unexpectedElts : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = formula , xlinkLabel = formula . xlinkLabel , aspectModel = formula . aspectModel , undefinedAspects = "<STR_LIT:U+002CU+0020>" . join ( [ elt . localName for elt in unexpectedElts ] ) ) <EOL> for sourceElt in ( [ formula ] + <EOL> XmlUtil . descendants ( formula , XbrlConst . formula , "<STR_LIT:*>" , "<STR_LIT:source>" , "<STR_LIT:*>" ) ) : <EOL> if sourceElt . get ( "<STR_LIT:source>" ) is not None : <EOL> qnSource = qname ( sourceElt , sourceElt . get ( "<STR_LIT:source>" ) , noPrefixIsNoNamespace = True ) <EOL> if qnSource == XbrlConst . qnFormulaUncovered : <EOL> if formula . implicitFiltering != "<STR_LIT:true>" : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = formula , xlinkLabel = formula . xlinkLabel , name = sourceElt . localName ) <EOL> elif qnSource not in nameVariables : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = formula , xlinkLabel = formula . xlinkLabel , name = qnSource ) <EOL> else : <EOL> factVariable = nameVariables . get ( qnSource ) <EOL> if isinstance ( factVariable , ModelVariableSet ) : <EOL> pass <EOL> elif not isinstance ( factVariable , ModelFactVariable ) : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = formula , xlinkLabel = formula . xlinkLabel , name = qnSource , element = factVariable . localName ) <EOL> elif factVariable . fallbackValue is not None : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = formula , xlinkLabel = formula . xlinkLabel , name = qnSource ) <EOL> elif sourceElt . localName == "<STR_LIT>" and factVariable . bindAsSequence == "<STR_LIT:true>" : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = formula , xlinkLabel = formula . xlinkLabel , name = qnSource ) <EOL> def checkTableRules ( val , xpathContext , table ) : <EOL> checkFilterAspectModel ( val , table , table . filterRelationships , xpathContext ) <EOL> checkDefinitionNodeRules ( val , table , table , ( XbrlConst . tableBreakdown , XbrlConst . tableBreakdownMMDD , XbrlConst . tableBreakdown201305 , XbrlConst . tableAxis2011 ) , xpathContext ) <EOL> def checkDefinitionNodeRules ( val , table , parent , arcrole , xpathContext ) : <EOL> for rel in val . modelXbrl . relationshipSet ( arcrole ) . fromModelObject ( parent ) : <EOL> axis = rel . toModelObject <EOL> if axis is not None : <EOL> if isinstance ( axis , ModelFilterDefinitionNode ) : <EOL> checkFilterAspectModel ( val , table , axis . filterRelationships , xpathContext ) <EOL> else : <EOL> if isinstance ( axis , ModelRuleDefinitionNode ) : <EOL> for eltName , dim , badUsageErr in ( ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , <EOL> ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) ) : <EOL> for dimElt in XmlUtil . descendants ( axis , XbrlConst . formula , eltName ) : <EOL> dimQname = qname ( dimElt , dimElt . get ( "<STR_LIT>" ) ) <EOL> dimConcept = val . modelXbrl . qnameConcepts . get ( dimQname ) <EOL> if dimQname and ( dimConcept is None or ( not dimConcept . isExplicitDimension if dim == "<STR_LIT>" else not dimConcept . isTypedDimension ) ) : <EOL> val . modelXbrl . error ( badUsageErr , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = axis , xlinkLabel = axis . xlinkLabel , dimensionType = dim , dimension = dimQname , <EOL> messageCodes = ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> memQname = axis . evaluateRule ( None , dimQname ) <EOL> if dimConcept . isExplicitDimension and memQname is not None and memQname not in val . modelXbrl . qnameConcepts : <EOL> val . modelXbrl . info ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = axis , xlinkLabel = axis . xlinkLabel , memQname = memQname ) <EOL> if table . aspectModel == "<STR_LIT>" : <EOL> unexpectedElts = XmlUtil . descendants ( axis , XbrlConst . formula , ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> if unexpectedElts : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = axis , xlinkLabel = axis . xlinkLabel , aspectModel = table . aspectModel , undefinedAspects = "<STR_LIT:U+002CU+0020>" . join ( [ elt . localName for elt in unexpectedElts ] ) ) <EOL> for sourceElt in ( [ axis ] + <EOL> XmlUtil . descendants ( axis , XbrlConst . formula , "<STR_LIT:*>" , "<STR_LIT:source>" , "<STR_LIT:*>" ) ) : <EOL> if sourceElt . get ( "<STR_LIT:source>" ) is not None : <EOL> qnSource = qname ( sourceElt , sourceElt . get ( "<STR_LIT:source>" ) , noPrefixIsNoNamespace = True ) <EOL> val . modelXbrl . info ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = axis , xlinkLabel = axis . xlinkLabel , qnSource = qnSource ) <EOL> conceptQname = axis . evaluateRule ( None , Aspect . CONCEPT ) <EOL> if conceptQname and conceptQname not in val . modelXbrl . qnameConcepts : <EOL> val . modelXbrl . info ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = axis , xlinkLabel = axis . xlinkLabel , conceptQname = conceptQname ) <EOL> elif isinstance ( axis , ModelRelationshipDefinitionNode ) : <EOL> for qnameAttr in ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) : <EOL> eltQname = axis . get ( qnameAttr ) <EOL> if eltQname and eltQname not in val . modelXbrl . qnameConcepts : <EOL> val . modelXbrl . info ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = axis , axis = axis . localName . title ( ) , xlinkLabel = axis . xlinkLabel , <EOL> qnameAttr = qnameAttr , qname = eltQname ) <EOL> checkDefinitionNodeRules ( val , table , axis , ( XbrlConst . tableBreakdownTree , XbrlConst . tableBreakdownTreeMMDD , XbrlConst . tableBreakdownTree201305 , XbrlConst . tableDefinitionNodeSubtree201301 , XbrlConst . tableAxisSubtree2011 ) , xpathContext ) <EOL> def checkValidationMessages ( val , modelVariableSet ) : <EOL> for msgRelationship in ( XbrlConst . assertionSatisfiedMessage , XbrlConst . assertionUnsatisfiedMessage ) : <EOL> for modelRel in val . modelXbrl . relationshipSet ( msgRelationship ) . fromModelObject ( modelVariableSet ) : <EOL> checkMessageExpressions ( val , modelRel . toModelObject ) <EOL> def checkMessageExpressions ( val , message ) : <EOL> if isinstance ( message , ModelMessage ) and not hasattr ( message , "<STR_LIT>" ) : <EOL> formatString = [ ] <EOL> expressions = [ ] <EOL> bracketNesting = <NUM_LIT:0> <EOL> skipTo = None <EOL> expressionIndex = <NUM_LIT:0> <EOL> expression = None <EOL> lastC = None <EOL> for c in message . text : <EOL> if skipTo : <EOL> if c == skipTo : <EOL> skipTo = None <EOL> if expression is not None and c in ( '<STR_LIT>' , '<STR_LIT:">' ) : <EOL> skipTo = c <EOL> elif lastC == c and c in ( '<STR_LIT:{>' , '<STR_LIT:}>' ) : <EOL> lastC = None <EOL> elif lastC == '<STR_LIT:{>' : <EOL> bracketNesting += <NUM_LIT:1> <EOL> expression = [ ] <EOL> lastC = None <EOL> elif c == '<STR_LIT:}>' and expression is not None : <EOL> expressions . append ( '<STR_LIT>' . join ( expression ) . strip ( ) ) <EOL> expression = None <EOL> formatString . append ( "<STR_LIT>" . format ( expressionIndex ) ) <EOL> expressionIndex += <NUM_LIT:1> <EOL> lastC = c <EOL> elif lastC == '<STR_LIT:}>' : <EOL> bracketNesting -= <NUM_LIT:1> <EOL> lastC = None <EOL> else : <EOL> lastC = c <EOL> if expression is not None : expression . append ( c ) <EOL> else : formatString . append ( c ) <EOL> if lastC == '<STR_LIT:}>' : <EOL> bracketNesting -= <NUM_LIT:1> <EOL> if bracketNesting : <EOL> val . modelXbrl . error ( "<STR_LIT>" if bracketNesting < <NUM_LIT:0> else "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = message , xlinkLabel = message . xlinkLabel , <EOL> character = '<STR_LIT:{>' if bracketNesting < <NUM_LIT:0> else '<STR_LIT:}>' , <EOL> text = message . text , <EOL> messageCodes = ( "<STR_LIT>" , "<STR_LIT>" ) ) <EOL> else : <EOL> message . expressions = expressions <EOL> message . formatString = '<STR_LIT>' . join ( formatString ) <EOL> if not message . xmlLang : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = message , xlinkLabel = message . xlinkLabel , text = message . text ) <EOL> def checkValidationMessageVariables ( val , modelVariableSet , varNames , paramNames ) : <EOL> if isinstance ( modelVariableSet , ModelConsistencyAssertion ) : <EOL> varSetVars = ( qname ( XbrlConst . ca , '<STR_LIT>' ) , <EOL> qname ( XbrlConst . ca , '<STR_LIT>' ) , <EOL> qname ( XbrlConst . ca , '<STR_LIT>' ) , <EOL> qname ( XbrlConst . ca , '<STR_LIT>' ) ) <EOL> elif isinstance ( modelVariableSet , ModelExistenceAssertion ) : <EOL> varSetVars = ( XbrlConst . qnEaTestExpression , ) <EOL> elif isinstance ( modelVariableSet , ModelValueAssertion ) : <EOL> varSetVars = ( XbrlConst . qnVaTestExpression , ) <EOL> for msgRelationship in ( XbrlConst . assertionSatisfiedMessage , XbrlConst . assertionUnsatisfiedMessage ) : <EOL> for modelRel in val . modelXbrl . relationshipSet ( msgRelationship ) . fromModelObject ( modelVariableSet ) : <EOL> message = modelRel . toModelObject <EOL> message . compile ( ) <EOL> for msgVarQname in message . variableRefs ( ) : <EOL> if msgVarQname not in varNames and msgVarQname not in varSetVars and msgVarQname not in paramNames : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = message , xlinkLabel = message . xlinkLabel , name = msgVarQname ) <EOL> elif ( msgVarQname in varNames and <EOL> isinstance ( modelVariableSet , ModelExistenceAssertion ) and <EOL> isinstance ( varNames [ msgVarQname ] . toModelObject , ModelVariable ) ) : <EOL> val . modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = message , xlinkLabel = message . xlinkLabel , name = msgVarQname ) </s>
