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,394 +0,0 @@
1
- '''
2
- BigInstance is an example of a plug-in to both GUI menu and command line/web service
3
- that provides an alternative approach to big instance documents without building a DOM, to save
4
- memory footprint. SAX is used to parse the big instance. ModelObjects are specialized by features
5
- for efficiency and to avoid dependency on an underlying DOM.
6
-
7
- See COPYRIGHT.md for copyright information.
8
- '''
9
-
10
- import xml.sax, io, sys
11
- from collections import defaultdict
12
- from arelle import XbrlConst, XmlUtil, XmlValidate
13
- from arelle.ModelDocument import ModelDocument, Type
14
- from arelle.ModelObject import ModelObject
15
- from arelle.ModelValue import QName
16
- from arelle.ModelInstanceObject import ModelContext, ModelFact, ModelUnit
17
- from arelle.Version import authorLabel, copyrightLabel
18
-
19
- class NotInstanceDocumentException(Exception):
20
- def __init__(self):
21
- pass
22
-
23
- sharedEmptyDict = {}
24
- sharedEmptyList = []
25
-
26
- qnIDattr = QName(None, None, "id")
27
- qnContextRefAttr = QName(None, None, "contextRef")
28
- qnUnitRefAttr = QName(None, None, "unitRef")
29
- qnPrecisionAttr = QName(None, None, "precision")
30
- qnDecimalsAttr = QName(None, None, "decimals")
31
-
32
- def initModelObject(obj, saxhandler, qname, attrs):
33
- obj._elementQname = qname
34
- obj._namespaceURI = qname.namespaceURI
35
- obj._localName = qname.localName
36
- obj.modelDocument = saxhandler.modelDocument
37
- obj._sourceline = saxhandler.saxParser.getLineNumber()
38
- obj._parent = saxhandler.qnameStack[0] if saxhandler.qnameStack else None
39
- obj._attrs = dict((('{{{0}}}{1}'.format(*name) if name[0] else name[1]), value)
40
- for name, value in attrs.items())
41
- obj._elementText = ''
42
-
43
- class BigInstModelObject(ModelObject):
44
- def __init__(self, saxhandler, qname, attrs):
45
- initModelObject(self, saxhandler, qname, attrs)
46
- super(BigInstModelObject, self).init(saxhandler.modelDocument)
47
-
48
- def getparent(self):
49
- return self._parent
50
-
51
- def items(self):
52
- return self._attrs.items()
53
-
54
- def get(self, clarkName):
55
- return self._attrs.get(clarkName)
56
-
57
- @property
58
- def sourceline(self):
59
- return self._sourceline
60
-
61
- @property
62
- def elementText(self):
63
- return self._elementText
64
-
65
- class BigInstContext(ModelContext):
66
- def __init__(self, saxhandler, qname, attrs):
67
- initModelObject(self, saxhandler, qname, attrs)
68
- super(BigInstContext, self).init(saxhandler.modelDocument)
69
- self._isStartEndPeriod = self._isInstantPeriod = self._isForeverPeriod = False
70
-
71
- def getparent(self):
72
- return self._parent
73
-
74
- def items(self):
75
- return self._attrs.items()
76
-
77
- def get(self, clarkName):
78
- return self._attrs.get(clarkName)
79
-
80
- @property
81
- def sourceline(self):
82
- return self._sourceline
83
-
84
- @property
85
- def elementText(self):
86
- return self._elementText
87
-
88
- class BigInstUnit(ModelUnit):
89
- def __init__(self, saxhandler, qname, attrs):
90
- initModelObject(self, saxhandler, qname, attrs)
91
- super(BigInstUnit, self).init(saxhandler.modelDocument)
92
- self._measures = [[],[]]
93
-
94
- def getparent(self):
95
- return self._parent
96
-
97
- def items(self):
98
- return self._attrs.items()
99
-
100
- def get(self, clarkName):
101
- return self._attrs.get(clarkName)
102
-
103
- @property
104
- def sourceline(self):
105
- return self._sourceline
106
-
107
- @property
108
- def elementText(self):
109
- return self._elementText
110
-
111
- class BigInstFact(ModelFact):
112
- __slots__ = ("_parent", "_concept", "_attrs", "_sourceline", "_elementText",
113
- "_context", "_conceptContextUnitLangHash",
114
- "_isItem", "_isTuple", "_isNumeric", "_isFraction",
115
- "_id", "_decimals", "_precision",
116
- "modelDocument", "objectIndex", "modelTupleFacts",
117
- "_parentBigInstObj", "_prevObj", "_nextObj",
118
- "xValid", "xValue", "sValue", "xAttributes")
119
-
120
- # reimplement ancestorQnames, parentQname
121
-
122
- def __init__(self, saxhandler, qname, attrs):
123
- self._concept = saxhandler.modelXbrl.qnameConcepts.get(qname) # use the qname object of the DTS, not parser
124
- self.modelDocument = saxhandler.modelDocument
125
- self._sourceline = saxhandler.saxParser.getLineNumber()
126
- self._parent = saxhandler.qnameStack[0] if saxhandler.qnameStack else None
127
- self._context = self._unit = self._decimals = self._precision = self._id = None
128
- self.xValid = 0 # unvalidated
129
- self._attrs = sharedEmptyDict # try with common shared emptyDict if no separate attributes
130
- self._parentBigInstObj = self._prevObj = self._nextObj = 1234
131
- for names, value in attrs.items():
132
- attrNameURI, attrLocalName= names
133
- if not attrNameURI:
134
- if attrLocalName == "id":
135
- self._id = value
136
- elif attrLocalName == "decimals":
137
- self._decimals = value
138
- elif attrLocalName == "precision":
139
- self._precision = value
140
- elif attrLocalName == "contextRef":
141
- self._context = saxhandler.modelXbrl.contexts.get(value, 0)
142
- if self._context == 0: # provide dummmy non-none so attribute is present for validation
143
- saxhandler.contextRefedFacts[value].append(self)
144
- elif attrLocalName == "unitRef":
145
- self._unit = saxhandler.modelXbrl.units.get(value, 0)
146
- if self._unit == 0:
147
- saxhandler.unitRefedFacts[value].append(self)
148
- else:
149
- if not self._attrs: self.attrs = {} # stop using common shared emptyDict
150
- self._attrs[attrLocalName] = value
151
- else:
152
- if not self._attrs: self.attrs = {} # stop using common shared emptyDict
153
- self._attrs['{{{0}}}{1}'.format(attrNameURI, attrLocalName)] = value
154
- self._elementText = ''
155
- self.modelTupleFacts = sharedEmptyList
156
- super(ModelFact, self).init(saxhandler.modelDocument)
157
-
158
- def getparent(self):
159
- return self._parent
160
-
161
- def items(self):
162
- return self._attrs.items()
163
-
164
- def get(self, clarkName):
165
- return self._attrs.get(clarkName)
166
-
167
- @property
168
- def sourceline(self):
169
- return self._sourceline
170
-
171
- @property
172
- def concept(self):
173
- return self._concept
174
-
175
- @property
176
- def qname(self):
177
- return self._concept.qname
178
-
179
- @property
180
- def elementQname(self):
181
- return self._concept.qname
182
-
183
- @property
184
- def namespaceURI(self):
185
- return self._concept.qname.namespaceURI
186
-
187
- @property
188
- def localName(self):
189
- return self._concept.qname.localName
190
-
191
- @property
192
- def elementText(self):
193
- return self._elementText
194
-
195
- @property
196
- def contextID(self):
197
- if self._context is not None:
198
- return self._context.id
199
- return None
200
-
201
- @property
202
- def slottedAttributesNames(self):
203
- names = set()
204
- if self._id: names.add(qnIDattr)
205
- if self._context is not None: names.add(qnContextRefAttr)
206
- if self._unit is not None: names.add(qnUnitRefAttr)
207
- if self._decimals is not None: names.add(qnDecimalsAttr)
208
- if self._precision is not None: names.add(qnPrecisionAttr)
209
- return names
210
-
211
- @property
212
- def unitID(self):
213
- if self._unit is not None:
214
- return self._unit.id
215
- return None
216
-
217
- class saxHandler(xml.sax.ContentHandler):
218
- def __init__(self, saxParser, modelXbrl, mappedUri, filepath):
219
- self.saxParser = saxParser
220
- self.modelXbrl = modelXbrl
221
- self.mappedUri = mappedUri
222
- self.filepath = filepath
223
- self.nsmap = {}
224
- self.prefixmap = {}
225
- self.qnameStack = []
226
- self.currentNamespaceURI = None
227
- self.modelDocument = None
228
- self.contextRefedFacts = defaultdict(list)
229
- self.unitRefedFacts = defaultdict(list)
230
-
231
- def qname(self, prefixedName):
232
- prefix, sep, localName = prefixedName.rpartition(":")
233
- return QName(prefix, self.nsmap.get(prefix,None), localName)
234
-
235
- def startPrefixMapping(self, prefix, uri):
236
- self.nsmap[prefix] = uri
237
- self.prefixmap[uri] = prefix
238
-
239
- def endPrefixMapping(self, prefix):
240
- if prefix in self.nsmap:
241
- self.prefixmap.pop(self.nsmap[prefix], None)
242
- self.nsmap.pop(prefix, None)
243
-
244
- def startElementNS(self, name, qname, attrs):
245
- namespaceURI, localName = name
246
- prefix = self.prefixmap.get(namespaceURI, None)
247
- thisQname = QName(prefix, namespaceURI, localName)
248
- if not self.qnameStack:
249
- if thisQname != XbrlConst.qnXbrliXbrl: # not an instance document
250
- self.modelXbrl = None # dereference
251
- self.saxParser = None
252
- raise NotInstanceDocumentException()
253
- if self.modelDocument is None:
254
- self.modelDocument = ModelDocument(self.modelXbrl, Type.INSTANCE, self.mappedUri, self.filepath, None)
255
- parentQname = None
256
- elif self.qnameStack:
257
- parentElement = self.qnameStack[0]
258
- parentQname = parentElement.elementQname
259
- if namespaceURI in (XbrlConst.xbrli, XbrlConst.link):
260
- if parentQname == XbrlConst.qnXbrliContext:
261
- if localName == "identifier":
262
- parentElement._entityIdentifier = (attrs.get(None,"scheme"), "")
263
- elif localName == "forever":
264
- parentElement._isForeverPeriod = True
265
- else:
266
- if localName == "context":
267
- thisModelObject = BigInstContext(self, thisQname, attrs)
268
- self.modelXbrl.contexts[thisModelObject.id] = thisModelObject
269
- elif localName == "unit":
270
- thisModelObject = BigInstUnit(self, thisQname, attrs)
271
- self.modelXbrl.units[thisModelObject.id] = thisModelObject
272
- else:
273
- thisModelObject = BigInstModelObject(self, thisQname, attrs)
274
- if localName in ("schemaRef", "linkbaseRef"):
275
- self.modelDocument.discoverHref(thisModelObject)
276
- else:
277
- self.qnameStack.insert(0, thisModelObject)
278
- elif parentQname:
279
- if parentQname == XbrlConst.qnXbrliContext:
280
- if namespaceURI == XbrlConst.xbrldi:
281
- if localName == "explicitMember":
282
- self.dimensionPrefixedName = attrs.get(None,"dimension")
283
- else: # might be a fact
284
- thisModelObject = BigInstFact(self, thisQname, attrs)
285
- if len(self.qnameStack) > 1:
286
- tuple = self.qnameStack[0]
287
- if not tuple.modelTupleFacts:
288
- tuple.modelTupleFacts = [] # allocate unshared list
289
- tuple.modelTupleFacts.append(thisModelObject)
290
- else:
291
- self.modelXbrl.facts.append(thisModelObject)
292
- self.qnameStack.insert(0, thisModelObject) # build content
293
- self.currentNamespaceURI = namespaceURI
294
- self.currentLocalName = localName
295
-
296
- def endElementNS(self, name, qname):
297
- thisQname = QName(None, *name)
298
- if self.qnameStack and self.qnameStack[0].elementQname == thisQname:
299
- elt = self.qnameStack.pop(0)
300
- if elt.namespaceURI == XbrlConst.xbrli:
301
- if elt.localName == "unit":
302
- elt._measures = (sorted(elt._measures[0]), sorted(elt._measures[1]))
303
- if elt.id in self.unitRefedFacts:
304
- for fact in self.unitRefedFacts[elt.id]:
305
- fact._unit = elt
306
- del self.unitRefedFacts[elt.id]
307
- elif elt.localName == "context":
308
- if elt.id in self.contextRefedFacts:
309
- for fact in self.contextRefedFacts[elt.id]:
310
- fact._context = elt
311
- del self.contextRefedFacts[elt.id]
312
- self.currentNamespaceURI = None
313
- self.currentLocalName = None
314
- XmlValidate.validate(self.modelXbrl, elt, recurse=False)
315
- pass
316
-
317
- def characters(self, content):
318
- if self.currentNamespaceURI:
319
- elt = self.qnameStack[0]
320
- if self.currentNamespaceURI == XbrlConst.xbrli:
321
- s = content.strip()
322
- if s:
323
- if self.currentLocalName == "identifier":
324
- elt._entityIdentifier = (elt._entityIdentifier[0], elt._entityIdentifier[1] + content)
325
- elif self.currentLocalName == "startDate":
326
- elt._startDatetime = XmlUtil.datetimeValue(s)
327
- elt._isStartEndPeriod = True
328
- elif self.currentLocalName == "endDate":
329
- elt._endDatetime = XmlUtil.datetimeValue(s, addOneDay=True)
330
- elt._isStartEndPeriod = True
331
- elif self.currentLocalName == "instant":
332
- elt._endDatetime = elt._instantDatetime = XmlUtil.datetimeValue(s, addOneDay=True)
333
- elt._isInstantPeriod = True
334
- elif self.currentLocalName == "measure":
335
- m = self.qname(content)
336
- parentEltLocalName = self.qnameStack[1].localName
337
- if parentEltLocalName == "unit":
338
- self.qnameStack[1]._measures[0].append(m)
339
- elif parentEltLocalName == "unitNumerator" and self.qnameStack[2].localName == "unit":
340
- self.qnameStack[2]._measures[0].append(m)
341
- elif parentEltLocalName == "unitDenominator" and self.qnameStack[2].localName == "unit":
342
- self.qnameStack[2]._measures[1].append(m)
343
- elif self.currentNamespaceURI == XbrlConst.xbrldi:
344
- s = content.strip()
345
- if s:
346
- if self.currentLocalName == "explicitMember" and self.dimensionPrefixedName:
347
- dimQname = self.qname(self.currentLocalName)
348
- memQname = self.qname(s)
349
- dimConcept = self.modelXbrl.qnameConcepts.get(dimQname)
350
- memConcept = self.modelXbrl.qnameConcepts.get(memQname)
351
- elif elt is not None:
352
- elt._elementText += content
353
-
354
- def skippedEntity(self, name):
355
- print ("skipped entity={0}".format(name))
356
-
357
- class BigInstDocument:
358
- def __init__(self, file, xbrlParser, saxParser, saxHandler):
359
- self.file = file
360
- self.xbrlParser = xbrlParser
361
- self.saxParser = saxParser
362
- self.saxHandler = saxHandler
363
-
364
- def getroot(self):
365
- return self.saxHandler.qnameStack[-1]
366
-
367
- def bigInstLoader(modelXbrl, file, mappedUri, filepath):
368
- saxParser = xml.sax.make_parser()
369
- saxParser.setFeature("http://xml.org/sax/features/namespaces", True)
370
- saxParser.setFeature("http://xml.org/sax/features/external-general-entities", True)
371
- saxhandler = saxHandler(saxParser, modelXbrl, mappedUri, filepath)
372
- saxParser.setContentHandler(saxhandler)
373
- try:
374
- saxParser.parse(file)
375
- return saxhandler.modelDocument
376
- except NotInstanceDocumentException:
377
- file.seek(0,io.SEEK_SET) # allow reparsing
378
- return None
379
-
380
- '''
381
- Do not use _( ) in pluginInfo itself (it is applied later, after loading
382
- '''
383
-
384
- __pluginInfo__ = {
385
- 'name': 'Big Instance Loader',
386
- 'version': '0.9',
387
- 'description': "This plug-in loads big XBRL instances without building a DOM in memory. "
388
- "SAX parses XBRL directly into an object model without a DOM. ",
389
- 'license': 'Apache-2',
390
- 'author': authorLabel,
391
- 'copyright': copyrightLabel,
392
- # classes of mount points (required)
393
- 'ModelDocument.CustomLoader': bigInstLoader,
394
- }
@@ -1,43 +0,0 @@
1
- '''
2
- Example extension plugin to provide custom REST api
3
-
4
- See COPYRIGHT.md for copyright information.
5
-
6
- To run test:
7
- arelleCmdLine.exe --webserver localhost:8080 --plugins ../examples/plugin/cmdWebServerExtension.py
8
-
9
- '''
10
-
11
- from arelle.CntlrWebMain import runOptionsAndGetResult
12
- from arelle.RuntimeOptions import RuntimeOptions
13
- from arelle.Version import copyrightLabel
14
-
15
- def my_test():
16
- return _("<html><body><h1>Test</h1><p>It works!</p></body></html>")
17
-
18
- def my_run(file=None):
19
- options = RuntimeOptions() # inspired by CntlrWebMain.validate
20
- options.entrypointFile = file
21
- options.validate = True
22
- return runOptionsAndGetResult(options, "html", None, None)
23
-
24
-
25
- def startWebServer(app, cntlr, host, port, server):
26
- # save
27
- # register /test-response to send a test response string
28
- app.route('/rest/my-test', "GET", my_test)
29
- # register /test/my-run to do a normal "validate" wprkflow cycle but with custom parameters
30
- app.route('/rest/my-run/<file:path>', ("GET", "POST"), my_run)
31
-
32
- return None # return "skip-routes" ## uncomment to block normal api REST "routes"
33
-
34
- __pluginInfo__ = {
35
- 'name': 'REST Extensions',
36
- 'version': '0.9',
37
- 'description': "Sample REST API extensions (or replacements).",
38
- 'license': 'Apache-2',
39
- 'author': 'R\xe9gis D\xce9camps',
40
- 'copyright': copyrightLabel,
41
- # classes of mount points (required)
42
- 'CntlrWebMain.StartWebServer': startWebServer,
43
- }
@@ -1,38 +0,0 @@
1
- '''
2
- Crash test is a plug in to cause an uncaught exception to test its recover
3
-
4
- See COPYRIGHT.md for copyright information.
5
- '''
6
- from arelle.Version import authorLabel, copyrightLabel
7
-
8
- def crashMenuEntender(cntlr, menu):
9
- menu.add_command(label="Crash now!!!", underline=0, command=lambda: crashMenuCommand(cntlr) )
10
-
11
- def crashMenuCommand(cntlr):
12
- foo = 25
13
- foo /= 0
14
-
15
- def crashCommandLineOptionExtender(parser):
16
- parser.add_option("--crash-test",
17
- action="store_true",
18
- dest="crashTest",
19
- help=_('Test what happens with an exception'))
20
-
21
- def crashCommandLineXbrlRun(cntlr, options, modelXbrl, *args, **kwargs):
22
- if getattr(options, "crashTest", False):
23
- foo = 25
24
- foo /= 0
25
-
26
-
27
- __pluginInfo__ = {
28
- 'name': 'Crash Test',
29
- 'version': '0.9',
30
- 'description': "Used to test that uncaught exceptions report their cause to the Arelle user.",
31
- 'license': 'Apache-2',
32
- 'author': authorLabel,
33
- 'copyright': copyrightLabel,
34
- # classes of mount points (required)
35
- 'CntlrWinMain.Menu.Tools': crashMenuEntender,
36
- 'CntlrCmdLine.Options': crashCommandLineOptionExtender,
37
- 'CntlrCmdLine.Xbrl.Run': crashCommandLineXbrlRun,
38
- }
@@ -1,106 +0,0 @@
1
- '''
2
- Sample custom functions plugin for formula XML Element, Attribute creation functions
3
-
4
- >>> note that this function has been renamed xfi:create-element and moved to FunctionXfi.py <<<
5
-
6
- See COPYRIGHT.md for copyright information.
7
- '''
8
- from arelle import XbrlUtil
9
- from arelle.formula import XPathContext
10
- from arelle.ModelValue import qname, QName
11
- from arelle.ModelInstanceObject import ModelDimensionValue, XmlUtil
12
- from arelle.FunctionUtil import qnameArg, nodeArg, atomicArg
13
- from arelle.Version import authorLabel, copyrightLabel
14
- from arelle import XmlValidate
15
- from lxml import etree
16
-
17
- '''
18
- Create an XML element in a "scratchpad" in-memory XML document, to behave like the results
19
- of an fn:doc() that would provide XML elements which can be consumed by formula typed
20
- dimension and OCC constructs.
21
-
22
- The element may be created with attributes and descendant elements, as needed.
23
-
24
- xfxc:element(
25
- qname, // qname of element
26
- (name-value pairs for creating attributes if any),
27
- value, if any, otherwise () or ''
28
- optional nested elements (e.g., xfc:element( ) ... of child nodes)
29
- )
30
-
31
- Attributes may be pairs of string name, value, or pairs of QName, value when attribute
32
- name is qualified.
33
-
34
- A function definition is required in the formula linkbase:
35
- <variable:function name="xfxc:element" output="element()" xlink:type="resource" xlink:label="cust-fn-xfxc-create">
36
- <variable:input type="xs:QName" /> <!-- qname of element to create -->
37
- <variable:input type="xs:anyAtomicType*" /> <!-- sequence of name, value pairs for creating attributes (name can be string or QName) -->
38
- <variable:input type="xs:anyAtomicType" /> <!-- optional value, () or '' if none -->
39
- <variable:input type="element()*" /> <!-- optional sequence of child elements, this parameter can be omitted if no child elements -->
40
- </variable:function>
41
- '''
42
- def xfxc_element(xc, p, contextItem, args):
43
- if not 2 <= len(args) <= 4: raise XPathContext.FunctionNumArgs()
44
- qn = qnameArg(xc, p, args, 0, 'QName', emptyFallback=None)
45
- attrArg = args[1] if isinstance(args[1],(list,tuple)) else (args[1],)
46
- # attributes have to be pairs
47
- if attrArg:
48
- if len(attrArg) & 1 or any(not isinstance(attrArg[i], (QName, str))
49
- for i in range(0, len(attrArg),2)):
50
- raise XPathContext.FunctionArgType(1,"((xs:qname|xs:string),xs:anyAtomicValue)", errCode="xfxce:AttributesNotNameValuePairs")
51
- else:
52
- attrParam = [(attrArg[i],attrArg[i+1]) # need name-value pairs for XmlUtil function
53
- for i in range(0, len(attrArg),2)]
54
- else:
55
- attrParam = None
56
-
57
- value = atomicArg(xc, p, args, 2, "xs:anyAtomicType", emptyFallback='')
58
- if not value: # be sure '' is None so no text node is created
59
- value = None
60
- if len(args) < 4:
61
- childElements = None
62
- else:
63
- childElements = xc.flattenSequence(args[3])
64
-
65
- # scratchpad instance document emulates fn:doc( ) to hold XML nodes
66
- scratchpadXmlDocUrl = "http://www.xbrl.org/2012/function/creation/xml_scratchpad.xml"
67
- if scratchpadXmlDocUrl in xc.modelXbrl.urlDocs:
68
- modelDocument = xc.modelXbrl.urlDocs[scratchpadXmlDocUrl]
69
- else:
70
- # create scratchpad xml document
71
- # this will get the fake instance document in the list of modelXbrl docs so that it is garbage collected
72
- from arelle import ModelDocument
73
- modelDocument = ModelDocument.create(xc.modelXbrl,
74
- ModelDocument.Type.UnknownXML,
75
- scratchpadXmlDocUrl,
76
- initialXml="<xfc:dummy xmlns:xfc='http://www.xbrl.org/2012/function/creation'/>")
77
-
78
- newElement = XmlUtil.addChild(modelDocument.xmlRootElement,
79
- qn,
80
- attributes=attrParam,
81
- text=value)
82
- if childElements:
83
- for element in childElements:
84
- if isinstance(element, etree.ElementBase):
85
- newElement.append(element)
86
-
87
- # node myst be validated for use in instance creation (typed dimension references)
88
- XmlValidate.validate(xc.modelXbrl, newElement)
89
-
90
- return newElement
91
-
92
- def xfxcFunctions():
93
- return {
94
- qname("{http://www.xbrl.org/2012/function/xml-creation}xfxc:element"): xfxc_element,
95
- }
96
-
97
- __pluginInfo__ = {
98
- 'name': 'Formula Xml Creation Functions',
99
- 'version': '1.0',
100
- 'description': "This plug-in adds a custom function to create xml elements, such as for typed dimensions, implemented by a plug-in. ",
101
- 'license': 'Apache-2',
102
- 'author': authorLabel,
103
- 'copyright': copyrightLabel,
104
- # classes of mount points (required)
105
- 'Formula.CustomFunctions': xfxcFunctions,
106
- }
@@ -1,26 +0,0 @@
1
- # Arelle
2
- # Copyright (C) 2011 MarkV System
3
- # This file is distributed under the same license as the Arelle package.
4
- # R�gis D�camps <regis.decamps@acp.banque-france.fr>, 2011.
5
- #
6
- #, fuzzy
7
- msgid ""
8
- msgstr ""
9
- "Project-Id-Version: PACKAGE VERSION\n"
10
- "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2012-01-04 18:08+0100\n"
12
- "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
- "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
- "Language-Team: LANGUAGE <LL@li.org>\n"
15
- "MIME-Version: 1.0\n"
16
- "Content-Type: text/plain; charset=CHARSET\n"
17
- "Content-Transfer-Encoding: 8bit\n"
18
-
19
- #: hello_i18n.py:28
20
- msgid "Hello World"
21
- msgstr ""
22
-
23
- #: hello_i18n.py:31
24
- msgid "Prints 'Hello world'"
25
- msgstr ""
26
-
@@ -1,32 +0,0 @@
1
- '''
2
- Hello dolly is a simple "Hello world" to demonstrate how plug-ins
3
- are written for Arelle
4
-
5
- See COPYRIGHT.md for copyright information.
6
- '''
7
- from arelle.Version import copyrightLabel
8
-
9
- def menuEntender(cntlr, menu):
10
- menu.add_command(label="Hello i18n", underline=0, command=lambda: menuCommand(cntlr) )
11
-
12
- def menuCommand(cntlr):
13
- i10L_world = _("Hello World");
14
- cntlr.addToLog(i10L_world)
15
- import tkinter
16
- tkinter.messagebox.showinfo(_("Prints 'Hello World'"), i10L_world, parent=cntlr.parent)
17
-
18
- '''
19
- Do not use _( ) in pluginInfo itself (it is applied later, after loading
20
- '''
21
- __pluginInfo__ = {
22
- 'name': 'Hello i18n',
23
- 'version': '0.9',
24
- 'description': '''Minimal plug-in that demonstrates i18n internationalization by localized gettext.''',
25
- 'localeURL': "locale",
26
- 'localeDomain': 'hello_i18n',
27
- 'license': 'Apache-2',
28
- 'author': 'R\u00e9gis D\u00e9camps',
29
- 'copyright': copyrightLabel,
30
- # classes of mount points (required)
31
- 'CntlrWinMain.Menu.Tools': menuEntender
32
- }
@@ -1,21 +0,0 @@
1
- '''
2
- pluginPackages test case
3
-
4
- See COPYRIGHT.md for copyright information.
5
- '''
6
- from arelle.Version import authorLabel, copyrightLabel
7
-
8
- def foo():
9
- print ("imported unpackaged plug-in child 1")
10
-
11
- __pluginInfo__ = {
12
- 'name': 'Unpackaged Listed Import Child 1',
13
- 'version': '0.9',
14
- 'description': "This is a unpackaged child plugin.",
15
- 'license': 'Apache-2',
16
- 'author': authorLabel,
17
- 'copyright': copyrightLabel,
18
- # classes of mount points (required)
19
- 'Import.Unpackaged.Entry2': foo,
20
- # imported plugins
21
- }
@@ -1,22 +0,0 @@
1
- '''
2
- pluginPackages test case
3
-
4
- See COPYRIGHT.md for copyright information.
5
- '''
6
- from arelle.Version import authorLabel, copyrightLabel
7
-
8
- def foo():
9
- print ("imported unpackaged plug-in child 2")
10
-
11
- __pluginInfo__ = {
12
- 'name': 'Unpackaged Listed Import Child 2',
13
- 'version': '0.9',
14
- 'description': "This is a unpackaged child plugin.",
15
- 'license': 'Apache-2',
16
- 'author': authorLabel,
17
- 'copyright': copyrightLabel,
18
- # classes of mount points (required)
19
- 'Import.Unpackaged.Entry3': foo,
20
- # import plugins
21
- 'import': ('importTestGrandchild1.py', 'importTestGrandchild2.py')
22
- }