arelle-release 2.37.46__py3-none-any.whl → 2.38.0__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.
Files changed (204) hide show
  1. arelle/BetaFeatures.py +0 -21
  2. arelle/Cntlr.py +15 -8
  3. arelle/CntlrCmdLine.py +121 -56
  4. arelle/CntlrWinMain.py +143 -70
  5. arelle/DialogFind.py +1 -1
  6. arelle/DialogPluginManager.py +6 -4
  7. arelle/DisclosureSystem.py +7 -0
  8. arelle/ErrorManager.py +21 -6
  9. arelle/FileSource.py +11 -4
  10. arelle/FunctionIxt.py +16 -11
  11. arelle/HtmlUtil.py +5 -4
  12. arelle/LeiUtil.py +63 -43
  13. arelle/ModelDocument.py +20 -15
  14. arelle/ModelDtsObject.py +8 -0
  15. arelle/ModelInstanceObject.py +1 -1
  16. arelle/ModelObject.py +16 -18
  17. arelle/ModelObjectFactory.py +35 -17
  18. arelle/ModelXbrl.py +28 -11
  19. arelle/PluginManager.py +130 -105
  20. arelle/RuntimeOptions.py +1 -0
  21. arelle/UrlUtil.py +14 -0
  22. arelle/Validate.py +17 -12
  23. arelle/ValidateDuplicateFacts.py +3 -1
  24. arelle/ValidateFileSource.py +38 -0
  25. arelle/ValidateFilingText.py +3 -3
  26. arelle/ValidateXbrl.py +5 -2
  27. arelle/ValidateXbrlCalcs.py +210 -186
  28. arelle/ValidateXbrlDTS.py +1 -1
  29. arelle/ViewFile.py +1 -0
  30. arelle/ViewFileFactTable.py +2 -2
  31. arelle/ViewWinDTS.py +4 -1
  32. arelle/WebCache.py +28 -24
  33. arelle/XbrlConst.py +22 -0
  34. arelle/XmlUtil.py +16 -21
  35. arelle/XmlValidate.py +6 -9
  36. arelle/_version.py +16 -3
  37. arelle/api/Session.py +11 -2
  38. arelle/config/disclosuresystems.xsd +2 -0
  39. arelle/config/rosettaEntitlements.plist +8 -0
  40. arelle/conformance/CSVTestcaseLoader.py +1 -1
  41. arelle/formula/XPathContext.py +3 -3
  42. arelle/logging/formatters/LogFormatter.py +3 -1
  43. arelle/packages/report/ReportPackage.py +26 -13
  44. arelle/packages/report/ReportPackageConst.py +0 -1
  45. arelle/plugin/inlineXbrlDocumentSet.py +19 -5
  46. arelle/plugin/validate/DBA/DisclosureSystems.py +19 -1
  47. arelle/plugin/validate/DBA/PluginValidationDataExtension.py +2 -4
  48. arelle/plugin/validate/DBA/ValidationPluginExtension.py +2 -1
  49. arelle/plugin/validate/DBA/resources/config.xml +5 -0
  50. arelle/plugin/validate/DBA/rules/__init__.py +2 -2
  51. arelle/plugin/validate/DBA/rules/fr.py +19 -2
  52. arelle/plugin/validate/DBA/rules/tc.py +2 -0
  53. arelle/plugin/validate/DBA/rules/th.py +6 -0
  54. arelle/plugin/validate/DBA/rules/tm.py +18 -5
  55. arelle/plugin/validate/DBA/rules/tr.py +11 -5
  56. arelle/plugin/validate/EDINET/Constants.py +193 -9
  57. arelle/plugin/validate/EDINET/ContextRequirement.py +58 -0
  58. arelle/plugin/validate/EDINET/ControllerPluginData.py +220 -1
  59. arelle/plugin/validate/EDINET/CoverItemRequirements.py +42 -0
  60. arelle/plugin/validate/EDINET/DeiRequirements.py +118 -0
  61. arelle/plugin/validate/EDINET/FilingFormat.py +275 -0
  62. arelle/plugin/validate/EDINET/FormType.py +134 -0
  63. arelle/plugin/validate/EDINET/ManifestInstance.py +72 -5
  64. arelle/plugin/validate/EDINET/NamespaceConfig.py +50 -0
  65. arelle/plugin/validate/EDINET/PluginValidationDataExtension.py +493 -132
  66. arelle/plugin/validate/EDINET/{InstanceType.py → ReportFolderType.py} +72 -15
  67. arelle/plugin/validate/EDINET/Statement.py +139 -0
  68. arelle/plugin/validate/EDINET/TableOfContentsBuilder.py +595 -0
  69. arelle/plugin/validate/EDINET/UploadContents.py +48 -0
  70. arelle/plugin/validate/EDINET/ValidationPluginExtension.py +20 -2
  71. arelle/plugin/validate/EDINET/__init__.py +31 -6
  72. arelle/plugin/validate/EDINET/resources/config.xml +8 -1
  73. arelle/plugin/validate/EDINET/resources/cover-item-requirements.json +793 -0
  74. arelle/plugin/validate/EDINET/resources/dei-requirements.csv +27 -0
  75. arelle/plugin/validate/EDINET/resources/edinet-taxonomies.xml +2 -0
  76. arelle/plugin/validate/EDINET/rules/contexts.py +375 -14
  77. arelle/plugin/validate/EDINET/rules/edinet.py +1934 -45
  78. arelle/plugin/validate/EDINET/rules/frta.py +122 -3
  79. arelle/plugin/validate/EDINET/rules/gfm.py +1907 -11
  80. arelle/plugin/validate/EDINET/rules/upload.py +989 -141
  81. arelle/plugin/validate/ESEF/Const.py +3 -1
  82. arelle/plugin/validate/ESEF/ESEF_2021/DTS.py +5 -0
  83. arelle/plugin/validate/ESEF/ESEF_2021/Image.py +2 -2
  84. arelle/plugin/validate/ESEF/ESEF_2021/ValidateXbrlFinally.py +23 -20
  85. arelle/plugin/validate/ESEF/ESEF_Current/DTS.py +47 -14
  86. arelle/plugin/validate/ESEF/ESEF_Current/ValidateXbrlFinally.py +100 -25
  87. arelle/plugin/validate/ESEF/__init__.py +20 -6
  88. arelle/plugin/validate/ESEF/resources/authority-validations.json +76 -9
  89. arelle/plugin/validate/ESEF/resources/config.xml +20 -0
  90. arelle/plugin/validate/NL/DisclosureSystems.py +22 -0
  91. arelle/plugin/validate/NL/PluginValidationDataExtension.py +27 -9
  92. arelle/plugin/validate/NL/ValidationPluginExtension.py +51 -7
  93. arelle/plugin/validate/NL/resources/config.xml +18 -0
  94. arelle/plugin/validate/NL/rules/br_kvk.py +17 -61
  95. arelle/plugin/validate/NL/rules/fg_nl.py +7 -38
  96. arelle/plugin/validate/NL/rules/fr_kvk.py +7 -42
  97. arelle/plugin/validate/NL/rules/fr_nl.py +31 -147
  98. arelle/plugin/validate/NL/rules/nl_kvk.py +142 -28
  99. arelle/plugin/validate/ROS/PluginValidationDataExtension.py +2 -0
  100. arelle/plugin/validate/ROS/ValidationPluginExtension.py +4 -1
  101. arelle/plugin/validate/ROS/rules/ros.py +41 -9
  102. arelle/plugin/validate/UK/ValidateUK.py +130 -66
  103. arelle/plugin/validate/UK/__init__.py +89 -103
  104. arelle/utils/EntryPointDetection.py +79 -13
  105. arelle/utils/PluginHooks.py +125 -0
  106. arelle/utils/validate/ESEFImage.py +6 -6
  107. arelle/utils/validate/Validation.py +18 -0
  108. arelle/utils/validate/ValidationPlugin.py +76 -11
  109. arelle/utils/validate/ValidationUtil.py +35 -3
  110. {arelle_release-2.37.46.dist-info → arelle_release-2.38.0.dist-info}/METADATA +30 -20
  111. {arelle_release-2.37.46.dist-info → arelle_release-2.38.0.dist-info}/RECORD +115 -191
  112. {arelle_release-2.37.46.dist-info → arelle_release-2.38.0.dist-info}/licenses/LICENSE.md +0 -3
  113. arelle/archive/CustomLogger.py +0 -43
  114. arelle/archive/LoadEFMvalidate.py +0 -32
  115. arelle/archive/LoadSavePreLbCsv.py +0 -26
  116. arelle/archive/LoadValidate.cs +0 -31
  117. arelle/archive/LoadValidate.py +0 -36
  118. arelle/archive/LoadValidateCmdLine.java +0 -69
  119. arelle/archive/LoadValidatePostedZip.java +0 -57
  120. arelle/archive/LoadValidateWebService.java +0 -34
  121. arelle/archive/SaveTableToExelle.py +0 -140
  122. arelle/archive/TR3toTR4.py +0 -88
  123. arelle/archive/plugin/ESEF_2022/__init__.py +0 -47
  124. arelle/archive/plugin/bigInstance.py +0 -394
  125. arelle/archive/plugin/cmdWebServerExtension.py +0 -43
  126. arelle/archive/plugin/crashTest.py +0 -38
  127. arelle/archive/plugin/functionsXmlCreation.py +0 -106
  128. arelle/archive/plugin/hello_i18n.pot +0 -26
  129. arelle/archive/plugin/hello_i18n.py +0 -32
  130. arelle/archive/plugin/importTestChild1.py +0 -21
  131. arelle/archive/plugin/importTestChild2.py +0 -22
  132. arelle/archive/plugin/importTestGrandchild1.py +0 -21
  133. arelle/archive/plugin/importTestGrandchild2.py +0 -21
  134. arelle/archive/plugin/importTestImported1.py +0 -23
  135. arelle/archive/plugin/importTestImported11.py +0 -22
  136. arelle/archive/plugin/importTestParent.py +0 -48
  137. arelle/archive/plugin/instanceInfo.py +0 -306
  138. arelle/archive/plugin/loadFromOIM-2018.py +0 -1282
  139. arelle/archive/plugin/locale/fr/LC_MESSAGES/hello_i18n.po +0 -25
  140. arelle/archive/plugin/objectmaker.py +0 -285
  141. arelle/archive/plugin/packagedImportTest/__init__.py +0 -47
  142. arelle/archive/plugin/packagedImportTest/importTestChild1.py +0 -21
  143. arelle/archive/plugin/packagedImportTest/importTestChild2.py +0 -22
  144. arelle/archive/plugin/packagedImportTest/importTestGrandchild1.py +0 -21
  145. arelle/archive/plugin/packagedImportTest/importTestGrandchild2.py +0 -21
  146. arelle/archive/plugin/packagedImportTest/importTestImported1.py +0 -24
  147. arelle/archive/plugin/packagedImportTest/importTestImported11.py +0 -21
  148. arelle/archive/plugin/packagedImportTest/subdir/importTestImported111.py +0 -21
  149. arelle/archive/plugin/packagedImportTest/subdir/subsubdir/importTestImported1111.py +0 -21
  150. arelle/archive/plugin/sakaCalendar.py +0 -215
  151. arelle/archive/plugin/saveInstanceInfoset.py +0 -121
  152. arelle/archive/plugin/sphinx/FormulaGenerator.py +0 -823
  153. arelle/archive/plugin/sphinx/SphinxContext.py +0 -404
  154. arelle/archive/plugin/sphinx/SphinxEvaluator.py +0 -783
  155. arelle/archive/plugin/sphinx/SphinxMethods.py +0 -1287
  156. arelle/archive/plugin/sphinx/SphinxParser.py +0 -1093
  157. arelle/archive/plugin/sphinx/SphinxValidator.py +0 -163
  158. arelle/archive/plugin/sphinx/US-GAAP Ratios Example.xsr +0 -52
  159. arelle/archive/plugin/sphinx/__init__.py +0 -285
  160. arelle/archive/plugin/streamingExtensions.py +0 -335
  161. arelle/archive/plugin/updateTableLB.py +0 -242
  162. arelle/archive/plugin/validate/SBRnl/CustomLoader.py +0 -19
  163. arelle/archive/plugin/validate/SBRnl/DTS.py +0 -305
  164. arelle/archive/plugin/validate/SBRnl/Dimensions.py +0 -357
  165. arelle/archive/plugin/validate/SBRnl/Document.py +0 -799
  166. arelle/archive/plugin/validate/SBRnl/Filing.py +0 -467
  167. arelle/archive/plugin/validate/SBRnl/__init__.py +0 -75
  168. arelle/archive/plugin/validate/SBRnl/config.xml +0 -26
  169. arelle/archive/plugin/validate/SBRnl/sbr-nl-taxonomies.xml +0 -754
  170. arelle/archive/plugin/validate/USBestPractices.py +0 -570
  171. arelle/archive/plugin/validate/USCorpAction.py +0 -557
  172. arelle/archive/plugin/validate/USSecTagging.py +0 -337
  173. arelle/archive/plugin/validate/XDC/__init__.py +0 -77
  174. arelle/archive/plugin/validate/XDC/config.xml +0 -20
  175. arelle/archive/plugin/validate/XFsyntax/__init__.py +0 -64
  176. arelle/archive/plugin/validate/XFsyntax/xf.py +0 -2227
  177. arelle/archive/plugin/validate/calc2.py +0 -536
  178. arelle/archive/plugin/validateSchemaLxml.py +0 -156
  179. arelle/archive/plugin/validateTableInfoset.py +0 -52
  180. arelle/archive/us-gaap-dei-docType-extraction-frm.xml +0 -90
  181. arelle/archive/us-gaap-dei-ratio-cash-frm.xml +0 -150
  182. arelle/examples/plugin/formulaSuiteConverter.py +0 -212
  183. arelle/examples/plugin/functionsCustom.py +0 -59
  184. arelle/examples/plugin/hello_dolly.py +0 -64
  185. arelle/examples/plugin/multi.py +0 -58
  186. arelle/examples/plugin/rssSaveOim.py +0 -96
  187. arelle/examples/plugin/validate/XYZ/DisclosureSystems.py +0 -2
  188. arelle/examples/plugin/validate/XYZ/PluginValidationDataExtension.py +0 -10
  189. arelle/examples/plugin/validate/XYZ/ValidationPluginExtension.py +0 -49
  190. arelle/examples/plugin/validate/XYZ/__init__.py +0 -75
  191. arelle/examples/plugin/validate/XYZ/resources/config.xml +0 -16
  192. arelle/examples/plugin/validate/XYZ/rules/__init__.py +0 -0
  193. arelle/examples/plugin/validate/XYZ/rules/rules01.py +0 -110
  194. arelle/examples/plugin/validate/XYZ/rules/rules02.py +0 -59
  195. arelle/model/CommentBase.py +0 -9
  196. arelle/model/ElementBase.py +0 -11
  197. arelle/model/PIBase.py +0 -10
  198. arelle/model/__init__.py +0 -15
  199. arelle/scripts-macOS/startWebServer.command +0 -3
  200. arelle/scripts-unix/startWebServer.sh +0 -1
  201. arelle/scripts-windows/startWebServer.bat +0 -5
  202. {arelle_release-2.37.46.dist-info → arelle_release-2.38.0.dist-info}/WHEEL +0 -0
  203. {arelle_release-2.37.46.dist-info → arelle_release-2.38.0.dist-info}/entry_points.txt +0 -0
  204. {arelle_release-2.37.46.dist-info → arelle_release-2.38.0.dist-info}/top_level.txt +0 -0
@@ -1,305 +0,0 @@
1
- '''
2
- See COPYRIGHT.md for copyright information.
3
- '''
4
- import os
5
- import regex as re
6
- from arelle import (ModelDocument, XmlUtil, XbrlConst)
7
- from arelle.ModelObject import ModelObject
8
- from arelle.ModelDtsObject import ModelConcept
9
-
10
- targetNamespaceDatePattern = None
11
- efmFilenamePattern = None
12
- roleTypePattern = None
13
- arcroleTypePattern = None
14
- arcroleDefinitionPattern = None
15
- namePattern = None
16
- namespacesConflictPattern = None
17
- linkroleDefinitionBalanceIncomeSheet = None
18
- extLinkEltFileNameEnding = {
19
- "calculationLink": "_cal",
20
- "definitionLink": "_def",
21
- "labelLink": "_lab",
22
- "presentationLink": "_pre",
23
- "referenceLink": "_ref"}
24
-
25
- def checkFilingDTS(val, modelDocument, visited):
26
- global targetNamespaceDatePattern, efmFilenamePattern, roleTypePattern, arcroleTypePattern, \
27
- arcroleDefinitionPattern, namePattern, linkroleDefinitionBalanceIncomeSheet, \
28
- namespacesConflictPattern
29
- if targetNamespaceDatePattern is None:
30
- targetNamespaceDatePattern = re.compile(r"/([12][0-9]{3})-([01][0-9])-([0-3][0-9])|"
31
- r"/([12][0-9]{3})([01][0-9])([0-3][0-9])|")
32
- efmFilenamePattern = re.compile(r"^[a-z0-9][a-zA-Z0-9_\.\-]*(\.xsd|\.xml)$")
33
- roleTypePattern = re.compile(r"^.*/role/[^/\s]+$")
34
- arcroleTypePattern = re.compile(r"^.*/arcrole/[^/\s]+$")
35
- arcroleDefinitionPattern = re.compile(r"^.*[^\\s]+.*$") # at least one non-whitespace character
36
- namePattern = re.compile("[][()*+?\\\\/^{}|@#%^=~`\"';:,<>&$\u00a3\u20ac]") # u20ac=Euro, u00a3=pound sterling
37
- linkroleDefinitionBalanceIncomeSheet = re.compile(r"[^-]+-\s+Statement\s+-\s+.*(income|balance|financial\W+position)",
38
- re.IGNORECASE)
39
- namespacesConflictPattern = re.compile(r"http://(xbrl\.us|fasb\.org|xbrl\.sec\.gov)/(dei|us-types|us-roles|rr)/([0-9]{4}-[0-9]{2}-[0-9]{2})$")
40
-
41
- visited.append(modelDocument)
42
- for referencedDocument, modelDocumentReference in modelDocument.referencesDocument.items():
43
- #6.07.01 no includes
44
- if "include" in modelDocumentReference.referenceTypes:
45
- val.modelXbrl.error("SBR.NL.2.2.0.18",
46
- _("Taxonomy schema %(schema)s includes %(include)s, only import is allowed"),
47
- modelObject=modelDocumentReference.referringModelObject,
48
- schema=os.path.basename(modelDocument.uri),
49
- include=os.path.basename(referencedDocument.uri))
50
- if referencedDocument not in visited:
51
- checkFilingDTS(val, referencedDocument, visited)
52
-
53
- if val.disclosureSystem.standardTaxonomiesDict is None:
54
- pass
55
-
56
- if (modelDocument.type == ModelDocument.Type.SCHEMA and
57
- modelDocument.targetNamespace not in val.disclosureSystem.baseTaxonomyNamespaces and
58
- modelDocument.uri.startswith(val.modelXbrl.uriDir)):
59
-
60
- # check schema contents types
61
- definesLinkroles = False
62
- definesArcroles = False
63
- definesLinkParts = False
64
- definesAbstractItems = False
65
- definesNonabstractItems = False
66
- definesConcepts = False
67
- definesTuples = False
68
- definesPresentationTuples = False
69
- definesSpecificationTuples = False
70
- definesTypes = False
71
- definesEnumerations = False
72
- definesDimensions = False
73
- definesDomains = False
74
- definesHypercubes = False
75
-
76
- genrlSpeclRelSet = val.modelXbrl.relationshipSet(XbrlConst.generalSpecial)
77
- for modelConcept in modelDocument.xmlRootElement.iterdescendants(tag="{http://www.w3.org/2001/XMLSchema}element"):
78
- if isinstance(modelConcept,ModelConcept):
79
- # 6.7.16 name not duplicated in standard taxonomies
80
- name = modelConcept.get("name")
81
- if name is None:
82
- name = ""
83
- if modelConcept.get("ref") is not None:
84
- continue # don't validate ref's here
85
- for c in val.modelXbrl.nameConcepts.get(name, []):
86
- if c.modelDocument != modelDocument:
87
- if not (genrlSpeclRelSet.isRelated(modelConcept, "child", c) or genrlSpeclRelSet.isRelated(c, "child", modelConcept)):
88
- val.modelXbrl.error("SBR.NL.2.2.2.02",
89
- _("Concept %(concept)s is also defined in standard taxonomy schema %(standardSchema)s without a general-special relationship"),
90
- modelObject=c, concept=modelConcept.qname, standardSchema=os.path.basename(c.modelDocument.uri))
91
- ''' removed RH 2011-12-23 corresponding set up of table in ValidateFiling
92
- if val.validateSBRNL and name in val.nameWordsTable:
93
- if not any( any( genrlSpeclRelSet.isRelated(c, "child", modelConcept)
94
- for c in val.modelXbrl.nameConcepts.get(partialWordName, []))
95
- for partialWordName in val.nameWordsTable[name]):
96
- val.modelXbrl.error("SBR.NL.2.3.2.01",
97
- _("Concept %(specialName)s is appears to be missing a general-special relationship to %(generalNames)s"),
98
- modelObject=c, specialName=modelConcept.qname, generalNames=', or to '.join(val.nameWordsTable[name]))
99
- '''
100
-
101
- if modelConcept.isTuple:
102
- if modelConcept.substitutionGroupQname.localName == "presentationTuple" and modelConcept.substitutionGroupQname.namespaceURI.endswith("/basis/sbr/xbrl/xbrl-syntax-extension"): # namespace may change each year
103
- definesPresentationTuples = True
104
- elif modelConcept.substitutionGroupQname.localName == "specificationTuple" and modelConcept.substitutionGroupQname.namespaceURI.endswith("/basis/sbr/xbrl/xbrl-syntax-extension"): # namespace may change each year
105
- definesSpecificationTuples = True
106
- else:
107
- definesTuples = True
108
- definesConcepts = True
109
- if modelConcept.isAbstract:
110
- val.modelXbrl.error("SBR.NL.2.2.2.03",
111
- _("Concept %(concept)s is an abstract tuple"),
112
- modelObject=modelConcept, concept=modelConcept.qname)
113
- if tupleCycle(val,modelConcept):
114
- val.modelXbrl.error("SBR.NL.2.2.2.07",
115
- _("Tuple %(concept)s has a tuple cycle"),
116
- modelObject=modelConcept, concept=modelConcept.qname)
117
- if modelConcept.get("nillable") != "false" and modelConcept.isRoot:
118
- val.modelXbrl.error("SBR.NL.2.2.2.17", #don't want default, just what was really there
119
- _("Tuple %(concept)s must have nillable='false'"),
120
- modelObject=modelConcept, concept=modelConcept.qname)
121
- elif modelConcept.isItem:
122
- definesConcepts = True
123
- if modelConcept.abstract == "true":
124
- if modelConcept.isRoot:
125
- if modelConcept.get("nillable") != "false": #don't want default, just what was really there
126
- val.modelXbrl.error("SBR.NL.2.2.2.16",
127
- _("Abstract root concept %(concept)s must have nillable='false'"),
128
- modelObject=modelConcept, concept=modelConcept.qname)
129
- if modelConcept.typeQname != XbrlConst.qnXbrliStringItemType:
130
- val.modelXbrl.error("SBR.NL.2.2.2.21",
131
- _("Abstract root concept %(concept)s must have type='xbrli:stringItemType'"),
132
- modelObject=modelConcept, concept=modelConcept.qname)
133
- if modelConcept.balance:
134
- val.modelXbrl.error("SBR.NL.2.2.2.22",
135
- _("Abstract concept %(concept)s must not have a balance attribute"),
136
- modelObject=modelConcept, concept=modelConcept.qname)
137
- if modelConcept.isHypercubeItem:
138
- definesHypercubes = True
139
- elif modelConcept.isDimensionItem:
140
- definesDimensions = True
141
- elif modelConcept.substitutionGroupQname and modelConcept.substitutionGroupQname.localName in ("domainItem","domainMemberItem"):
142
- definesDomains = True
143
- elif modelConcept.isItem:
144
- definesAbstractItems = True
145
- else: # not abstract
146
- if modelConcept.isItem:
147
- definesNonabstractItems = True
148
- if not (modelConcept.label(preferredLabel=XbrlConst.documentationLabel,fallbackToQname=False,lang="nl") or
149
- val.modelXbrl.relationshipSet(XbrlConst.conceptReference).fromModelObject(c) or
150
- modelConcept.genLabel(role=XbrlConst.genDocumentationLabel,lang="nl") or
151
- val.modelXbrl.relationshipSet(XbrlConst.elementReference).fromModelObject(c)):
152
- val.modelXbrl.error("SBR.NL.2.2.2.28",
153
- _("Concept %(concept)s must have a documentation label or reference"),
154
- modelObject=modelConcept, concept=modelConcept.qname)
155
- if modelConcept.balance and not modelConcept.instanceOfType(XbrlConst.qnXbrliMonetaryItemType):
156
- val.modelXbrl.error("SBR.NL.2.2.2.24",
157
- _("Non-monetary concept %(concept)s must not have a balance attribute"),
158
- modelObject=modelConcept, concept=modelConcept.qname)
159
- if modelConcept.isLinkPart:
160
- definesLinkParts = True
161
- val.modelXbrl.error("SBR.NL.2.2.5.01",
162
- _("Link:part concept %(concept)s is not allowed"),
163
- modelObject=modelConcept, concept=modelConcept.qname)
164
- if not modelConcept.genLabel(fallbackToQname=False,lang="nl"):
165
- val.modelXbrl.error("SBR.NL.2.2.5.02",
166
- _("Link part definition %(concept)s must have a generic label in language 'nl'"),
167
- modelObject=modelConcept, concept=modelConcept.qname)
168
-
169
- # 6.7.9 role types authority
170
- for e in modelDocument.xmlRootElement.iterdescendants(tag="{http://www.xbrl.org/2003/linkbase}roleType"):
171
- if isinstance(e,ModelObject):
172
- roleURI = e.get("roleURI")
173
- # 6.7.10 only one role type declaration in DTS
174
- modelRoleTypes = val.modelXbrl.roleTypes.get(roleURI)
175
- if modelRoleTypes is not None:
176
- modelRoleType = modelRoleTypes[0]
177
- definition = modelRoleType.definitionNotStripped
178
- usedOns = modelRoleType.usedOns
179
- if usedOns & XbrlConst.standardExtLinkQnames or XbrlConst.qnGenLink in usedOns:
180
- definesLinkroles = True
181
- if not e.genLabel():
182
- val.modelXbrl.error("SBR.NL.2.2.3.03",
183
- _("Link RoleType %(roleType)s missing a generic standard label"),
184
- modelObject=e, roleType=roleURI)
185
- nlLabel = e.genLabel(lang="nl")
186
- if definition != nlLabel:
187
- val.modelXbrl.error("SBR.NL.2.2.3.04",
188
- _("Link RoleType %(roleType)s definition does not match NL standard generic label, \ndefinition: %(definition)s \nNL label: %(label)s"),
189
- modelObject=e, roleType=roleURI, definition=definition, label=nlLabel)
190
- if definition and (definition[0].isspace() or definition[-1].isspace()):
191
- val.modelXbrl.error("SBR.NL.2.2.3.07",
192
- _('Link RoleType %(roleType)s definition has leading or trailing spaces: "%(definition)s"'),
193
- modelObject=e, roleType=roleURI, definition=definition)
194
-
195
- # 6.7.13 arcrole types authority
196
- for e in modelDocument.xmlRootElement.iterdescendants(tag="{http://www.xbrl.org/2003/linkbase}arcroleType"):
197
- if isinstance(e,ModelObject):
198
- arcroleURI = e.get("arcroleURI")
199
- definesArcroles = True
200
- val.modelXbrl.error("SBR.NL.2.2.4.01",
201
- _("Arcrole type definition is not allowed: %(arcroleURI)s"),
202
- modelObject=e, arcroleURI=arcroleURI)
203
-
204
- for appinfoElt in modelDocument.xmlRootElement.iter(tag="{http://www.w3.org/2001/XMLSchema}appinfo"):
205
- for nonLinkElt in appinfoElt.iterdescendants():
206
- if isinstance(nonLinkElt, ModelObject) and nonLinkElt.namespaceURI != XbrlConst.link:
207
- val.modelXbrl.error("SBR.NL.2.2.11.05",
208
- _("Appinfo contains disallowed non-link element %(element)s"),
209
- modelObject=nonLinkElt, element=nonLinkElt.qname)
210
-
211
- for cplxTypeElt in modelDocument.xmlRootElement.iter(tag="{http://www.w3.org/2001/XMLSchema}complexType"):
212
- choiceElt = cplxTypeElt.find("{http://www.w3.org/2001/XMLSchema}choice")
213
- if choiceElt is not None:
214
- val.modelXbrl.error("SBR.NL.2.2.11.09",
215
- _("ComplexType contains disallowed xs:choice element"),
216
- modelObject=choiceElt)
217
-
218
- for cplxContentElt in modelDocument.xmlRootElement.iter(tag="{http://www.w3.org/2001/XMLSchema}complexContent"):
219
- if XmlUtil.descendantAttr(cplxContentElt, "http://www.w3.org/2001/XMLSchema", ("extension","restriction"), "base") != "sbr:placeholder":
220
- val.modelXbrl.error("SBR.NL.2.2.11.10",
221
- _("ComplexContent is disallowed"),
222
- modelObject=cplxContentElt)
223
-
224
- for typeEltTag in ("{http://www.w3.org/2001/XMLSchema}complexType",
225
- "{http://www.w3.org/2001/XMLSchema}simpleType"):
226
- for typeElt in modelDocument.xmlRootElement.iter(tag=typeEltTag):
227
- definesTypes = True
228
- name = typeElt.get("name")
229
- if name:
230
- if not name[0].islower() or not name.isalnum():
231
- val.modelXbrl.error("SBR.NL.3.2.8.09",
232
- _("Type name attribute must be lower camelcase: %(name)s."),
233
- modelObject=typeElt, name=name)
234
-
235
- for enumElt in modelDocument.xmlRootElement.iter(tag="{http://www.w3.org/2001/XMLSchema}enumeration"):
236
- definesEnumerations = True
237
- if any(not valueElt.genLabel(lang="nl")
238
- for valueElt in enumElt.iter(tag="{http://www.w3.org/2001/XMLSchema}value")):
239
- val.modelXbrl.error("SBR.NL.2.2.7.05",
240
- _("Enumeration element has value(s) without generic label."),
241
- modelObject=enumElt)
242
-
243
- if (definesLinkroles + definesArcroles + definesLinkParts +
244
- definesAbstractItems + definesNonabstractItems +
245
- definesTuples + definesPresentationTuples + definesSpecificationTuples + definesTypes +
246
- definesEnumerations + definesDimensions + definesDomains +
247
- definesHypercubes) != 1:
248
- schemaContents = []
249
- if definesLinkroles: schemaContents.append(_("linkroles"))
250
- if definesArcroles: schemaContents.append(_("arcroles"))
251
- if definesLinkParts: schemaContents.append(_("link parts"))
252
- if definesAbstractItems: schemaContents.append(_("abstract items"))
253
- if definesNonabstractItems: schemaContents.append(_("nonabstract items"))
254
- if definesTuples: schemaContents.append(_("tuples"))
255
- if definesPresentationTuples: schemaContents.append(_("sbrPresentationTuples"))
256
- if definesSpecificationTuples: schemaContents.append(_("sbrSpecificationTuples"))
257
- if definesTypes: schemaContents.append(_("types"))
258
- if definesEnumerations: schemaContents.append(_("enumerations"))
259
- if definesDimensions: schemaContents.append(_("dimensions"))
260
- if definesDomains: schemaContents.append(_("domains"))
261
- if definesHypercubes: schemaContents.append(_("hypercubes"))
262
- if schemaContents:
263
- if not ((definesTuples or definesPresentationTuples or definesSpecificationTuples) and
264
- not (definesLinkroles or definesArcroles or definesLinkParts or definesAbstractItems or
265
- definesTypes or definesDimensions or definesDomains or definesHypercubes)):
266
- val.modelXbrl.error("SBR.NL.2.2.1.01",
267
- _("Taxonomy schema may only define one of these: %(contents)s"),
268
- modelObject=modelDocument, contents=', '.join(schemaContents))
269
- elif not any(refDoc.inDTS and refDoc.targetNamespace not in val.disclosureSystem.baseTaxonomyNamespaces
270
- for refDoc in modelDocument.referencesDocument.keys()): # no linkbase ref or includes
271
- val.modelXbrl.error("SBR.NL.2.2.1.01",
272
- _("Taxonomy schema must be a DTS entrypoint OR define linkroles OR arcroles OR link:parts OR context fragments OR abstract items OR tuples OR non-abstract elements OR types OR enumerations OR dimensions OR domains OR hypercubes"),
273
- modelObject=modelDocument)
274
- if definesConcepts ^ any( # xor so either concepts and no label LB or no concepts and has label LB
275
- (refDoc.type == ModelDocument.Type.LINKBASE and
276
- XmlUtil.descendant(refDoc.xmlRootElement, XbrlConst.link, "labelLink") is not None)
277
- for refDoc in modelDocument.referencesDocument.keys()): # no label linkbase
278
- val.modelXbrl.error("SBR.NL.2.2.1.02",
279
- _("A schema that defines concepts MUST have a linked 2.1 label linkbase"),
280
- modelObject=modelDocument)
281
- if (definesNonabstractItems or definesTuples) and not any( # was xor but changed to and not per RH 1/11/12
282
- (refDoc.type == ModelDocument.Type.LINKBASE and
283
- (XmlUtil.descendant(refDoc.xmlRootElement, XbrlConst.link, "referenceLink") is not None or
284
- XmlUtil.descendant(refDoc.xmlRootElement, XbrlConst.link, "label", "{http://www.w3.org/1999/xlink}role", "http://www.xbrl.org/2003/role/documentation" ) is not None))
285
- for refDoc in modelDocument.referencesDocument.keys()):
286
- val.modelXbrl.error("SBR.NL.2.2.1.03",
287
- _("A schema that defines non-abstract items MUST have a linked (2.1) reference linkbase AND/OR a label linkbase with @xlink:role=documentation"),
288
- modelObject=modelDocument)
289
-
290
- elif modelDocument.type == ModelDocument.Type.LINKBASE:
291
- pass
292
- visited.remove(modelDocument)
293
-
294
- def tupleCycle(val, concept, ancestorTuples=None):
295
- if ancestorTuples is None: ancestorTuples = set()
296
- if concept in ancestorTuples:
297
- return True
298
- ancestorTuples.add(concept)
299
- if concept.type is not None:
300
- for elementQname in concept.type.elements:
301
- childConcept = val.modelXbrl.qnameConcepts.get(elementQname)
302
- if childConcept is not None and tupleCycle(val, childConcept, ancestorTuples):
303
- return True
304
- ancestorTuples.discard(concept)
305
- return False