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,557 +0,0 @@
1
- '''
2
- See COPYRIGHT.md for copyright information.
3
- '''
4
-
5
- from arelle.ModelValue import qname
6
- from arelle.Version import copyrightLabel
7
- from arelle.XmlValidateConst import VALID
8
- import time
9
- from collections import defaultdict
10
-
11
- caNamespace2011 = "http://xbrl.us/corporateActions/2011-05-31"
12
- caNamespace2012 = "http://xbrl.us/corporateActions/2012-03-31"
13
-
14
-
15
- eventTypeMap = {
16
- "CashDividendMember": {"Cash Dividend", "Sale Of Rights"},
17
- "StockDividendMember": {"Stock Dividend"},
18
- "SpecialDividendMember": {"Special Dividend"},
19
- "CashDividendWithCurrencyOptionMember": {"Cash Dividend with Currency Option"},
20
- "DividendwithOptionMember": {"Dividend with Option"},
21
- "CancelMember": {"Sale Of Rights", "Annual General Meeting", "Assimilation", "Attachment",
22
- "Automatic Dividend Reinvestment",
23
- "Bankruptcy Note", "Bankruptcy Vote", "Bankruptcy",
24
- "Bearer to Registered Form",
25
- "Bid Tender / Sealed Tender",
26
- "Bonus Issue", "Bonus Rights Issue",
27
- "Buy Up",
28
- "Capital Distribution", "Capital Gains Distribution", "Capitalisation",
29
- "Cash and Securities Merger",
30
- "Cash Dividend with Currency Option", "Cash Dividend",
31
- "Cash in Lieu", "Cash Merger",
32
- "Change in Board Lot", "Change in Domicile", "Change in Name",
33
- "Change in Place of Incorporation", "Change in Place of Listing",
34
- "Change In Security Term",
35
- "Change Resulting in Decrease of Par Value", "Change Resulting in Increase of Par Value",
36
- "Class Action",
37
- "Consent for Plan of Reorganization", "Consent Tender", "Consent with No Payout", "Consent with Payout",
38
- "Convert And Tender",
39
- "Convertible Security Issue",
40
- "Coupon Distribution",
41
- "Credit Event",
42
- "Decimalisation",
43
- "Default",
44
- "Dematerialised to Physical Form",
45
- "Dissent",
46
- "Distribution on Recapitalization", "Distribution",
47
- "Dividend Reinvestment", "Dividend with Option",
48
- "Drawing",
49
- "Dutch Auction Tender", "Dutch Auction",
50
- "Exchange Offer with Consent Fee", "Exchange Offer",
51
- "Exchange on 144a Type Securities", "Exchange on Reg S Type Securities",
52
- "Exercise",
53
- "Extraordinary General Meeting",
54
- "Final Paydown",
55
- "Full Call on Convertible Security", "Full Call",
56
- "Full Pre-refunding",
57
- "General Information",
58
- "Global Permanent to Physical Form",
59
- "Global Temporary to Global Permanent Form", "Global Temporary to Physical Form",
60
- "Holdings Disclosure",
61
- "Interest",
62
- "Issue Fraction",
63
- "Liquidation",
64
- "Mandatory (Put) Tender", "Mandatory (Put) With Option to Retain",
65
- "Mandatory Exchange", "Mandatory Redemption of Shares",
66
- "Mandatory Tender", "Maturity Extension",
67
- "Maturity",
68
- "Meeting",
69
- "Merger",
70
- "Mini Tender",
71
- "Mortgage Backed",
72
- "Non US TEFRAD Certification",
73
- "Odd Lot Offer",
74
- "Offer To Purchase",
75
- "Ordinary Meeting",
76
- "Par Value Change",
77
- "Partial Call on Convertible Security", "Partial Call With Reduction in Nominal Value",
78
- "Partial Call",
79
- "Partial Defeasance",
80
- "Partial Mandatory (Put) Tender", "Partial Mandatory Tender",
81
- "Partial Prerefunding",
82
- "Pay in Kind",
83
- "Physical to Dematerialised Form", "Physical to Dematerialized Form",
84
- "Principal",
85
- "Put",
86
- "Redemption",
87
- "Redenomination",
88
- "Registered to Bearer Form",
89
- "Remarketing Agreement", "Remarketing",
90
- "Reorganization",
91
- "Return of Capital",
92
- "Reverse Stock Split",
93
- "Rights Issue", "Rights Subscription",
94
- "Round Down", "Round to Nearest", "Round Up",
95
- "Sale of Assets",
96
- "Securities Merger", "Security Delisted", "Security Separation", "Security to Certificate ",
97
- "Self Tender",
98
- "Share Exchange", "Share Premium Dividend",
99
- "Special Dividend Reinvestment", "Special Dividend",
100
- "Special Meeting",
101
- "Special Memorial Dividend",
102
- "Spinoff",
103
- "Standard Exchange",
104
- "Stock Dividend",
105
- "Stock Split with Mandatory Redemption of Shares", "Stock Split",
106
- "Subscription Offer Open Offer", "Subscription Offer Share Purchase Plan",
107
- "Subscription Offer",
108
- "Survivor Option",
109
- "Temporary Rate/Price Change",
110
- "Tender With Rights",
111
- "Termination",
112
- "Trading Status Active",
113
- "Transfer",
114
- "Unknown",
115
- "Warrants Issue"}
116
- }
117
-
118
- def checkCorporateActions(val, *args, **kwargs):
119
- modelXbrl = val.modelXbrl
120
- if caNamespace2011 in modelXbrl.namespaceDocs:
121
- caNamespace = caNamespace2011
122
- elif caNamespace2012 in modelXbrl.namespaceDocs:
123
- caNamespace = caNamespace2012
124
- else:
125
- return # no corporate actions taxonomy
126
-
127
- #Axes
128
- qnEventOptionsSequenceTypedAxis = qname(caNamespace, "ca:EventOptionsSequenceTypedAxis")
129
- qnEventTypeAxis = qname(caNamespace, "ca:EventTypeAxis")
130
- qnIssueTypeAxis = qname(caNamespace, "ca:IssueTypeAxis")
131
- qnMandatoryVoluntaryAxis = qname(caNamespace, "ca:MandatoryVoluntaryAxis")
132
- qnMarketTypeAxis = qname(caNamespace, "ca:MarketTypeAxis")
133
- qnPayoutSecurityIdentifierSchemeAxis = qname(caNamespace, "ca:PayoutSecurityIdentifierSchemeAxis")
134
- qnPayoutSequenceTypedAxis = qname(caNamespace, "ca:PayoutSequenceTypedAxis")
135
- qnStatusAxis = qname(caNamespace, "ca:StatusAxis")
136
- qnUnderlyingInstrumentIdentifierSchemeAxis = qname(caNamespace, "ca:UnderlyingInstrumentIdentifierSchemeAxis")
137
- qnUnderlyingSecuritiesImpactedTypedAxis = qname(caNamespace, "ca:UnderlyingSecuritiesImpactedTypedAxis")
138
-
139
- #Members
140
- qnCancelMember = qname(caNamespace, "ca:CancelMember")
141
- qnCashDividendMember = qname(caNamespace, "ca:CashDividendMember")
142
- qnEquityMember = qname(caNamespace, "ca:EquityMember")
143
- qnMandatoryMember = qname(caNamespace, "ca:MandatoryMember")
144
- qnPreliminaryMember = qname(caNamespace, "ca:PreliminaryMember")
145
- qnStockDividendMember = qname(caNamespace, "ca:StockDividendMember")
146
- qnUnconfirmedMember = qname(caNamespace, "ca:UnconfirmedMember")
147
- qnUnitedStatesMember = qname(caNamespace, "ca:UnitedStatesMember")
148
-
149
- startedAt = time.time()
150
- caFacts = defaultdict(list)
151
- hasUsEquityCashDiv = False
152
- hasUsEquityStockDiv = False
153
- hasCancel = False
154
- for f in modelXbrl.facts:
155
- if f.qname.namespaceURI == caNamespace:
156
- context = f.context
157
- if context is not None and getattr(f, "xValid", 0) == 4:
158
- caFacts[f.qname.localName].append(f)
159
- qnEventTypeMember = context.dimMemberQname(qnEventTypeAxis)
160
- qnIssueTypeMember = context.dimMemberQname(qnIssueTypeAxis)
161
- qnMandatoryVoluntaryMember = context.dimMemberQname(qnMandatoryVoluntaryAxis)
162
- qnMarketTypeMember = context.dimMemberQname(qnMarketTypeAxis)
163
- if (not hasUsEquityCashDiv and
164
- qnEventTypeMember == qnCashDividendMember and
165
- qnIssueTypeMember == qnEquityMember and
166
- qnMandatoryVoluntaryMember == qnMandatoryMember and
167
- qnMarketTypeMember == qnUnitedStatesMember):
168
- hasUsEquityCashDiv = True
169
- if (not hasUsEquityStockDiv and
170
- qnEventTypeMember == qnStockDividendMember and
171
- qnIssueTypeMember == qnEquityMember and
172
- qnMandatoryVoluntaryMember == qnMandatoryMember and
173
- qnMarketTypeMember == qnUnitedStatesMember):
174
- hasUsEquityStockDiv = True
175
- if (not hasCancel and
176
- qnEventTypeMember == qnCancelMember and
177
- qnIssueTypeMember == qnCancelMember and
178
- qnMandatoryVoluntaryMember == qnCancelMember and
179
- qnMarketTypeMember == qnCancelMember):
180
- hasCancel = True
181
-
182
- hasEventComplete = False
183
- eventCompleteContextHash = None
184
- for f in caFacts["EventCompleteness"]:
185
- if f.xValue == "Complete":
186
- eventCompleteContextHash = f.context.contextDimAwareHash
187
- hasEventComplete = True
188
- break
189
-
190
- if hasEventComplete:
191
- facts = [f for f in modelXbrl.facts
192
- if f.context is not None and f.context.dimMemberQname(qnStatusAxis) == qnPreliminaryMember]
193
- if facts:
194
- modelXbrl.error("US-CA.PreliminaryAndComplete.100",
195
- _("Facts have a preliminary status, but the event is indicated to be complete: %(facts)s"),
196
- modelObject=facts, facts=", ".join(f.localName for f in facts))
197
-
198
- facts = [f for f in modelXbrl.facts
199
- if f.context is not None and f.context.dimMemberQname(qnStatusAxis) == qnUnconfirmedMember]
200
- if facts:
201
- modelXbrl.error("US-CA.UnconfirmedAndComplete.101",
202
- _("Facts have an unconfirmed status, but the event is indicated to be complete: %(facts)s"),
203
- modelObject=facts, facts=", ".join(f.localName for f in facts))
204
-
205
- for i, localName in ((1, "AnnouncementDate"),
206
- (2, "EventCompleteness"),
207
- (3, "UniqueUniversalEventIdentifier"),
208
- (4, "AnnouncementIdentifier"),
209
- (5, "AnnouncementType"),
210
- (6, "EventType"),
211
- # 7, 8 below under hasUsEquityCashDiv
212
- (9, "MandatoryVoluntaryChoiceIndicator")):
213
- if localName not in caFacts:
214
- modelXbrl.error("US-CA.Exists.{0}".format(i),
215
- _("A %(fact)s must exist in the document."),
216
- modelObject=modelXbrl, fact=localName)
217
- if hasEventComplete:
218
- if not caFacts["EventConfirmationStatus"]:
219
- modelXbrl.error("US-CA.Exists.10",
220
- _("An EventConfirmationStatus must exist in the document if the document is Complete."),
221
- modelObject=modelXbrl, fact="EventConfirmationStatus")
222
- if hasUsEquityCashDiv:
223
- for i, localName in ((12, "CountryOfIssuer"),
224
- (14, "PaymentDate")):
225
- if not any(f.context.contextDimAwareHash == eventCompleteContextHash
226
- for f in caFacts[localName]):
227
- modelXbrl.error("US-CA.Exists.{0}".format(i),
228
- _("A %(fact)s must exist in the document if the document is Complete."),
229
- modelObject=modelXbrl, fact=localName)
230
- if not any(f.context.hasDimension(qnEventOptionsSequenceTypedAxis)
231
- for f in caFacts["OptionType"]):
232
- modelXbrl.error("US-CA.Exists.15",
233
- _("A OptionType must exist in the document for the security impacted by the corporate action."),
234
- modelObject=modelXbrl, fact="InstrumentIdentifier")
235
-
236
- dupFacts = defaultdict(list)
237
- for localName, facts in caFacts.items():
238
- for f in facts:
239
- dupFacts[f.context.contextDimAwareHash].append(f)
240
- for dups in dupFacts.values():
241
- if len(dups) > 1:
242
- modelXbrl.error("US-CA.DuplicateValue.11",
243
- _("Fact %(fact)s exists %(count)s times in the document."),
244
- modelObject=dups, fact=localName, count=len(dups))
245
- dupFacts.clear()
246
- del dupFacts
247
-
248
- if hasUsEquityCashDiv:
249
- if not any(f.context.hasDimension(qnUnderlyingSecuritiesImpactedTypedAxis) and
250
- f.context.hasDimension(qnUnderlyingInstrumentIdentifierSchemeAxis)
251
- for f in caFacts["InstrumentIdentifier"]):
252
- modelXbrl.error("US-CA.Exists.7",
253
- _("A InstrumentIdentifier must exist in the document for the security impacted by the corporate action."),
254
- modelObject=modelXbrl, fact="InstrumentIdentifier")
255
-
256
- if "RecordDate" not in caFacts:
257
- modelXbrl.error("US-CA.Exists.8",
258
- _("A RecordDate must exist in the document."),
259
- modelObject=modelXbrl)
260
-
261
- countOptions = len(caFacts["OptionType"])
262
- if not countOptions:
263
- modelXbrl.error("US-CA.atLeastOneOptionIsRequired.16",
264
- _("At least one %(fact)s must be defined for a mandatory cash dividend."),
265
- modelObject=modelXbrl, fact="OptionType")
266
- countWithholdingRates = len(caFacts["WithholdingTaxPercentage"])
267
- if (countOptions != len(caFacts["TaxRateDescription"]) and
268
- countOptions > 1 and
269
- countWithholdingRates != countOptions):
270
- modelXbrl.error("US-CA.noMoreThanOnOption.16a",
271
- _("More than one option has been defined for a cash dividend only one Option can be defined for a mandatory cash dividend unless there is multiple tax rates defined. In the file there are %(countOfWithholdingRates)s unique withholding rates defined but %(countOfOptions)s options defined."),
272
- modelObject=modelXbrl, fact="OptionType",
273
- countOfWithholdingRates=countWithholdingRates, countOfOptions=countOptions)
274
- for f in caFacts["OptionType"]:
275
- if f.xValue != "Cash":
276
- modelXbrl.error("US-CA.onlyOneOptionAllowed.26",
277
- _("The Option Type for a mandatory cash dividend, %(value)s must be defined as \"Cash\"."),
278
- modelObject=f, fact="OptionType", value=f.value)
279
- for f in caFacts["PayoutType"]:
280
- if f.xValue != "Dividend":
281
- modelXbrl.error("US-CA.paymentOptions.17",
282
- _("The Payout Type for a cash dividend, %(value)s must be defined as \"Dividend\"."),
283
- modelObject=f, fact="PayoutType", value=f.value)
284
-
285
- for f1 in caFacts["PayoutAmount"]:
286
- for f2 in caFacts["PayoutAmountNetOfTax"]:
287
- if f1.xValue < f2.xValue:
288
- modelXbrl.error("US-CA.gte.18",
289
- _("The PayoutType %(value1)s must be greater than PayoutAmountNetOfTax %(value2)s."),
290
- modelObject=(f1,f2), fact="PayoutAmount", value1=f1.value, value2=f2.value)
291
-
292
- for i, localName in ((19, "PayoutAmount"), (21, "PayoutAmountNetOfTax")):
293
- for f in caFacts[localName]:
294
- if f.xValue < 0:
295
- modelXbrl.error("US-CA.nonNeg.{0}".format(i),
296
- _("The %(fact)s, %(value)s must be positive."),
297
- modelObject=f, fact=localName, value=f.value)
298
-
299
- for i, localName1, localName2 in ((22, "PaymentDate", "RecordDate"),
300
- (23, "OrdPaymentDate", "OrdRecordDate"),
301
- (103, "PaymentDate", "OrdPaymentDate"),
302
- (104, "AnnouncementDate", "OrdinaryAnnouncementDate"),
303
- (105, "BooksClosedEndDate", "BooksClosedStartDate")):
304
- for f1 in caFacts[localName1]:
305
- for f2 in caFacts[localName2]:
306
- if (f1.context.contextDimAwareHash == f2.context.contextDimAwareHash and
307
- f1.xValue < f2.xValue):
308
- modelXbrl.error("US-CA.date.{0}".format(i),
309
- _("The %(fact1)s %(value1)s must be later than the %(fact2)s %(value2)s."),
310
- modelObject=(f1,f2), fact1=localName1, fact2=localName2, value1=f1.value, value2=f2.value)
311
-
312
-
313
- if hasUsEquityCashDiv:
314
- for f in caFacts["EventType"]:
315
- eventTypeMember = f.context.dimMemberQname(qnEventTypeAxis)
316
- if eventTypeMember:
317
- if f.xValue not in eventTypeMap[eventTypeMember.localName]:
318
- modelXbrl.error("US-CA.eventTypeMatch.20",
319
- _("The %(fact)s, %(value)s must be defined as \"Cash Dividend\" or \"Sale Of Rights\"."),
320
- modelObject=f, fact="EventType", value=f.value)
321
- paymentDateFacts = caFacts["PaymentDate"]
322
- for fEvent in paymentDateFacts:
323
- if (qnEventOptionsSequenceTypedAxis not in fEvent.context.qnameDims and
324
- qnPayoutSequenceTypedAxis not in fEvent.context.qnameDims):
325
- for fDetail in paymentDateFacts:
326
- if (f.context.hasDimension(qnEventOptionsSequenceTypedAxis) and
327
- f.context.hasDimension(qnPayoutSequenceTypedAxis) and
328
- fEvent.xValue != fDetail.xValue):
329
- modelXbrl.error("US-CA.us-equity-cashDiv-mand.dupValues.24",
330
- _("The PaymentDate %(detailValue)s at the detail level must equal the PaymentDate %(eventValue)s at the event level."),
331
- modelObject=(fDetail,fEvent), fact="PaymentDate", detailValue=fDetail.value, eventValue=fEvent.value)
332
-
333
- for i, f1 in enumerate(paymentDateFacts):
334
- if (not f.context.hasDimension(qnEventOptionsSequenceTypedAxis) and
335
- not f.context.hasDimension(qnPayoutSequenceTypedAxis)):
336
- for f2 in paymentDateFacts[i+1:]:
337
- if (f.context.hasDimension(qnEventOptionsSequenceTypedAxis) and
338
- f.context.hasDimension(qnPayoutSequenceTypedAxis) and
339
- f1.xValue != f2.xValue):
340
- modelXbrl.error("US-CA.us-equity-cashDiv-mand.multPayouts.25",
341
- _("The PaymentDate %(detailValue)s at the detail level must equal the PaymentDate %(eventValue)s at the detail level."),
342
- modelObject=(f1, f2), fact="PaymentDate", detailValue=f1.value, eventValue=f2.value)
343
-
344
- if (hasEventComplete and
345
- len(caFacts["OptionType"]) > len(caFacts["PayoutType"])):
346
- modelXbrl.error("US-CA.us-equity-cashDiv-mand.missingPayouts.25a",
347
- _("The number of payouts associated with a cash dividend must match the number of options on a complete corporate action event. Each option must have at least one payout associated with it."),
348
- modelObject=(caFacts["OptionType"] + caFacts["PayoutType"]))
349
-
350
- if len(caFacts["OptionType"]) > 1:
351
- fmax = None
352
- maxValue = max((f.xValue for f in caFacts["WithholdingTaxPercentage"]))
353
- f1 = None
354
- for f in caFacts["WithholdingTaxPercentage"]:
355
- if fmax is None or f.xValue > fmax.xValue:
356
- fmax = f
357
- if (f.context.hasDimension(qnEventOptionsSequenceTypedAxis) and
358
- f.context.dimValue(qnEventOptionsSequenceTypedAxis).typedMember.xValue == 1):
359
- f1 = f
360
- if f1 is not None and fmax.xValue != f1.xValue:
361
- modelXbrl.error("US-CA.noMoreThanOnOption.16b",
362
- _("In those cases where multiple tax rates are defined the highest rate typically represents the payout rate associated with the "
363
- "corporate action to the clearing and settlement organization. The first option should represent the distribution made for settlement. "
364
- "In this case the withholding tax rate for option 1 is %(seq1Value)s. This is not the maximium withholding rate assoicated with the "
365
- "action which is %(maxValue)s. Make the payout with the highest withholding rate the first option."),
366
- modelObject=(fmax,f1),maxValue=fmax.value, seq1Value=f1.value)
367
-
368
-
369
- for fPayoutAmt in caFacts["PayoutAmount"]:
370
- for fPayoutAmtNetOfTax in caFacts["PayoutAmountNetOfTax"]:
371
- if fPayoutAmt.context.contextDimAwareHash == fPayoutAmtNetOfTax.context.contextDimAwareHash:
372
- for fTax in caFacts["TaxAmountWithheldFromPayout"]:
373
- if (fPayoutAmt.context.contextDimAwareHash == fTax.context.contextDimAwareHash and
374
- fPayoutAmt.xValue < fPayoutAmtNetOfTax.xValue + fTax.xValue):
375
- modelXbrl.error("US-CA.ne.26c",
376
- _("The PayoutAmount of %(payoutAmt)s must always be greater than or equal to the sum of PayoutAmountNetOfTax with a value of "
377
- "%(payoutNetOfTax)s and TaxAmountWithheldFromPayout with a value of %(taxAmt)s."),
378
- modelObject=(fPayoutAmt, fPayoutAmtNetOfTax, fTax),
379
- payoutAmt=fPayoutAmt.xValue,
380
- payoutNetOfTax=fPayoutAmtNetOfTax.xValue,
381
- taxAmt=fTax.xValue)
382
-
383
- # stock dividend
384
- if hasUsEquityStockDiv:
385
- if len(caFacts["OptionType"]) != 1:
386
- modelXbrl.error("US-CA.stockDiv.onlyOneOptionAllowed.41",
387
- _("Only one Option Type can be defined for a mandatory stock dividend."),
388
- modelObject=caFacts["OptionType"],)
389
-
390
- if (len(caFacts["OptionType"]) != len(caFacts["TaxRateDescription"]) and
391
- len(caFacts["OptionType"]) > 1 and
392
- len(set(f.xValue
393
- for f in caFacts["WithholdingTaxPercentage"])) != len(caFacts["OptionType"])):
394
- modelXbrl.error("US-CA.noMoreThanOnOption.41a",
395
- _("More than one option has been defined for a stock dividend. Only one Option can be defined for a mandatory stock dividend unless there is multiple tax rates defined.\n(id:41a)\n$"),
396
- modelObject=caFacts["OptionType"])
397
-
398
- if hasEventComplete and not caFacts["CountryOfIssuer"]:
399
- modelXbrl.error("US-CA.completedExists.50",
400
- _("The Country Of Issuer must be populated in the document for a stock Dividend if the document is complete."),
401
- modelObject=val.modeXbrl, fact="CountryOfIssuer")
402
-
403
- if (hasEventComplete and
404
- not any(f.context.hasDimension(qnEventOptionsSequenceTypedAxis)
405
- for f in caFacts["OptionType"])):
406
- modelXbrl.error("US-CA.completedExists.48",
407
- _("The Option Type must be populated in the document if the document is complete."),
408
- modelObject=val.modeXbrl, fact="OptionType")
409
-
410
- if not any(f.context.hasDimension(qnUnderlyingSecuritiesImpactedTypedAxis) and
411
- f.context.hasDimension(qnUnderlyingInstrumentIdentifierSchemeAxis)
412
- for f in caFacts["InstrumentIdentifier"]):
413
- modelXbrl.error("US-CA.exists.40",
414
- _("An InstrumentIdentifier fact must exist in the document for the security impacted by the corporate action."),
415
- modelObject=val.modeXbrl, fact="InstrumentIdentifier")
416
-
417
- if not caFacts["RecordDate"]:
418
- modelXbrl.error("US-CA.exists.42",
419
- _("A RecordDate fact must exist in the document."),
420
- modelObject=val.modeXbrl, fact="RecordDate")
421
-
422
- if hasEventComplete and not caFacts["PaymentDate"]:
423
- modelXbrl.error("US-CA.completedExists.43",
424
- _("The PaymentDate must be populated in the document if the document is complete."),
425
- modelObject=val.modeXbrl, fact="PaymentDate")
426
-
427
- for f in caFacts["PayoutType"]:
428
- if f.xValue != "Dividend":
429
- modelXbrl.error("US-CA.stockDiv.paymentOptions.44",
430
- _("The Payout Type for a cash dividend must be defined as a \"Dividend\"."),
431
- modelObject=f, fact="PayoutType")
432
-
433
- for f in caFacts["OptionType"]:
434
- if f.xValue != "Securities":
435
- modelXbrl.error("US-CA.stockDiv.optionType.45",
436
- _("The Option Type for a cash dividend must be defined as a \"Securities\"."),
437
- modelObject=f, fact="OptionType")
438
-
439
- for f in caFacts["EventType"]:
440
- eventTypeMember = f.context.dimMemberQname(qnEventTypeAxis)
441
- if eventTypeMember:
442
- if f.xValue not in eventTypeMap[eventTypeMember.localName]:
443
- modelXbrl.error("US-CA.stockDiv-mand.eventTypeMatch.46",
444
- _("The %(fact)s, %(value)s must be defined as \"Stock Dividend\"."),
445
- modelObject=f, fact="EventType", value=f.value)
446
-
447
- paymentDateFacts = caFacts["PaymentDate"]
448
- for i, f1 in enumerate(paymentDateFacts):
449
- if (not f.context.hasDimension(qnEventOptionsSequenceTypedAxis) and
450
- not f.context.hasDimension(qnPayoutSequenceTypedAxis)):
451
- for f2 in paymentDateFacts[i+1:]:
452
- if (f.context.hasDimension(qnEventOptionsSequenceTypedAxis) and
453
- f.context.hasDimension(qnPayoutSequenceTypedAxis) and
454
- f1.xValue != f2.xValue):
455
- modelXbrl.error("US-CA.stockDiv-mand.dupValues.47",
456
- _("The PaymentDate %(detailValue)s at the detail level must equal the PaymentDate %(eventValue)s at the detail level."),
457
- modelObject=(f1, f2), fact="PaymentDate", detailValue=f1.value, eventValue=f2.value)
458
-
459
- if (hasEventComplete and
460
- not any(f.context.hasDimension(qnPayoutSequenceTypedAxis) and
461
- f.context.hasDimension(qnPayoutSecurityIdentifierSchemeAxis)
462
- for f in caFacts["InstrumentIdentifier"])):
463
- modelXbrl.error("US-CA.completedExists.49",
464
- _("An InstrumentIdentifier fact must exist in the document for the security paid out as part of the corporate action if the event is complete"),
465
- modelObject=modelXbrl, fact="InstrumentIdentifier")
466
-
467
- if (hasEventComplete and
468
- len(caFacts["OptionType"]) > len(caFacts["PayoutType"])):
469
- modelXbrl.error("US-CA.stockDiv-mand.missingPayouts.49a",
470
- _("The number of payouts associated with a stock dividend must match the number of options on a complete corporate action event. Each option must have at least one payout associated with it."),
471
- modelObject=(caFacts["OptionType"] + caFacts["PayoutType"]))
472
-
473
- if (hasEventComplete and
474
- not any(f.context.hasDimension(qnPayoutSequenceTypedAxis)
475
- for f in caFacts["DisbursedQuantity"])):
476
- modelXbrl.error("US-CA.stockDiv-mand.missingPayouts.49b",
477
- _("An DisbursedQuantity fact must exist in the document for the security paid out as part of the corporate action if the event is complete."),
478
- modelObject=modelXbrl, fact="DisbursedQuantity")
479
-
480
- if (hasEventComplete and
481
- not any(f.context.hasDimension(qnPayoutSequenceTypedAxis)
482
- for f in caFacts["BaseQuantity"])):
483
- modelXbrl.error("US-CA.stockDiv-mand.missingPayouts.49c",
484
- _("An BaseQuantity fact must exist in the document for the security paid out as part of the corporate action if the event is complete."),
485
- modelObject=modelXbrl, fact="BaseQuantity")
486
-
487
- if hasCancel:
488
- if not hasEventComplete:
489
- modelXbrl.error("US-CA.cancelComplete.30",
490
- _("The Details Completness Status (EventCompletenes) must have a value of Complete for a cancel event."),
491
- modelObject=modelXbrl, fact="EventCompleteness")
492
-
493
- if not caFacts["EventCompleteness"]:
494
- modelXbrl.error("US-CA.exists.31",
495
- _("The Details Completness Status must must be tagged in the cancel document with a value of Complete."),
496
- modelObject=modelXbrl, fact="EventCompleteness")
497
-
498
- if not (caFacts["EventConfirmationStatus"] and
499
- all(f.xValue == "Confirmed"
500
- for f in caFacts["EventConfirmationStatus"])):
501
- modelXbrl.error("US-CA.cancelComplete.32",
502
- _("The Event Confirmation Status must be tagged with a value of Confirmed for a cancel event."),
503
- modelObject=modelXbrl, fact="EventConfirmationStatus")
504
-
505
- facts = [f for f in modelXbrl.facts
506
- if f.context is not None and f.context.dimValue(qnStatusAxis) == qnUnconfirmedMember]
507
- if facts:
508
- modelXbrl.error("US-CA.cancel.invalid_member.33",
509
- _("Facts have been reported with the UnconfirmedMember on the StatusAxis for a cancel event: %(facts)s."),
510
- modelObject=facts, facts=", ".join(f.localName for f in facts))
511
-
512
- facts = [f for f in modelXbrl.facts
513
- if f.context is not None and
514
- f.context.dimValue(qnStatusAxis) == qnPreliminaryMember and
515
- f.context.dimValue(qnEventTypeAxis) == qnCancelMember]
516
- if facts:
517
- modelXbrl.error("US-CA.cancel.invalid_member.34",
518
- _("Facts have been reported with the PreliminaryMember on the StatusAxis for a cancel event: %(facts)s. "
519
- "A cancel event must use the ConfirmedMember on the StatusAxis."),
520
- modelObject=facts, facts=", ".join(f.localName for f in facts))
521
-
522
- facts = [f for f in modelXbrl.facts
523
- if f.context is not None and
524
- f.context.dimValue(qnStatusAxis) == qnUnconfirmedMember and
525
- f.context.dimValue(qnEventTypeAxis) == qnCancelMember]
526
- if facts:
527
- modelXbrl.error("US-CA.cancel.invalid_member.36",
528
- _("Facts have been reported with the UnconfirmedMember on the StatusAxis for a cancel event: %(facts)s. "
529
- "A cancel event must use the ConfirmedMember on the StatusAxis."),
530
- modelObject=facts, facts=", ".join(f.localName for f in facts))
531
-
532
-
533
- for f in caFacts["EventType"]:
534
- eventTypeMember = f.context.dimMemberQname(qnEventTypeAxis)
535
- if eventTypeMember:
536
- if f.xValue not in eventTypeMap[eventTypeMember.localName]:
537
- modelXbrl.error("US-CA.cancel.eventTypeMatch.37",
538
- _("The %(fact)s, %(value)s must be defined as \"Stock Dividend\"."),
539
- modelObject=f, fact="EventType", value=f.value)
540
-
541
- if 'facts' in locals():
542
- del facts
543
- del caFacts # dereference explicitly
544
-
545
- modelXbrl.profileStat(_("validate US Corporate Actions"), time.time() - startedAt)
546
-
547
- __pluginInfo__ = {
548
- # Do not use _( ) in pluginInfo itself (it is applied later, after loading
549
- 'name': 'Validate XBRL-US Corporate Actions',
550
- 'version': '0.9',
551
- 'description': '''XBRL-US Corporate Actions Validation.''',
552
- 'license': 'Apache-2',
553
- 'author': 'Ewe S. Gap',
554
- 'copyright': copyrightLabel,
555
- # classes of mount points (required)
556
- 'Validate.XBRL.Finally': checkCorporateActions
557
- }