本文整理汇总了Python中arelle.XbrlConst.isStandardRole方法的典型用法代码示例。如果您正苦于以下问题:Python XbrlConst.isStandardRole方法的具体用法?Python XbrlConst.isStandardRole怎么用?Python XbrlConst.isStandardRole使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类arelle.XbrlConst
的用法示例。
在下文中一共展示了XbrlConst.isStandardRole方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: validate
# 需要导入模块: from arelle import XbrlConst [as 别名]
# 或者: from arelle.XbrlConst import isStandardRole [as 别名]
#.........这里部分代码省略.........
versReport.namespaceRenameFrom.get(fromAttr.namespaceURI, fromAttr.namespaceURI) != toAttr.namespaceURI))):
self.modelVersReport.error("vercde:invalidAttributeCorrespondence",
_("%(action)s %(event)s has non-equivalent attributes %(fromQname)s and %(toQname)s"),
modelObject=conceptChange, action=conceptChange.actionId, event=conceptChange.name,
fromQname=fromAttr, toQname=toAttr)
del equivalentAttributes # dereference
# check relationship set changes
for relSetChange in versReport.relationshipSetChanges:
for relationshipSet, name in ((relSetChange.fromRelationshipSet, "fromRelationshipSet"),
(relSetChange.toRelationshipSet, "toRelationshipSet")):
if relationshipSet is not None:
dts = relationshipSet.dts
relationshipSetValid = True
if relationshipSet.link:
if (relationshipSet.link not in dts.qnameConcepts or
(dts.qnameConcepts[relationshipSet.link].type is not None and
not dts.qnameConcepts[relationshipSet.link].type.isDerivedFrom(XbrlConst.qnXlExtendedType))):
self.modelVersReport.error("verrelse:invalidLinkElementReferenceEvent",
_("%(event)s %(relSet)s link %(link)s does not reference an element in its DTS"),
modelObject=relSetChange, event=relSetChange.name, relSet=name,
link=relationshipSet.link)
relationshipSetValid = False
if relationshipSet.arc:
if (relationshipSet.arc not in dts.qnameConcepts or
(dts.qnameConcepts[relationshipSet.arc].type is not None and
not dts.qnameConcepts[relationshipSet.arc].type.isDerivedFrom(XbrlConst.qnXlArcType))):
self.modelVersReport.error("verrelse:invalidArcElementReferenceEvent",
_("%(event)s %(relSet)s arc %(arc) does not reference an element in its DTS"),
modelObject=relSetChange, event=relSetChange.name, relSet=name,
arc=relationshipSet.arc)
relationshipSetValid = False
if relationshipSet.linkrole:
if not (XbrlConst.isStandardRole(relationshipSet.linkrole) or
relationshipSet.linkrole in relationshipSet.dts.roleTypes):
self.modelVersReport.error("verrelse:invalidLinkrole",
_("%(event)s %(relSet)s linkrole %(linkrole)s does not reference an linkrole in its DTS"),
modelObject=relSetChange, event=relSetChange.name, relSet=name,
linkrole=relationshipSet.linkrole)
relationshipSetValid = False
elif not any(linkrole == relationshipSet.linkrole
for arcrole, linkrole, linkqname, arcqname in dts.baseSets.keys()):
self.modelVersReport.error("verrelse:invalidLinkrole",
_("%(event)s %(relSet)s linkrole %(linkrole)s is not used in its DTS"),
modelObject=relSetChange, event=relSetChange.name, relSet=name,
linkrole=relationshipSet.linkrole)
relationshipSetValid = False
if relationshipSet.arcrole:
if not (XbrlConst.isStandardArcrole(relationshipSet.arcrole) or
relationshipSet.arcrole in relationshipSet.dts.arcroleTypes):
self.modelVersReport.error("verrelse:invalidArcrole",
_("%(event)s %(relSet)s arcrole %(arcrole)s does not reference an arcrole in its DTS"),
modelObject=relSetChange, event=relSetChange.name, relSet=name,
arcrole=relationshipSet.arcrole)
relationshipSetValid = False
elif not any(arcrole == relationshipSet.arcrole
for arcrole, linkrole, linkqname, arcqname in dts.baseSets.keys()):
self.modelVersReport.error("verrelse:invalidArcrole",
_("%(event)s %(relSet)s arcrole %(arcrole)s is not used in its DTS"),
modelObject=relSetChange, event=relSetChange.name, relSet=name,
arcrole=relationshipSet.arcrole)
relationshipSetValid = False
for relationship in relationshipSet.relationships:
# fromConcept checks
if relationship.fromConcept is None:
self.modelVersReport.error("vercue:invalidConceptReference",
示例2: validate
# 需要导入模块: from arelle import XbrlConst [as 别名]
# 或者: from arelle.XbrlConst import isStandardRole [as 别名]
#.........这里部分代码省略.........
"err", "vercee:invalidConceptReferenceIdentifier")
else:
self.modelVersReport.error(
_("{0} {1} toResource {2} does not have a reference relationship to {3} in toDTS").format(
conceptChange.actionId, conceptChange.name, conceptChange.toResourceValue, conceptChange.toConceptQname),
"err", "vercee:invalidContentResourceIdentifier")
# check concept correspondence
if fromConcept and toConcept:
if versReport.toDTSqname(fromConcept.qname) != toConcept.qname and \
versReport.equivalentConcepts.get(fromConcept.qname) != toConcept.qname and \
toConcept.qname not in versReport.relatedConcepts.get(fromConcept.qname,[]):
self.modelVersReport.error(
_("{0} {1} fromConcept {2} and toConcept {3} must be equivalent or related").format(
conceptChange.actionId, conceptChange.name, conceptChange.fromConceptQname, conceptChange.toConceptQname),
"err", "vercee:invalidConceptCorrespondence")
# custom attribute events
if conceptChange.name.startswith("conceptAttribute"):
try:
for attr in conceptAttributeEventAttributes[conceptChange.name]:
customAttributeQname = conceptChange.customAttributeQname(attr)
if not customAttributeQname or customAttributeQname.namespaceURI is None:
self.modelVersReport.error(
_("{0} {1} {2} {3} does not have a namespace").format(
conceptChange.actionId, conceptChange.name, attr, customAttributeQname),
"err", "vercee:invalidAttributeChange")
elif customAttributeQname.namespaceURI in (XbrlConst.xbrli, XbrlConst.xsd):
self.modelVersReport.error(
_("{0} {1} {2} {3} has an invalid namespace").format(
conceptChange.actionId, conceptChange.name, attr, customAttributeQname),
"err", "vercee:illegalCustomAttributeEvent")
except KeyError:
self.modelVersReport.error(
_("{0} {1} event is not recognized").format(conceptChange.actionId, conceptChange.name),
"info", "arelle:eventNotRecognized")
# check relationship set changes
for relSetChange in versReport.relationshipSetChanges:
for relationshipSet, name in ((relSetChange.fromRelationshipSet, "fromRelationshipSet"),
(relSetChange.toRelationshipSet, "toRelationshipSet")):
if relationshipSet:
relationshipSetValid = True
if relationshipSet.link and relationshipSet.link not in relationshipSet.dts.qnameConcepts:
self.modelVersReport.error(
_("{0} link {1} does not reference an element in its DTS").format(
relSetChange.name, name, relationshipSet.link),
"err", "verrelse:invalidLinkElementReference")
relationshipSetValid = False
if relationshipSet.arc and relationshipSet.arc not in relationshipSet.dts.qnameConcepts:
self.modelVersReport.error(
_("{0} arc {1} does not reference an element in its DTS").format(
relSetChange.name, name, relationshipSet.link),
"err", "verrelse:invalidArcElementReference")
relationshipSetValid = False
if relationshipSet.linkrole and not (XbrlConst.isStandardRole(relationshipSet.linkrole) or
relationshipSet.linkrole in relationshipSet.dts.roleTypes):
self.modelVersReport.error(
_("{0} linkrole {1} does not reference an linkrole in its DTS").format(
relSetChange.name, name, relationshipSet.linkrole),
"err", "verrelse:invalidLinkrole")
relationshipSetValid = False
if relationshipSet.arcrole and not (XbrlConst.isStandardArcrole(relationshipSet.arcrole) or
relationshipSet.arcrole in relationshipSet.dts.arcroleTypes):
self.modelVersReport.error(
_("{0} arcrole {1} does not reference an arcrole in its DTS").format(
relSetChange.name, name, relationshipSet.linkrole),
"err", "verrelse:invalidArcrole")
relationshipSetValid = False
for relationship in relationshipSet.relationships:
# fromConcept checks
if not relationship.fromConcept:
self.modelVersReport.error(
_("{0} {1} relationship fromConcept {2} does not reference a concept in its DTS").format(
relSetChange.name, name, relationship.fromName),
"err", "verrelse:invalidConceptReference")
relationshipSetValid = False
if relationship.toName and not relationship.toConcept:
self.modelVersReport.error(
_("{0} {1} relationship toConcept {2} does not reference a concept in its DTS").format(
relSetChange.name, name, relationship.toName),
"err", "verrelse:invalidConceptReference")
relationshipSetValid = False
if relationshipSetValid: # test that relations exist
if relationship.fromRelationship is None:
if relationship.toName:
self.modelVersReport.error(
_("{0} {1} no relationship found from toConcept {2} to {3} in its DTS").format(
relSetChange.name, name, relationship.fromName, relationship.toName),
"err", "verrelse:invalidRelationshipReference")
else:
self.modelVersReport.error(
_("{0} {1} no relationship found from toConcept {2} in its DTS").format(
relSetChange.name, name, relationship.fromName),
"err", "verrelse:invalidRelationshipReference")
'''
示例3: validate
# 需要导入模块: from arelle import XbrlConst [as 别名]
# 或者: from arelle.XbrlConst import isStandardRole [as 别名]
#.........这里部分代码省略.........
self.modelVersReport.error("vercee:invalidConceptCorrespondence",
_("%(action)s %(event)s fromConcept %(conceptFrom)s and toConcept %(conceptTo)s must be equivalent or related"),
modelObject=conceptChange, action=conceptChange.actionId,
event=conceptChange.name, conceptFrom=conceptChange.fromConceptQname, conceptTo=conceptChange.toConceptQname)
# custom attribute events
if conceptChange.name.startswith("conceptAttribute"):
try:
for attr in conceptAttributeEventAttributes[conceptChange.name]:
customAttributeQname = conceptChange.customAttributeQname(attr)
if not customAttributeQname or customAttributeQname.namespaceURI is None:
self.modelVersReport.error("vercee:invalidAttributeChange",
_("%(action)s %(event)s %(attr)s $(attrName)s does not have a namespace"),
modelObject=conceptChange, action=conceptChange.actionId,
attr=attr, attrName=customAttributeQname)
elif customAttributeQname.namespaceURI in (XbrlConst.xbrli, XbrlConst.xsd):
self.modelVersReport.error("vercee:illegalCustomAttributeEvent",
_("%(action)s %(event)s %(attr)s $(attrName)s has an invalid namespace"),
modelObject=conceptChange, action=conceptChange.actionId, event=conceptChange.name,
attr=attr, attrName=customAttributeQname)
except KeyError:
self.modelVersReport.info("arelle:eventNotRecognized",
_("%(action)s %(event)s event is not recognized"),
modelObject=conceptChange, action=conceptChange.actionId, event=conceptChange.name)
# check relationship set changes
for relSetChange in versReport.relationshipSetChanges:
for relationshipSet, name in ((relSetChange.fromRelationshipSet, "fromRelationshipSet"),
(relSetChange.toRelationshipSet, "toRelationshipSet")):
if relationshipSet is not None:
relationshipSetValid = True
if relationshipSet.link and relationshipSet.link not in relationshipSet.dts.qnameConcepts:
self.modelVersReport.error("verrelse:invalidLinkElementReference",
_("%(event)s %(relSet)s link %(link)s does not reference an element in its DTS"),
modelObject=relSetChange, event=relSetChange.name, relSet=name,
link=relationshipSet.link)
relationshipSetValid = False
if relationshipSet.arc and relationshipSet.arc not in relationshipSet.dts.qnameConcepts:
self.modelVersReport.error("verrelse:invalidArcElementReference",
_("%(event)s %(relSet)s arc %(arc) does not reference an element in its DTS"),
modelObject=relSetChange, event=relSetChange.name, relSet=name,
arc=relationshipSet.arc)
relationshipSetValid = False
if relationshipSet.linkrole and not (XbrlConst.isStandardRole(relationshipSet.linkrole) or
relationshipSet.linkrole in relationshipSet.dts.roleTypes):
self.modelVersReport.error("verrelse:invalidLinkrole",
_("%(event)s %(relSet)s linkrole %(linkrole)s does not reference an linkrole in its DTS"),
modelObject=relSetChange, event=relSetChange.name, relSet=name,
linkrole=relationshipSet.linkrole)
relationshipSetValid = False
if relationshipSet.arcrole and not (XbrlConst.isStandardArcrole(relationshipSet.arcrole) or
relationshipSet.arcrole in relationshipSet.dts.arcroleTypes):
self.modelVersReport.error("verrelse:invalidArcrole",
_("%(event)s %(relSet)s arcrole %(arcrole)s does not reference an arcrole in its DTS"),
modelObject=relSetChange, event=relSetChange.name, relSet=name,
arcrole=relationshipSet.arcrole)
relationshipSetValid = False
for relationship in relationshipSet.relationships:
# fromConcept checks
if relationship.fromConcept is None:
self.modelVersReport.error("verrelse:invalidConceptReference",
_("%(event)s %(relSet)s relationship fromConcept %(conceptFrom)s does not reference a concept in its DTS"),
modelObject=relSetChange, event=relSetChange.name, relSet=name,
conceptFrom=relationship.fromName)
relationshipSetValid = False
if relationship.toName and relationship.toConcept is None:
self.modelVersReport.error("verrelse:invalidConceptReference",
_("%(event)s %(relSet)s relationship toConcept %(conceptTo)s does not reference a concept in its DTS"),
modelObject=relSetChange, event=relSetChange.name, relSet=name,
conceptTo=relationship.toName)
relationshipSetValid = False
if relationshipSetValid: # test that relations exist
if relationship.fromRelationship is None:
if relationship.toName:
self.modelVersReport.error("verrelse:invalidRelationshipReference",
_("%(event)s %(relSet)s no relationship found from fromConcept %(conceptFrom)s to toConcept %(conceptTo)s in its DTS"),
modelObject=relSetChange, event=relSetChange.name, relSet=name,
conceptFrom=relationship.fromName, conceptTo=relationship.toName)
else:
self.modelVersReport.error("verrelse:invalidRelationshipReference",
_("%(event)s %(relSet)s no relationship found fromConcept %(conceptFrom)s in its DTS"),
modelObject=relSetChange, event=relSetChange.name, relSet=name,
conceptFrom=relationship.fromName)
'''
# check instance aspect changes
for iaChange in versReport.instanceAspectChanges:
# validate related concepts
for aspectName in ("{http://xbrl.org/2010/versioning-instance-aspects}concept", "{http://xbrl.org/2010/versioning-instance-aspects}member"):
for aspectElt in iaChange.iterdescendants(aspectName):
# check link attribute
link = aspectElement.get("link")
if link is not None:
iaChange.hrefToModelObject(link, dts)
'''
self.close()
示例4: checkDTSdocument
# 需要导入模块: from arelle import XbrlConst [as 别名]
# 或者: from arelle.XbrlConst import isStandardRole [as 别名]
def checkDTSdocument(val, modelDocument, isFilingDocument):
for hrefElt, _hrefedDoc, hrefId in modelDocument.hrefObjects:
if hrefId: #check scheme regardless of whether document loaded
# check all xpointer schemes
for scheme, _path in XmlUtil.xpointerSchemes(hrefId):
if scheme == "element" and val.validateDisclosureSystem:
val.modelXbrl.error(("EFM.6.03.06", "GFM.1.01.03"),
_("Href %(elementHref)s may only have shorthand xpointers"),
modelObject=hrefElt,
elementHref=hrefElt.get("{http://www.w3.org/1999/xlink}href"))
if not isFilingDocument:
return # not a filing's extension document
if modelDocument.type == ModelDocument.Type.SCHEMA:
if modelDocument.targetNamespace is not None and len(modelDocument.targetNamespace) > 85:
l = len(modelDocument.targetNamespace.encode("utf-8"))
if l > 255:
val.modelXbrl.error("EFM.6.07.30",
_("Schema targetNamespace length (%(length)s) is over 255 bytes long in utf-8 %(targetNamespace)s"),
modelObject=modelDocument.xmlRootElement, length=l, targetNamespace=modelDocument.targetNamespace, value=modelDocument.targetNamespace)
if modelDocument.type in (ModelDocument.Type.SCHEMA, ModelDocument.Type.LINKBASE):
isSchema = modelDocument.type == ModelDocument.Type.SCHEMA
if isSchema:
for elt in modelDocument.xmlRootElement.iter(tag="{http://www.w3.org/2001/XMLSchema}*"):
if elt.namespaceURI == XbrlConst.xsd:
localName = elt.localName
if localName in {"element", "complexType", "simpleType"}:
name = elt.get("name")
if name and len(name) > 64:
l = len(name.encode("utf-8"))
if l > 200:
val.modelXbrl.error("EFM.6.07.29",
_("Schema %(element)s has a name length (%(length)s) over 200 bytes long in utf-8, %(name)s."),
modelObject=elt, element=localName, name=name, length=l)
for elt in modelDocument.xmlRootElement.iter():
if isinstance(elt, ModelObject):
xlinkType = elt.get("{http://www.w3.org/1999/xlink}type")
xlinkRole = elt.get("{http://www.w3.org/1999/xlink}role")
if elt.namespaceURI == XbrlConst.link:
# check schema roleTypes
if elt.localName in ("roleType","arcroleType"):
uriAttr = {"roleType":"roleURI", "arcroleType":"arcroleURI"}[elt.localName]
roleURI = elt.get(uriAttr)
if len(roleURI) > 85:
l = len(roleURI.encode("utf-8"))
if l > 255:
val.modelXbrl.error("EFM.6.07.30",
_("Schema %(element)s %(attribute)s length (%(length)s) is over 255 bytes long in utf-8 %(roleURI)s"),
modelObject=elt, element=elt.qname, attribute=uriAttr, length=l, roleURI=roleURI, value=roleURI)
if elt.localName == "arcroleRef":
refUri = elt.get("arcroleURI")
hrefAttr = elt.get("{http://www.w3.org/1999/xlink}href")
hrefUri, hrefId = UrlUtil.splitDecodeFragment(hrefAttr)
if hrefUri not in val.disclosureSystem.standardTaxonomiesDict:
val.modelXbrl.error(("EFM.6.09.06", "GFM.1.04.06"),
_("Arcrole %(refURI)s arcroleRef %(xlinkHref)s must be a standard taxonomy"),
modelObject=elt, refURI=refUri, xlinkHref=hrefUri)
if modelDocument.type == ModelDocument.Type.INLINEXBRL and elt.namespaceURI in XbrlConst.ixbrlAll:
if elt.localName == "footnote":
if val.validateGFM:
if elt.get("{http://www.w3.org/1999/xlink}arcrole") != XbrlConst.factFootnote:
# must be in a nonDisplay div
if not any(inlineDisplayNonePattern.search(e.get("style") or "")
for e in XmlUtil.ancestors(elt, XbrlConst.xhtml, "div")):
val.modelXbrl.error(("EFM.N/A", "GFM:1.10.16"),
_("Inline XBRL footnote %(footnoteID)s must be in non-displayable div due to arcrole %(arcrole)s"),
modelObject=elt, footnoteID=elt.get("footnoteID"),
arcrole=elt.get("{http://www.w3.org/1999/xlink}arcrole"))
if not elt.get("{http://www.w3.org/XML/1998/namespace}lang"):
val.modelXbrl.error(("EFM.N/A", "GFM:1.10.13"),
_("Inline XBRL footnote %(footnoteID)s is missing an xml:lang attribute"),
modelObject=elt, footnoteID=id)
if xlinkType == "extended":
if not xlinkRole or xlinkRole == "":
val.modelXbrl.error(("EFM.6.09.04", "GFM.1.04.04"),
"%(element)s is missing an xlink:role",
modelObject=elt, element=elt.qname)
if not val.extendedElementName:
val.extendedElementName = elt.qname
elif val.extendedElementName != elt.qname:
val.modelXbrl.error(("EFM.6.09.07", "GFM:1.04.07"),
_("Extended element %(element)s must be the same as %(element2)s"),
modelObject=elt, element=elt.qname, element2=val.extendedElementName)
elif xlinkType == "resource":
if not xlinkRole:
val.modelXbrl.error(("EFM.6.09.04", "GFM.1.04.04"),
_("%(element)s is missing an xlink:role"),
modelObject=elt, element=elt.qname)
elif not XbrlConst.isStandardRole(xlinkRole):
modelsRole = val.modelXbrl.roleTypes.get(xlinkRole)
if (modelsRole is None or len(modelsRole) == 0 or
modelsRole[0].modelDocument.targetNamespace not in val.disclosureSystem.standardTaxonomiesDict):
val.modelXbrl.error(("EFM.6.09.05", "GFM.1.04.05"),
_("Resource %(xlinkLabel)s role %(role)s is not a standard taxonomy role"),
modelObject=elt, xlinkLabel=elt.get("{http://www.w3.org/1999/xlink}label"), role=xlinkRole, element=elt.qname,
#.........这里部分代码省略.........