本文整理汇总了Python中arelle.XbrlConst.isStandardResourceOrExtLinkElement方法的典型用法代码示例。如果您正苦于以下问题:Python XbrlConst.isStandardResourceOrExtLinkElement方法的具体用法?Python XbrlConst.isStandardResourceOrExtLinkElement怎么用?Python XbrlConst.isStandardResourceOrExtLinkElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类arelle.XbrlConst
的用法示例。
在下文中一共展示了XbrlConst.isStandardResourceOrExtLinkElement方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: linkbaseDiscover
# 需要导入模块: from arelle import XbrlConst [as 别名]
# 或者: from arelle.XbrlConst import isStandardResourceOrExtLinkElement [as 别名]
def linkbaseDiscover(self, linkbaseElement, inInstance=False):
for lbElement in linkbaseElement.iterchildren():
if isinstance(lbElement,ModelObject):
lbLn = lbElement.localName
lbNs = lbElement.namespaceURI
if lbNs == XbrlConst.link:
if lbLn == "roleRef" or lbLn == "arcroleRef":
href = self.discoverHref(lbElement)
if href is None:
self.modelXbrl.error("xbrl:hrefMissing",
_("Linkbase reference for %(linkbaseRefElement)s href attribute missing or malformed"),
modelObject=lbElement, linkbaseRefElement=lbLn)
else:
self.hrefObjects.append(href)
continue
if lbElement.get("{http://www.w3.org/1999/xlink}type") == "extended":
if isinstance(lbElement, ModelLink):
self.schemalocateElementNamespace(lbElement)
arcrolesFound = set()
dimensionArcFound = False
formulaArcFound = False
tableRenderingArcFound = False
linkQn = qname(lbElement)
linkrole = lbElement.get("{http://www.w3.org/1999/xlink}role")
isStandardExtLink = XbrlConst.isStandardResourceOrExtLinkElement(lbElement)
if inInstance:
#index footnote links even if no arc children
baseSetKeys = (("XBRL-footnotes",None,None,None),
("XBRL-footnotes",linkrole,None,None))
for baseSetKey in baseSetKeys:
self.modelXbrl.baseSets[baseSetKey].append(lbElement)
for linkElement in lbElement.iterchildren():
if isinstance(linkElement,ModelObject):
self.schemalocateElementNamespace(linkElement)
xlinkType = linkElement.get("{http://www.w3.org/1999/xlink}type")
modelResource = None
if xlinkType == "locator":
nonDTS = linkElement.namespaceURI != XbrlConst.link or linkElement.localName != "loc"
# only link:loc elements are discovered or processed
href = self.discoverHref(linkElement, nonDTS=nonDTS)
if href is None:
if isStandardExtLink:
self.modelXbrl.error("xbrl:hrefMissing",
_("Locator href attribute missing or malformed in standard extended link"),
modelObejct=linkElement)
else:
self.modelXbrl.warning("arelle:hrefWarning",
_("Locator href attribute missing or malformed in non-standard extended link"),
modelObejct=linkElement)
else:
linkElement.modelHref = href
modelResource = linkElement
elif xlinkType == "arc":
arcQn = qname(linkElement)
arcrole = linkElement.get("{http://www.w3.org/1999/xlink}arcrole")
if arcrole not in arcrolesFound:
if linkrole == "":
linkrole = XbrlConst.defaultLinkRole
#index by both arcrole and linkrole#arcrole and dimensionsions if applicable
baseSetKeys = [(arcrole, linkrole, linkQn, arcQn)]
baseSetKeys.append((arcrole, linkrole, None, None))
baseSetKeys.append((arcrole, None, None, None))
if XbrlConst.isDimensionArcrole(arcrole) and not dimensionArcFound:
baseSetKeys.append(("XBRL-dimensions", None, None, None))
baseSetKeys.append(("XBRL-dimensions", linkrole, None, None))
dimensionArcFound = True
if XbrlConst.isFormulaArcrole(arcrole) and not formulaArcFound:
baseSetKeys.append(("XBRL-formulae", None, None, None))
baseSetKeys.append(("XBRL-formulae", linkrole, None, None))
formulaArcFound = True
if XbrlConst.isTableRenderingArcrole(arcrole) and not tableRenderingArcFound:
baseSetKeys.append(("Table-rendering", None, None, None))
baseSetKeys.append(("Table-rendering", linkrole, None, None))
tableRenderingArcFound = True
self.modelXbrl.hasTableRendering = True
for baseSetKey in baseSetKeys:
self.modelXbrl.baseSets[baseSetKey].append(lbElement)
arcrolesFound.add(arcrole)
elif xlinkType == "resource":
# create resource and make accessible by id for document
modelResource = linkElement
if modelResource is not None:
lbElement.labeledResources[linkElement.get("{http://www.w3.org/1999/xlink}label")] \
.append(modelResource)
else:
self.modelXbrl.error("xbrl:schemaDefinitionMissing",
_("Linkbase extended link %(element)s missing schema definition"),
modelObject=lbElement, element=lbElement.prefixedName)