<s> '''<STR_LIT>''' <EOL> import io , os , time , sys , re , gc <EOL> from decimal import Decimal , InvalidOperation <EOL> from lxml import etree <EOL> from arelle import XbrlConst , XmlUtil , XmlValidate , ValidateXbrlDimensions <EOL> from arelle . ModelDocument import ModelDocument , Type <EOL> from arelle . ModelObjectFactory import parser <EOL> from arelle . ModelObject import ModelObject <EOL> from arelle . ModelInstanceObject import ModelFact <EOL> from arelle . PluginManager import pluginClassMethods <EOL> from arelle . Validate import Validate <EOL> from arelle . HashUtil import md5hash , Md5Sum <EOL> _streamingExtensionsCheck = True <EOL> _streamingExtensionsValidate = False <EOL> _streamingValidatePlugin = False <EOL> class NotInstanceDocumentException ( Exception ) : <EOL> def __init__ ( self ) : <EOL> pass <EOL> def precedingProcessingInstruction ( elt , target ) : <EOL> pi = elt . getprevious ( ) <EOL> while pi is not None : <EOL> if isinstance ( pi , etree . _ProcessingInstruction ) and pi . target == target : <EOL> return pi <EOL> pi = pi . getprevious ( ) <EOL> return None <EOL> def childProcessingInstruction ( elt , target , reversed = False ) : <EOL> for pi in elt . iterchildren ( reversed = reversed ) : <EOL> if isinstance ( pi , etree . _ProcessingInstruction ) : <EOL> if pi . target == target : <EOL> return pi <EOL> else : <EOL> break <EOL> return None <EOL> def precedingComment ( elt ) : <EOL> c = elt . getprevious ( ) <EOL> comment = '<STR_LIT>' <EOL> while c is not None : <EOL> if isinstance ( c , etree . _Comment ) and c . text : <EOL> comment = c . text + '<STR_LIT:\n>' + comment <EOL> c = c . getprevious ( ) <EOL> return comment or None <EOL> def streamingExtensionsLoader ( modelXbrl , mappedUri , filepath , * args , ** kwargs ) : <EOL> if not _streamingExtensionsCheck : <EOL> return None <EOL> modelXbrl . _streamingExtensionValidated = False <EOL> def logSyntaxErrors ( parsercontext ) : <EOL> for error in parsercontext . error_log : <EOL> modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = modelXbrl , fileName = os . path . basename ( filepath ) , <EOL> error = error . message , line = error . line , column = error . column , sourceAction = "<STR_LIT>" ) <EOL> _file , = modelXbrl . fileSource . file ( filepath , binary = True ) <EOL> startedAt = time . time ( ) <EOL> modelXbrl . profileActivity ( ) <EOL> '''<STR_LIT>''' <EOL> foundErrors = False <EOL> foundInstance = False <EOL> streamingAspects = None <EOL> creationSoftwareComment = None <EOL> instInfoNumRootFacts = <NUM_LIT:0> <EOL> numElts = <NUM_LIT:0> <EOL> elt = None <EOL> instInfoContext = etree . iterparse ( _file , events = ( "<STR_LIT:start>" , "<STR_LIT:end>" ) , huge_tree = True ) <EOL> try : <EOL> for event , elt in instInfoContext : <EOL> if event == "<STR_LIT:start>" : <EOL> if elt . getparent ( ) is not None : <EOL> if elt . getparent ( ) . tag == "<STR_LIT>" : <EOL> if not foundInstance : <EOL> foundInstance = True <EOL> pi = precedingProcessingInstruction ( elt , "<STR_LIT>" ) <EOL> if pi is None : <EOL> break <EOL> else : <EOL> streamingAspects = dict ( pi . attrib . copy ( ) ) <EOL> if creationSoftwareComment is None : <EOL> creationSoftwareComment = precedingComment ( elt ) <EOL> if not elt . tag . startswith ( "<STR_LIT>" ) : <EOL> instInfoNumRootFacts += <NUM_LIT:1> <EOL> if instInfoNumRootFacts % <NUM_LIT:1000> == <NUM_LIT:0> : <EOL> modelXbrl . profileActivity ( "<STR_LIT>" , minTimeToShow = <NUM_LIT> ) <EOL> elif not foundInstance : <EOL> break <EOL> elif elt . tag == "<STR_LIT>" : <EOL> creationSoftwareComment = precedingComment ( elt ) <EOL> if precedingProcessingInstruction ( elt , "<STR_LIT>" ) is not None : <EOL> modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = elt ) <EOL> elif event == "<STR_LIT:end>" : <EOL> elt . clear ( ) <EOL> numElts += <NUM_LIT:1> <EOL> if numElts % <NUM_LIT:1000> == <NUM_LIT:0> and elt . getparent ( ) is not None : <EOL> while elt . getprevious ( ) is not None and elt . getparent ( ) is not None : <EOL> del elt . getparent ( ) [ <NUM_LIT:0> ] <EOL> except etree . XMLSyntaxError as err : <EOL> modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> error = err ) <EOL> _file . close ( ) <EOL> return err <EOL> _file . seek ( <NUM_LIT:0> , io . SEEK_SET ) <EOL> if not foundInstance or streamingAspects is None : <EOL> del elt <EOL> _file . close ( ) <EOL> return None <EOL> modelXbrl . profileStat ( _ ( "<STR_LIT>" ) , time . time ( ) - startedAt ) <EOL> startedAt = time . time ( ) <EOL> try : <EOL> version = Decimal ( streamingAspects . get ( "<STR_LIT:version>" ) ) <EOL> if int ( version ) != <NUM_LIT:1> : <EOL> modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = elt , version = version ) <EOL> foundErrors = True <EOL> except ( InvalidOperation , OverflowError ) : <EOL> modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = elt , version = streamingAspects . get ( "<STR_LIT:version>" , "<STR_LIT>" ) ) <EOL> foundErrors = True <EOL> for bufAspect in ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) : <EOL> try : <EOL> bufLimit = Decimal ( streamingAspects . get ( bufAspect , "<STR_LIT>" ) ) <EOL> if bufLimit < <NUM_LIT:1> or ( bufLimit . is_finite ( ) and bufLimit % <NUM_LIT:1> != <NUM_LIT:0> ) : <EOL> raise InvalidOperation <EOL> elif bufAspect == "<STR_LIT>" : <EOL> contextBufferLimit = bufLimit <EOL> elif bufAspect == "<STR_LIT>" : <EOL> unitBufferLimit = bufLimit <EOL> elif bufAspect == "<STR_LIT>" : <EOL> footnoteBufferLimit = bufLimit <EOL> except InvalidOperation : <EOL> modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = elt , attrib = bufAspect , value = streamingAspects . get ( bufAspect ) ) <EOL> foundErrors = True <EOL> if _streamingExtensionsValidate : <EOL> incompatibleValidations = [ ] <EOL> _validateDisclosureSystem = modelXbrl . modelManager . validateDisclosureSystem <EOL> _disclosureSystem = modelXbrl . modelManager . disclosureSystem <EOL> if _validateDisclosureSystem and _disclosureSystem . validationType == "<STR_LIT>" : <EOL> incompatibleValidations . append ( "<STR_LIT>" ) <EOL> if _validateDisclosureSystem and _disclosureSystem . validationType == "<STR_LIT>" : <EOL> incompatibleValidations . append ( "<STR_LIT>" ) <EOL> if _validateDisclosureSystem and _disclosureSystem . validationType == "<STR_LIT>" : <EOL> incompatibleValidations . append ( "<STR_LIT>" ) <EOL> if modelXbrl . modelManager . validateCalcLB : <EOL> incompatibleValidations . append ( "<STR_LIT>" ) <EOL> if incompatibleValidations : <EOL> modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = modelXbrl , incompatibleValidations = '<STR_LIT:U+002CU+0020>' . join ( incompatibleValidations ) ) <EOL> foundErrors = True <EOL> if instInfoContext . error_log : <EOL> foundErrors = True <EOL> logSyntaxErrors ( instInfoContext ) <EOL> del instInfoContext <EOL> for pluginMethod in pluginClassMethods ( "<STR_LIT>" ) : <EOL> _blockingPluginName = pluginMethod ( modelXbrl ) <EOL> if _blockingPluginName : <EOL> modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = modelXbrl , blockingPlugin = _blockingPluginName ) <EOL> foundErrors = True <EOL> if foundErrors : <EOL> _file . close ( ) <EOL> return None <EOL> _encoding = XmlUtil . encoding ( _file . read ( <NUM_LIT> ) ) <EOL> _file . seek ( <NUM_LIT:0> , io . SEEK_SET ) <EOL> if _streamingExtensionsValidate : <EOL> validator = Validate ( modelXbrl ) <EOL> instValidator = validator . instValidator <EOL> contextBuffer = [ ] <EOL> contextsToDrop = [ ] <EOL> unitBuffer = [ ] <EOL> unitsToDrop = [ ] <EOL> footnoteBuffer = [ ] <EOL> footnoteLinksToDrop = [ ] <EOL> _streamingFactsPlugin = any ( True for pluginMethod in pluginClassMethods ( "<STR_LIT>" ) ) <EOL> _streamingValidateFactsPlugin = ( _streamingExtensionsValidate and <EOL> any ( True for pluginMethod in pluginClassMethods ( "<STR_LIT>" ) ) ) <EOL> '''<STR_LIT>''' <EOL> streamingParserContext = etree . iterparse ( _file , events = ( "<STR_LIT:start>" , "<STR_LIT:end>" ) , huge_tree = True ) <EOL> from arelle . ModelObjectFactory import setParserElementClassLookup <EOL> modelXbrl . isStreamingMode = True <EOL> ( _parser , _parserLookupName , _parserLookupClass ) = setParserElementClassLookup ( streamingParserContext , modelXbrl ) <EOL> foundInstance = False <EOL> beforeInstanceStream = beforeStartStreamingPlugin = True <EOL> numRootFacts = <NUM_LIT:0> <EOL> factsCheckVersion = None <EOL> def factCheckFact ( fact ) : <EOL> modelDocument . _factsCheckMd5s += fact . md5sum <EOL> for _tupleFact in fact . modelTupleFacts : <EOL> factCheckFact ( _tupleFact ) <EOL> for event , mdlObj in streamingParserContext : <EOL> if event == "<STR_LIT:start>" : <EOL> if mdlObj . tag == "<STR_LIT>" : <EOL> modelDocument = ModelDocument ( modelXbrl , Type . INSTANCE , mappedUri , filepath , mdlObj . getroottree ( ) ) <EOL> modelXbrl . modelDocument = modelDocument <EOL> mdlObj . init ( modelDocument ) <EOL> modelDocument . parser = _parser <EOL> modelDocument . parserLookupName = _parserLookupName <EOL> modelDocument . parserLookupClass = _parserLookupClass <EOL> modelDocument . xmlRootElement = mdlObj <EOL> modelDocument . schemaLocationElements . add ( mdlObj ) <EOL> modelDocument . documentEncoding = _encoding <EOL> modelDocument . _creationSoftwareComment = precedingComment ( mdlObj ) <EOL> modelDocument . _factsCheckMd5s = Md5Sum ( ) <EOL> modelXbrl . info ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = modelDocument ) <EOL> elif mdlObj . getparent ( ) is not None : <EOL> mdlObj . _init ( ) <EOL> if mdlObj . getparent ( ) . tag == "<STR_LIT>" : <EOL> if not foundInstance : <EOL> foundInstance = True <EOL> pi = precedingProcessingInstruction ( mdlObj , "<STR_LIT>" ) <EOL> if pi is not None : <EOL> factsCheckVersion = pi . attrib . get ( "<STR_LIT:version>" , None ) <EOL> elif not foundInstance : <EOL> break <EOL> ns = mdlObj . qname . namespaceURI <EOL> ln = mdlObj . qname . localName <EOL> if beforeInstanceStream : <EOL> if ( ( ns == XbrlConst . link and ln not in ( "<STR_LIT>" , "<STR_LIT>" ) ) or <EOL> ( ns == XbrlConst . xbrli and ln in ( "<STR_LIT>" , "<STR_LIT>" ) ) or <EOL> ( ns not in ( XbrlConst . link , XbrlConst . xbrli ) ) ) : <EOL> beforeInstanceStream = False <EOL> if _streamingExtensionsValidate : <EOL> instValidator . validate ( modelXbrl , modelXbrl . modelManager . formulaOptions . typedParameters ( ) ) <EOL> else : <EOL> ValidateXbrlDimensions . loadDimensionDefaults ( modelXbrl ) <EOL> elif not beforeInstanceStream and beforeStartStreamingPlugin : <EOL> for pluginMethod in pluginClassMethods ( "<STR_LIT>" ) : <EOL> pluginMethod ( modelXbrl ) <EOL> beforeStartStreamingPlugin = False <EOL> elif event == "<STR_LIT:end>" : <EOL> parentMdlObj = mdlObj . getparent ( ) <EOL> ns = mdlObj . namespaceURI <EOL> ln = mdlObj . localName <EOL> if ns == XbrlConst . xbrli : <EOL> if ln == "<STR_LIT>" : <EOL> if mdlObj . get ( "<STR_LIT>" ) : <EOL> del mdlObj . attrib [ "<STR_LIT>" ] <EOL> XmlValidate . validate ( modelXbrl , mdlObj ) <EOL> modelDocument . contextDiscover ( mdlObj ) <EOL> else : <EOL> if len ( contextBuffer ) >= contextBufferLimit : <EOL> cntx = contextBuffer . pop ( <NUM_LIT:0> ) <EOL> if _streamingFactsPlugin or _streamingValidateFactsPlugin : <EOL> contextsToDrop . append ( cntx ) <EOL> else : <EOL> dropContext ( modelXbrl , cntx ) <EOL> cntx = None <EOL> XmlValidate . validate ( modelXbrl , mdlObj ) <EOL> modelDocument . contextDiscover ( mdlObj ) <EOL> if contextBufferLimit . is_finite ( ) : <EOL> contextBuffer . append ( mdlObj ) <EOL> if _streamingExtensionsValidate : <EOL> contextsToCheck = ( mdlObj , ) <EOL> instValidator . checkContexts ( contextsToCheck ) <EOL> if modelXbrl . hasXDT : <EOL> instValidator . checkContextsDimensions ( contextsToCheck ) <EOL> del contextsToCheck <EOL> elif ln == "<STR_LIT>" : <EOL> if len ( unitBuffer ) >= unitBufferLimit : <EOL> unit = unitBuffer . pop ( <NUM_LIT:0> ) <EOL> if _streamingFactsPlugin or _streamingValidateFactsPlugin : <EOL> unitsToDrop . append ( unit ) <EOL> else : <EOL> dropUnit ( modelXbrl , unit ) <EOL> unit = None <EOL> XmlValidate . validate ( modelXbrl , mdlObj ) <EOL> modelDocument . unitDiscover ( mdlObj ) <EOL> if unitBufferLimit . is_finite ( ) : <EOL> unitBuffer . append ( mdlObj ) <EOL> if _streamingExtensionsValidate : <EOL> instValidator . checkUnits ( ( mdlObj , ) ) <EOL> elif ln == "<STR_LIT>" : <EOL> if _streamingFactsPlugin or _streamingValidateFactsPlugin : <EOL> if len ( modelXbrl . facts ) > <NUM_LIT:0> : <EOL> factsToCheck = modelXbrl . facts . copy ( ) <EOL> if _streamingValidateFactsPlugin : <EOL> for pluginMethod in pluginClassMethods ( "<STR_LIT>" ) : <EOL> pluginMethod ( instValidator , factsToCheck ) <EOL> if _streamingFactsPlugin : <EOL> for pluginMethod in pluginClassMethods ( "<STR_LIT>" ) : <EOL> pluginMethod ( modelXbrl , factsToCheck ) <EOL> for fact in factsToCheck : <EOL> dropFact ( modelXbrl , fact , modelXbrl . facts ) <EOL> for cntx in contextsToDrop : <EOL> dropContext ( modelXbrl , cntx ) <EOL> for unit in unitsToDrop : <EOL> dropUnit ( modelXbrl , unit ) <EOL> for footnoteLink in footnoteLinksToDrop : <EOL> dropFootnoteLink ( modelXbrl , footnoteLink ) <EOL> fact = cntx = unit = footnoteLink = None <EOL> del contextsToDrop [ : ] <EOL> del unitsToDrop [ : ] <EOL> del footnoteLinksToDrop [ : ] <EOL> del factsToCheck <EOL> for footnoteLink in footnoteBuffer : <EOL> checkFootnoteHrefs ( modelXbrl , footnoteLink ) <EOL> pi = childProcessingInstruction ( mdlObj , "<STR_LIT>" , reversed = True ) <EOL> if pi is not None : <EOL> _match = re . search ( "<STR_LIT>" , pi . text ) <EOL> if _match : <EOL> _matchGroups = _match . groups ( ) <EOL> if len ( _matchGroups ) == <NUM_LIT:2> : <EOL> if _matchGroups [ <NUM_LIT:0> ] == "<STR_LIT>" : <EOL> try : <EOL> expectedMd5 = Md5Sum ( _matchGroups [ <NUM_LIT:1> ] ) <EOL> if modelDocument . _factsCheckMd5s != expectedMd5 : <EOL> modelXbrl . warning ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = modelXbrl , expectedMd5 = expectedMd5 , actualMd5Sum = modelDocument . _factsCheckMd5s ) <EOL> else : <EOL> modelXbrl . info ( "<STR_LIT:info>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = modelXbrl ) <EOL> except ValueError : <EOL> modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = modelXbrl , sumOfMd5 = _matchGroups [ <NUM_LIT:1> ] ) <EOL> if _streamingValidateFactsPlugin : <EOL> for pluginMethod in pluginClassMethods ( "<STR_LIT>" ) : <EOL> pluginMethod ( instValidator ) <EOL> if _streamingFactsPlugin : <EOL> for pluginMethod in pluginClassMethods ( "<STR_LIT>" ) : <EOL> pluginMethod ( modelXbrl ) <EOL> elif ns == XbrlConst . link : <EOL> if ln in ( "<STR_LIT>" , "<STR_LIT>" ) : <EOL> modelDocument . discoverHref ( mdlObj , urlRewritePluginClass = "<STR_LIT>" ) <EOL> elif ln in ( "<STR_LIT>" , "<STR_LIT>" ) : <EOL> modelDocument . linkbaseDiscover ( ( mdlObj , ) , inInstance = True ) <EOL> elif ln == "<STR_LIT>" : <EOL> XmlValidate . validate ( modelXbrl , mdlObj ) <EOL> footnoteLinks = ( mdlObj , ) <EOL> modelDocument . linkbaseDiscover ( footnoteLinks , inInstance = True ) <EOL> if footnoteBufferLimit . is_finite ( ) : <EOL> footnoteBuffer . append ( mdlObj ) <EOL> if _streamingExtensionsValidate : <EOL> instValidator . checkLinks ( footnoteLinks ) <EOL> if len ( footnoteBuffer ) > footnoteBufferLimit : <EOL> footnoteLink = footnoteBuffer . pop ( <NUM_LIT:0> ) <EOL> checkFootnoteHrefs ( modelXbrl , footnoteLink ) <EOL> if _streamingValidateFactsPlugin : <EOL> footnoteLinksToDrop . append ( footnoteLink ) <EOL> else : <EOL> dropFootnoteLink ( modelXbrl , footnoteLink ) <EOL> footnoteLink = None <EOL> footnoteLinks = None <EOL> elif parentMdlObj . qname == XbrlConst . qnXbrliXbrl and isinstance ( mdlObj , ModelFact ) : <EOL> numRootFacts += <NUM_LIT:1> <EOL> XmlValidate . validate ( modelXbrl , mdlObj ) <EOL> modelDocument . factDiscover ( mdlObj , modelXbrl . facts ) <EOL> if factsCheckVersion : <EOL> factCheckFact ( mdlObj ) <EOL> if _streamingExtensionsValidate or _streamingFactsPlugin or _streamingValidateFactsPlugin : <EOL> factsToCheck = ( mdlObj , ) <EOL> if _streamingExtensionsValidate : <EOL> instValidator . checkFacts ( factsToCheck ) <EOL> if modelXbrl . hasXDT : <EOL> instValidator . checkFactsDimensions ( factsToCheck ) <EOL> if _streamingFactsPlugin or _streamingValidateFactsPlugin : <EOL> if len ( modelXbrl . facts ) > <NUM_LIT:1000> : <EOL> factsToCheck = modelXbrl . facts . copy ( ) <EOL> if _streamingValidateFactsPlugin : <EOL> for pluginMethod in pluginClassMethods ( "<STR_LIT>" ) : <EOL> pluginMethod ( instValidator , factsToCheck ) <EOL> if _streamingFactsPlugin : <EOL> for pluginMethod in pluginClassMethods ( "<STR_LIT>" ) : <EOL> pluginMethod ( modelXbrl , factsToCheck ) <EOL> for fact in factsToCheck : <EOL> dropFact ( modelXbrl , fact , modelXbrl . facts ) <EOL> for cntx in contextsToDrop : <EOL> dropContext ( modelXbrl , cntx ) <EOL> for unit in unitsToDrop : <EOL> dropUnit ( modelXbrl , unit ) <EOL> for footnoteLink in footnoteLinksToDrop : <EOL> dropFootnoteLink ( modelXbrl , footnoteLink ) <EOL> fact = cntx = unit = footnoteLink = None <EOL> del contextsToDrop [ : ] <EOL> del unitsToDrop [ : ] <EOL> del footnoteLinksToDrop [ : ] <EOL> del factsToCheck <EOL> else : <EOL> dropFact ( modelXbrl , mdlObj , modelXbrl . facts ) <EOL> if numRootFacts % <NUM_LIT:1000> == <NUM_LIT:0> : <EOL> pass <EOL> if mdlObj is not None : <EOL> mdlObj . clear ( ) <EOL> del _parser , _parserLookupName , _parserLookupClass <EOL> if _streamingExtensionsValidate and validator is not None : <EOL> _file . close ( ) <EOL> del instValidator <EOL> validator . close ( ) <EOL> modelXbrl . _streamingExtensionValidated = True <EOL> modelXbrl . profileStat ( _ ( "<STR_LIT>" ) , time . time ( ) - startedAt ) <EOL> return modelXbrl . modelDocument <EOL> def checkFootnoteHrefs ( modelXbrl , footnoteLink ) : <EOL> for locElt in footnoteLink . iterchildren ( tag = "<STR_LIT>" ) : <EOL> for hrefElt , _doc , _id in footnoteLink . modelDocument . hrefObjects : <EOL> if locElt == hrefElt and id not in footnoteLink . modelDocument . idObjects : <EOL> modelXbrl . error ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = footnoteLink , id = id ) <EOL> def dropContext ( modelXbrl , cntx ) : <EOL> del modelXbrl . contexts [ cntx . id ] <EOL> dropObject ( modelXbrl , cntx ) <EOL> def dropUnit ( modelXbrl , unit ) : <EOL> del modelXbrl . units [ unit . id ] <EOL> dropObject ( modelXbrl , unit ) <EOL> def dropFootnoteLink ( modelXbrl , footnoteLink ) : <EOL> for baseSet in modelXbrl . baseSets . values ( ) : <EOL> if footnoteLink in baseSet : <EOL> baseSet . remove ( footnoteLink ) <EOL> dropObject ( modelXbrl , footnoteLink ) <EOL> def dropFact ( modelXbrl , fact , facts ) : <EOL> while fact . modelTupleFacts : <EOL> dropFact ( modelXbrl , fact . modelTupleFacts [ <NUM_LIT:0> ] , fact . modelTupleFacts ) <EOL> modelXbrl . factsInInstance . discard ( fact ) <EOL> facts . remove ( fact ) <EOL> modelXbrl . modelObjects [ fact . objectIndex ] = None <EOL> if fact . id : <EOL> fact . modelDocument . idObjects . pop ( fact . id , None ) <EOL> fact . clear ( ) <EOL> def dropObject ( modelXbrl , mdlObj ) : <EOL> for childObj in mdlObj . iterchildren ( ) : <EOL> dropObject ( modelXbrl , childObj ) <EOL> if mdlObj . qname == XbrlConst . qnLinkLoc : <EOL> hrefs = mdlObj . modelDocument . hrefObjects <EOL> removedHrefs = [ i for i , hrefObj in enumerate ( hrefs ) if mdlObj == hrefObj [ <NUM_LIT:0> ] ] <EOL> for i in removedHrefs : <EOL> del hrefs [ i ] <EOL> modelXbrl . modelObjects [ mdlObj . objectIndex ] = None <EOL> if mdlObj . id : <EOL> mdlObj . modelDocument . idObjects . pop ( mdlObj . id , None ) <EOL> mdlObj . clear ( ) <EOL> '''<STR_LIT>''' <EOL> def streamingExtensionsSetup ( cntlr , options , * args , ** kwargs ) : <EOL> global _streamingExtensionsCheck , _streamingExtensionsValidate <EOL> _streamingExtensionsValidate = options . validate <EOL> def streamingExtensionsIsValidated ( modelXbrl , * args , ** kwargs ) : <EOL> return getattr ( modelXbrl , "<STR_LIT>" , False ) <EOL> '''<STR_LIT>''' <EOL> __pluginInfo__ = { <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT:version>' : '<STR_LIT>' , <EOL> '<STR_LIT:description>' : "<STR_LIT>" <EOL> "<STR_LIT>" , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : streamingExtensionsSetup , <EOL> '<STR_LIT>' : streamingExtensionsLoader , <EOL> '<STR_LIT>' : streamingExtensionsIsValidated , <EOL> } </s>
