当前位置: 首页>>代码示例>>Python>>正文


Python XbrlConst.isTotalRole方法代码示例

本文整理汇总了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
开发者ID:Arelle,项目名称:Arelle,代码行数:67,代码来源:PreCalAlignment.py


注:本文中的arelle.XbrlConst.isTotalRole方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。