arelle-release 2.37.46__py3-none-any.whl → 2.37.48__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 (107) hide show
  1. arelle/CntlrCmdLine.py +10 -1
  2. arelle/ErrorManager.py +14 -5
  3. arelle/ModelObjectFactory.py +18 -2
  4. arelle/Validate.py +4 -0
  5. arelle/_version.py +2 -2
  6. arelle/plugin/validate/DBA/ValidationPluginExtension.py +2 -1
  7. arelle/plugin/validate/EDINET/ControllerPluginData.py +84 -0
  8. arelle/plugin/validate/EDINET/PluginValidationDataExtension.py +0 -114
  9. arelle/plugin/validate/EDINET/UploadContents.py +17 -0
  10. arelle/plugin/validate/EDINET/ValidationPluginExtension.py +8 -2
  11. arelle/plugin/validate/EDINET/__init__.py +5 -0
  12. arelle/plugin/validate/EDINET/rules/upload.py +66 -75
  13. arelle/plugin/validate/NL/ValidationPluginExtension.py +3 -1
  14. arelle/plugin/validate/ROS/ValidationPluginExtension.py +3 -1
  15. arelle/utils/PluginHooks.py +32 -0
  16. arelle/utils/validate/ValidationPlugin.py +54 -8
  17. {arelle_release-2.37.46.dist-info → arelle_release-2.37.48.dist-info}/METADATA +1 -1
  18. {arelle_release-2.37.46.dist-info → arelle_release-2.37.48.dist-info}/RECORD +22 -106
  19. arelle/archive/CustomLogger.py +0 -43
  20. arelle/archive/LoadEFMvalidate.py +0 -32
  21. arelle/archive/LoadSavePreLbCsv.py +0 -26
  22. arelle/archive/LoadValidate.cs +0 -31
  23. arelle/archive/LoadValidate.py +0 -36
  24. arelle/archive/LoadValidateCmdLine.java +0 -69
  25. arelle/archive/LoadValidatePostedZip.java +0 -57
  26. arelle/archive/LoadValidateWebService.java +0 -34
  27. arelle/archive/SaveTableToExelle.py +0 -140
  28. arelle/archive/TR3toTR4.py +0 -88
  29. arelle/archive/plugin/ESEF_2022/__init__.py +0 -47
  30. arelle/archive/plugin/bigInstance.py +0 -394
  31. arelle/archive/plugin/cmdWebServerExtension.py +0 -43
  32. arelle/archive/plugin/crashTest.py +0 -38
  33. arelle/archive/plugin/functionsXmlCreation.py +0 -106
  34. arelle/archive/plugin/hello_i18n.pot +0 -26
  35. arelle/archive/plugin/hello_i18n.py +0 -32
  36. arelle/archive/plugin/importTestChild1.py +0 -21
  37. arelle/archive/plugin/importTestChild2.py +0 -22
  38. arelle/archive/plugin/importTestGrandchild1.py +0 -21
  39. arelle/archive/plugin/importTestGrandchild2.py +0 -21
  40. arelle/archive/plugin/importTestImported1.py +0 -23
  41. arelle/archive/plugin/importTestImported11.py +0 -22
  42. arelle/archive/plugin/importTestParent.py +0 -48
  43. arelle/archive/plugin/instanceInfo.py +0 -306
  44. arelle/archive/plugin/loadFromOIM-2018.py +0 -1282
  45. arelle/archive/plugin/locale/fr/LC_MESSAGES/hello_i18n.po +0 -25
  46. arelle/archive/plugin/objectmaker.py +0 -285
  47. arelle/archive/plugin/packagedImportTest/__init__.py +0 -47
  48. arelle/archive/plugin/packagedImportTest/importTestChild1.py +0 -21
  49. arelle/archive/plugin/packagedImportTest/importTestChild2.py +0 -22
  50. arelle/archive/plugin/packagedImportTest/importTestGrandchild1.py +0 -21
  51. arelle/archive/plugin/packagedImportTest/importTestGrandchild2.py +0 -21
  52. arelle/archive/plugin/packagedImportTest/importTestImported1.py +0 -24
  53. arelle/archive/plugin/packagedImportTest/importTestImported11.py +0 -21
  54. arelle/archive/plugin/packagedImportTest/subdir/importTestImported111.py +0 -21
  55. arelle/archive/plugin/packagedImportTest/subdir/subsubdir/importTestImported1111.py +0 -21
  56. arelle/archive/plugin/sakaCalendar.py +0 -215
  57. arelle/archive/plugin/saveInstanceInfoset.py +0 -121
  58. arelle/archive/plugin/sphinx/FormulaGenerator.py +0 -823
  59. arelle/archive/plugin/sphinx/SphinxContext.py +0 -404
  60. arelle/archive/plugin/sphinx/SphinxEvaluator.py +0 -783
  61. arelle/archive/plugin/sphinx/SphinxMethods.py +0 -1287
  62. arelle/archive/plugin/sphinx/SphinxParser.py +0 -1093
  63. arelle/archive/plugin/sphinx/SphinxValidator.py +0 -163
  64. arelle/archive/plugin/sphinx/US-GAAP Ratios Example.xsr +0 -52
  65. arelle/archive/plugin/sphinx/__init__.py +0 -285
  66. arelle/archive/plugin/streamingExtensions.py +0 -335
  67. arelle/archive/plugin/updateTableLB.py +0 -242
  68. arelle/archive/plugin/validate/SBRnl/CustomLoader.py +0 -19
  69. arelle/archive/plugin/validate/SBRnl/DTS.py +0 -305
  70. arelle/archive/plugin/validate/SBRnl/Dimensions.py +0 -357
  71. arelle/archive/plugin/validate/SBRnl/Document.py +0 -799
  72. arelle/archive/plugin/validate/SBRnl/Filing.py +0 -467
  73. arelle/archive/plugin/validate/SBRnl/__init__.py +0 -75
  74. arelle/archive/plugin/validate/SBRnl/config.xml +0 -26
  75. arelle/archive/plugin/validate/SBRnl/sbr-nl-taxonomies.xml +0 -754
  76. arelle/archive/plugin/validate/USBestPractices.py +0 -570
  77. arelle/archive/plugin/validate/USCorpAction.py +0 -557
  78. arelle/archive/plugin/validate/USSecTagging.py +0 -337
  79. arelle/archive/plugin/validate/XDC/__init__.py +0 -77
  80. arelle/archive/plugin/validate/XDC/config.xml +0 -20
  81. arelle/archive/plugin/validate/XFsyntax/__init__.py +0 -64
  82. arelle/archive/plugin/validate/XFsyntax/xf.py +0 -2227
  83. arelle/archive/plugin/validate/calc2.py +0 -536
  84. arelle/archive/plugin/validateSchemaLxml.py +0 -156
  85. arelle/archive/plugin/validateTableInfoset.py +0 -52
  86. arelle/archive/us-gaap-dei-docType-extraction-frm.xml +0 -90
  87. arelle/archive/us-gaap-dei-ratio-cash-frm.xml +0 -150
  88. arelle/examples/plugin/formulaSuiteConverter.py +0 -212
  89. arelle/examples/plugin/functionsCustom.py +0 -59
  90. arelle/examples/plugin/hello_dolly.py +0 -64
  91. arelle/examples/plugin/multi.py +0 -58
  92. arelle/examples/plugin/rssSaveOim.py +0 -96
  93. arelle/examples/plugin/validate/XYZ/DisclosureSystems.py +0 -2
  94. arelle/examples/plugin/validate/XYZ/PluginValidationDataExtension.py +0 -10
  95. arelle/examples/plugin/validate/XYZ/ValidationPluginExtension.py +0 -49
  96. arelle/examples/plugin/validate/XYZ/__init__.py +0 -75
  97. arelle/examples/plugin/validate/XYZ/resources/config.xml +0 -16
  98. arelle/examples/plugin/validate/XYZ/rules/__init__.py +0 -0
  99. arelle/examples/plugin/validate/XYZ/rules/rules01.py +0 -110
  100. arelle/examples/plugin/validate/XYZ/rules/rules02.py +0 -59
  101. arelle/scripts-macOS/startWebServer.command +0 -3
  102. arelle/scripts-unix/startWebServer.sh +0 -1
  103. arelle/scripts-windows/startWebServer.bat +0 -5
  104. {arelle_release-2.37.46.dist-info → arelle_release-2.37.48.dist-info}/WHEEL +0 -0
  105. {arelle_release-2.37.46.dist-info → arelle_release-2.37.48.dist-info}/entry_points.txt +0 -0
  106. {arelle_release-2.37.46.dist-info → arelle_release-2.37.48.dist-info}/licenses/LICENSE.md +0 -0
  107. {arelle_release-2.37.46.dist-info → arelle_release-2.37.48.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