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,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