本文整理汇总了Python中arelle.ModelRenderingObject.StructuralNode.header方法的典型用法代码示例。如果您正苦于以下问题:Python StructuralNode.header方法的具体用法?Python StructuralNode.header怎么用?Python StructuralNode.header使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类arelle.ModelRenderingObject.StructuralNode
的用法示例。
在下文中一共展示了StructuralNode.header方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: expandDefinition
# 需要导入模块: from arelle.ModelRenderingObject import StructuralNode [as 别名]
# 或者: from arelle.ModelRenderingObject.StructuralNode import header [as 别名]
def expandDefinition(view, structuralNode, breakdownNode, definitionNode, depth, axisDisposition, facts, i=None, tblAxisRels=None, processOpenDefinitionNode=True):
subtreeRelationships = view.axisSubtreeRelSet.fromModelObject(definitionNode)
def checkLabelWidth(structuralNode, checkBoundFact=False):
if axisDisposition == "y":
# messages can't be evaluated, just use the text portion of format string
label = structuralNode.header(lang=view.lang,
returnGenLabel=not checkBoundFact,
returnMsgFormatString=not checkBoundFact)
if label:
# need to et more exact word length in screen units
widestWordLen = max(len(w) * 16 for w in label.split())
# abstract only pertains to subtree of closed nodesbut not cartesian products or open nodes
while structuralNode.depth >= len(view.rowHdrColWidth):
view.rowHdrColWidth.append(0)
if definitionNode.isAbstract or not subtreeRelationships: # isinstance(definitionNode, ModelOpenDefinitionNode):
if widestWordLen > view.rowHdrColWidth[structuralNode.depth]:
view.rowHdrColWidth[structuralNode.depth] = widestWordLen
else:
if widestWordLen > view.rowNonAbstractHdrSpanMin[structuralNode.depth]:
view.rowNonAbstractHdrSpanMin[structuralNode.depth] = widestWordLen
if structuralNode and isinstance(definitionNode, (ModelBreakdown, ModelEuAxisCoord, ModelDefinitionNode)):
try:
#cartesianProductNestedArgs = (view, depth, axisDisposition, facts, tblAxisRels, i)
ordCardinality, ordDepth = definitionNode.cardinalityAndDepth(structuralNode)
if (not definitionNode.isAbstract and
isinstance(definitionNode, ModelClosedDefinitionNode) and
ordCardinality == 0):
view.modelXbrl.error("xbrlte:closedDefinitionNodeZeroCardinality",
_("Closed definition node %(xlinkLabel)s does not contribute at least one structural node"),
modelObject=(view.modelTable,definitionNode), xlinkLabel=definitionNode.xlinkLabel, axis=definitionNode.localName)
nestedDepth = depth + ordDepth
# HF test
cartesianProductNestedArgs = [view, nestedDepth, axisDisposition, facts, tblAxisRels, i]
if axisDisposition == "z":
if depth == 1: # choices (combo boxes) don't add to z row count
view.zAxisRows += 1
elif axisDisposition == "x":
if ordDepth:
if nestedDepth - 1 > view.colHdrRows: view.colHdrRows = nestedDepth - 1
'''
if not view.colHdrDocRow:
if definitionNode.header(role="http://www.xbrl.org/2008/role/documentation",
lang=view.lang):
view.colHdrDocRow = True
if not view.colHdrCodeRow:
if definitionNode.header(role="http://www.eurofiling.info/role/2010/coordinate-code"):
view.colHdrCodeRow = True
'''
hdrNonStdRoles = view.colHdrNonStdRoles
elif axisDisposition == "y":
if ordDepth:
#if not definitionNode.isAbstract:
# view.dataRows += ordCardinality
if nestedDepth - 1 > view.rowHdrCols:
view.rowHdrCols = nestedDepth - 1
for j in range(1 + ordDepth):
view.rowHdrColWidth.append(16) # min width for 'tail' of nonAbstract coordinate
view.rowNonAbstractHdrSpanMin.append(0)
checkLabelWidth(structuralNode, checkBoundFact=False)
'''
if not view.rowHdrDocCol:
if definitionNode.header(role="http://www.xbrl.org/2008/role/documentation",
lang=view.lang):
view.rowHdrDocCol = True
if not view.rowHdrCodeCol:
if definitionNode.header(role="http://www.eurofiling.info/role/2010/coordinate-code"):
view.rowHdrCodeCol = True
'''
hdrNonStdRoles = view.rowHdrNonStdRoles
if axisDisposition in ("x", "y"):
hdrNonStdPosition = -1 # where a match last occured
for rel in view.modelXbrl.relationshipSet(XbrlConst.elementLabel).fromModelObject(definitionNode):
if rel.toModelObject is not None and rel.toModelObject.role != XbrlConst.genStandardLabel:
labelLang = rel.toModelObject.xmlLang
labelRole = rel.toModelObject.role
if (labelLang == view.lang or labelLang.startswith(view.lang) or view.lang.startswith(labelLang)
or ("code" in labelRole)):
labelRole = rel.toModelObject.role
if labelRole in hdrNonStdRoles:
hdrNonStdPosition = hdrNonStdRoles.index(labelRole)
else:
hdrNonStdRoles.insert(hdrNonStdPosition + 1, labelRole)
isCartesianProductExpanded = False
if not isinstance(definitionNode, ModelFilterDefinitionNode):
# note: reduced set of facts should always be passed to subsequent open nodes
isCartesianProductExpanded = True
for axisSubtreeRel in subtreeRelationships:
isCartesianProductExpanded = True
childDefinitionNode = axisSubtreeRel.toModelObject
if childDefinitionNode.isRollUp:
structuralNode.rollUpStructuralNode = StructuralNode(structuralNode, breakdownNode, childDefinitionNode, )
if not structuralNode.childStructuralNodes: # first sub ordinate is the roll up
structuralNode.subtreeRollUp = CHILD_ROLLUP_FIRST
else:
structuralNode.subtreeRollUp = CHILD_ROLLUP_LAST
if not view.topRollup.get(axisDisposition):
view.topRollup[axisDisposition] = structuralNode.subtreeRollUp
else:
#.........这里部分代码省略.........
示例2: analyzeHdrs
# 需要导入模块: from arelle.ModelRenderingObject import StructuralNode [as 别名]
# 或者: from arelle.ModelRenderingObject.StructuralNode import header [as 别名]
def analyzeHdrs(view, structuralNode, definitionNode, depth, axisDisposition, facts, i=None, tblAxisRels=None, processOpenDefinitionNode=True):
subtreeRelationships = view.axisSubtreeRelSet.fromModelObject(definitionNode)
def checkLabelWidth(structuralNode, checkBoundFact=False):
if axisDisposition == "y":
# messages can't be evaluated, just use the text portion of format string
label = structuralNode.header(lang=view.lang,
returnGenLabel=not checkBoundFact,
returnMsgFormatString=not checkBoundFact)
if label:
# need to et more exact word length in screen units
widestWordLen = max(len(w) * 16 for w in label.split())
# abstract only pertains to subtree of closed nodesbut not cartesian products or open nodes
if definitionNode.isAbstract or not subtreeRelationships: # isinstance(definitionNode, ModelOpenDefinitionNode):
if widestWordLen > view.rowHdrColWidth[structuralNode.depth]:
view.rowHdrColWidth[structuralNode.depth] = widestWordLen
else:
if widestWordLen > view.rowNonAbstractHdrSpanMin[structuralNode.depth]:
view.rowNonAbstractHdrSpanMin[structuralNode.depth] = widestWordLen
if structuralNode and isinstance(definitionNode, (ModelEuAxisCoord, ModelDefinitionNode)):
try:
#cartesianProductNestedArgs = (view, depth, axisDisposition, facts, tblAxisRels, i)
ordCardinality, ordDepth = definitionNode.cardinalityAndDepth(structuralNode)
nestedDepth = depth + ordDepth
# HF test
cartesianProductNestedArgs = [view, nestedDepth, axisDisposition, facts, tblAxisRels, i]
if axisDisposition == "z":
if depth == 1: # choices (combo boxes) don't add to z row count
view.zAxisRows += 1
elif axisDisposition == "x":
if ordDepth:
if nestedDepth > view.colHdrRows: view.colHdrRows = nestedDepth
'''
if not view.colHdrDocRow:
if definitionNode.header(role="http://www.xbrl.org/2008/role/documentation",
lang=view.lang):
view.colHdrDocRow = True
if not view.colHdrCodeRow:
if definitionNode.header(role="http://www.eurofiling.info/role/2010/coordinate-code"):
view.colHdrCodeRow = True
'''
hdrNonStdRoles = view.colHdrNonStdRoles
elif axisDisposition == "y":
if ordDepth:
#if not definitionNode.isAbstract:
# view.dataRows += ordCardinality
if nestedDepth > view.rowHdrCols:
view.rowHdrCols = nestedDepth
for j in range(1 + ordDepth):
view.rowHdrColWidth.append(16) # min width for 'tail' of nonAbstract coordinate
view.rowNonAbstractHdrSpanMin.append(0)
checkLabelWidth(structuralNode, checkBoundFact=False)
'''
if not view.rowHdrDocCol:
if definitionNode.header(role="http://www.xbrl.org/2008/role/documentation",
lang=view.lang):
view.rowHdrDocCol = True
if not view.rowHdrCodeCol:
if definitionNode.header(role="http://www.eurofiling.info/role/2010/coordinate-code"):
view.rowHdrCodeCol = True
'''
hdrNonStdRoles = view.rowHdrNonStdRoles
if axisDisposition in ("x", "y"):
hdrNonStdPosition = -1 # where a match last occured
for rel in view.modelXbrl.relationshipSet(XbrlConst.elementLabel).fromModelObject(definitionNode):
if rel.toModelObject is not None and rel.toModelObject.role != XbrlConst.genStandardLabel:
labelLang = rel.toModelObject.xmlLang
labelRole = rel.toModelObject.role
if (labelLang == view.lang or labelLang.startswith(view.lang) or view.lang.startswith(labelLang)
or ("code" in labelRole)):
labelRole = rel.toModelObject.role
if labelRole in hdrNonStdRoles:
hdrNonStdPosition = hdrNonStdRoles.index(labelRole)
else:
hdrNonStdRoles.insert(hdrNonStdPosition + 1, labelRole)
cartesianProductAnalyzed = False
for axisSubtreeRel in subtreeRelationships:
cartesianProductAnalyzed = True
childDefinitionNode = axisSubtreeRel.toModelObject
if childDefinitionNode.isRollUp:
structuralNode.rollUpStructuralNode = StructuralNode(structuralNode, childDefinitionNode)
if not structuralNode.childStructuralNodes: # first sub ordinate is the roll up
structuralNode.subtreeRollUp = CHILD_ROLLUP_FIRST
else:
structuralNode.subtreeRollUp = CHILD_ROLLUP_LAST
if not view.topRollup.get(axisDisposition):
view.topRollup[axisDisposition] = structuralNode.subtreeRollUp
else:
if (isinstance(definitionNode, ModelCompositionDefinitionNode) and
isinstance(childDefinitionNode, ModelRelationshipDefinitionNode)): # append list products to composititionAxes subObjCntxs
childStructuralNode = structuralNode
else:
childStructuralNode = StructuralNode(structuralNode, childDefinitionNode) # others are nested structuralNode
if axisDisposition != "z":
structuralNode.childStructuralNodes.append(childStructuralNode)
if axisDisposition != "z":
analyzeHdrs(view, childStructuralNode, childDefinitionNode, depth+ordDepth, axisDisposition, facts) #recurse
analyzeCartesianProductHdrs(childStructuralNode, *cartesianProductNestedArgs)
else:
#.........这里部分代码省略.........