本文整理汇总了Python中arelle.UrlUtil.isAbsolute方法的典型用法代码示例。如果您正苦于以下问题:Python UrlUtil.isAbsolute方法的具体用法?Python UrlUtil.isAbsolute怎么用?Python UrlUtil.isAbsolute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类arelle.UrlUtil
的用法示例。
在下文中一共展示了UrlUtil.isAbsolute方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: resolveHtmlUri
# 需要导入模块: from arelle import UrlUtil [as 别名]
# 或者: from arelle.UrlUtil import isAbsolute [as 别名]
def resolveHtmlUri(elt, name, value):
if name == "archive": # URILIST
return " ".join(resolveHtmlUri(elt, None, v) for v in value.split(" "))
if not UrlUtil.isAbsolute(value) and not value.startswith("/"):
if elt.modelDocument.htmlBase is not None:
value = elt.modelDocument.htmlBase + value
# canonicalize ../ and ./
scheme, sep, pathpart = value.rpartition("://")
if sep:
pathpart = pathpart.replace('\\','/')
endingSep = '/' if pathpart[-1] == '/' else '' # normpath drops ending directory separator
_uri = scheme + "://" + posixpath.normpath(pathpart) + endingSep
else:
_uri = posixpath.normpath(value)
return _uri # .replace(" ", "%20") requirement for this is not yet clear
示例2: final
# 需要导入模块: from arelle import UrlUtil [as 别名]
# 或者: from arelle.UrlUtil import isAbsolute [as 别名]
def final(val):
if not (val.validateEBA or val.validateEIOPA):
return
modelXbrl = val.modelXbrl
modelDocument = modelXbrl.modelDocument
_statusMsg = _("validating {0} filing rules").format(val.disclosureSystem.name)
modelXbrl.profileActivity()
modelXbrl.modelManager.showStatus(_statusMsg)
if modelDocument.type == ModelDocument.Type.INSTANCE and (val.validateEBA or val.validateEIOPA):
if not modelDocument.uri.endswith(".xbrl"):
modelXbrl.warning("EBA.1.1",
_('XBRL instance documents SHOULD use the extension ".xbrl" but it is "%(extension)s"'),
modelObject=modelDocument, extension=os.path.splitext(modelDocument.basename)[1])
if modelDocument.documentEncoding.lower() not in ("utf-8", "utf-8-sig"):
modelXbrl.error("EBA.1.4",
_('XBRL instance documents MUST use "UTF-8" encoding but is "%(xmlEncoding)s"'),
modelObject=modelDocument, xmlEncoding=modelDocument.documentEncoding)
schemaRefElts = []
schemaRefFileNames = []
for doc, docRef in modelDocument.referencesDocument.items():
if docRef.referenceType == "href":
if docRef.referringModelObject.localName == "schemaRef":
schemaRefElts.append(docRef.referringModelObject)
schemaRefFileNames.append(doc.basename)
if not UrlUtil.isAbsolute(doc.uri):
modelXbrl.error("EBA.2.2",
_('The link:schemaRef element in submitted instances MUST resolve to the full published entry point URL: %(url)s.'),
modelObject=docRef.referringModelObject, url=doc.uri)
elif docRef.referringModelObject.localName == "linkbaseRef":
modelXbrl.error("EBA.2.3",
_('The link:linkbaseRef element is not allowed: %(fileName)s.'),
modelObject=docRef.referringModelObject, fileName=doc.basename)
if len(schemaRefFileNames) > 1:
modelXbrl.error("EBA.1.5",
_('XBRL instance documents MUST reference only one entry point schema but %(numEntryPoints)s were found: %(entryPointNames)s'),
modelObject=modelDocument, numEntryPoints=len(schemaRefFileNames), entryPointNames=', '.join(sorted(schemaRefFileNames)))
### check entry point names appropriate for filing indicator (DPM DB?)
if len(schemaRefElts) != 1:
modelXbrl.error("EBA.2.3",
_('Any reported XBRL instance document MUST contain only one xbrli:xbrl/link:schemaRef node, but %(entryPointCount)s.'),
modelObject=schemaRefElts, entryPointCount=len(schemaRefElts))
# non-streaming EBA checks
if not getattr(modelXbrl, "isStreamingMode", False):
validateFacts(val, modelXbrl.facts)
# check sum of fact md5s (otherwise checked in streaming process)
xbrlFactsCheckVersion = None
expectedSumOfFactMd5s = None
for pi in modelDocument.xmlRootElement.getchildren():
if isinstance(pi, etree._ProcessingInstruction) and pi.target == "xbrl-facts-check":
_match = re.search("([\\w-]+)=[\"']([^\"']+)[\"']", pi.text)
if _match:
_matchGroups = _match.groups()
if len(_matchGroups) == 2:
if _matchGroups[0] == "version":
xbrlFactsCheckVersion = _matchGroups[1]
elif _matchGroups[0] == "sum-of-fact-md5s":
try:
expectedSumOfFactMd5s = Md5Sum(_matchGroups[1])
except ValueError:
modelXbrl.error("EIOPA:xbrlFactsCheckError",
_("Invalid sum-of-md5s %(sumOfMd5)s"),
modelObject=modelXbrl, sumOfMd5=_matchGroups[1])
if xbrlFactsCheckVersion and expectedSumOfFactMd5s:
sumOfFactMd5s = Md5Sum()
for f in modelXbrl.factsInInstance:
sumOfFactMd5s += f.md5sum
if sumOfFactMd5s != expectedSumOfFactMd5s:
modelXbrl.warning("EIOPA:xbrlFactsCheckWarning",
_("XBRL facts sum of md5s expected %(expectedMd5)s not matched to actual sum %(actualMd5Sum)s"),
modelObject=modelXbrl, expectedMd5=expectedSumOfFactMd5s, actualMd5Sum=sumOfFactMd5s)
else:
modelXbrl.info("info",
_("Successful XBRL facts sum of md5s."),
modelObject=modelXbrl)
if not val.filingIndicators:
modelXbrl.error("EBA.1.6",
_('Missing filing indicators. Reported XBRL instances MUST include appropriate filing indicator elements'),
modelObject=modelDocument)
if val.numFilingIndicatorTuples > 1:
modelXbrl.info("EBA.1.6.2",
_('Multiple filing indicators tuples when not in streaming mode (info).'),
modelObject=modelXbrl.factsByQname[qnFIndicators])
if len(val.cntxDates) > 1:
modelXbrl.error("EBA.2.13",
_('Contexts must have the same date: %(dates)s.'),
# when streaming values are no longer available, but without streaming they can be logged
modelObject=set(_cntx for _cntxs in val.cntxDates.values() for _cntx in _cntxs),
dates=', '.join(XmlUtil.dateunionValue(_dt, subtractOneDay=True)
for _dt in val.cntxDates.keys()))
if val.unusedCntxIDs:
#.........这里部分代码省略.........
示例3: final
# 需要导入模块: from arelle import UrlUtil [as 别名]
# 或者: from arelle.UrlUtil import isAbsolute [as 别名]
def final(val):
if not (val.validateEBA or val.validateEIOPA):
return
modelXbrl = val.modelXbrl
modelDocument = modelXbrl.modelDocument
_statusMsg = _("validating {0} filing rules").format(val.disclosureSystem.name)
modelXbrl.profileActivity()
modelXbrl.modelManager.showStatus(_statusMsg)
if modelDocument.type == ModelDocument.Type.INSTANCE and (val.validateEBA or val.validateEIOPA):
if not modelDocument.uri.endswith(".xbrl"):
modelXbrl.warning("EBA.1.1",
_('XBRL instance documents SHOULD use the extension ".xbrl" but it is "%(extension)s"'),
modelObject=modelDocument, extension=os.path.splitext(modelDocument.basename)[1])
modelXbrl.error("EIOPA.S.1.1.a",
_('XBRL instance documents MUST use the extension ".xbrl" but it is "%(extension)s"'),
modelObject=modelDocument, extension=os.path.splitext(modelDocument.basename)[1])
if val.isEIOPA_2_0_1: _encodings = ("UTF-8", "utf-8-sig")
else: _encodings = ("utf-8", "UTF-8", "utf-8-sig")
if modelDocument.documentEncoding not in _encodings:
modelXbrl.error(("EBA.1.4", "EIOPA.1.4"),
_('XBRL instance documents MUST use "UTF-8" encoding but is "%(xmlEncoding)s"'),
modelObject=modelDocument, xmlEncoding=modelDocument.documentEncoding)
schemaRefElts = []
schemaRefFileNames = []
for doc, docRef in modelDocument.referencesDocument.items():
if docRef.referenceType == "href":
if docRef.referringModelObject.localName == "schemaRef":
schemaRefElts.append(docRef.referringModelObject)
schemaRefFileNames.append(doc.basename)
if not UrlUtil.isAbsolute(doc.uri):
modelXbrl.error(("EBA.2.2", "EIOPA.S.1.5.a" if val.isEIOPAfullVersion else "EIOPA.S.1.5.b"),
_('The link:schemaRef element in submitted instances MUST resolve to the full published entry point URL: %(url)s.'),
modelObject=docRef.referringModelObject, url=doc.uri,
messageCodes=("EBA.2.2", "EIOPA.S.1.5.a","EIOPA.S.1.5.b"))
elif docRef.referringModelObject.localName == "linkbaseRef":
modelXbrl.error(("EBA.2.3","EIOPA.S.1.5.a"),
_('The link:linkbaseRef element is not allowed: %(fileName)s.'),
modelObject=docRef.referringModelObject, fileName=doc.basename)
_numSchemaRefs = len(XmlUtil.children(modelDocument.xmlRootElement, XbrlConst.link, "schemaRef"))
if _numSchemaRefs > 1:
modelXbrl.error(("EIOPA.S.1.5.a", "EBA.1.5"),
_('XBRL instance documents MUST reference only one entry point schema but %(numEntryPoints)s were found: %(entryPointNames)s'),
modelObject=modelDocument, numEntryPoints=_numSchemaRefs, entryPointNames=', '.join(sorted(schemaRefFileNames)))
### check entry point names appropriate for filing indicator (DPM DB?)
if len(schemaRefElts) != 1:
modelXbrl.error("EBA.2.3",
_('Any reported XBRL instance document MUST contain only one xbrli:xbrl/link:schemaRef node, but %(entryPointCount)s.'),
modelObject=schemaRefElts, entryPointCount=len(schemaRefElts))
# non-streaming EBA checks
if not getattr(modelXbrl, "isStreamingMode", False):
val.qnReportedCurrency = None
if val.isEIOPA_2_0_1 and qnMetReportingCurrency in modelXbrl.factsByQname:
for _multiCurrencyFact in modelXbrl.factsByQname[qnMetReportingCurrency]:
# multi-currency fact
val.qnReportedCurrency = _multiCurrencyFact.xValue
break
validateFacts(val, modelXbrl.facts)
# check sum of fact md5s (otherwise checked in streaming process)
xbrlFactsCheckVersion = None
expectedSumOfFactMd5s = None
for pi in modelDocument.xmlRootElement.getchildren():
if isinstance(pi, etree._ProcessingInstruction) and pi.target == "xbrl-facts-check":
_match = re.search("([\\w-]+)=[\"']([^\"']+)[\"']", pi.text)
if _match:
_matchGroups = _match.groups()
if len(_matchGroups) == 2:
if _matchGroups[0] == "version":
xbrlFactsCheckVersion = _matchGroups[1]
elif _matchGroups[0] == "sum-of-fact-md5s":
try:
expectedSumOfFactMd5s = Md5Sum(_matchGroups[1])
except ValueError:
modelXbrl.error("EIOPA:xbrlFactsCheckError",
_("Invalid sum-of-md5s %(sumOfMd5)s"),
modelObject=modelXbrl, sumOfMd5=_matchGroups[1])
if xbrlFactsCheckVersion and expectedSumOfFactMd5s:
sumOfFactMd5s = Md5Sum()
for f in modelXbrl.factsInInstance:
sumOfFactMd5s += f.md5sum
if sumOfFactMd5s != expectedSumOfFactMd5s:
modelXbrl.warning("EIOPA:xbrlFactsCheckWarning",
_("XBRL facts sum of md5s expected %(expectedMd5)s not matched to actual sum %(actualMd5Sum)s"),
modelObject=modelXbrl, expectedMd5=expectedSumOfFactMd5s, actualMd5Sum=sumOfFactMd5s)
else:
modelXbrl.info("info",
_("Successful XBRL facts sum of md5s."),
modelObject=modelXbrl)
if any(badError in modelXbrl.errors
for badError in ("EBA.2.1", "EIOPA.2.1", "EIOPA.S.1.5.a/EIOPA.S.1.5.b")):
pass # skip checking filingIndicators if bad errors
elif not val.filingIndicators:
#.........这里部分代码省略.........
示例4: final
# 需要导入模块: from arelle import UrlUtil [as 别名]
# 或者: from arelle.UrlUtil import isAbsolute [as 别名]
def final(val):
if not (val.validateEBA or val.validateEIOPA):
return
modelXbrl = val.modelXbrl
modelDocument = modelXbrl.modelDocument
_statusMsg = _("validating {0} filing rules").format(val.disclosureSystem.name)
modelXbrl.profileActivity()
val.showStatus(_statusMsg)
if modelDocument.type == ModelDocument.Type.INSTANCE and (val.validateEBA or val.validateEIOPA):
if not modelDocument.uri.endswith(".xbrl"):
modelXbrl.warning("EBA.1.1",
_('XBRL instance documents SHOULD use the extension ".xbrl" but it is "%(extension)s"'),
modelObject=modelDocument, xmlEncoding=os.path.splitext(modelDocument.basename)[1])
if modelDocument.documentEncoding.lower() not in ("utf-8", "utf-8-sig"):
modelXbrl.error("EBA.1.4",
_('XBRL instance documents MUST use "UTF-8" encoding but is "%(xmlEncoding)s"'),
modelObject=modelDocument, xmlEncoding=modelDocument.documentEncoding)
schemaRefElts = []
schemaRefFileNames = []
for doc, docRef in modelDocument.referencesDocument.items():
if docRef.referenceType == "href":
if docRef.referringModelObject.localName == "schemaRef":
schemaRefElts.append(docRef.referringModelObject)
schemaRefFileNames.append(doc.basename)
if not UrlUtil.isAbsolute(doc.uri):
modelXbrl.error("EBA.2.2",
_('The link:schemaRef element in submitted instances MUST resolve to the full published entry point URL: %(url)s.'),
modelObject=docRef.referringModelObject, url=doc.uri)
elif docRef.referringModelObject.localName == "linkbaseRef":
modelXbrl.error("EBA.2.3",
_('The link:linkbaseRef element is not allowed: %(fileName)s.'),
modelObject=docRef.referringModelObject, fileName=doc.basename)
if len(schemaRefFileNames) > 1:
modelXbrl.error("EBA.1.5",
_('XBRL instance documents MUST reference only one entry point schema but %(numEntryPoints)s were found: %(entryPointNames)s'),
modelObject=modelDocument, numEntryPoints=len(schemaRefFileNames), entryPointNames=', '.join(sorted(schemaRefFileNames)))
### check entry point names appropriate for filing indicator (DPM DB?)
if len(schemaRefElts) != 1:
modelXbrl.error("EBA.2.3",
_('Any reported XBRL instance document MUST contain only one xbrli:xbrl/link:schemaRef node, but %(entryPointCount)s.'),
modelObject=schemaRefElts, entryPointCount=len(schemaRefElts))
filingIndicators = {}
for fIndicator in modelXbrl.factsByQname[qnFilingIndicator]:
_value = (fIndicator.xValue or fIndicator.value) # use validated xValue if DTS else value for skipDTS
if _value in filingIndicators:
modelXbrl.error("EBA.1.6.1",
_('Multiple filing indicators facts for indicator %(filingIndicator)s.'),
modelObject=(fIndicator, filingIndicators[_value]), filingIndicator=_value)
filingIndicators[_value] = fIndicator
if not filingIndicators:
modelXbrl.error("EBA.1.6",
_('Missing filing indicators. Reported XBRL instances MUST include appropriate filing indicator elements'),
modelObject=modelDocument)
numFilingIndicatorTuples = len(modelXbrl.factsByQname[qnFIndicators])
if numFilingIndicatorTuples > 1 and not getattr(modelXbrl, "isStreamingMode", False):
modelXbrl.info("EBA.1.6.2",
_('Multiple filing indicators tuples when not in streaming mode (info).'),
modelObject=modelXbrl.factsByQname[qnFIndicators])
# note EBA 2.1 is in ModelDocument.py
cntxIDs = set()
cntxEntities = set()
cntxDates = defaultdict(list)
timelessDatePattern = re.compile(r"\s*([0-9]{4})-([0-9]{2})-([0-9]{2})\s*$")
for cntx in modelXbrl.contexts.values():
cntxIDs.add(cntx.id)
cntxEntities.add(cntx.entityIdentifier)
dateElts = XmlUtil.descendants(cntx, XbrlConst.xbrli, ("startDate","endDate","instant"))
if any(not timelessDatePattern.match(e.textValue) for e in dateElts):
modelXbrl.error("EBA.2.10",
_('Period dates must be whole dates without time or timezone: %(dates)s.'),
modelObject=cntx, dates=", ".join(e.text for e in dateElts))
if cntx.isForeverPeriod:
modelXbrl.error("EBA.2.11",
_('Forever context period is not allowed.'),
modelObject=cntx)
elif cntx.isStartEndPeriod:
modelXbrl.error("EBA.2.13",
_('Start-End (flow) context period is not allowed.'),
modelObject=cntx)
elif cntx.isInstantPeriod:
cntxDates[cntx.instantDatetime].append(cntx)
if XmlUtil.hasChild(cntx, XbrlConst.xbrli, "segment"):
modelXbrl.error("EBA.2.14",
_("The segment element not allowed in context Id: %(context)s"),
modelObject=cntx, context=cntx.contextID)
for scenElt in XmlUtil.descendants(cntx, XbrlConst.xbrli, "scenario"):
childTags = ", ".join([child.prefixedName for child in scenElt.iterchildren()
if isinstance(child,ModelObject) and
child.tag != "{http://xbrl.org/2006/xbrldi}explicitMember" and
child.tag != "{http://xbrl.org/2006/xbrldi}typedMember"])
if len(childTags) > 0:
#.........这里部分代码省略.........
示例5: validateTestcase
# 需要导入模块: from arelle import UrlUtil [as 别名]
# 或者: from arelle.UrlUtil import isAbsolute [as 别名]
#.........这里部分代码省略.........
modelXbrl.error("exception:" + type(err).__name__,
_("Testcase variation validation exception: %(error)s, instance: %(instance)s"),
modelXbrl=modelXbrl, instance=modelXbrl.modelDocument.basename, error=err, exc_info=True)
modelXbrl.hasFormulae = _hasFormulae
if resultIsVersioningReport and modelXbrl.modelDocument:
versReportFile = modelXbrl.modelManager.cntlr.webCache.normalizeUrl(
modelTestcaseVariation.versioningReportUri, baseForElement)
if os.path.exists(versReportFile): #validate existing
modelVersReport = ModelXbrl.load(self.modelXbrl.modelManager, versReportFile, _("validating existing version report"))
if modelVersReport and modelVersReport.modelDocument and modelVersReport.modelDocument.type == Type.VERSIONINGREPORT:
ValidateVersReport.ValidateVersReport(self.modelXbrl).validate(modelVersReport)
self.determineTestStatus(modelTestcaseVariation, modelVersReport.errors)
modelVersReport.close()
elif len(inputDTSes) == 2:
ModelVersReport.ModelVersReport(self.modelXbrl).diffDTSes(
versReportFile, inputDTSes["from"], inputDTSes["to"])
modelTestcaseVariation.status = "generated"
else:
modelXbrl.error("arelle:notLoaded",
_("Variation %(id)s %(name)s input DTSes not loaded, unable to generate versioning report: %(file)s"),
modelXbrl=testcase, id=modelTestcaseVariation.id, name=modelTestcaseVariation.name, file=os.path.basename(readMeFirstUri))
modelTestcaseVariation.status = "failed"
for inputDTS in inputDTSes.values():
inputDTS.close()
del inputDTSes # dereference
elif resultIsTaxonomyPackage:
self.determineTestStatus(modelTestcaseVariation, modelXbrl.errors)
modelXbrl.close()
elif inputDTSes:
# validate schema, linkbase, or instance
modelXbrl = inputDTSes[None][0]
expectedDataFiles = set(modelXbrl.modelManager.cntlr.webCache.normalizeUrl(uri, baseForElement)
for d in modelTestcaseVariation.dataUris.values() for uri in d
if not UrlUtil.isAbsolute(uri))
foundDataFiles = set()
variationBase = os.path.dirname(baseForElement)
for dtsName, inputDTS in inputDTSes.items(): # input instances are also parameters
if dtsName: # named instance
parameters[dtsName] = (None, inputDTS) #inputDTS is a list of modelXbrl's (instance DTSes)
elif len(inputDTS) > 1: # standard-input-instance with multiple instance documents
parameters[XbrlConst.qnStandardInputInstance] = (None, inputDTS) # allow error detection in validateFormula
for _inputDTS in inputDTS:
for docUrl, doc in _inputDTS.urlDocs.items():
if docUrl.startswith(variationBase) and not doc.type == Type.INLINEXBRLDOCUMENTSET:
if getattr(doc,"loadedFromXbrlFormula", False): # may have been sourced from xf file
if docUrl.replace("-formula.xml", ".xf") in expectedDataFiles:
docUrl = docUrl.replace("-formula.xml", ".xf")
foundDataFiles.add(docUrl)
if expectedDataFiles - foundDataFiles:
modelXbrl.info("arelle:testcaseDataNotUsed",
_("Variation %(id)s %(name)s data files not used: %(missingDataFiles)s"),
modelObject=modelTestcaseVariation, name=modelTestcaseVariation.name, id=modelTestcaseVariation.id,
missingDataFiles=", ".join(sorted(os.path.basename(f) for f in expectedDataFiles - foundDataFiles)))
if foundDataFiles - expectedDataFiles:
modelXbrl.info("arelle:testcaseDataUnexpected",
_("Variation %(id)s %(name)s files not in variation data: %(unexpectedDataFiles)s"),
modelObject=modelTestcaseVariation, name=modelTestcaseVariation.name, id=modelTestcaseVariation.id,
unexpectedDataFiles=", ".join(sorted(os.path.basename(f) for f in foundDataFiles - expectedDataFiles)))
if modelXbrl.hasTableRendering or modelTestcaseVariation.resultIsTable:
try:
RenderingEvaluator.init(modelXbrl)
except Exception as err:
modelXbrl.error("exception:" + type(err).__name__,
_("Testcase RenderingEvaluator.init exception: %(error)s, instance: %(instance)s"),
modelXbrl=modelXbrl, instance=modelXbrl.modelDocument.basename, error=err, exc_info=True)
modelXbrlHasFormulae = modelXbrl.hasFormulae
示例6: checkDTSdocument
# 需要导入模块: from arelle import UrlUtil [as 别名]
# 或者: from arelle.UrlUtil import isAbsolute [as 别名]
def checkDTSdocument(val, modelDocument):
modelXbrl = val.modelXbrl
if modelDocument.type == ModelDocument.Type.INSTANCE:
if not modelDocument.uri.endswith(".xbrl"):
modelXbrl.warning("EBA.1.1",
_('XBRL instance documents SHOULD use the extension ".xbrl" encoding but it is "%(extension)s"'),
modelObject=modelDocument, xmlEncoding=os.path.splitext(modelDocument.basename)[1])
if modelDocument.documentEncoding.lower() not in ("utf-8", "utf-8-sig"):
modelXbrl.error("EBA.1.4",
_('XBRL instance documents MUST use "UTF-8" encoding but is "%(xmlEncoding)s"'),
modelObject=modelDocument, xmlEncoding=modelDocument.documentEncoding)
schemaRefElts = []
schemaRefFileNames = []
for doc, docRef in modelDocument.referencesDocument.items():
if docRef.referenceType == "href":
if docRef.referringModelObject.localName == "schemaRef":
schemaRefElts.append(docRef.referringModelObject)
schemaRefFileNames.append(doc.basename)
if not UrlUtil.isAbsolute(doc.uri):
modelXbrl.error("EBA.2.2",
_('The link:schemaRef element in submitted instances MUST resolve to the full published entry point URL: %(url)s.'),
modelObject=docRef.referringModelObject, url=doc.uri)
elif docRef.referringModelObject.localName == "linkbaseRef":
modelXbrl.error("EBA.2.3",
_('The link:linkbaseRef element is not allowed: %(fileName)s.'),
modelObject=docRef.referringModelObject, fileName=doc.basename)
if len(schemaRefFileNames) > 1:
modelXbrl.error("EBA.1.5",
_('XBRL instance documents MUST reference only one entry point schema but %(numEntryPoints)s were found: %(entryPointNames)s'),
modelObject=modelDocument, numEntryPoints=len(schemaRefFileNames), entryPointNames=', '.join(sorted(schemaRefFileNames)))
### check entry point names appropriate for filing indicator (DPM DB?)
if len(schemaRefElts) != 1:
modelXbrl.error("EBA.2.3",
_('Any reported XBRL instance document MUST contain only one xbrli:xbrl/link:schemaRef node, but %(entryPointCount)s.'),
modelObject=schemaRefElts, entryPointCount=len(schemaRefElts))
filingIndicators = {}
for fIndicator in modelXbrl.factsByQname[qnFilingIndicator]:
if fIndicator.xValue in filingIndicators:
modelXbrl.error("EBA.1.6.1",
_('Multiple filing indicators facts for indicator %(filingIndicator)s.'),
modelObject=(fIndicator, filingIndicators[filingIndicators]), filingIndicator=fIndicator.xValue)
filingIndicators[fIndicator.xValue] = fIndicator
if not filingIndicators:
modelXbrl.error("EBA.1.6",
_('Missing filing indicators. Reported XBRL instances MUST include appropriate filing indicator elements'),
modelObject=modelDocument)
numFilingIndicatorTuples = len(modelXbrl.factsByQname[qnFilingIndicators])
if numFilingIndicatorTuples > 1 and not getattr(modelXbrl, "isStreamingMode", False):
modelXbrl.info("EBA.1.6.2",
_('Multiple filing indicators tuples when not in streaming mode (info).'),
modelObject=modelXbrl.factsByQname[qnFilingIndicators])
# note EBA 2.1 is in ModelDocument.py
cntxIDs = set()
cntxEntities = set()
timelessDatePattern = re.compile(r"\s*([0-9]{4})-([0-9]{2})-([0-9]{2})\s*$")
for cntx in modelXbrl.contexts.values():
cntxIDs.add(cntx.id)
cntxEntities.add(cntx.entityIdentifier)
dateElts = XmlUtil.descendants(cntx, XbrlConst.xbrli, ("startDate","endDate","instant"))
if any(not timelessDatePattern.match(e.textValue) for e in dateElts):
modelXbrl.error("EBA.2.10",
_('Period dates must be whole dates without time or timezone: %(dates)s.'),
modelObject=cntx, dates=", ".join(e.text for e in dateElts))
if cntx.isForeverPeriod:
modelXbrl.error("EBA.2.11",
_('Forever context period is not allowed.'),
modelObject=cntx)
if XmlUtil.hasChild(cntx, XbrlConst.xbrli, "segment"):
modelXbrl.error("EBA.2.14",
_("The segment element not allowed in context Id: %(context)s"),
modelObject=cntx, context=cntx.contextID)
for scenElt in XmlUtil.descendants(cntx, XbrlConst.xbrli, "scenario"):
childTags = ", ".join([child.prefixedName for child in scenElt.iterchildren()
if isinstance(child,ModelObject) and
child.tag != "{http://xbrl.org/2006/xbrldi}explicitMember" and
child.tag != "{http://xbrl.org/2006/xbrldi}typedMember"])
if len(childTags) > 0:
modelXbrl.error("EBA.2.15",
_("Scenario of context Id %(context)s has disallowed content: %(content)s"),
modelObject=cntx, context=cntx.id, content=childTags)
unusedCntxIDs = cntxIDs - {fact.contextID for fact in modelXbrl.facts}
if unusedCntxIDs:
modelXbrl.warning("EBA.2.7",
_('Unused xbrli:context nodes SHOULD NOT be present in the instance: %(unusedContextIDs)s.'),
modelObject=[modelXbrl.contexts[unusedCntxID] for unusedCntxID in unusedCntxIDs],
unusedContextIDs=", ".join(sorted(unusedCntxIDs)))
if len(cntxEntities) > 1:
modelXbrl.warning("EBA.2.9",
_('All entity identifiers and schemes must be the same, %(count)s found: %(entities)s.'),
modelObject=modelDocument, count=len(cntxEntities),
entities=", ".join(sorted(str(cntxEntity) for cntxEntity in cntxEntities)))
#.........这里部分代码省略.........