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,215 +0,0 @@
1
- #! /usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
- # Calendar Program
4
- # Copyright 2008 Santhosh Thottingal <santhosh.thottingal@gmail.com>
5
- # http://www.smc.org.in
6
- #####
7
- # Arelle modification: interfaces to allow operation as a run-time user-discretion plug in
8
- # Hindi month names
9
- #
10
- # Note that this plug-in is LGPL-v3 and not Apache-2 see http://www.apache.org/licenses/GPL-compatibility.html
11
- #####
12
- #
13
- # This program is free software; you can redistribute it and/or modify
14
- # it under the terms of the GNU Lesser General Public License as published by
15
- # the Free Software Foundation; either version 3 of the License, or
16
- # (at your option) any later version.
17
- #
18
- # This program is distributed in the hope that it will be useful,
19
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
- # GNU Library General Public License for more details.
22
- #
23
- # You should have received a copy of the GNU Lesser General Public License
24
- # along with this program; if not, write to the Free Software
25
- # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
- #
27
- # If you find any bugs or have any suggestions email: santhosh.thottingal@gmail.com
28
-
29
- import math
30
- class SakaCalendar:
31
- JULIAN_EPOCH = 1721425.5
32
- SAKA_MONTH_NAMES= ["Chaitra", "Vaisakha", "Jyaishta", "Asadha", "Sravana", "Bhadra","Aswina", "Kartiak", "Agrahayana","Pausa","Magha","Phalguna"]
33
- SAKA_WEEK_NAMES= ["Ravivar", "Somavar", "Mangalvar", "Budhvar", "Sukhravar", "Guruvar","Sanivar"]
34
- IE = 0
35
- # The only practical difference from a Gregorian calendar is that years
36
- #are numbered since the Saka Era. A couple of overrides will
37
- #take care of that....
38
- # Starts in 78 AD,
39
- INDIAN_ERA_START = 78
40
- # The Indian year starts 80 days later than the Gregorian year.
41
- INDIAN_YEAR_START = 80
42
- def get_month_length(self, extendedYear, month):
43
- if month < 0 or month > 11:
44
- extendedYear += month/12 # floorDivide(month, 12, remainder)
45
- month = month%12
46
- if self.is_gregorian_leap(extendedYear + self.INDIAN_ERA_START) and month == 0:
47
- return 31
48
- if month >= 1 and month <=5 :
49
- return 31
50
- return 30
51
-
52
-
53
- """
54
- This routine converts an Indian date to the corresponding Julian date
55
- @param year The year in Saka Era according to Indian calendar.
56
- @param month The month according to Indian calendar (between 1 to 12)
57
- @param date The date in month
58
- """
59
- def saka_to_julian_date(self,year,month, date):
60
- gyear = year + self.INDIAN_ERA_START
61
- if self.is_gregorian_leap(gyear) :
62
- leapMonth = 31
63
- start = self.gregorian_to_julian_date(gyear, 3, 21)
64
- else :
65
- leapMonth = 30
66
- start = self.gregorian_to_julian_date(gyear, 3, 22)
67
- if month == 1 :
68
- jd = start + (date - 1)
69
- else:
70
- jd = start + leapMonth
71
- m = month - 2
72
- m = m if m <= 5 else 5
73
- jd += m * 31
74
- if month >= 8 :
75
- m = month - 7
76
- jd += m * 30
77
- jd += date - 1
78
- return jd
79
-
80
-
81
- """
82
- The following function is not needed for basic calendar functioning.
83
- This routine converts a gregorian date to the corresponding Julian date"
84
- @param year The year in standard Gregorian calendar (AD/BC) .
85
- @param month The month according to Gregorian calendar (between 0 to 11)
86
- @param date The date in month
87
- """
88
- def gregorian_to_julian_date(self, year, month, date) :
89
- jd = ((self.JULIAN_EPOCH - 1) +
90
- (365 * (year - 1)) +
91
- math.floor((year - 1) / 4) +
92
- (-math.floor((year - 1) / 100)) +
93
- math.floor((year - 1) / 400) +
94
- math.floor((((367 * month) - 362) / 12) +
95
- ( 0 if (month <= 2) else -1 if self.is_gregorian_leap(year) else -2) ) +
96
- date)
97
-
98
- return jd
99
-
100
-
101
- """
102
- The following function is not needed for basic calendar functioning.
103
- This routine converts a julian day (jd) to the corresponding date in Gregorian calendar"
104
- @param jd The Julian date in Julian Calendar which is to be converted to Indian date"
105
- """
106
- def julian_date_to_gregorian(self, jd) :
107
- julianDate=[None, None,None]
108
- wjd = math.floor(jd - 0.5) + 0.5
109
- depoch = wjd - self.JULIAN_EPOCH
110
- quadricent = math.floor(depoch / 146097)
111
- dqc = depoch % 146097
112
- cent = math.floor(dqc / 36524)
113
- dcent = dqc % 36524
114
- quad = math.floor(dcent / 1461)
115
- dquad = dcent % 1461
116
- yindex = math.floor(dquad / 365)
117
- year = int((quadricent * 400) + (cent * 100) + (quad * 4) + yindex)
118
- if not ((cent == 4) or (yindex == 4)) :
119
- year+=1
120
- yearday = wjd - self.gregorian_to_julian_date(year, 1, 1)
121
- leapadj = ( 0 if (wjd < self.gregorian_to_julian_date(year, 3, 1)) else 1 if self.is_gregorian_leap(year) else 2)
122
- month = int(math.floor((((yearday + leapadj) * 12) + 373) / 367))
123
- day = int((wjd - self.gregorian_to_julian_date(year, month, 1)) + 1)
124
- julianDate[0] = year
125
- julianDate[1] = month
126
- julianDate[2] = day
127
- return julianDate
128
-
129
-
130
- """
131
- The following function is not needed for basic calendar functioning.
132
- This routine checks if the Gregorian year is a leap year"
133
- @param year The year in Gregorian Calendar
134
- """
135
- def is_gregorian_leap(self,year):
136
- return ((year % 4) == 0) and (not(((year % 100) == 0) and ((year % 400) != 0)))
137
-
138
- def gregorian_to_saka_date(self, gregorianDay):
139
- indDate=[None,None,None]
140
- IndianYear = gregorianDay[0] - self.INDIAN_ERA_START # Year in Saka era
141
- jdAtStartOfGregYear = self. gregorian_to_julian_date(gregorianDay[0], 1, 1) # JD at start of Gregorian year
142
- julianDay = self.gregorian_to_julian_date( gregorianDay[0], gregorianDay[1], gregorianDay[2])
143
- yday = int(julianDay - jdAtStartOfGregYear) # Day number in Gregorian year (starting from 0)
144
- if yday < self.INDIAN_YEAR_START :
145
- # Day is at the end of the preceding Saka year
146
- IndianYear -= 1
147
- leapMonth = 31 if self.is_gregorian_leap(gregorianDay[0] - 1) else 30 # Days in leapMonth this year, previous Gregorian year
148
- yday += leapMonth + (31 * 5) + (30 * 3) + 10
149
- else:
150
- leapMonth = 31 if self.is_gregorian_leap(gregorianDay[0]) else 30 # Days in leapMonth this year
151
- yday -= self.INDIAN_YEAR_START
152
- if yday < leapMonth :
153
- IndianMonth = 0
154
- IndianDayOfMonth = yday + 1
155
- else :
156
- mday = yday - leapMonth
157
- if mday < (31 * 5) :
158
- IndianMonth = int(math.floor(mday / 31) + 1)
159
- IndianDayOfMonth = (mday % 31) + 1
160
- else :
161
- mday -= 31 * 5
162
- IndianMonth = int(math.floor(mday / 30)) + 6
163
- IndianDayOfMonth = (mday % 30) + 1
164
-
165
- #Month is 0 based.converting it to 1 based
166
- if IndianMonth == 12 :
167
- IndianMonth = 1
168
- else :
169
- IndianMonth = IndianMonth +1
170
- indDate[0]=IndianYear
171
- indDate[1]=IndianMonth
172
- indDate[2]=IndianDayOfMonth
173
- return indDate
174
- def get_month_name(self, month_index):
175
- return self.SAKA_MONTH_NAMES[month_index-1]
176
- def get_week_name(self, week_index) :
177
- return self.SAKA_WEEK_NAMES[week_index-1]
178
-
179
- # Arelle modifications follow this comment. They do not modify the behavior of the original module.
180
-
181
- def gregorianToSaka(gregorianDateArray):
182
- if (not isinstance(gregorianDateArray, (tuple,list)) or
183
- len(gregorianDateArray) != 3):
184
- raise ValueError("sakaCalendar:Invalid argument, must be tuple or list of yr,mo,day: {}".format(gregorianDateArray))
185
- return SakaCalendar().gregorian_to_saka_date(gregorianDateArray)
186
-
187
- def sakaToGregorian(sakaDateArray):
188
- if (not isinstance(sakaDateArray, (tuple,list)) or
189
- len(sakaDateArray) != 3):
190
- raise ValueError("sakaCalendar:Invalid argument, must be tuple or list of yr,mo,day: {}".format(sakaDateArray))
191
- sakaCal = SakaCalendar()
192
- sakaYr = sakaDateArray[0]
193
- sakaMo = sakaDateArray[1]
194
- sakaDay = sakaDateArray[2]
195
- # validate date
196
- if (not isinstance(sakaDateArray, (tuple,list)) or
197
- len(sakaDateArray) != 3 or
198
- not 1 <= sakaYr <= 9999 or
199
- not 1 <= sakaMo <= 12 or
200
- not 1 <= sakaDay <= sakaCal.get_month_length(sakaYr, sakaMo)):
201
- raise ValueError("sakaCalendar:InvalidDate: {} {} {}".format(sakaYr, sakaMo, sakaDay))
202
- # convert to gregorian calendar
203
- return sakaCal.julian_date_to_gregorian(sakaCal.saka_to_julian_date(sakaYr, sakaMo, sakaDay))
204
-
205
- __pluginInfo__ = {
206
- 'name': 'Saka Calendar',
207
- 'version': '1.0',
208
- 'description': "India National Calendar date validation and conversion. ",
209
- 'license': 'LGPL-v3',
210
- 'author': 'Santhosh Thottingal',
211
- 'copyright': '(c) Copyright 2008 Santhosh Thottingal <santhosh.thottingal@gmail.com>.',
212
- # classes of mount points (required)
213
- 'SakaCalendar.FromGregorian': gregorianToSaka,
214
- 'SakaCalendar.ToGregorian': sakaToGregorian,
215
- }
@@ -1,121 +0,0 @@
1
- '''
2
- Save Instance Infoset is an example of a plug-in to both GUI menu and command line/web service
3
- that will save facts decorated with ptv:periodType, ptv:balance, ptv:decimals and ptv:precision (inferred).
4
-
5
- See COPYRIGHT.md for copyright information.
6
- '''
7
- from arelle.Version import authorLabel, copyrightLabel
8
-
9
- def generateInstanceInfoset(dts, instanceInfosetFile):
10
- if dts.fileSource.isArchive:
11
- return
12
- import os, io
13
- from arelle import XmlUtil, XbrlConst
14
- from arelle.ValidateXbrlCalcs import inferredPrecision, inferredDecimals
15
-
16
- XmlUtil.setXmlns(dts.modelDocument, "ptv", "http://www.xbrl.org/2003/ptv")
17
-
18
- numFacts = 0
19
-
20
- for fact in dts.facts:
21
- try:
22
- if fact.concept.periodType:
23
- fact.set("{http://www.xbrl.org/2003/ptv}periodType", fact.concept.periodType)
24
- if fact.concept.balance:
25
- fact.set("{http://www.xbrl.org/2003/ptv}balance", fact.concept.balance)
26
- if fact.isNumeric and not fact.isNil:
27
- fact.set("{http://www.xbrl.org/2003/ptv}decimals", str(inferredDecimals(fact)))
28
- fact.set("{http://www.xbrl.org/2003/ptv}precision", str(inferredPrecision(fact)))
29
- numFacts += 1
30
- except Exception as err:
31
- dts.error("saveInfoset.exception",
32
- _("Facts exception %(fact)s %(value)s %(error)s."),
33
- modelObject=fact, fact=fact.qname, value=fact.effectiveValue, error = err)
34
-
35
- fh = open(instanceInfosetFile, "w", encoding="utf-8")
36
- XmlUtil.writexml(fh, dts.modelDocument.xmlDocument, encoding="utf-8")
37
- fh.close()
38
-
39
- dts.info("info:saveInstanceInfoset",
40
- _("Instance infoset of %(entryFile)s has %(numberOfFacts)s facts in infoset file %(infosetOutputFile)s."),
41
- modelObject=dts,
42
- entryFile=dts.uri, numberOfFacts=numFacts, infosetOutputFile=instanceInfosetFile)
43
-
44
- def saveInstanceInfosetMenuEntender(cntlr, menu):
45
- # Extend menu with an item for the save infoset plugin
46
- menu.add_command(label="Save infoset",
47
- underline=0,
48
- command=lambda: saveInstanceInfosetMenuCommand(cntlr) )
49
-
50
- def saveInstanceInfosetMenuCommand(cntlr):
51
- # save Infoset menu item has been invoked
52
- from arelle.ModelDocument import Type
53
- if cntlr.modelManager is None or cntlr.modelManager.modelXbrl is None or cntlr.modelManager.modelXbrl.modelDocument.type != Type.INSTANCE:
54
- cntlr.addToLog("No instance loaded.")
55
- return
56
-
57
- # get file name into which to save log file while in foreground thread
58
- instanceInfosetFile = cntlr.uiFileDialog("save",
59
- title=_("arelle - Save instance infoset file"),
60
- initialdir=cntlr.config.setdefault("infosetFileDir","."),
61
- filetypes=[(_("Infoset file .xml"), "*.xml")],
62
- defaultextension=".xml")
63
- if not instanceInfosetFile:
64
- return False
65
- import os
66
- cntlr.config["infosetFileDir"] = os.path.dirname(instanceInfosetFile)
67
- cntlr.saveConfig()
68
-
69
- try:
70
- generateInstanceInfoset(cntlr.modelManager.modelXbrl, instanceInfosetFile)
71
- except Exception as ex:
72
- dts = cntlr.modelManager.modelXbrl
73
- dts.error("exception",
74
- _("Instance infoset generation exception: %(error)s"), error=ex,
75
- modelXbrl=dts,
76
- exc_info=True)
77
-
78
- def saveInstanceInfosetCommandLineOptionExtender(parser):
79
- # extend command line options with a save DTS option
80
- parser.add_option("--save-instance-infoset",
81
- action="store",
82
- dest="instanceInfosetFile",
83
- help=_("Save instance infoset in specified file, or to send testcase infoset out files to out directory specify 'generateOutFiles'."))
84
-
85
- def saveInstanceInfosetCommandLineXbrlLoaded(cntlr, options, modelXbrl, *args, **kwargs):
86
- # extend XBRL-loaded run processing for this option
87
- from arelle.ModelDocument import Type
88
- if getattr(options, "instanceInfosetFile", None) and options.infosetFile == "generateOutFiles" and modelXbrl.modelDocument.type in (Type.TESTCASESINDEX, Type.TESTCASE):
89
- cntlr.modelManager.generateInfosetOutFiles = True
90
-
91
- def saveInstanceInfosetCommandLineXbrlRun(cntlr, options, modelXbrl, *args, **kwargs):
92
- # extend XBRL-loaded run processing for this option
93
- if getattr(options, "instanceInfosetFile", None) and options.instanceInfosetFile != "generateOutFiles":
94
- if cntlr.modelManager is None or cntlr.modelManager.modelXbrl is None:
95
- cntlr.addToLog("No taxonomy loaded.")
96
- return
97
- generateInstanceInfoset(cntlr.modelManager.modelXbrl, options.instanceInfosetFile)
98
-
99
- def validateInstanceInfoset(dts, instanceInfosetFile):
100
- if getattr(dts.modelManager, 'generateInfosetOutFiles', False):
101
- generateInstanceInfoset(dts,
102
- # normalize file to instance
103
- dts.modelManager.cntlr.webCache.normalizeUrl(instanceInfosetFile, dts.uri))
104
-
105
-
106
- __pluginInfo__ = {
107
- 'name': 'Save Instance Infoset (PTV)',
108
- 'version': '0.9',
109
- 'description': "This plug-in adds a feature to output an instance \"ptv\" infoset. "
110
- "(Does not offset infoset hrefs and schemaLocations for directory offset from DTS.) "
111
- "The ptv infoset is the source instance with facts having ptv:periodType, ptv:balance (where applicable), ptv:decimals and ptv:precision (inferred). ",
112
- 'license': 'Apache-2',
113
- 'author': authorLabel,
114
- 'copyright': copyrightLabel,
115
- # classes of mount points (required)
116
- 'CntlrWinMain.Menu.Tools': saveInstanceInfosetMenuEntender,
117
- 'CntlrCmdLine.Options': saveInstanceInfosetCommandLineOptionExtender,
118
- 'CntlrCmdLine.Xbrl.Loaded': saveInstanceInfosetCommandLineXbrlLoaded,
119
- 'CntlrCmdLine.Xbrl.Run': saveInstanceInfosetCommandLineXbrlRun,
120
- 'Validate.Infoset': validateInstanceInfoset,
121
- }