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,31 +0,0 @@
1
- using System;
2
- using System.Collections.Generic;
3
- using System.Linq;
4
- using System.Text;
5
- using System.Net;
6
- using System.IO;
7
- using System.Diagnostics;
8
-
9
- namespace ArelleCsharpProject
10
- {
11
- class LoadValidate
12
- {
13
- static void Main(string[] args)
14
- {
15
- string restAPIstr =
16
- "http://localhost:8080/rest/xbrl/" +
17
- "C:/Users/John%20Doe/Samples/instance0010000.xbrl" +
18
- "/validation/xbrl?media=text";
19
-
20
- HttpWebRequest req = WebRequest.Create(restAPIstr) as HttpWebRequest;
21
-
22
- string line;
23
- using (HttpWebResponse resp = req.GetResponse() as HttpWebResponse)
24
- {
25
- StreamReader reader = new StreamReader(resp.GetResponseStream());
26
- while ((line = reader.ReadLine()) != null)
27
- Debug.WriteLine(line);
28
- }
29
- }
30
- }
31
- }
@@ -1,36 +0,0 @@
1
- '''
2
- This module is an example Arelle controller in non-interactive mode
3
-
4
- See COPYRIGHT.md for copyright information.
5
- '''
6
- from arelle import Cntlr
7
- from arelle.ValidateXbrlCalcs import ValidateCalcsMode
8
-
9
- # this is the controller class
10
- class CntlrValidateExample(Cntlr.Cntlr):
11
-
12
- # init sets up the default controller for logging to a file (instead of to terminal window)
13
- def __init__(self):
14
- # initialize superclass with default file logger
15
- super().__init__(logFileName="c:\\temp\\test-log.txt", logFileMode="w")
16
-
17
- def run(self):
18
- # create the modelXbrl by load instance and discover DTS
19
- modelXbrl = self.modelManager.load("c:\\temp\\test.xbrl")
20
-
21
- # select validation of calculation linkbase using infer decimals option
22
- self.modelManager.validateCalcs = ValidateCalcsMode.XBRL_v2_1
23
-
24
- # perfrom XBRL 2.1, dimensions, calculation
25
- self.modelManager.validate()
26
-
27
- # close the loaded instance
28
- self.modelManager.close()
29
-
30
- # close controller and application
31
- self.close()
32
-
33
- # if python is initiated as a main program, start the controller
34
- if __name__ == "__main__":
35
- # create the controller and start it running
36
- CntlrValidateExample().run()
@@ -1,69 +0,0 @@
1
- import java.io.BufferedInputStream;
2
- import java.io.BufferedReader;
3
- import java.io.IOException;
4
- import java.io.InputStream;
5
- import java.io.InputStreamReader;
6
-
7
- public class LoadValidateCmdLine {
8
- public static void main(String[] args) throws IOException {
9
- Runtime r = Runtime.getRuntime();
10
- String arelleExe = "\"C:\\Program Files\\Arelle\\arelleCmdLine.exe\"";
11
- // XDG_CONFIG_HOME is optional, when omitted it defaults to "~/.config"
12
- String arelleXdgConfigHome = "C:\\Users\\hermfi~1\\appdir\\local";
13
- String fileBase = "C:\\Users\\John Doe\\samples\\";
14
- String [] fileNames = {
15
- "instance0000010.xml",
16
- "instance0010000.xml"
17
- //"instance0020000.xml",
18
- //"instance0040000.xml",
19
- //"instance0060000.xml",
20
- //"instance0080000.xml",
21
- //"instance0100000.xml",
22
- //"instance0120000.xml",
23
- //"instance0165000.xml"
24
- };
25
- for (String fileName : fileNames) {
26
- try {
27
- System.out.println("File: " + fileName);
28
- String cmdLine =
29
- arelleExe +
30
- " --file " +
31
- "\"" + fileBase + fileName + "\"" +
32
- " -v";
33
- System.out.println("CmdLine: " + cmdLine);
34
- String[] envp = new String[1];
35
- // XDG_CONFIG_HOME is optional, defaults to "~/.config"
36
- envp[0] = "XDG_CONFIG_HOME=" + arelleXdgConfigHome;
37
- Process p = r.exec(cmdLine, envp);
38
- InputStream in = p.getInputStream();
39
- BufferedInputStream buf = new BufferedInputStream(in);
40
- InputStreamReader inread = new InputStreamReader(buf);
41
- BufferedReader br = new BufferedReader(inread);
42
-
43
- String line;
44
- while ((line = br.readLine()) != null) {
45
- System.out.println(line);
46
- }
47
- try {
48
- if (p.waitFor() != 0) {
49
- System.err.println("exit value = " + p.exitValue());
50
- }
51
- }
52
- catch (InterruptedException e) {
53
- System.err.println(e);
54
- }
55
- finally {
56
- // Close the InputStream
57
- br.close();
58
- inread.close();
59
- buf.close();
60
- in.close();
61
- }
62
- }
63
- catch (IOException e) {
64
- System.err.println(e.getMessage());
65
- }
66
- }
67
- System.out.println("Done");
68
- }
69
- }
@@ -1,57 +0,0 @@
1
- import java.io.BufferedReader;
2
- import java.io.DataOutputStream;
3
- import java.io.File;
4
- import java.io.FileInputStream;
5
- import java.io.IOException;
6
- import java.io.InputStream;
7
- import java.io.InputStreamReader;
8
- import java.io.PrintStream;
9
- import java.net.HttpURLConnection;
10
- import java.net.URL;
11
-
12
- public class LoadValidatePostedZip {
13
- public static void main(String[] args) throws IOException {
14
- String restAPIstr =
15
- "http://localhost:8080/rest/xbrl/" +
16
- "instance-no-formula-link.xml" +
17
- "/validation/xbrl" +
18
- "?media=text" +
19
- "&import=assertionsHtmlSchemaLoc.xml" +
20
- "&formulaAsserResultCounts";
21
- URL url = new URL(restAPIstr);
22
- HttpURLConnection conn =
23
- (HttpURLConnection) url.openConnection();
24
- conn.setRequestMethod("POST");
25
- conn.setRequestProperty("Content-Type",
26
- "application/zip");
27
- conn.setDoOutput(true);
28
- //Send request
29
- File zipFile = new File("C:/temp/test-assertion-example.zip");
30
- InputStream is = new FileInputStream(zipFile);
31
- byte[] zipFileBytes = new byte[1000000];
32
- int countRead = is.read(zipFileBytes, 0, 1000000);
33
- is.close();
34
-
35
- DataOutputStream wr = new DataOutputStream (
36
- conn.getOutputStream ());
37
- wr.write(zipFileBytes, 0, countRead);
38
- wr.flush ();
39
- wr.close ();
40
-
41
- if (conn.getResponseCode() != 200) {
42
- throw new IOException(conn.getResponseMessage());
43
- }
44
-
45
- // Buffer the result into a string
46
- BufferedReader rd = new BufferedReader(
47
- new InputStreamReader(conn.getInputStream()));
48
- StringBuilder sb = new StringBuilder();
49
- String line;
50
- while ((line = rd.readLine()) != null) {
51
- sb.append(line);
52
- System.out.println(line);
53
- }
54
- rd.close();
55
- conn.disconnect();
56
- }
57
- }
@@ -1,34 +0,0 @@
1
- import java.io.BufferedReader;
2
- import java.io.IOException;
3
- import java.io.InputStreamReader;
4
- import java.io.PrintStream;
5
- import java.net.HttpURLConnection;
6
- import java.net.URL;
7
-
8
- public class LoadValidateWebService {
9
- public static void main(String[] args) throws IOException {
10
- String restAPIstr =
11
- "http://localhost:8080/rest/xbrl/" +
12
- "C:/Users/John%20Doe/Samples/instance0010000.xbrl" +
13
- "/validation/xbrl?media=text";
14
- URL url = new URL(restAPIstr);
15
- HttpURLConnection conn =
16
- (HttpURLConnection) url.openConnection();
17
-
18
- if (conn.getResponseCode() != 200) {
19
- throw new IOException(conn.getResponseMessage());
20
- }
21
-
22
- // Buffer the result into a string
23
- BufferedReader rd = new BufferedReader(
24
- new InputStreamReader(conn.getInputStream()));
25
- StringBuilder sb = new StringBuilder();
26
- String line;
27
- while ((line = rd.readLine()) != null) {
28
- sb.append(line);
29
- System.out.println(line);
30
- }
31
- rd.close();
32
- conn.disconnect();
33
- }
34
- }
@@ -1,140 +0,0 @@
1
- '''
2
- This module is an example to convert Html Tables into Xlsx (Excel) tables
3
- Preconfigured here to use SEC Edgar Rendering R files as input
4
-
5
- See COPYRIGHT.md for copyright information.
6
- '''
7
- import os, sys
8
- import regex as re
9
- from lxml import etree, html
10
- from openpyxl.workbook import Workbook
11
- from openpyxl.worksheet import ColumnDimension
12
- from openpyxl.cell import get_column_letter
13
- from openpyxl.style import Alignment
14
-
15
- class Report():
16
- def __init__(self, longName, shortName, htmlFileName):
17
- self.longName = longName
18
- self.shortName = shortName
19
- self.htmlFileName = htmlFileName
20
- def __repr__(self):
21
- return ("report(longName='{}', shortName='{}', htmlFileName='{}')"
22
- .format(self.longName, self.shortName, self.htmlFileName))
23
-
24
- def intCol(elt, attrName, default=None):
25
- try:
26
- return int(elt.get(attrName, default))
27
- except (TypeError, ValueError):
28
- return default
29
-
30
- numberPattern = re.compile(r"\s*([$]\s*)?[(]?\s*[+-]?[0-9,]+([.][0-9]*)?[)-]?\s*$")
31
- displayNonePattern = re.compile(r"\s*display:\s*none;")
32
-
33
- def saveTableToExelle(rFilesDir):
34
-
35
- # get reports from FilingSummary
36
- reports = []
37
- try:
38
- fsdoc = etree.parse(os.path.join(rFilesDir, "FilingSummary.xml"))
39
- for rElt in fsdoc.iter(tag="Report"):
40
- reports.append(Report(rElt.findtext("LongName"),
41
- rElt.findtext("ShortName"),
42
- rElt.findtext("HtmlFileName")))
43
- except (EnvironmentError,
44
- etree.LxmlError) as err:
45
- print("FilingSummary.xml: directory {0} error: {1}".format(rFilesDir, err))
46
-
47
- wb = Workbook(encoding='utf-8')
48
- # remove predefined sheets
49
- for sheetName in wb.get_sheet_names():
50
- ws = wb.get_sheet_by_name(sheetName)
51
- if ws is not None:
52
- wb.remove_sheet(ws)
53
-
54
- sheetNames = set() # prevent duplicates
55
-
56
- for reportNum, report in enumerate(reports):
57
- sheetName = report.shortName[:31] # max length 31 for excel title
58
- if sheetName in sheetNames:
59
- sheetName = sheetName[:31-len(str(reportNum))] + str(reportNum)
60
- sheetNames.add(sheetName)
61
- ws = wb.create_sheet(title=sheetName)
62
-
63
- try:
64
- # doesn't detect utf-8 encoding the normal way, pass it a string
65
- #htmlSource = ''
66
- #with open(os.path.join(rFilesDir, report.htmlFileName), 'rt', encoding='utf-8') as fh:
67
- # htmlSource = fh.read()
68
- #rdoc = html.document_fromstring(htmlSource)
69
- rdoc = html.parse(os.path.join(rFilesDir, report.htmlFileName))
70
- row = -1
71
- mergedAreas = {} # colNumber: (colspan,lastrow)
72
- for tableElt in rdoc.iter(tag="table"):
73
- # skip pop up tables
74
- if tableElt.get("class") == "authRefData":
75
- continue
76
- if tableElt.getparent().tag == "div":
77
- style = tableElt.getparent().get("style")
78
- if style and displayNonePattern.match(style):
79
- continue
80
- colWidths = {}
81
- for rowNum, trElt in enumerate(tableElt.iter(tag="tr")):
82
- # remove passed mergedAreas
83
- for mergeCol in [col
84
- for col, mergedArea in mergedAreas.items()
85
- if mergedArea[1] > rowNum]:
86
- del mergedAreas[mergeCol]
87
- col = 0
88
- for coltag in ("th", "td"):
89
- for cellElt in trElt.iter(tag=coltag):
90
- if col == 0:
91
- row += 1 # new row
92
- if col in mergedAreas:
93
- col += mergedAreas[col][0] - 1
94
- text = cellElt.text_content()
95
- colspan = intCol(cellElt, "colspan", 1)
96
- rowspan = intCol(cellElt, "rowspan", 1)
97
- #if col not in colWidths:
98
- # colWidths[col] = 10.0 # some kind of default width
99
- for elt in cellElt.iter():
100
- style = elt.get("style")
101
- if style and "width:" in style:
102
- try:
103
- kw, sep, width = style.partition("width:")
104
- if "px" in width:
105
- width, sep, kw = width.partition("px")
106
- width = float(width) * 0.67777777
107
- else:
108
- width = float(width)
109
- colWidths[col] = width
110
- except ValueError:
111
- pass
112
- if rowspan > 1:
113
- mergedAreas[col] = (colspan, row + rowspan - 1)
114
- cell = ws.cell(row=row,column=col)
115
- if text:
116
- cell.value = text
117
- if numberPattern.match(text):
118
- cell.style.alignment.horizontal = Alignment.HORIZONTAL_RIGHT
119
- else:
120
- cell.style.alignment.wrap_text = True
121
- if colspan > 1 or rowspan > 1:
122
- ws.merge_cells(start_row=row, end_row=row+rowspan-1, start_column=col, end_column=col+colspan-1)
123
- cell.style.alignment.vertical = Alignment.VERTICAL_TOP
124
- if coltag == "th":
125
- cell.style.alignment.horizontal = Alignment.HORIZONTAL_CENTER
126
- cell.style.font.bold = True
127
- cell.style.font.size = 9 # some kind of default size
128
- col += colspan
129
- for col, width in colWidths.items():
130
- ws.column_dimensions[get_column_letter(col+1)].width = width
131
- except (EnvironmentError,
132
- etree.LxmlError) as err:
133
- print("{0}: directory {1} error: {2}".format(report.htmlFileName, rFilesDir, err))
134
-
135
- wb.save(os.path.join(rFilesDir, "exelleOut.xlsx"))
136
-
137
- if __name__ == "__main__":
138
-
139
- # test directory
140
- saveTableToExelle(r"C:\Users\Herm Fischer\Documents\mvsl\projects\SEC\14.1\R-files\wpoRfiles")
@@ -1,88 +0,0 @@
1
- '''
2
- See COPYRIGHT.md for copyright information.
3
- License: https://www.apache.org/licenses/LICENSE-2.0
4
-
5
- usage: python3 {tr2 or tr3 input-file} {tr4 output-file}
6
- '''
7
-
8
- import io, os, sys, time
9
- from lxml import etree
10
-
11
- if len(sys.argv) < 3:
12
- print("Please enter input and output filename arguments")
13
- exit(1)
14
- INFILE = sys.argv[1]
15
- OUTFILE = sys.argv[2]
16
-
17
- if not INFILE or not os.path.isfile(INFILE) or not OUTFILE:
18
- print("Please enter existing input filename and output filename")
19
- exit(1)
20
-
21
- xhtmlNs = "http://www.w3.org/1999/xhtml"
22
- ixNS = "http://www.xbrl.org/2013/inlineXBRL"
23
- ixEltsWithFormat = ["{{{}}}{}".format(ixNS, localName) for localName in ("denominator", "numerator", "nonFraction", "nonNumeric")]
24
- xhtmlRootElts = ["{{{}}}{}".format(xhtmlNs, localName) for localName in ("html", "xhtml")]
25
- TR2NS = "http://www.xbrl.org/inlineXBRL/transformation/2011-07-31"
26
- TR3NS = "http://www.xbrl.org/inlineXBRL/transformation/2015-02-26"
27
- TR4NS = "http://www.xbrl.org/inlineXBRL/transformation/2020-02-12"
28
- TR23to4 = {
29
- "booleanfalse": "fixed-false",
30
- "booleantrue": "fixed-true",
31
- "calindaymonthyear": "date-ind-day-monthname-year-hi",
32
- "datedaymonth": "date-day-month",
33
- "datedaymonthdk": "date-day-monthname-da",
34
- "datedaymonthen": "date-day-monthname-en",
35
- "datedaymonthyear": "date-day-month-year",
36
- "datedaymonthyeardk": "date-day-monthname-year-da",
37
- "datedaymonthyearen": "date-day-monthname-year-en",
38
- "datedaymonthyearin": "date-day-monthname-year-hi", # does not handle this: Use date-day-month-year when using Devanagari numerals for the month, otherwise use date-day-monthname-year-hi.
39
- "dateerayearmonthdayjp": "date-jpn-era-year-month-day",
40
- "dateerayearmonthjp": "date-jpn-era-year-month",
41
- "datemonthday": "date-month-day",
42
- "datemonthdayen": "date-monthname-day-en",
43
- "datemonthdayyear": "date-month-day-year",
44
- "datemonthdayyearen": "date-monthname-day-year-en",
45
- "datemonthyear": "date-month-year",
46
- "datemonthyeardk": "date-monthname-year-da",
47
- "datemonthyearen": "date-monthname-year-en",
48
- "datemonthyearin": "date-monthname-year-hi",
49
- "dateyearmonthday": "date-year-month-day",
50
- "dateyearmonthdaycjk": "date-year-month-day",
51
- "dateyearmonthcjk": "date-year-month",
52
- "dateyearmonthen": "date-year-monthname-en",
53
- "nocontent": "fixed-empty",
54
- "numcommadecimal": "num-comma-decimal",
55
- "numdotdecimal": "num-dot-decimal",
56
- "numdotdecimalin": "num-dot-decimal",
57
- "numunitdecimal": "num-unit-decimal",
58
- "numunitdecimalin": "num-unit-decimal",
59
- "zerodash": "fixed-zero"
60
- }
61
-
62
- print("Parsing TR3 file {}".format(INFILE))
63
- startedAt = time.time()
64
- parser = etree.XMLParser(recover=True, huge_tree=True)
65
- with io.open(INFILE, "rb") as fh:
66
- doc = etree.parse(fh,parser=parser,base_url=INFILE)
67
-
68
- # replace format TR3 with TR4
69
- nsToChange = set()
70
- for elt in doc.iter(*ixEltsWithFormat):
71
- prefix, _sep, localName = elt.get("format", "").rpartition(":")
72
- if localName:
73
- ns = elt.nsmap.get(prefix)
74
- if ns in (TR2NS, TR3NS):
75
- if localName in TR23to4:
76
- elt.set("format", "ixt:" + TR23to4[localName])
77
- nsToChange.add(ns)
78
- else:
79
- print("{} line {}: nable to convert transform {}".format(elt.tag, elt.sourceline, elt.get("format")))
80
-
81
- # replace TR2 and TR3 namespaces in any xmlns'ed element
82
- outXhtml = etree.tostring(doc, encoding=doc.docinfo.encoding, xml_declaration=True)
83
- for ns in nsToChange:
84
- outXhtml = outXhtml.replace(ns.encode(), TR4NS.encode())
85
-
86
- with io.open(OUTFILE, "wb", ) as fh:
87
- fh.write(outXhtml)
88
- print("Converted in {:.3f} secs, TR4 file {}".format(time.time()-startedAt, INFILE))
@@ -1,47 +0,0 @@
1
- """
2
- See COPYRIGHT.md for copyright information.
3
- """
4
- from __future__ import annotations
5
-
6
- from typing import Any
7
-
8
- from arelle.ModelDocument import LoadingException, ModelDocument
9
- from arelle.ModelXbrl import ModelXbrl
10
- from arelle.Version import authorLabel, copyrightLabel
11
- from arelle.typing import TypeGetText
12
- from arelle.utils.PluginHooks import PluginHooks
13
-
14
- _: TypeGetText
15
-
16
-
17
- class DeprecatedESEF2022Plugin(PluginHooks):
18
- """
19
- The 'validate/ESEF_2022' plugin has been merged into the `validate/ESEF` plugin using disclosure systems to select the year.
20
- This implementation only exists to raise an error and inform users to migrate their configuration.
21
- """
22
-
23
- @staticmethod
24
- def modelDocumentPullLoader(
25
- modelXbrl: ModelXbrl,
26
- normalizedUri: str,
27
- filepath: str,
28
- isEntry: bool,
29
- namespace: str | None,
30
- *args: Any,
31
- **kwargs: Any,
32
- ) -> ModelDocument | LoadingException | None:
33
- message = _("The 'validate/ESEF_2022' plugin has been combined with the 'validate/ESEF' plugin. Please use the 'validate/ESEF' plugin with a 2022 disclosure system.")
34
- modelXbrl.error("plugin:deprecated", message)
35
- return LoadingException(message)
36
-
37
-
38
- __pluginInfo__ = {
39
- "name": "Validate ESMA ESEF-2022",
40
- "version": "1.2023.00",
41
- "description": "Deprecated: use the 'validate/ESEF' plugin with a 2022 disclosure system instead.",
42
- "license": "Apache-2",
43
- "author": authorLabel,
44
- "copyright": copyrightLabel,
45
- "import": ("inlineXbrlDocumentSet",),
46
- "ModelDocument.PullLoader": DeprecatedESEF2022Plugin.modelDocumentPullLoader,
47
- }