<s> '''<STR_LIT>''' <EOL> import os <EOL> from arelle import ViewFile <EOL> def viewDTS ( modelXbrl , outfile ) : <EOL> view = ViewDTS ( modelXbrl , outfile ) <EOL> modelXbrl . modelManager . showStatus ( _ ( "<STR_LIT>" ) ) <EOL> view . treeDepth ( modelXbrl . modelDocument , <NUM_LIT:1> , set ( ) ) <EOL> view . addRow ( [ "<STR_LIT>" ] , asHeader = True ) <EOL> view . viewDtsElement ( modelXbrl . modelDocument , "<STR_LIT>" , <NUM_LIT:0> , set ( ) ) <EOL> view . close ( ) <EOL> class ViewDTS ( ViewFile . View ) : <EOL> def __init__ ( self , modelXbrl , outfile ) : <EOL> super ( ViewDTS , self ) . __init__ ( modelXbrl , outfile , "<STR_LIT>" ) <EOL> def treeDepth ( self , modelDocument , indent , visited ) : <EOL> visited . add ( modelDocument ) <EOL> if indent > self . treeCols : self . treeCols = indent <EOL> for referencedDocument in modelDocument . referencesDocument . keys ( ) : <EOL> if referencedDocument not in visited : <EOL> self . treeDepth ( referencedDocument , indent + <NUM_LIT:1> , visited ) <EOL> visited . remove ( modelDocument ) <EOL> def viewDtsElement ( self , modelDocument , referenceType , indent , visited ) : <EOL> visited . add ( modelDocument ) <EOL> dtsObjectType = modelDocument . gettype ( ) <EOL> attr = { "<STR_LIT:file>" : modelDocument . basename , "<STR_LIT>" : referenceType } <EOL> if not modelDocument . inDTS : <EOL> attr [ "<STR_LIT>" ] = "<STR_LIT:false>" <EOL> self . addRow ( [ "<STR_LIT>" . format ( modelDocument . basename , dtsObjectType ) ] , treeIndent = indent , <EOL> xmlRowElementName = dtsObjectType , xmlRowEltAttr = attr , xmlCol0skipElt = True ) <EOL> for referencedDocument , ref in modelDocument . referencesDocument . items ( ) : <EOL> if referencedDocument not in visited : <EOL> self . viewDtsElement ( referencedDocument , ref . referenceType , indent + <NUM_LIT:1> , visited ) <EOL> visited . remove ( modelDocument ) </s>
