arelle-release 2.37.47__py3-none-any.whl → 2.37.49__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of arelle-release might be problematic. Click here for more details.

Files changed (100) hide show
  1. arelle/CntlrCmdLine.py +5 -1
  2. arelle/ModelObjectFactory.py +18 -2
  3. arelle/_version.py +2 -2
  4. arelle/plugin/validate/EDINET/Constants.py +6 -0
  5. arelle/plugin/validate/EDINET/PluginValidationDataExtension.py +134 -7
  6. arelle/plugin/validate/EDINET/Statement.py +139 -0
  7. arelle/plugin/validate/EDINET/rules/contexts.py +5 -10
  8. arelle/plugin/validate/EDINET/rules/edinet.py +89 -51
  9. arelle/plugin/validate/EDINET/rules/gfm.py +41 -0
  10. {arelle_release-2.37.47.dist-info → arelle_release-2.37.49.dist-info}/METADATA +3 -1
  11. {arelle_release-2.37.47.dist-info → arelle_release-2.37.49.dist-info}/RECORD +15 -99
  12. arelle/archive/CustomLogger.py +0 -43
  13. arelle/archive/LoadEFMvalidate.py +0 -32
  14. arelle/archive/LoadSavePreLbCsv.py +0 -26
  15. arelle/archive/LoadValidate.cs +0 -31
  16. arelle/archive/LoadValidate.py +0 -36
  17. arelle/archive/LoadValidateCmdLine.java +0 -69
  18. arelle/archive/LoadValidatePostedZip.java +0 -57
  19. arelle/archive/LoadValidateWebService.java +0 -34
  20. arelle/archive/SaveTableToExelle.py +0 -140
  21. arelle/archive/TR3toTR4.py +0 -88
  22. arelle/archive/plugin/ESEF_2022/__init__.py +0 -47
  23. arelle/archive/plugin/bigInstance.py +0 -394
  24. arelle/archive/plugin/cmdWebServerExtension.py +0 -43
  25. arelle/archive/plugin/crashTest.py +0 -38
  26. arelle/archive/plugin/functionsXmlCreation.py +0 -106
  27. arelle/archive/plugin/hello_i18n.pot +0 -26
  28. arelle/archive/plugin/hello_i18n.py +0 -32
  29. arelle/archive/plugin/importTestChild1.py +0 -21
  30. arelle/archive/plugin/importTestChild2.py +0 -22
  31. arelle/archive/plugin/importTestGrandchild1.py +0 -21
  32. arelle/archive/plugin/importTestGrandchild2.py +0 -21
  33. arelle/archive/plugin/importTestImported1.py +0 -23
  34. arelle/archive/plugin/importTestImported11.py +0 -22
  35. arelle/archive/plugin/importTestParent.py +0 -48
  36. arelle/archive/plugin/instanceInfo.py +0 -306
  37. arelle/archive/plugin/loadFromOIM-2018.py +0 -1282
  38. arelle/archive/plugin/locale/fr/LC_MESSAGES/hello_i18n.po +0 -25
  39. arelle/archive/plugin/objectmaker.py +0 -285
  40. arelle/archive/plugin/packagedImportTest/__init__.py +0 -47
  41. arelle/archive/plugin/packagedImportTest/importTestChild1.py +0 -21
  42. arelle/archive/plugin/packagedImportTest/importTestChild2.py +0 -22
  43. arelle/archive/plugin/packagedImportTest/importTestGrandchild1.py +0 -21
  44. arelle/archive/plugin/packagedImportTest/importTestGrandchild2.py +0 -21
  45. arelle/archive/plugin/packagedImportTest/importTestImported1.py +0 -24
  46. arelle/archive/plugin/packagedImportTest/importTestImported11.py +0 -21
  47. arelle/archive/plugin/packagedImportTest/subdir/importTestImported111.py +0 -21
  48. arelle/archive/plugin/packagedImportTest/subdir/subsubdir/importTestImported1111.py +0 -21
  49. arelle/archive/plugin/sakaCalendar.py +0 -215
  50. arelle/archive/plugin/saveInstanceInfoset.py +0 -121
  51. arelle/archive/plugin/sphinx/FormulaGenerator.py +0 -823
  52. arelle/archive/plugin/sphinx/SphinxContext.py +0 -404
  53. arelle/archive/plugin/sphinx/SphinxEvaluator.py +0 -783
  54. arelle/archive/plugin/sphinx/SphinxMethods.py +0 -1287
  55. arelle/archive/plugin/sphinx/SphinxParser.py +0 -1093
  56. arelle/archive/plugin/sphinx/SphinxValidator.py +0 -163
  57. arelle/archive/plugin/sphinx/US-GAAP Ratios Example.xsr +0 -52
  58. arelle/archive/plugin/sphinx/__init__.py +0 -285
  59. arelle/archive/plugin/streamingExtensions.py +0 -335
  60. arelle/archive/plugin/updateTableLB.py +0 -242
  61. arelle/archive/plugin/validate/SBRnl/CustomLoader.py +0 -19
  62. arelle/archive/plugin/validate/SBRnl/DTS.py +0 -305
  63. arelle/archive/plugin/validate/SBRnl/Dimensions.py +0 -357
  64. arelle/archive/plugin/validate/SBRnl/Document.py +0 -799
  65. arelle/archive/plugin/validate/SBRnl/Filing.py +0 -467
  66. arelle/archive/plugin/validate/SBRnl/__init__.py +0 -75
  67. arelle/archive/plugin/validate/SBRnl/config.xml +0 -26
  68. arelle/archive/plugin/validate/SBRnl/sbr-nl-taxonomies.xml +0 -754
  69. arelle/archive/plugin/validate/USBestPractices.py +0 -570
  70. arelle/archive/plugin/validate/USCorpAction.py +0 -557
  71. arelle/archive/plugin/validate/USSecTagging.py +0 -337
  72. arelle/archive/plugin/validate/XDC/__init__.py +0 -77
  73. arelle/archive/plugin/validate/XDC/config.xml +0 -20
  74. arelle/archive/plugin/validate/XFsyntax/__init__.py +0 -64
  75. arelle/archive/plugin/validate/XFsyntax/xf.py +0 -2227
  76. arelle/archive/plugin/validate/calc2.py +0 -536
  77. arelle/archive/plugin/validateSchemaLxml.py +0 -156
  78. arelle/archive/plugin/validateTableInfoset.py +0 -52
  79. arelle/archive/us-gaap-dei-docType-extraction-frm.xml +0 -90
  80. arelle/archive/us-gaap-dei-ratio-cash-frm.xml +0 -150
  81. arelle/examples/plugin/formulaSuiteConverter.py +0 -212
  82. arelle/examples/plugin/functionsCustom.py +0 -59
  83. arelle/examples/plugin/hello_dolly.py +0 -64
  84. arelle/examples/plugin/multi.py +0 -58
  85. arelle/examples/plugin/rssSaveOim.py +0 -96
  86. arelle/examples/plugin/validate/XYZ/DisclosureSystems.py +0 -2
  87. arelle/examples/plugin/validate/XYZ/PluginValidationDataExtension.py +0 -10
  88. arelle/examples/plugin/validate/XYZ/ValidationPluginExtension.py +0 -50
  89. arelle/examples/plugin/validate/XYZ/__init__.py +0 -75
  90. arelle/examples/plugin/validate/XYZ/resources/config.xml +0 -16
  91. arelle/examples/plugin/validate/XYZ/rules/__init__.py +0 -0
  92. arelle/examples/plugin/validate/XYZ/rules/rules01.py +0 -110
  93. arelle/examples/plugin/validate/XYZ/rules/rules02.py +0 -59
  94. arelle/scripts-macOS/startWebServer.command +0 -3
  95. arelle/scripts-unix/startWebServer.sh +0 -1
  96. arelle/scripts-windows/startWebServer.bat +0 -5
  97. {arelle_release-2.37.47.dist-info → arelle_release-2.37.49.dist-info}/WHEEL +0 -0
  98. {arelle_release-2.37.47.dist-info → arelle_release-2.37.49.dist-info}/entry_points.txt +0 -0
  99. {arelle_release-2.37.47.dist-info → arelle_release-2.37.49.dist-info}/licenses/LICENSE.md +0 -0
  100. {arelle_release-2.37.47.dist-info → arelle_release-2.37.49.dist-info}/top_level.txt +0 -0
@@ -1,467 +0,0 @@
1
- '''
2
- See COPYRIGHT.md for copyright information.
3
- '''
4
- import regex as re
5
- from collections import defaultdict
6
- from arelle import (ModelDocument, ModelRelationshipSet, XmlUtil, XbrlConst)
7
- from arelle.ModelDtsObject import ModelConcept, ModelResource
8
- from arelle.ModelObject import ModelObject
9
- from arelle.UrlUtil import isHttpUrl
10
- from .Dimensions import checkFilingDimensions
11
- from .DTS import checkFilingDTS
12
-
13
-
14
- def validateFiling(val, modelXbrl):
15
-
16
- linkroleDefinitionStatementSheet = re.compile(r"[^-]+-\s+Statement\s+-\s+.*", # no restriction to type of statement
17
- re.IGNORECASE)
18
- if not hasattr(modelXbrl.modelDocument, "xmlDocument"): # not parsed
19
- return
20
-
21
- val._isStandardUri = {}
22
- modelXbrl.modelManager.disclosureSystem.loadStandardTaxonomiesDict()
23
-
24
- # find typedDomainRefs before validateXBRL pass
25
- val.typedDomainQnames = set()
26
- val.typedDomainElements = set()
27
- for modelConcept in modelXbrl.qnameConcepts.values():
28
- if modelConcept.isTypedDimension:
29
- typedDomainElement = modelConcept.typedDomainElement
30
- if isinstance(typedDomainElement, ModelConcept):
31
- val.typedDomainQnames.add(typedDomainElement.qname)
32
- val.typedDomainElements.add(typedDomainElement)
33
-
34
- # note that some XFM tests are done by ValidateXbrl to prevent multiple node walks
35
- xbrlInstDoc = modelXbrl.modelDocument.xmlDocument.getroot()
36
- disclosureSystem = val.disclosureSystem
37
- disclosureSystemVersion = disclosureSystem.version
38
-
39
- modelXbrl.modelManager.showStatus(_("validating {0}").format(disclosureSystem.name))
40
-
41
- val.modelXbrl.profileActivity()
42
- conceptsUsed = {} # key=concept object value=True if has presentation label
43
- labelsRelationshipSet = modelXbrl.relationshipSet(XbrlConst.conceptLabel)
44
- genLabelsRelationshipSet = modelXbrl.relationshipSet(XbrlConst.elementLabel)
45
- presentationRelationshipSet = modelXbrl.relationshipSet(XbrlConst.parentChild)
46
- referencesRelationshipSetWithProhibits = modelXbrl.relationshipSet(XbrlConst.conceptReference, includeProhibits=True)
47
- val.modelXbrl.profileActivity("... cache lbl, pre, ref relationships", minTimeToShow=1.0)
48
-
49
- val.validateLoggingSemantic = validateLoggingSemantic = (
50
- modelXbrl.isLoggingEffectiveFor(level="WARNING-SEMANTIC") or
51
- modelXbrl.isLoggingEffectiveFor(level="ERROR-SEMANTIC"))
52
-
53
- # instance checks
54
- val.fileNameBasePart = None # prevent testing on fileNameParts if not instance or invalid
55
- val.fileNameDate = None
56
- val.entityRegistrantName = None
57
- val.requiredContext = None
58
- val.standardNamespaceConflicts = defaultdict(set)
59
- val.exhibitType = None # e.g., EX-101, EX-201
60
-
61
-
62
- # entry point schema checks
63
- if modelXbrl.modelDocument.type == ModelDocument.Type.SCHEMA:
64
- # entry must have a P-link
65
- if not any(hrefElt.localName == "linkbaseRef" and hrefElt.get("{http://www.w3.org/1999/xlink}role") == "http://www.xbrl.org/2003/role/presentationLinkbaseRef"
66
- for hrefElt, hrefDoc, hrefId in modelXbrl.modelDocument.hrefObjects):
67
- modelXbrl.error("SBR.NL.2.2.10.01",
68
- 'Entrypoint schema must have a presentation linkbase', modelObject=modelXbrl.modelDocument)
69
- # all-labels and references checks
70
- for concept in modelXbrl.qnameConcepts.values():
71
- conceptHasDefaultLangStandardLabel = False
72
- for modelLabelRel in labelsRelationshipSet.fromModelObject(concept):
73
- modelLabel = modelLabelRel.toModelObject
74
- role = modelLabel.role
75
- text = modelLabel.text
76
- lang = modelLabel.xmlLang
77
- if role == XbrlConst.documentationLabel:
78
- if concept.modelDocument.targetNamespace in disclosureSystem.standardTaxonomiesDict:
79
- modelXbrl.error("SBR.NL.2.1.0.08",
80
- _("Concept %(concept)s of a standard taxonomy cannot have a documentation label: %(text)s"),
81
- modelObject=modelLabel, concept=concept.qname, text=text)
82
- elif text and lang and disclosureSystem.defaultXmlLang and lang.startswith(disclosureSystem.defaultXmlLang):
83
- if role == XbrlConst.standardLabel: # merge of pre-plugin code per LOGIUS
84
- conceptHasDefaultLangStandardLabel = True
85
- match = modelXbrl.modelManager.disclosureSystem.labelCheckPattern.search(text)
86
- if match:
87
- modelXbrl.error("SBR.NL.2.3.8.07",
88
- 'Label for concept %(concept)s role %(role)s has disallowed characters: "%(text)s"',
89
- modelObject=modelLabel, concept=concept.qname, role=role, text=match.group())
90
- for modelRefRel in referencesRelationshipSetWithProhibits.fromModelObject(concept):
91
- modelReference = modelRefRel.toModelObject
92
- text = XmlUtil.innerText(modelReference)
93
- #6.18.1 no reference to company extension concepts
94
- if (concept.modelDocument.targetNamespace in disclosureSystem.standardTaxonomiesDict and
95
- not isStandardUri(val, modelRefRel.modelDocument.uri)): # merge of pre-plugin code per LOGIUS
96
- #6.18.2 no extension to add or remove references to standard concepts
97
- modelXbrl.error("SBR.NL.2.1.0.08",
98
- _("References for standard taxonomy concept %(concept)s are not allowed in an extension linkbase: %(text)s"),
99
- modelObject=modelReference, concept=concept.qname, text=text, xml=XmlUtil.xmlstring(modelReference, stripXmlns=True, contentsOnly=True))
100
- if concept.isItem or concept.isTuple:
101
- if concept.modelDocument.targetNamespace not in disclosureSystem.standardTaxonomiesDict:
102
- if not conceptHasDefaultLangStandardLabel:
103
- modelXbrl.error("SBR.NL.2.2.2.26",
104
- _("Concept %(concept)s missing standard label in local language."),
105
- modelObject=concept, concept=concept.qname)
106
- subsGroup = concept.get("substitutionGroup")
107
- if ((not concept.isAbstract or subsGroup == "sbr:presentationItem") and
108
- not (presentationRelationshipSet.toModelObject(concept) or
109
- presentationRelationshipSet.fromModelObject(concept))):
110
- modelXbrl.error("SBR.NL.2.2.2.04",
111
- _("Concept %(concept)s not referred to by presentation relationship."),
112
- modelObject=concept, concept=concept.qname)
113
- elif ((concept.isDimensionItem or
114
- (subsGroup and (subsGroup.endswith(":domainItem") or subsGroup.endswith(":domainMemberItem")))) and
115
- not (presentationRelationshipSet.toModelObject(concept) or
116
- presentationRelationshipSet.fromModelObject(concept))):
117
- modelXbrl.error("SBR.NL.2.2.10.03",
118
- _("DTS concept %(concept)s not referred to by presentation relationship."),
119
- modelObject=concept, concept=concept.qname)
120
- if (concept.substitutionGroupQname and
121
- concept.substitutionGroupQname.namespaceURI not in disclosureSystem.baseTaxonomyNamespaces):
122
- modelXbrl.error("SBR.NL.2.2.2.05",
123
- _("Concept %(concept)s has a substitutionGroup of a non-standard concept."),
124
- modelObject=concept, concept=concept.qname)
125
-
126
- if concept.isTuple: # verify same presentation linkbase nesting
127
- for missingQname in set(concept.type.elements) ^ pLinkedNonAbstractDescendantQnames(modelXbrl, concept):
128
- modelXbrl.error("SBR.NL.2.3.4.01",
129
- _("Tuple %(concept)s has mismatch between content and presentation children: %(missingQname)s."),
130
- modelObject=concept, concept=concept.qname, missingQname=missingQname)
131
- checkConceptLabels(val, modelXbrl, labelsRelationshipSet, disclosureSystem, concept)
132
- checkConceptLabels(val, modelXbrl, genLabelsRelationshipSet, disclosureSystem, concept)
133
-
134
- val.modelXbrl.profileActivity("... filer concepts checks", minTimeToShow=1.0)
135
-
136
- # checks on all documents: instance, schema, instance
137
- checkFilingDTS(val, modelXbrl.modelDocument, [])
138
- ''' removed RH 2011-12-23, corresponding use of nameWordsTable in ValidateFilingDTS
139
- if val.validateSBRNL:
140
- del val.nameWordsTable
141
- '''
142
- val.modelXbrl.profileActivity("... filer DTS checks", minTimeToShow=1.0)
143
-
144
- conceptRelsUsedWithPreferredLabels = defaultdict(list)
145
- usedCalcsPresented = defaultdict(set) # pairs of concepts objectIds used in calc
146
- usedCalcFromTosELR = {}
147
- localPreferredLabels = defaultdict(set)
148
- drsELRs = set()
149
-
150
- # do calculation, then presentation, then other arcroles
151
- val.summationItemRelsSetAllELRs = modelXbrl.relationshipSet(XbrlConst.summationItem)
152
- for arcroleFilter in (XbrlConst.summationItem, XbrlConst.parentChild, "*"):
153
- for baseSetKey, baseSetModelLinks in modelXbrl.baseSets.items():
154
- arcrole, ELR, linkqname, arcqname = baseSetKey
155
- if ELR and linkqname and arcqname and not arcrole.startswith("XBRL-"):
156
- # assure summationItem, then parentChild, then others
157
- if not (arcroleFilter == arcrole or
158
- arcroleFilter == "*" and arcrole not in (XbrlConst.summationItem, XbrlConst.parentChild)):
159
- continue
160
- if arcrole == XbrlConst.parentChild:
161
- ineffectiveArcs = ModelRelationshipSet.ineffectiveArcs(baseSetModelLinks, arcrole)
162
- #validate ineffective arcs
163
- for modelRel in ineffectiveArcs:
164
- if isinstance(modelRel.fromModelObject, ModelObject) and isinstance(modelRel.toModelObject, ModelObject):
165
- modelXbrl.error("SBR.NL.2.3.4.06",
166
- _("Ineffective arc %(arc)s in \nlink role %(linkrole)s \narcrole %(arcrole)s \nfrom %(conceptFrom)s \nto %(conceptTo)s \n%(ineffectivity)s"),
167
- modelObject=modelRel, arc=modelRel.qname, arcrole=modelRel.arcrole,
168
- linkrole=modelRel.linkrole, linkroleDefinition=modelXbrl.roleTypeDefinition(modelRel.linkrole),
169
- conceptFrom=modelRel.fromModelObject.qname, conceptTo=modelRel.toModelObject.qname,
170
- ineffectivity=modelRel.ineffectivity)
171
- if arcrole == XbrlConst.parentChild:
172
- isStatementSheet = any(linkroleDefinitionStatementSheet.match(roleType.definition or '')
173
- for roleType in val.modelXbrl.roleTypes.get(ELR,()))
174
- conceptsPresented = set()
175
- # 6.12.2 check for distinct order attributes
176
- parentChildRels = modelXbrl.relationshipSet(arcrole, ELR)
177
- for relFrom, siblingRels in parentChildRels.fromModelObjects().items():
178
- targetConceptPreferredLabels = defaultdict(dict)
179
- orderRels = {}
180
- firstRel = True
181
- relFromUsed = True
182
- for rel in siblingRels:
183
- if firstRel:
184
- firstRel = False
185
- if relFrom in conceptsUsed:
186
- conceptsUsed[relFrom] = True # 6.12.3, has a pres relationship
187
- relFromUsed = True
188
- relTo = rel.toModelObject
189
- preferredLabel = rel.preferredLabel
190
- if relTo in conceptsUsed:
191
- conceptsUsed[relTo] = True # 6.12.3, has a pres relationship
192
- if preferredLabel and preferredLabel != "":
193
- conceptRelsUsedWithPreferredLabels[relTo].append(rel)
194
- if preferredLabel in ("periodStart","periodEnd"):
195
- modelXbrl.error("SBR.NL.2.3.4.03",
196
- _("Preferred label on presentation relationships not allowed"), modelObject=modelRel)
197
- # 6.12.5 distinct preferred labels in base set
198
- preferredLabels = targetConceptPreferredLabels[relTo]
199
- if (preferredLabel in preferredLabels or
200
- (not relFrom.isTuple and
201
- (not preferredLabel or None in preferredLabels))):
202
- if preferredLabel in preferredLabels:
203
- rel2, relTo2 = preferredLabels[preferredLabel]
204
- else:
205
- rel2 = relTo2 = None
206
- modelXbrl.error("SBR.NL.2.3.4.06",
207
- _("Concept %(concept)s has duplicate preferred label %(preferredLabel)s in link role %(linkrole)s"),
208
- modelObject=(rel, relTo, rel2, relTo2),
209
- concept=relTo.qname, fromConcept=rel.fromModelObject.qname,
210
- preferredLabel=preferredLabel, linkrole=rel.linkrole, linkroleDefinition=modelXbrl.roleTypeDefinition(rel.linkrole))
211
- else:
212
- preferredLabels[preferredLabel] = (rel, relTo)
213
- if relFromUsed:
214
- # 6.14.5
215
- conceptsPresented.add(relFrom.objectIndex)
216
- conceptsPresented.add(relTo.objectIndex)
217
- order = rel.order
218
- if order in orderRels:
219
- modelXbrl.error("SBR.NL.2.3.4.05",
220
- _("Duplicate presentation relations from concept %(conceptFrom)s for order %(order)s in base set role %(linkrole)s to concept %(conceptTo)s and to concept %(conceptTo2)s"),
221
- modelObject=(rel, orderRels[order]), conceptFrom=relFrom.qname, order=rel.arcElement.get("order"), linkrole=rel.linkrole, linkroleDefinition=modelXbrl.roleTypeDefinition(rel.linkrole),
222
- conceptTo=rel.toModelObject.qname, conceptTo2=orderRels[order].toModelObject.qname)
223
- else:
224
- orderRels[order] = rel
225
- if not relFrom.isTuple:
226
- if relTo in localPreferredLabels:
227
- if {None, preferredLabel} & localPreferredLabels[relTo]:
228
- val.modelXbrl.error("SBR.NL.2.3.4.06",
229
- _("Non-distinguished preferredLabel presentation relations from concept %(conceptFrom)s in base set role %(linkrole)s"),
230
- modelObject=rel, conceptFrom=relFrom.qname, linkrole=rel.linkrole, conceptTo=relTo.qname)
231
- localPreferredLabels[relTo].add(preferredLabel)
232
- targetConceptPreferredLabels.clear()
233
- orderRels.clear()
234
- localPreferredLabels.clear() # clear for next relationship
235
- for conceptPresented in conceptsPresented:
236
- if conceptPresented in usedCalcsPresented:
237
- usedCalcPairingsOfConcept = usedCalcsPresented[conceptPresented]
238
- if len(usedCalcPairingsOfConcept & conceptsPresented) > 0:
239
- usedCalcPairingsOfConcept -= conceptsPresented
240
- elif arcrole == XbrlConst.summationItem:
241
- # find a calc relationship to get the containing document name
242
- for modelRel in val.modelXbrl.relationshipSet(arcrole, ELR).modelRelationships:
243
- val.modelXbrl.error("SBR.NL.2.3.9.01",
244
- _("Calculation linkbase linkrole %(linkrole)s"),
245
- modelObject=modelRel, linkrole=ELR)
246
- break
247
-
248
- elif arcrole == XbrlConst.all or arcrole == XbrlConst.notAll:
249
- drsELRs.add(ELR)
250
-
251
- else:
252
- if arcrole == XbrlConst.dimensionDefault:
253
- for modelRel in val.modelXbrl.relationshipSet(arcrole).modelRelationships:
254
- val.modelXbrl.error("SBR.NL.2.3.6.05",
255
- _("Dimension-default in from %(conceptFrom)s to %(conceptTo)s in role %(linkrole)s is not allowed"),
256
- modelObject=modelRel, conceptFrom=modelRel.fromModelObject.qname, conceptTo=modelRel.toModelObject.qname,
257
- linkrole=modelRel.linkrole)
258
- ''' removed per RH 2013-01-11
259
- if not (XbrlConst.isStandardArcrole(arcrole) or XbrlConst.isDefinitionOrXdtArcrole(arcrole)):
260
- for modelRel in val.modelXbrl.relationshipSet(arcrole).modelRelationships:
261
- relTo = modelRel.toModelObject
262
- relFrom = modelRel.fromModelObject
263
- if not ((isinstance(relFrom,ModelConcept) and isinstance(relTo,ModelConcept)) or
264
- (relFrom.modelDocument.inDTS and
265
- (relTo.qname == XbrlConst.qnGenLabel and modelRel.arcrole == XbrlConst.elementLabel) or
266
- (relTo.qname == XbrlConst.qnGenReference and modelRel.arcrole == XbrlConst.elementReference) or
267
- (relTo.qname == val.qnSbrLinkroleorder))):
268
- val.modelXbrl.error("SBR.NL.2.3.2.07",
269
- _("The source and target of an arc must be in the DTS from %(elementFrom)s to %(elementTo)s, in linkrole %(linkrole)s, arcrole %(arcrole)s"),
270
- modelObject=modelRel, elementFrom=relFrom.qname, elementTo=relTo.qname,
271
- linkrole=modelRel.linkrole, arcrole=arcrole)
272
- '''
273
-
274
- del localPreferredLabels # dereference
275
- del usedCalcFromTosELR
276
- del val.summationItemRelsSetAllELRs
277
-
278
- val.modelXbrl.profileActivity("... filer relationships checks", minTimeToShow=1.0)
279
-
280
-
281
- # checks on dimensions
282
- checkFilingDimensions(val, drsELRs)
283
- val.modelXbrl.profileActivity("... filer dimensions checks", minTimeToShow=1.0)
284
-
285
- del conceptRelsUsedWithPreferredLabels
286
-
287
- # 6 16 4, 1.16.5 Base sets of Domain Relationship Sets testing
288
- val.modelXbrl.profileActivity("... filer preferred label checks", minTimeToShow=1.0)
289
-
290
- # moved from original validateSBRnl finally
291
-
292
- for qname, modelType in modelXbrl.qnameTypes.items():
293
- if qname.namespaceURI not in val.disclosureSystem.baseTaxonomyNamespaces:
294
- facets = modelType.facets
295
- if facets:
296
- lengthFacets = facets.keys() & {"minLength", "maxLength", "length"}
297
- if lengthFacets:
298
- modelXbrl.error("SBR.NL.2.2.7.02",
299
- _("Type %(typename)s has length restriction facets %(facets)s"),
300
- modelObject=modelType, typename=modelType.qname, facets=", ".join(lengthFacets))
301
- if "enumeration" in facets and not modelType.isDerivedFrom(XbrlConst.qnXbrliStringItemType):
302
- modelXbrl.error("SBR.NL.2.2.7.04",
303
- _("Concept %(concept)s has enumeration and is not based on stringItemType"),
304
- modelObject=modelType, concept=modelType.qname)
305
-
306
- ''' removed RH 2011-12-23, corresponding use of nameWordsTable in ValidateFilingDTS
307
- # build camelCasedNamesTable
308
- self.nameWordsTable = {}
309
- for name in modelXbrl.nameConcepts.keys():
310
- words = []
311
- wordChars = []
312
- lastchar = ""
313
- for c in name:
314
- if c.isupper() and lastchar.islower(): # it's another word
315
- partialName = ''.join(wordChars)
316
- if partialName in modelXbrl.nameConcepts:
317
- words.append(partialName)
318
- wordChars.append(c)
319
- lastchar = c
320
- if words:
321
- self.nameWordsTable[name] = words
322
- self.modelXbrl.profileActivity("... build name words table", minTimeToShow=1.0)
323
- '''
324
-
325
-
326
-
327
- # check presentation link roles for generic linkbase order number
328
- ordersRelationshipSet = modelXbrl.relationshipSet("http://www.nltaxonomie.nl/2011/arcrole/linkrole-order")
329
- presLinkroleNumberURI = {}
330
- presLinkrolesCount = 0
331
- for countLinkroles in (True, False):
332
- for _roleURI, modelRoleTypes in modelXbrl.roleTypes.items():
333
- for modelRoleType in modelRoleTypes:
334
- if XbrlConst.qnLinkPresentationLink in modelRoleType.usedOns:
335
- if countLinkroles:
336
- presLinkrolesCount += 1
337
- else:
338
- if not ordersRelationshipSet:
339
- modelXbrl.error("SBR.NL.2.2.3.06",
340
- _("Presentation linkrole %(linkrole)s missing order number relationship set"),
341
- modelObject=modelRoleType, linkrole=modelRoleType.roleURI)
342
- else:
343
- order = None
344
- for orderNumRel in ordersRelationshipSet.fromModelObject(modelRoleType):
345
- order = getattr(orderNumRel.toModelObject, "xValue", "(noPSVIvalue)")
346
- if order in presLinkroleNumberURI:
347
- modelXbrl.error("SBR.NL.2.2.3.06",
348
- _("Presentation linkrole order number %(order)s of %(linkrole)s also used in %(otherLinkrole)s"),
349
- modelObject=modelRoleType, order=order, linkrole=modelRoleType.roleURI, otherLinkrole=presLinkroleNumberURI[order])
350
- else:
351
- presLinkroleNumberURI[order] = modelRoleType.roleURI
352
- if not order:
353
- modelXbrl.error("SBR.NL.2.2.3.06",
354
- _("Presentation linkrole %(linkrole)s missing order number"),
355
- modelObject=modelRoleType, linkrole=modelRoleType.roleURI)
356
- if countLinkroles and presLinkrolesCount < 2:
357
- break # don't check order numbers if only one presentation linkrole
358
- # check arc role definitions for labels
359
- for arcroleURI, modelRoleTypes in modelXbrl.arcroleTypes.items():
360
- for modelRoleType in modelRoleTypes:
361
- if (not arcroleURI.startswith("http://xbrl.org/") and
362
- modelRoleType.modelDocument.targetNamespace not in val.disclosureSystem.baseTaxonomyNamespaces and
363
- (not modelRoleType.genLabel(lang="nl") or not modelRoleType.genLabel(lang="en"))):
364
- modelXbrl.error("SBR.NL.2.2.4.02",
365
- _("ArcroleType missing nl or en generic label: %(arcrole)s"),
366
- modelObject=modelRoleType, arcrole=arcroleURI)
367
-
368
- for domainElt in val.typedDomainElements:
369
- if domainElt.modelDocument.targetNamespace not in val.disclosureSystem.baseTaxonomyNamespaces:
370
- if not domainElt.genLabel(fallbackToQname=False, lang="nl"):
371
- modelXbrl.error("SBR.NL.2.2.8.01",
372
- _("Typed dimension domain element %(concept)s must have a generic label"),
373
- modelObject=domainElt, concept=domainElt.qname)
374
- if domainElt.type is not None and domainElt.type.localName == "complexType":
375
- modelXbrl.error("SBR.NL.2.2.8.02",
376
- _("Typed dimension domain element %(concept)s has disallowed complex content"),
377
- modelObject=domainElt, concept=domainElt.qname)
378
-
379
- modelXbrl.profileActivity("... SBR role types and type facets checks", minTimeToShow=1.0)
380
- # end moved from ValidateFiling
381
-
382
- # 3.2.4.4 check each using prefix against taxonomy declaring the prefix
383
- for docs in modelXbrl.namespaceDocs.values():
384
- for doc in docs:
385
- for prefix, NS in doc.xmlRootElement.nsmap.items():
386
- if NS in val.namespacePrefix and prefix != val.namespacePrefix[NS]:
387
- modelXbrl.error("SBR.NL.3.2.4.04",
388
- _("The assigned namespace prefix %(assignedPrefix)s for the schema that declares the targetnamespace %(namespace)s, MUST be adhired by all other NT schemas, referencedPrefix: %(referencedPrefix)s"),
389
- modelObject=doc.xmlRootElement, namespace=NS, assignedPrefix=val.namespacePrefix.get(NS, ''), referencedPrefix=prefix)
390
-
391
- # check non-concept elements that can appear in elements for labels (concepts checked by
392
- labelsRelationshipSet = modelXbrl.relationshipSet((XbrlConst.conceptLabel, XbrlConst.elementLabel))
393
- baseTaxonomyNamespaces = val.disclosureSystem.baseTaxonomyNamespaces
394
- for eltDef in modelXbrl.qnameConcepts.values():
395
- if (not (eltDef.isItem or eltDef.isTuple or eltDef.isLinkPart) and
396
- eltDef.qname.namespaceURI not in baseTaxonomyNamespaces):
397
- eltDefHasDefaultLangStandardLabel = False
398
- for modelLabelRel in labelsRelationshipSet.fromModelObject(eltDef):
399
- modelLabel = modelLabelRel.toModelObject
400
- role = modelLabel.role
401
- text = modelLabel.text
402
- lang = modelLabel.xmlLang
403
- if text and lang and val.disclosureSystem.defaultXmlLang and lang.startswith(val.disclosureSystem.defaultXmlLang):
404
- if role in (XbrlConst.standardLabel, XbrlConst.genStandardLabel):
405
- eltDefHasDefaultLangStandardLabel = True
406
- if not eltDefHasDefaultLangStandardLabel:
407
- modelXbrl.error("SBR.NL.3.2.15.01",
408
- _("XML nodes that can appear in instances MUST have standard labels in the local language: %(element)s"),
409
- modelObject=eltDef, element=eltDef.qname)
410
-
411
- val.modelXbrl.profileStat(_("validate{0}").format(modelXbrl.modelManager.disclosureSystem.validationType))
412
-
413
- modelXbrl.modelManager.showStatus(_("ready"), 2000)
414
-
415
- def isStandardUri(val, uri):
416
- try:
417
- return val._isStandardUri[uri]
418
- except KeyError:
419
- isStd = (uri in val.disclosureSystem.standardTaxonomiesDict or
420
- (not isHttpUrl(uri) and
421
- # try 2011-12-23 RH: if works, remove the localHrefs
422
- # any(u.endswith(e) for u in (uri.replace("\\","/"),) for e in disclosureSystem.standardLocalHrefs)
423
- "/basis/sbr/" in uri.replace("\\","/")
424
- ))
425
- val._isStandardUri[uri] = isStd
426
- return isStd
427
-
428
- def checkConceptLabels(val, modelXbrl, labelsRelationshipSet, disclosureSystem, concept):
429
- hasDefaultLangStandardLabel = False
430
- dupLabels = {}
431
- for modelLabelRel in labelsRelationshipSet.fromModelObject(concept):
432
- modelLabel = modelLabelRel.toModelObject
433
- if isinstance(modelLabel, ModelResource) and modelLabel.xmlLang:
434
- if modelLabel.xmlLang.startswith(disclosureSystem.defaultXmlLang) and \
435
- modelLabel.role == XbrlConst.standardLabel:
436
- hasDefaultLangStandardLabel = True
437
- dupDetectKey = ( (modelLabel.role or ''), modelLabel.xmlLang)
438
- if dupDetectKey in dupLabels:
439
- modelXbrl.error("SBR.NL.2.2.1.05",
440
- _("Concept %(concept)s has duplicated labels for role %(role)s lang %(lang)s."),
441
- modelObject=(modelLabel, dupLabels[dupDetectKey]), # removed concept from modelObjects
442
- concept=concept.qname, role=dupDetectKey[0], lang=dupDetectKey[1])
443
- else:
444
- dupLabels[dupDetectKey] = modelLabel
445
- if modelLabel.role in (XbrlConst.periodStartLabel, XbrlConst.periodEndLabel):
446
- modelXbrl.error("SBR.NL.2.3.8.03",
447
- _("Concept %(concept)s has label for semantical role %(role)s."),
448
- modelObject=modelLabel, concept=concept.qname, role=modelLabel.role)
449
- for role, lang in dupLabels.keys():
450
- if role and lang != disclosureSystem.defaultXmlLang and (role,disclosureSystem.defaultXmlLang) not in dupLabels:
451
- modelXbrl.error("SBR.NL.2.3.8.05",
452
- _("Concept %(concept)s has en but no nl label in role %(role)s."),
453
- modelObject=(concept,dupLabels[(role,lang)]), concept=concept.qname, role=role)
454
-
455
-
456
-
457
- # for SBR 2.3.4.01
458
- def pLinkedNonAbstractDescendantQnames(modelXbrl, concept, descendants=None):
459
- if descendants is None: descendants = set()
460
- for rel in modelXbrl.relationshipSet(XbrlConst.parentChild).fromModelObject(concept):
461
- child = rel.toModelObject
462
- if child is not None:
463
- if child.isAbstract:
464
- pLinkedNonAbstractDescendantQnames(modelXbrl, child, descendants)
465
- else:
466
- descendants.add(child.qname)
467
- return descendants
@@ -1,75 +0,0 @@
1
- '''
2
- See COPYRIGHT.md for copyright information.
3
- '''
4
- import os
5
- from arelle import ModelDocument, ModelValue, XmlUtil
6
- from arelle.ModelValue import qname
7
- from arelle.Version import authorLabel, copyrightLabel
8
- import regex as re
9
- from collections import defaultdict
10
- from .CustomLoader import checkForBOMs
11
- from .Document import checkDTSdocument
12
- from .Filing import validateFiling
13
-
14
-
15
- def dislosureSystemTypes(disclosureSystem, *args, **kwargs):
16
- # return ((disclosure system type name, variable name), ...)
17
- return (("SBR.NL", "SBRNLplugin"),)
18
-
19
- def disclosureSystemConfigURL(disclosureSystem, *args, **kwargs):
20
- return os.path.join(os.path.dirname(__file__), "config.xml")
21
-
22
- def validateXbrlStart(val, parameters=None, *args, **kwargs):
23
- val.validateSBRNLplugin = val.validateDisclosureSystem and getattr(val.disclosureSystem, "SBRNLplugin", False)
24
- if not val.validateSBRNLplugin:
25
- return
26
-
27
- val.prefixNamespace = {}
28
- val.namespacePrefix = {}
29
- val.idObjects = {}
30
-
31
-
32
- def validateXbrlFinally(val):
33
- if not val.validateSBRNLplugin:
34
- return
35
-
36
- modelXbrl = val.modelXbrl
37
-
38
- _statusMsg = _("validating {0} filing rules").format(val.disclosureSystem.name)
39
- modelXbrl.profileActivity()
40
- modelXbrl.modelManager.showStatus(_statusMsg)
41
-
42
- validateFiling(val, modelXbrl)
43
-
44
- modelXbrl.profileActivity(_statusMsg, minTimeToShow=0.0)
45
- modelXbrl.modelManager.showStatus(None)
46
-
47
- def validateFinally(val, *args, **kwargs):
48
- if not val.validateSBRNLplugin:
49
- return
50
-
51
- del val.prefixNamespace, val.namespacePrefix, val.idObjects
52
-
53
- def validateXbrlDtsDocument(val, modelDocument, isFilingDocument, *args, **kwargs):
54
- if not val.validateSBRNLplugin:
55
- return
56
-
57
- checkDTSdocument(val, modelDocument, isFilingDocument)
58
-
59
- __pluginInfo__ = {
60
- # Do not use _( ) in pluginInfo itself (it is applied later, after loading
61
- 'name': 'Validate SBR NL',
62
- 'version': '1.0',
63
- 'description': '''SBR NL Validation.''',
64
- 'license': 'Apache-2',
65
- 'author': authorLabel,
66
- 'copyright': copyrightLabel,
67
- # classes of mount points (required)
68
- 'DisclosureSystem.Types': dislosureSystemTypes,
69
- 'DisclosureSystem.ConfigURL': disclosureSystemConfigURL,
70
- 'Validate.XBRL.Start': validateXbrlStart,
71
- 'Validate.XBRL.Finally': validateXbrlFinally,
72
- 'Validate.XBRL.DTS.document': validateXbrlDtsDocument,
73
- 'Validate.Finally': validateFinally,
74
- 'ModelDocument.CustomLoader': checkForBOMs
75
- }
@@ -1,26 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <DisclosureSystems xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
- xsi:noNamespaceSchemaLocation="../../../config/disclosuresystems.xsd" >
4
- <!-- see ../config/disclosuresystem.xml for full comments -->
5
-
6
- <DisclosureSystem
7
- names="SBR-NL|sbr-nl"
8
- description="SBR Netherlands\n
9
- Default language Dutch\n
10
- EDInet identifier patterns\n
11
- Allowed references TBD"
12
- defaultXmlLang="nl"
13
- xmlLangPattern="(^nl$|^en$)"
14
- defaultLanguage="Nederlands"
15
- validationType="SBR.NL"
16
- exclusiveTypesPattern="EFM|GFM|HMRC|SBR.NL"
17
- validateFileText="false"
18
- standardTaxonomiesUrl="sbr-nl-taxonomies.xml"
19
- maxSubmissionSubdirectoryEntryNesting="3"
20
- contextElement="scenario"
21
- roleDefinitionPattern="^\S[^\n]* - [^\n]*\S$"
22
- labelCheckPattern="^\s[^\s]+|[^\s]+\s$|\s{2,}|[\r\n\t]"
23
- labelTrimPattern="\s"
24
- />
25
-
26
- </DisclosureSystems>