ixbrl-viewer 1.4.33__py3-none-any.whl → 1.4.35__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ixbrl-viewer might be problematic. Click here for more details.
- iXBRLViewerPlugin/_version.py +2 -2
- iXBRLViewerPlugin/iXBRLViewer.py +29 -3
- iXBRLViewerPlugin/viewer/dist/ixbrlviewer.js +1 -1
- iXBRLViewerPlugin/viewer/src/js/calculationInspector.js +1 -1
- iXBRLViewerPlugin/viewer/src/js/inspector.js +1 -1
- {ixbrl_viewer-1.4.33.dist-info → ixbrl_viewer-1.4.35.dist-info}/METADATA +2 -2
- {ixbrl_viewer-1.4.33.dist-info → ixbrl_viewer-1.4.35.dist-info}/RECORD +13 -13
- tests/unit_tests/iXBRLViewerPlugin/test_iXBRLViewer.py +19 -0
- {ixbrl_viewer-1.4.33.dist-info → ixbrl_viewer-1.4.35.dist-info}/LICENSE +0 -0
- {ixbrl_viewer-1.4.33.dist-info → ixbrl_viewer-1.4.35.dist-info}/NOTICE +0 -0
- {ixbrl_viewer-1.4.33.dist-info → ixbrl_viewer-1.4.35.dist-info}/WHEEL +0 -0
- {ixbrl_viewer-1.4.33.dist-info → ixbrl_viewer-1.4.35.dist-info}/entry_points.txt +0 -0
- {ixbrl_viewer-1.4.33.dist-info → ixbrl_viewer-1.4.35.dist-info}/top_level.txt +0 -0
iXBRLViewerPlugin/_version.py
CHANGED
iXBRLViewerPlugin/iXBRLViewer.py
CHANGED
|
@@ -26,6 +26,7 @@ from lxml import etree
|
|
|
26
26
|
from .constants import DEFAULT_JS_FILENAME, DEFAULT_OUTPUT_NAME, ERROR_MESSAGE_CODE, FEATURE_CONFIGS, INFO_MESSAGE_CODE
|
|
27
27
|
from .xhtmlserialize import XHTMLSerializer
|
|
28
28
|
|
|
29
|
+
REPORT_TYPE_EXTENSIONS = ('.xbrl', '.xhtml', '.html', '.htm', '.json')
|
|
29
30
|
UNRECOGNIZED_LINKBASE_LOCAL_DOCUMENTS_TYPE = 'unrecognizedLinkbase'
|
|
30
31
|
LINK_QNAME_TO_LOCAL_DOCUMENTS_LINKBASE_TYPE = {
|
|
31
32
|
XbrlConst.qnLinkCalculationLink: 'calcLinkbase',
|
|
@@ -89,6 +90,7 @@ class IXBRLViewerBuilder:
|
|
|
89
90
|
basenameSuffix: str = '',
|
|
90
91
|
useStubViewer: bool = False,
|
|
91
92
|
):
|
|
93
|
+
self.reportZip = None
|
|
92
94
|
self.nsmap = NamespaceMap()
|
|
93
95
|
self.roleMap = NamespaceMap()
|
|
94
96
|
self.taxonomyData = {
|
|
@@ -116,6 +118,7 @@ class IXBRLViewerBuilder:
|
|
|
116
118
|
|
|
117
119
|
self.fromSingleZIP = None
|
|
118
120
|
self.reportCount = 0
|
|
121
|
+
self.assets = []
|
|
119
122
|
|
|
120
123
|
def enableFeature(self, featureName: str):
|
|
121
124
|
if featureName in self.taxonomyData["features"]:
|
|
@@ -439,7 +442,6 @@ class IXBRLViewerBuilder:
|
|
|
439
442
|
docSetFiles = [ srcFilename ]
|
|
440
443
|
filename = srcFilename
|
|
441
444
|
self.iv.addFile(iXBRLViewerFile(filename, report.modelDocument.xmlDocument))
|
|
442
|
-
|
|
443
445
|
docSetKey = frozenset(docSetFiles)
|
|
444
446
|
sourceReport = self.sourceReportsByFiles.get(docSetKey)
|
|
445
447
|
if sourceReport is None:
|
|
@@ -479,6 +481,14 @@ class IXBRLViewerBuilder:
|
|
|
479
481
|
self.filingDocZipPath = os.path.dirname(report.modelDocument.filepath)
|
|
480
482
|
else:
|
|
481
483
|
self.fromSingleZIP = False
|
|
484
|
+
if report.fileSource.isArchive:
|
|
485
|
+
filelist = report.fileSource.fs.filelist
|
|
486
|
+
for file in filelist:
|
|
487
|
+
directory, asset = os.path.split(file.filename)
|
|
488
|
+
if "reports" in directory and asset != '' and not asset.lower().endswith(REPORT_TYPE_EXTENSIONS):
|
|
489
|
+
self.assets.append(file.filename)
|
|
490
|
+
if self.assets:
|
|
491
|
+
self.reportZip = report.fileSource.fs.filename
|
|
482
492
|
|
|
483
493
|
def createViewer(
|
|
484
494
|
self,
|
|
@@ -495,7 +505,6 @@ class IXBRLViewerBuilder:
|
|
|
495
505
|
|
|
496
506
|
self.taxonomyData["prefixes"] = self.nsmap.prefixmap
|
|
497
507
|
self.taxonomyData["roles"] = self.roleMap.prefixmap
|
|
498
|
-
|
|
499
508
|
if showValidations:
|
|
500
509
|
self.taxonomyData["validation"] = self.validationErrors()
|
|
501
510
|
|
|
@@ -513,7 +522,10 @@ class IXBRLViewerBuilder:
|
|
|
513
522
|
# If there is only a single report, call the output file "xbrlviewer.html"
|
|
514
523
|
# We should probably preserve the source file extension here.
|
|
515
524
|
self.iv.files[0].filename = 'xbrlviewer.html'
|
|
516
|
-
|
|
525
|
+
if self.assets:
|
|
526
|
+
self.iv.addReportAssets(self.assets)
|
|
527
|
+
if self.reportZip:
|
|
528
|
+
self.iv.reportZip = self.reportZip
|
|
517
529
|
return self.iv
|
|
518
530
|
|
|
519
531
|
|
|
@@ -534,10 +546,15 @@ class iXBRLViewerFile:
|
|
|
534
546
|
class iXBRLViewer:
|
|
535
547
|
|
|
536
548
|
def __init__(self, cntlr: Cntlr):
|
|
549
|
+
self.reportZip = None
|
|
537
550
|
self.files = []
|
|
538
551
|
self.filingDocuments = None
|
|
539
552
|
self.cntlr = cntlr
|
|
540
553
|
self.filenames = set()
|
|
554
|
+
self.assets = []
|
|
555
|
+
|
|
556
|
+
def addReportAssets(self, assets):
|
|
557
|
+
self.assets.extend(assets)
|
|
541
558
|
|
|
542
559
|
def addFile(self, ivf):
|
|
543
560
|
if ivf.filename in self.filenames:
|
|
@@ -606,6 +623,15 @@ class iXBRLViewer:
|
|
|
606
623
|
filename = os.path.basename(self.filingDocuments)
|
|
607
624
|
self.cntlr.addToLog("Writing %s" % filename, messageCode=INFO_MESSAGE_CODE)
|
|
608
625
|
shutil.copy2(self.filingDocuments, os.path.join(destination, filename))
|
|
626
|
+
if self.assets:
|
|
627
|
+
with zipfile.ZipFile(self.reportZip) as z:
|
|
628
|
+
for asset in self.assets:
|
|
629
|
+
fileName = os.path.basename(asset)
|
|
630
|
+
path = os.path.join(destination, fileName)
|
|
631
|
+
self.cntlr.addToLog("Writing %s" % asset, messageCode=INFO_MESSAGE_CODE)
|
|
632
|
+
with z.open(asset) as zf, open(path, 'wb') as f:
|
|
633
|
+
shutil.copyfileobj(zf, f)
|
|
634
|
+
|
|
609
635
|
if copyScriptPath is not None:
|
|
610
636
|
self._copyScript(Path(destination), copyScriptPath)
|
|
611
637
|
else:
|