本文整理汇总了Python中arelle.XbrlConst.isTotalRole方法的典型用法代码示例。如果您正苦于以下问题:Python XbrlConst.isTotalRole方法的具体用法?Python XbrlConst.isTotalRole怎么用?Python XbrlConst.isTotalRole使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类arelle.XbrlConst
的用法示例。
在下文中一共展示了XbrlConst.isTotalRole方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: presumptionOfTotal
# 需要导入模块: from arelle import XbrlConst [as 别名]
# 或者: from arelle.XbrlConst import isTotalRole [as 别名]
def presumptionOfTotal(val, rel, siblingRels, iSibling, isStatementSheet, nestedInTotal, checkLabelRoleOnly):
"""
A numeric concept target of a parent-child relationship is presumed total if:
(i) its preferredLabel role is a total role (pre XbrlConst static function of
current such total roles) or
(ii) if not in a nested total (abstract child relationship to a known total's
contributing siblings):
the parent is not SupplementalCashFlowInformationAbstract and the preceding
sibling relationship is monetary and it's on a statement sheet and it's the
last of more than one monetary item
(a) Last monetary parented by an abstract or non-monetary and not in a nested
(breakdown) total, or
(b) effective label (en-US of preferred role) has "Total" in its wording.
(c) (commented out for now due to false positives: Concept name has "Total"
in its name)
(d) last monetary (may be sub level) whose immediate sibling is a calc LB child
"""
concept = rel.toModelObject
if isinstance(concept, ModelConcept) and concept.isNumeric:
preferredLabel = rel.preferredLabel
if XbrlConst.isTotalRole(preferredLabel):
return _("preferredLabel {0}").format(os.path.basename(preferredLabel))
if concept.isMonetary and not checkLabelRoleOnly:
effectiveLabel = concept.label(lang="en-US", fallbackToQname=False, preferredLabel=preferredLabel)
''' word total in label/name does not seem to be a good indicator,
e.g., Google Total in label for ShareBasedCompensationArrangementByShareBasedPaymentAwardGrantDateFairValueOfOptionsVested followed by
label with Aggregate but name has Total
... so only perform this test on last monetary in a Note
if 'Total' in effectiveLabel: # also check for Net ???
return _("word 'Total' in effective label {0}").format(effectiveLabel)
if 'Total' in concept.name: # also check for Net ???
return _("word 'Total' in concept name {0}").format(concept.name)
'''
parent = rel.fromModelObject
if (len(siblingRels) > 1 and
iSibling == len(siblingRels) - 1 and
parent is not None and
parent.name not in {
"SupplementalCashFlowInformationAbstract"
}):
preceedingSibling = siblingRels[iSibling - 1].toModelObject
if preceedingSibling is not None and preceedingSibling.isMonetary:
# last fact, may be total
if isStatementSheet:
# check if facts add up??
if (parent.isAbstract or not parent.isMonetary) and not nestedInTotal:
return _("last monetary item in statement sheet monetary line items parented by nonMonetary concept")
elif effectiveLabel and 'Total' in effectiveLabel:
return _("last monetary item in statement sheet monetary line items with word 'Total' in effective label {0}").format(effectiveLabel)
elif 'Total' in concept.name:
return _("last monetary item in statement sheet monetary line items with word 'Total' in concept name {0}").format(concept.name)
elif val.summationItemRelsSetAllELRs.isRelated(concept, "child", preceedingSibling):
return _("last monetary item in statement sheet monetary line items is calc sum of previous line item")
''' for now unreliable to use total words for notes
else:
if 'Total' in effectiveLabel: # also check for Net ???
return _("last monetary item in note with word 'Total' in effective label {0}").format(effectiveLabel)
if 'Total' in concept.name: # also check for Net ???
return _("last monetary item in note with word 'Total' in concept name {0}").format(concept.name)
'''
return None