<s> '''<STR_LIT>''' <EOL> def package ( dts ) : <EOL> if dts . fileSource . isArchive : <EOL> return <EOL> import os <EOL> from zipfile import ZipFile , ZIP_STORED , ZIP_DEFLATED <EOL> from arelle . UrlUtil import isHttpUrl <EOL> try : <EOL> import zlib <EOL> compression = ZIP_DEFLATED <EOL> except ImportError : <EOL> compression = ZIP_STORED <EOL> dts . info ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = dts ) <EOL> entryFilename = dts . fileSource . url <EOL> pkgFilename = entryFilename + "<STR_LIT>" <EOL> with ZipFile ( pkgFilename , '<STR_LIT:w>' , compression ) as zipFile : <EOL> numFiles = <NUM_LIT:0> <EOL> for fileUri in sorted ( dts . urlDocs . keys ( ) ) : <EOL> if not isHttpUrl ( fileUri ) : <EOL> numFiles += <NUM_LIT:1> <EOL> zipFile . write ( fileUri , os . path . basename ( fileUri ) ) <EOL> dts . info ( "<STR_LIT>" , <EOL> _ ( "<STR_LIT>" ) , <EOL> modelObject = dts , <EOL> entryFile = entryFilename , numberOfFiles = numFiles , packageOutputFile = pkgFilename ) <EOL> def saveDtsMenuEntender ( cntlr , menu , * args , ** kwargs ) : <EOL> menu . add_command ( label = "<STR_LIT>" , <EOL> underline = <NUM_LIT:0> , <EOL> command = lambda : saveDtsMenuCommand ( cntlr ) ) <EOL> def saveDtsMenuCommand ( cntlr ) : <EOL> if cntlr . modelManager is None or cntlr . modelManager . modelXbrl is None : <EOL> cntlr . addToLog ( "<STR_LIT>" ) <EOL> return <EOL> package ( cntlr . modelManager . modelXbrl ) <EOL> def saveDtsCommandLineOptionExtender ( parser , * args , ** kwargs ) : <EOL> parser . add_option ( "<STR_LIT>" , <EOL> action = "<STR_LIT:store_true>" , <EOL> dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> def saveDtsCommandLineXbrlRun ( cntlr , options , modelXbrl , * args , ** kwargs ) : <EOL> if getattr ( options , "<STR_LIT>" , False ) : <EOL> if cntlr . modelManager is None or cntlr . modelManager . modelXbrl is None : <EOL> cntlr . addToLog ( "<STR_LIT>" ) <EOL> return <EOL> package ( cntlr . modelManager . modelXbrl ) <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>" , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : saveDtsMenuEntender , <EOL> '<STR_LIT>' : saveDtsCommandLineOptionExtender , <EOL> '<STR_LIT>' : saveDtsCommandLineXbrlRun , <EOL> } </s>
