Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #106 from hermfischer-wf/edgar24.2-preview
Browse files Browse the repository at this point in the history
  • Loading branch information
austinmatherne-wk authored Jun 29, 2024
2 parents 61f544c + 362a196 commit 7ff457c
Show file tree
Hide file tree
Showing 303 changed files with 15,486 additions and 116,374 deletions.
2 changes: 1 addition & 1 deletion Cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def handlePeriodStartEndLabel(self,discoveredDurations=[]):
# will side effect cube.periodStartEndLabelDict if there is a duration fact with period start/end label.
# will generally side effect self.factMemberships by appending to it.

initialDurationSet = set([x[1]['period'] for x in self.factMemberships if x[1]['period'].periodTypeStr=='duration'])
initialDurationSet = set([x[1]['period'] for x in self.factMemberships if ('period' in x[1] and x[1]['period'].periodTypeStr=='duration')])

def matchingDurationSet(iFxm,preferredLabel):
# iFxm = instant Fact - axis - membership tuple.
Expand Down
7 changes: 4 additions & 3 deletions Filing.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@ def __init__(self, controller, modelXbrl, outputFolderName, transform, suplSuffi
('us-gaap',self.usgaapNamespace,'PartnerCapitalComponentsAxis'),
('us-gaap',self.usgaapNamespace,'StatementClassOfStockAxis')
]
self.builtinEquityRowAxes = [('us-gaap',self.usgaapNamespace,'CreationDateAxis'),
self.builtinEquityRowAxes = [('us-gaap',self.usgaapNamespace,'CreationDateAxis'), # us-gaap deprecated 2019 absent after 2021.
('ifrs-full',self.ifrsNamespace,'CreationDateAxis'),
('us-gaap',self.usgaapNamespace,'StatementScenarioAxis'),
('us-gaap',self.usgaapNamespace,'AdjustmentsForNewAccountingPronouncementsAxis'),
('us-gaap',self.usgaapNamespace,'AdjustmentsForChangeInAccountingPrincipleAxis'),
Expand All @@ -260,7 +261,7 @@ def __init__(self, controller, modelXbrl, outputFolderName, transform, suplSuffi
['ScenarioPreviouslyReportedMember',
'RestatementAdjustmentMember',
'ChangeInAccountingPrincipleMember'],
['ScenarioUnspecifiedDomain'])
['ScenarioUnspecifiedDomain']) # never deprecated, moved to srt in 2019
,(arelle.ModelValue.QName('ifrs-full',self.ifrsNamespace,'RetrospectiveApplicationAndRetrospectiveRestatementAxis')
,['PreviouslyStatedMember'
,'IncreaseDecreaseDueToChangesInAccountingPolicyAndCorrectionsOfPriorPeriodErrorsMember'
Expand Down Expand Up @@ -1018,7 +1019,7 @@ def finishOffReportIfNotEmbedded(self, embedding):


def RemoveStuntedCashFlowColumns(self,report):
visibleColumns = [col for col in report.colList if not col.isHidden]
visibleColumns = [col for col in report.colList if (not col.isHidden and col.startEndContext is not None)]
didWeHideAnyCols = False
remainingVisibleColumns = visibleColumns.copy()
maxMonths = max(col.startEndContext.numMonths for col in visibleColumns)
Expand Down
44 changes: 33 additions & 11 deletions Summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
INSTANCE = arelle.ModelDocument.Type.INSTANCE
INLINEXBRL = arelle.ModelDocument.Type.INLINEXBRL

FilingSummaryCompletionMessage = "Write filing summary complete" # Marker for the end of previous rendering.

def mergeCountDicts(iterable, dictAttribute=None, key=None):
'Return a dictionary merged from a collection of dictionaries, with values summed.'
newdict = defaultdict(int)
Expand Down Expand Up @@ -190,10 +192,17 @@ def appendSummaryFooter(self):
break
SubElement(logs, 'Log', type=errmsg.msgCode.title()).text = errmsg.msg
'''
logHandler = self.controller.cntlr.logHandler
numShownMessages = 0
for logRec in getattr(logHandler, "logRecordBuffer") or (): # non buffered handlers don't keep log records (e.g., log to print handler)
if logRec.levelno > logging.INFO:
_lastSummaryWritten = -1 # find the end of the last filing summary write operation.
_buffer = getattr(self.controller.cntlr.logHandler,"logRecordBuffer",[])
for i, logRec in enumerate(_buffer):
m = getattr(logRec, 'message', getattr(logRec, 'msg', ''))
# if len(m) == 0 or bool(re.match('.*complete.*',m)):
# print("WHY not '"+m+"'")
if m == FilingSummaryCompletionMessage:
_lastSummaryWritten = i
for i, logRec in enumerate(_buffer): # non buffered handlers don't keep log records (e.g., log to print handler)
if i > _lastSummaryWritten and logRec.levelno > logging.INFO:
if numShownMessages == 0:
logs = SubElement(self.rootETree, 'Logs')
self.controller.summaryHasLogEntries = True
Expand Down Expand Up @@ -266,8 +275,8 @@ def removeSummaryLogs(self):
self.rootETree.remove(self.eTreeLogsElement)
self.eTreeLogsElement = None # dereference

def writeMetaFiles(self):
def innerWriteMetaFiles():
def writeMetaFiles(self, reportsFolder, zipDir="", suplSuffix="", prefix=""):
def innerWriteMetaFiles(reportsFolder, zipDir="", suplSuffix="", prefix=""):
roots = OrderedDict()
roots['version'] = metaversion
instance = roots['instance'] = OrderedDict() # preserve instances order
Expand Down Expand Up @@ -357,12 +366,12 @@ def innerWriteMetaFiles():
if file is not None:
file.seek(0)
if self.controller.reportZip:
self.controller.reportZip.writestr(EJson, file.read().encode("utf-8"))
self.controller.reportZip.writestr(zipDir + EJson, file.read().encode("utf-8"))
else:
self.controller.writeFile(os.path.join(self.controller.reportsFolder, EJson), file.read())
self.controller.writeFile(os.path.join(reportsFolder, prefix + EJson + suplSuffix), file.read())
file.close()
del file # dereference
innerWriteMetaFiles() # if exception is raised, must be caught by caller in EdgarRenderer.filingEnd()
innerWriteMetaFiles(reportsFolder, zipDir, suplSuffix, prefix or "") # if exception is raised, must be caught by caller in EdgarRenderer.filingEnd()

class InstanceSummary(object):
"""The InstanceSummary object represents the summary information from one instance.
Expand Down Expand Up @@ -409,6 +418,7 @@ def __init__(self, filing, modelXbrl):
# even though they all go into the same list in the filing summary
self.instanceFiles = []
self.inlineFiles = []
self.targetDocumentFile = None
self.otherXbrlFiles = []

self.customPrefix = None
Expand All @@ -422,13 +432,16 @@ def __init__(self, filing, modelXbrl):
self.hasStdNamespace = set()
self.hasRRorOEF = self.hasOef = self.hasRR = self.hasVip = self.hasFeeExhibit = False

self.edgarDocType = getattr(modelXbrl,'efmAttachmentDocumentType',
self.edgarDocType = getattr(modelXbrl,'efmIxdsType',
next((f.xValue for f in modelXbrl.factsByLocalName["DocumentType"]
if (f.xValue is not None and f.context is not None and not f.context.hasSegment))
,None))

for uri,doc in sorted(modelXbrl.urlDocs.items(), key=lambda i: i[0]): # change to url from discovery order. i[1].objectIndex
if doc.type == arelle.ModelDocument.Type.INLINEXBRLDOCUMENTSET:
targetDocumentPreferredFilename = getattr(doc, "targetDocumentPreferredFilename", None)
if targetDocumentPreferredFilename:
self.targetDocumentFile = os.path.splitext(os.path.basename(targetDocumentPreferredFilename))[0]
continue # ignore ixds manifest
if not doc.inDTS:
continue # ignore non-DTS documents (e.g., reference and documentation labels imported by rendering
Expand Down Expand Up @@ -761,7 +774,16 @@ def appendToFilingSummary(self, myReportsEtree, isFirstInstance, isRRorProspectu
state = self.classifyReportFiniteStateMachine(state, reportSummary.longName)
parentRole = self.getReportParentIfExists(reportSummary, state)
reportETree = SubElement(myReportsEtree, 'Report')
reportETree.set('instance',os.path.basename((self.instanceFiles+self.inlineFiles)[0]))
instanceFile = None
if self.targetDocumentFile:
# find matching inline file for primary document
for f in self.inlineFiles:
if os.path.splitext(os.path.basename(f))[0] == self.targetDocumentFile:
instanceFile = f
break
if not instanceFile:
instanceFile = (self.instanceFiles+self.inlineFiles)[0]
reportETree.set('instance',os.path.basename(instanceFile))
SubElement(reportETree, 'IsDefault').text = str(isFirstInstance and i == 1).casefold()
SubElement(reportETree, 'HasEmbeddedReports').text = str(reportSummary.hasEmbeddedReports).casefold()
if reportSummary.htmlFileName is not None:
Expand Down Expand Up @@ -834,7 +856,7 @@ def paternityScore(self, parentReportShortName, childReportShortName):
index = childReportShortName.find(' (')
if index != -1:
childReportShortName = childReportShortName[:index]

if len(childReportShortName) == 0: return 0
return Utils.commonPrefix(parentReportShortName, childReportShortName) * 100 / (len(childReportShortName))

def classifyReportFiniteStateMachine(self, currentState, longName):
Expand Down
Loading

0 comments on commit 7ff457c

Please sign in to comment.