<s> '''<STR_LIT>''' <EOL> from arelle import PythonUtil <EOL> import gettext , time , datetime , os , shlex , sys , traceback , fnmatch , threading , json , logging <EOL> from optparse import OptionParser , SUPPRESS_HELP <EOL> import re <EOL> from arelle import ( Cntlr , FileSource , ModelDocument , XmlUtil , Version , <EOL> ViewFileDTS , ViewFileFactList , ViewFileFactTable , ViewFileConcepts , <EOL> ViewFileFormulae , ViewFileRelationshipSet , ViewFileTests , ViewFileRssFeed , <EOL> ViewFileRoleTypes , <EOL> ModelManager ) <EOL> from arelle . ModelValue import qname <EOL> from arelle . Locale import format_string <EOL> from arelle . ModelFormulaObject import FormulaOptions <EOL> from arelle import PluginManager <EOL> from arelle . PluginManager import pluginClassMethods <EOL> from arelle . UrlUtil import isHttpUrl <EOL> from arelle . WebCache import proxyTuple <EOL> import logging <EOL> from lxml import etree <EOL> win32file = win32api = win32process = pywintypes = None <EOL> STILL_ACTIVE = <NUM_LIT> <EOL> PROCESS_QUERY_INFORMATION = <NUM_LIT> <EOL> def main ( ) : <EOL> """<STR_LIT>""" <EOL> envArgs = os . getenv ( "<STR_LIT>" ) <EOL> if envArgs : <EOL> args = shlex . split ( envArgs ) <EOL> else : <EOL> args = sys . argv [ <NUM_LIT:1> : ] <EOL> gettext . install ( "<STR_LIT>" ) <EOL> parseAndRun ( args ) <EOL> def wsgiApplication ( extraArgs = [ ] ) : <EOL> return parseAndRun ( [ "<STR_LIT>" ] + extraArgs ) <EOL> def parseAndRun ( args ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> from arelle import webserver <EOL> hasWebServer = True <EOL> except ImportError : <EOL> hasWebServer = False <EOL> cntlr = CntlrCmdLine ( ) <EOL> usage = "<STR_LIT>" <EOL> parser = OptionParser ( usage , <EOL> version = "<STR_LIT>" . format ( cntlr . systemWordSize , Version . version ) , <EOL> conflict_handler = "<STR_LIT>" ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , dest = "<STR_LIT:username>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , dest = "<STR_LIT:password>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , dest = "<STR_LIT>" , action = "<STR_LIT:store_true>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , <EOL> action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , choices = ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT:none>" ) , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , choices = ( "<STR_LIT>" , "<STR_LIT>" ) , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , type = "<STR_LIT:int>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , type = "<STR_LIT:int>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , choices = ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , choices = ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = _ ( "<STR_LIT>" ) ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = SUPPRESS_HELP ) <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , help = _ ( "<STR_LIT>" ) ) <EOL> if hasWebServer : <EOL> parser . add_option ( "<STR_LIT>" , action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) ) <EOL> pluginOptionsIndex = len ( parser . option_list ) <EOL> for i , arg in enumerate ( args ) : <EOL> if arg . startswith ( '<STR_LIT>' ) : <EOL> if len ( arg ) > <NUM_LIT:9> and arg [ <NUM_LIT:9> ] == '<STR_LIT:=>' : <EOL> preloadPlugins = arg [ <NUM_LIT:10> : ] <EOL> elif i < len ( args ) - <NUM_LIT:1> : <EOL> preloadPlugins = args [ i + <NUM_LIT:1> ] <EOL> else : <EOL> preloadPlugins = "<STR_LIT>" <EOL> for pluginCmd in preloadPlugins . split ( '<STR_LIT:|>' ) : <EOL> cmd = pluginCmd . strip ( ) <EOL> if cmd not in ( "<STR_LIT>" , "<STR_LIT>" ) and len ( cmd ) > <NUM_LIT:0> and cmd [ <NUM_LIT:0> ] not in ( '<STR_LIT:->' , '<STR_LIT>' , '<STR_LIT:+>' ) : <EOL> moduleInfo = PluginManager . addPluginModule ( cmd ) <EOL> if moduleInfo : <EOL> cntlr . preloadedPlugins [ cmd ] = moduleInfo <EOL> PluginManager . reset ( ) <EOL> break <EOL> for optionsExtender in pluginClassMethods ( "<STR_LIT>" ) : <EOL> optionsExtender ( parser ) <EOL> pluginLastOptionIndex = len ( parser . option_list ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , <EOL> action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" , <EOL> help = _ ( "<STR_LIT>" ) ) <EOL> if not args and cntlr . isGAE : <EOL> args = [ "<STR_LIT>" ] <EOL> elif cntlr . isCGI : <EOL> args = [ "<STR_LIT>" ] <EOL> elif cntlr . isMSW : <EOL> sourceArgs = args <EOL> args = [ ] <EOL> namedOptions = set ( ) <EOL> optionsWithArg = set ( ) <EOL> for option in parser . option_list : <EOL> names = str ( option ) . split ( '<STR_LIT:/>' ) <EOL> namedOptions . update ( names ) <EOL> if option . action == "<STR_LIT:store>" : <EOL> optionsWithArg . update ( names ) <EOL> priorArg = None <EOL> for arg in sourceArgs : <EOL> if priorArg in optionsWithArg and arg in namedOptions : <EOL> args . append ( '<STR_LIT>' ) <EOL> if r'<STR_LIT>' in arg : <EOL> arg = arg . replace ( r'<STR_LIT>' , '<STR_LIT:">' ) <EOL> args . append ( arg ) <EOL> priorArg = arg <EOL> ( options , leftoverArgs ) = parser . parse_args ( args ) <EOL> if options . about : <EOL> print ( _ ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> ) . format ( cntlr . systemWordSize , Version . version , <EOL> _ ( "<STR_LIT>" ) if hasWebServer else "<STR_LIT>" , <EOL> sys . version_info , etree . LXML_VERSION ) ) <EOL> elif options . disclosureSystemName in ( "<STR_LIT>" , "<STR_LIT>" ) : <EOL> text = _ ( "<STR_LIT>" ) . format ( '<STR_LIT>' . join ( cntlr . modelManager . disclosureSystem . dirlist ( options . disclosureSystemName ) ) ) <EOL> try : <EOL> print ( text ) <EOL> except UnicodeEncodeError : <EOL> print ( text . encode ( "<STR_LIT:ascii>" , "<STR_LIT:replace>" ) . decode ( "<STR_LIT:ascii>" ) ) <EOL> elif len ( leftoverArgs ) != <NUM_LIT:0> and ( not hasWebServer or options . webserver is None ) : <EOL> parser . error ( _ ( "<STR_LIT>" . format ( '<STR_LIT:U+002CU+0020>' . join ( leftoverArgs ) ) ) ) <EOL> elif ( options . entrypointFile is None and <EOL> ( ( not options . proxy ) and ( not options . plugins ) and <EOL> ( not any ( pluginOption for pluginOption in parser . option_list [ pluginOptionsIndex : pluginLastOptionIndex ] ) ) and <EOL> ( not hasWebServer or options . webserver is None ) ) ) : <EOL> parser . error ( _ ( "<STR_LIT>" ) ) <EOL> elif hasWebServer and options . webserver : <EOL> if any ( ( options . entrypointFile , options . importFiles , options . diffFile , options . versReportFile , <EOL> options . factsFile , options . factListCols , options . factTableFile , <EOL> options . conceptsFile , options . preFile , options . calFile , options . dimFile , options . formulaeFile , options . viewArcrole , options . viewFile , <EOL> options . roleTypesFile , options . arcroleTypesFile <EOL> ) ) : <EOL> parser . error ( _ ( "<STR_LIT>" ) ) <EOL> else : <EOL> cntlr . startLogging ( logFileName = '<STR_LIT>' ) <EOL> from arelle import CntlrWebMain <EOL> app = CntlrWebMain . startWebserver ( cntlr , options ) <EOL> if options . webserver == '<STR_LIT>' : <EOL> return app <EOL> else : <EOL> cntlr . startLogging ( logFileName = ( options . logFile or "<STR_LIT>" ) , <EOL> logFormat = ( options . logFormat or "<STR_LIT>" ) , <EOL> logLevel = ( options . logLevel or "<STR_LIT>" ) , <EOL> logToBuffer = getattr ( options , "<STR_LIT>" , False ) ) <EOL> cntlr . run ( options ) <EOL> return cntlr <EOL> class ParserForDynamicPlugins : <EOL> def __init__ ( self , options ) : <EOL> self . options = options <EOL> def add_option ( self , * args , ** kwargs ) : <EOL> if '<STR_LIT>' in kwargs : <EOL> _dest = kwargs [ '<STR_LIT>' ] <EOL> if not hasattr ( self . options , _dest ) : <EOL> setattr ( self . options , _dest , kwargs . get ( '<STR_LIT:default>' , None ) ) <EOL> class CntlrCmdLine ( Cntlr . Cntlr ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , logFileName = None ) : <EOL> super ( CntlrCmdLine , self ) . __init__ ( hasGui = False ) <EOL> self . preloadedPlugins = { } <EOL> def run ( self , options , sourceZipStream = None , responseZipStream = None ) : <EOL> """<STR_LIT>""" <EOL> if options . statusPipe or options . monitorParentProcess : <EOL> try : <EOL> global win32file , win32api , win32process , pywintypes <EOL> import win32file , win32api , win32process , pywintypes <EOL> except ImportError : <EOL> self . addToLog ( "<STR_LIT>" . format ( options . statusPipe ) ) <EOL> options . statusPipe = options . monitorParentProcess = None <EOL> if options . statusPipe : <EOL> try : <EOL> self . statusPipe = win32file . CreateFile ( "<STR_LIT>" . format ( options . statusPipe ) , <EOL> win32file . GENERIC_READ | win32file . GENERIC_WRITE , <NUM_LIT:0> , None , win32file . OPEN_EXISTING , win32file . FILE_FLAG_NO_BUFFERING , None ) <EOL> self . showStatus = self . showStatusOnPipe <EOL> self . lastStatusTime = <NUM_LIT:0.0> <EOL> self . parentProcessHandle = None <EOL> except pywintypes . error : <EOL> self . addToLog ( "<STR_LIT>" . format ( options . statusPipe ) ) <EOL> if options . monitorParentProcess : <EOL> try : <EOL> self . parentProcessHandle = win32api . OpenProcess ( PROCESS_QUERY_INFORMATION , False , int ( options . monitorParentProcess ) ) <EOL> def monitorParentProcess ( ) : <EOL> if win32process . GetExitCodeProcess ( self . parentProcessHandle ) != STILL_ACTIVE : <EOL> sys . exit ( ) <EOL> _t = threading . Timer ( <NUM_LIT> , monitorParentProcess ) <EOL> _t . daemon = True <EOL> _t . start ( ) <EOL> monitorParentProcess ( ) <EOL> except ImportError : <EOL> self . addToLog ( "<STR_LIT>" . format ( options . monitorParentProcess ) ) <EOL> except ( ValueError , pywintypes . error ) : <EOL> self . addToLog ( "<STR_LIT>" . format ( options . monitorParentProcess ) ) <EOL> sys . exit ( ) <EOL> if options . showOptions : <EOL> for optName , optValue in sorted ( options . __dict__ . items ( ) , key = lambda optItem : optItem [ <NUM_LIT:0> ] ) : <EOL> self . addToLog ( "<STR_LIT>" . format ( optName , optValue ) , messageCode = "<STR_LIT:info>" ) <EOL> self . addToLog ( "<STR_LIT>" . format ( sys . argv ) , messageCode = "<STR_LIT:info>" ) <EOL> if options . uiLang : <EOL> self . setUiLanguage ( options . uiLang ) <EOL> if options . proxy : <EOL> if options . proxy != "<STR_LIT>" : <EOL> proxySettings = proxyTuple ( options . proxy ) <EOL> self . webCache . resetProxies ( proxySettings ) <EOL> self . config [ "<STR_LIT>" ] = proxySettings <EOL> self . saveConfig ( ) <EOL> self . addToLog ( _ ( "<STR_LIT>" ) , messageCode = "<STR_LIT:info>" ) <EOL> useOsProxy , urlAddr , urlPort , user , password = self . config . get ( "<STR_LIT>" , proxyTuple ( "<STR_LIT:none>" ) ) <EOL> if useOsProxy : <EOL> self . addToLog ( _ ( "<STR_LIT>" ) . format ( <EOL> _ ( '<STR_LIT>' ) if sys . platform . startswith ( "<STR_LIT>" ) <EOL> else ( _ ( '<STR_LIT>' ) if sys . platform in ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> else _ ( '<STR_LIT>' ) ) ) , messageCode = "<STR_LIT:info>" ) <EOL> elif urlAddr : <EOL> self . addToLog ( _ ( "<STR_LIT>" ) . format ( <EOL> user if user else "<STR_LIT>" , <EOL> "<STR_LIT>" if password else "<STR_LIT>" , <EOL> "<STR_LIT:@>" if ( user or password ) else "<STR_LIT>" , <EOL> urlAddr , <EOL> "<STR_LIT>" . format ( urlPort ) if urlPort else "<STR_LIT>" ) , messageCode = "<STR_LIT:info>" ) <EOL> else : <EOL> self . addToLog ( _ ( "<STR_LIT>" ) , messageCode = "<STR_LIT:info>" ) <EOL> if options . plugins : <EOL> resetPlugins = False <EOL> savePluginChanges = True <EOL> showPluginModules = False <EOL> for pluginCmd in options . plugins . split ( '<STR_LIT:|>' ) : <EOL> cmd = pluginCmd . strip ( ) <EOL> if cmd == "<STR_LIT>" : <EOL> showPluginModules = True <EOL> elif cmd == "<STR_LIT>" : <EOL> savePluginChanges = False <EOL> elif cmd . startswith ( "<STR_LIT:+>" ) : <EOL> moduleInfo = PluginManager . addPluginModule ( cmd [ <NUM_LIT:1> : ] ) <EOL> if moduleInfo : <EOL> self . addToLog ( _ ( "<STR_LIT>" ) . format ( moduleInfo . get ( "<STR_LIT:name>" ) ) , <EOL> messageCode = "<STR_LIT:info>" , file = moduleInfo . get ( "<STR_LIT>" ) ) <EOL> resetPlugins = True <EOL> if "<STR_LIT>" in moduleInfo [ "<STR_LIT>" ] : <EOL> addedPluginWithCntlrCmdLineOptions = True <EOL> else : <EOL> self . addToLog ( _ ( "<STR_LIT>" ) , messageCode = "<STR_LIT:info>" , file = cmd [ <NUM_LIT:1> : ] ) <EOL> elif cmd . startswith ( "<STR_LIT>" ) : <EOL> if PluginManager . reloadPluginModule ( cmd [ <NUM_LIT:1> : ] ) : <EOL> self . addToLog ( _ ( "<STR_LIT>" ) , messageCode = "<STR_LIT:info>" , file = cmd [ <NUM_LIT:1> : ] ) <EOL> resetPlugins = True <EOL> else : <EOL> self . addToLog ( _ ( "<STR_LIT>" ) , messageCode = "<STR_LIT:info>" , file = cmd [ <NUM_LIT:1> : ] ) <EOL> elif cmd . startswith ( "<STR_LIT:->" ) : <EOL> if PluginManager . removePluginModule ( cmd [ <NUM_LIT:1> : ] ) : <EOL> self . addToLog ( _ ( "<STR_LIT>" ) , messageCode = "<STR_LIT:info>" , file = cmd [ <NUM_LIT:1> : ] ) <EOL> resetPlugins = True <EOL> else : <EOL> self . addToLog ( _ ( "<STR_LIT>" ) , messageCode = "<STR_LIT:info>" , file = cmd [ <NUM_LIT:1> : ] ) <EOL> else : <EOL> savePluginChanges = False <EOL> if cmd in self . preloadedPlugins : <EOL> moduleInfo = self . preloadedPlugins [ cmd ] <EOL> else : <EOL> moduleInfo = PluginManager . addPluginModule ( cmd ) <EOL> if moduleInfo : <EOL> resetPlugins = True <EOL> if moduleInfo : <EOL> self . addToLog ( _ ( "<STR_LIT>" ) . format ( moduleInfo . get ( "<STR_LIT:name>" ) , moduleInfo . get ( "<STR_LIT:version>" ) ) , <EOL> messageCode = "<STR_LIT:info>" , file = moduleInfo . get ( "<STR_LIT>" ) ) <EOL> else : <EOL> self . addToLog ( _ ( "<STR_LIT>" ) , <EOL> messageCode = "<STR_LIT>" , <EOL> messageArgs = { "<STR_LIT:name>" : cmd , "<STR_LIT:file>" : cmd } , level = logging . ERROR ) <EOL> if resetPlugins : <EOL> PluginManager . reset ( ) <EOL> if savePluginChanges : <EOL> PluginManager . save ( self ) <EOL> if options . webserver : <EOL> _optionsParser = ParserForDynamicPlugins ( options ) <EOL> for optionsExtender in pluginClassMethods ( "<STR_LIT>" ) : <EOL> optionsExtender ( _optionsParser ) <EOL> if showPluginModules : <EOL> self . addToLog ( _ ( "<STR_LIT>" ) , messageCode = "<STR_LIT:info>" ) <EOL> for i , moduleItem in enumerate ( sorted ( PluginManager . pluginConfig . get ( "<STR_LIT>" , { } ) . items ( ) ) ) : <EOL> moduleInfo = moduleItem [ <NUM_LIT:1> ] <EOL> self . addToLog ( _ ( "<STR_LIT>" ) . format ( <EOL> moduleItem [ <NUM_LIT:0> ] , moduleInfo . get ( "<STR_LIT>" ) , moduleInfo . get ( "<STR_LIT:version>" ) , moduleInfo . get ( "<STR_LIT:status>" ) , <EOL> moduleInfo . get ( "<STR_LIT>" ) , moduleInfo . get ( "<STR_LIT:description>" ) , moduleInfo . get ( "<STR_LIT>" ) ) , <EOL> messageCode = "<STR_LIT:info>" , file = moduleInfo . get ( "<STR_LIT>" ) ) <EOL> if options . packages : <EOL> from arelle import PackageManager <EOL> savePackagesChanges = True <EOL> showPackages = False <EOL> for packageCmd in options . packages . split ( '<STR_LIT:|>' ) : <EOL> cmd = packageCmd . strip ( ) <EOL> if cmd == "<STR_LIT>" : <EOL> showPackages = True <EOL> elif cmd == "<STR_LIT>" : <EOL> savePackagesChanges = False <EOL> elif cmd . startswith ( "<STR_LIT:+>" ) : <EOL> packageInfo = PackageManager . addPackage ( self , cmd [ <NUM_LIT:1> : ] , options . packageManifestName ) <EOL> if packageInfo : <EOL> self . addToLog ( _ ( "<STR_LIT>" ) . format ( packageInfo . get ( "<STR_LIT:name>" ) ) , <EOL> messageCode = "<STR_LIT:info>" , file = packageInfo . get ( "<STR_LIT>" ) ) <EOL> else : <EOL> self . addToLog ( _ ( "<STR_LIT>" ) , messageCode = "<STR_LIT:info>" , file = cmd [ <NUM_LIT:1> : ] ) <EOL> elif cmd . startswith ( "<STR_LIT>" ) : <EOL> if PackageManager . reloadPackageModule ( self , cmd [ <NUM_LIT:1> : ] ) : <EOL> self . addToLog ( _ ( "<STR_LIT>" ) , messageCode = "<STR_LIT:info>" , file = cmd [ <NUM_LIT:1> : ] ) <EOL> else : <EOL> self . addToLog ( _ ( "<STR_LIT>" ) , messageCode = "<STR_LIT:info>" , file = cmd [ <NUM_LIT:1> : ] ) <EOL> elif cmd . startswith ( "<STR_LIT:->" ) : <EOL> if PackageManager . removePackageModule ( self , cmd [ <NUM_LIT:1> : ] ) : <EOL> self . addToLog ( _ ( "<STR_LIT>" ) , messageCode = "<STR_LIT:info>" , file = cmd [ <NUM_LIT:1> : ] ) <EOL> else : <EOL> self . addToLog ( _ ( "<STR_LIT>" ) , messageCode = "<STR_LIT:info>" , file = cmd [ <NUM_LIT:1> : ] ) <EOL> else : <EOL> savePackagesChanges = False <EOL> packageInfo = PackageManager . addPackage ( self , cmd , options . packageManifestName ) <EOL> if packageInfo : <EOL> self . addToLog ( _ ( "<STR_LIT>" ) . format ( packageInfo . get ( "<STR_LIT:name>" ) ) , <EOL> messageCode = "<STR_LIT:info>" , file = packageInfo . get ( "<STR_LIT>" ) ) <EOL> resetPlugins = True <EOL> else : <EOL> self . addToLog ( _ ( "<STR_LIT>" ) , <EOL> messageCode = "<STR_LIT>" , <EOL> messageArgs = { "<STR_LIT:name>" : cmd , "<STR_LIT:file>" : cmd } , level = logging . ERROR ) <EOL> if PackageManager . packagesConfigChanged : <EOL> PackageManager . rebuildRemappings ( self ) <EOL> if savePackagesChanges : <EOL> PackageManager . save ( self ) <EOL> else : <EOL> PackageManager . packagesConfigChanged = False <EOL> if showPackages : <EOL> self . addToLog ( _ ( "<STR_LIT>" ) , messageCode = "<STR_LIT:info>" ) <EOL> for packageInfo in PackageManager . orderedPackagesConfig ( ) [ "<STR_LIT>" ] : <EOL> self . addToLog ( _ ( "<STR_LIT>" ) . format ( <EOL> packageInfo . get ( "<STR_LIT:name>" ) , packageInfo . get ( "<STR_LIT:version>" ) , packageInfo . get ( "<STR_LIT:status>" ) , <EOL> packageInfo . get ( "<STR_LIT>" ) , packageInfo . get ( "<STR_LIT:description>" ) ) , <EOL> messageCode = "<STR_LIT:info>" , file = packageInfo . get ( "<STR_LIT>" ) ) <EOL> if options . showEnvironment : <EOL> self . addToLog ( _ ( "<STR_LIT>" ) . format ( self . configDir ) ) <EOL> self . addToLog ( _ ( "<STR_LIT>" ) . format ( self . userAppDir ) ) <EOL> for envVar in ( "<STR_LIT>" , ) : <EOL> if envVar in os . environ : <EOL> self . addToLog ( _ ( "<STR_LIT>" ) . format ( os . environ [ envVar ] ) ) <EOL> return True <EOL> self . modelManager . customTransforms = None <EOL> self . modelManager . loadCustomTransforms ( ) <EOL> hasUtilityPlugin = False <EOL> for pluginXbrlMethod in pluginClassMethods ( "<STR_LIT>" ) : <EOL> hasUtilityPlugin = True <EOL> try : <EOL> pluginXbrlMethod ( self , options , sourceZipStream = sourceZipStream , responseZipStream = responseZipStream ) <EOL> except SystemExit : <EOL> return True <EOL> if options . proxy or options . plugins or hasUtilityPlugin : <EOL> if not ( options . entrypointFile or sourceZipStream ) : <EOL> return True <EOL> self . username = options . username <EOL> self . password = options . password <EOL> if options . disclosureSystemName : <EOL> self . modelManager . validateDisclosureSystem = True <EOL> self . modelManager . disclosureSystem . select ( options . disclosureSystemName ) <EOL> if options . validateEFM : <EOL> self . addToLog ( _ ( "<STR_LIT>" ) , <EOL> messageCode = "<STR_LIT:info>" , file = options . entrypointFile ) <EOL> elif options . validateEFM : <EOL> self . modelManager . validateDisclosureSystem = True <EOL> self . modelManager . disclosureSystem . select ( "<STR_LIT>" ) <EOL> elif options . validateHMRC : <EOL> self . modelManager . validateDisclosureSystem = True <EOL> self . modelManager . disclosureSystem . select ( "<STR_LIT>" ) <EOL> else : <EOL> self . modelManager . disclosureSystem . select ( None ) <EOL> self . modelManager . validateDisclosureSystem = False <EOL> if options . utrUrl : <EOL> self . modelManager . disclosureSystem . utrUrl = options . utrUrl <EOL> if options . skipDTS : <EOL> self . modelManager . skipDTS = True <EOL> if options . skipLoading : <EOL> self . modelManager . skipLoading = re . compile ( <EOL> '<STR_LIT:|>' . join ( fnmatch . translate ( f ) for f in options . skipLoading . split ( '<STR_LIT:|>' ) ) ) <EOL> if options . logLevelFilter : <EOL> self . setLogLevelFilter ( options . logLevelFilter ) <EOL> if options . logCodeFilter : <EOL> self . setLogCodeFilter ( options . logCodeFilter ) <EOL> if options . calcDecimals : <EOL> if options . calcPrecision : <EOL> self . addToLog ( _ ( "<STR_LIT>" ) , <EOL> messageCode = "<STR_LIT:info>" , file = options . entrypointFile ) <EOL> self . modelManager . validateInferDecimals = True <EOL> self . modelManager . validateCalcLB = True <EOL> elif options . calcPrecision : <EOL> self . modelManager . validateInferDecimals = False <EOL> self . modelManager . validateCalcLB = True <EOL> if options . utrValidate : <EOL> self . modelManager . validateUtr = True <EOL> if options . infosetValidate : <EOL> self . modelManager . validateInfoset = True <EOL> if options . abortOnMajorError : <EOL> self . modelManager . abortOnMajorError = True <EOL> if options . collectProfileStats : <EOL> self . modelManager . collectProfileStats = True <EOL> if options . outputAttribution : <EOL> self . modelManager . outputAttribution = options . outputAttribution <EOL> if options . internetConnectivity == "<STR_LIT>" : <EOL> self . webCache . workOffline = True <EOL> elif options . internetConnectivity == "<STR_LIT>" : <EOL> self . webCache . workOffline = False <EOL> if options . internetTimeout is not None : <EOL> self . webCache . timeout = ( options . internetTimeout or None ) <EOL> if options . internetLogDownloads : <EOL> self . webCache . logDownloads = True <EOL> fo = FormulaOptions ( ) <EOL> if options . parameters : <EOL> parameterSeparator = ( options . parameterSeparator or '<STR_LIT:U+002C>' ) <EOL> fo . parameterValues = dict ( ( ( qname ( key , noPrefixIsNoNamespace = True ) , ( None , value ) ) <EOL> for param in options . parameters . split ( parameterSeparator ) <EOL> for key , sep , value in ( param . partition ( '<STR_LIT:=>' ) , ) ) ) <EOL> if options . formulaParamExprResult : <EOL> fo . traceParameterExpressionResult = True <EOL> if options . formulaParamInputValue : <EOL> fo . traceParameterInputValue = True <EOL> if options . formulaCallExprSource : <EOL> fo . traceCallExpressionSource = True <EOL> if options . formulaCallExprCode : <EOL> fo . traceCallExpressionCode = True <EOL> if options . formulaCallExprEval : <EOL> fo . traceCallExpressionEvaluation = True <EOL> if options . formulaCallExprResult : <EOL> fo . traceCallExpressionResult = True <EOL> if options . formulaVarSetExprEval : <EOL> fo . traceVariableSetExpressionEvaluation = True <EOL> if options . formulaVarSetExprResult : <EOL> fo . traceVariableSetExpressionResult = True <EOL> if options . formulaAsserResultCounts : <EOL> fo . traceAssertionResultCounts = True <EOL> if options . formulaSatisfiedAsser : <EOL> fo . traceSatisfiedAssertions = True <EOL> if options . formulaUnsatisfiedAsser : <EOL> fo . traceUnsatisfiedAssertions = True <EOL> if options . formulaUnsatisfiedAsserError : <EOL> fo . errorUnsatisfiedAssertions = True <EOL> if options . formulaFormulaRules : <EOL> fo . traceFormulaRules = True <EOL> if options . formulaVarsOrder : <EOL> fo . traceVariablesOrder = True <EOL> if options . formulaVarExpressionSource : <EOL> fo . traceVariableExpressionSource = True <EOL> if options . formulaVarExpressionCode : <EOL> fo . traceVariableExpressionCode = True <EOL> if options . formulaVarExpressionEvaluation : <EOL> fo . traceVariableExpressionEvaluation = True <EOL> if options . formulaVarExpressionResult : <EOL> fo . traceVariableExpressionResult = True <EOL> if options . timeVariableSetEvaluation : <EOL> fo . timeVariableSetEvaluation = True <EOL> if options . formulaVarFilterWinnowing : <EOL> fo . traceVariableFilterWinnowing = True <EOL> if options . formulaVarFiltersResult : <EOL> fo . traceVariableFiltersResult = True <EOL> if options . formulaVarFiltersResult : <EOL> fo . traceVariableFiltersResult = True <EOL> if options . formulaRunIDs : <EOL> fo . runIDs = options . formulaRunIDs <EOL> self . modelManager . formulaOptions = fo <EOL> success = True <EOL> _entryPoints = [ ] <EOL> if options . entrypointFile : <EOL> _f = options . entrypointFile <EOL> try : <EOL> _entryPoints = json . loads ( _f ) <EOL> except ValueError : <EOL> if _f . startswith ( "<STR_LIT>" ) or _f . endswith ( "<STR_LIT>" ) or '<STR_LIT>' in _f : <EOL> self . addToLog ( _ ( "<STR_LIT>" ) . format ( _f ) , <EOL> messageCode = "<STR_LIT>" , <EOL> level = logging . ERROR ) <EOL> success = False <EOL> else : <EOL> for f in ( _f or '<STR_LIT>' ) . split ( '<STR_LIT:|>' ) : <EOL> if not sourceZipStream and not isHttpUrl ( f ) and not os . path . isabs ( f ) : <EOL> f = os . path . normpath ( os . path . join ( os . getcwd ( ) , f ) ) <EOL> _entryPoints . append ( { "<STR_LIT:file>" : f } ) <EOL> filesource = None <EOL> if sourceZipStream : <EOL> filesource = FileSource . openFileSource ( None , self , sourceZipStream ) <EOL> elif len ( _entryPoints ) == <NUM_LIT:1> : <EOL> filesource = FileSource . openFileSource ( _entryPoints [ <NUM_LIT:0> ] . get ( "<STR_LIT:file>" , None ) , self ) <EOL> _entrypointFiles = _entryPoints <EOL> if filesource and not filesource . selection : <EOL> if filesource . isArchive : <EOL> _entrypointFiles = [ ] <EOL> for _archiveFile in ( filesource . dir or ( ) ) : <EOL> filesource . select ( _archiveFile ) <EOL> if ModelDocument . Type . identify ( filesource , filesource . url ) in ( ModelDocument . Type . INSTANCE , ModelDocument . Type . INLINEXBRL ) : <EOL> _entrypointFiles . append ( { "<STR_LIT:file>" : filesource . url } ) <EOL> elif os . path . isdir ( filesource . url ) : <EOL> _entrypointFiles = [ ] <EOL> for _file in os . listdir ( filesource . url ) : <EOL> _path = os . path . join ( filesource . url , _file ) <EOL> if os . path . isfile ( _path ) and ModelDocument . Type . identify ( filesource , _path ) in ( ModelDocument . Type . INSTANCE , ModelDocument . Type . INLINEXBRL ) : <EOL> _entrypointFiles . append ( { "<STR_LIT:file>" : _path } ) <EOL> for pluginXbrlMethod in pluginClassMethods ( "<STR_LIT>" ) : <EOL> pluginXbrlMethod ( self , options , filesource , _entrypointFiles , sourceZipStream = sourceZipStream , responseZipStream = responseZipStream ) <EOL> for _entrypoint in _entrypointFiles : <EOL> _entrypointFile = _entrypoint . get ( "<STR_LIT:file>" , None ) if isinstance ( _entrypoint , dict ) else _entrypoint <EOL> if filesource and filesource . isArchive : <EOL> filesource . select ( _entrypointFile ) <EOL> else : <EOL> filesource = FileSource . openFileSource ( _entrypointFile , self , sourceZipStream ) <EOL> self . entrypointFile = _entrypointFile <EOL> timeNow = XmlUtil . dateunionValue ( datetime . datetime . now ( ) ) <EOL> firstStartedAt = startedAt = time . time ( ) <EOL> modelDiffReport = None <EOL> modelXbrl = None <EOL> try : <EOL> if filesource : <EOL> modelXbrl = self . modelManager . load ( filesource , _ ( "<STR_LIT>" ) ) <EOL> except ModelDocument . LoadingException : <EOL> pass <EOL> except Exception as err : <EOL> self . addToLog ( _ ( "<STR_LIT>" ) . format ( <EOL> err , <EOL> traceback . format_tb ( sys . exc_info ( ) [ <NUM_LIT:2> ] ) ) , <EOL> messageCode = "<STR_LIT>" , <EOL> level = logging . ERROR ) <EOL> success = False <EOL> if modelXbrl and modelXbrl . modelDocument : <EOL> loadTime = time . time ( ) - startedAt <EOL> modelXbrl . profileStat ( _ ( "<STR_LIT>" ) , loadTime ) <EOL> self . addToLog ( format_string ( self . modelManager . locale , <EOL> _ ( "<STR_LIT>" ) , <EOL> ( loadTime , timeNow ) ) , <EOL> messageCode = "<STR_LIT:info>" , file = self . entrypointFile ) <EOL> if options . importFiles : <EOL> for importFile in options . importFiles . split ( "<STR_LIT:|>" ) : <EOL> fileName = importFile . strip ( ) <EOL> if sourceZipStream is not None and not ( fileName . startswith ( '<STR_LIT>' ) or os . path . isabs ( fileName ) ) : <EOL> fileName = os . path . dirname ( modelXbrl . uri ) + os . sep + fileName <EOL> ModelDocument . load ( modelXbrl , fileName , isSupplemental = True ) <EOL> loadTime = time . time ( ) - startedAt <EOL> self . addToLog ( format_string ( self . modelManager . locale , <EOL> _ ( "<STR_LIT>" ) , <EOL> ( loadTime , timeNow ) ) , <EOL> messageCode = "<STR_LIT:info>" , file = importFile ) <EOL> modelXbrl . profileStat ( _ ( "<STR_LIT>" ) , loadTime ) <EOL> if modelXbrl . errors : <EOL> success = False <EOL> if modelXbrl . modelDocument . type in ModelDocument . Type . TESTCASETYPES : <EOL> for pluginXbrlMethod in pluginClassMethods ( "<STR_LIT>" ) : <EOL> pluginXbrlMethod ( self , options , modelXbrl ) <EOL> else : <EOL> for pluginXbrlMethod in pluginClassMethods ( "<STR_LIT>" ) : <EOL> pluginXbrlMethod ( self , options , modelXbrl , _entrypoint ) <EOL> else : <EOL> success = False <EOL> if success and options . diffFile and options . versReportFile : <EOL> try : <EOL> diffFilesource = FileSource . FileSource ( options . diffFile , self ) <EOL> startedAt = time . time ( ) <EOL> modelXbrl2 = self . modelManager . load ( diffFilesource , _ ( "<STR_LIT>" ) ) <EOL> if modelXbrl2 . errors : <EOL> if not options . keepOpen : <EOL> modelXbrl2 . close ( ) <EOL> success = False <EOL> else : <EOL> loadTime = time . time ( ) - startedAt <EOL> modelXbrl . profileStat ( _ ( "<STR_LIT>" ) , loadTime ) <EOL> self . addToLog ( format_string ( self . modelManager . locale , <EOL> _ ( "<STR_LIT>" ) , <EOL> loadTime ) , <EOL> messageCode = "<STR_LIT:info>" , file = self . entrypointFile ) <EOL> startedAt = time . time ( ) <EOL> modelDiffReport = self . modelManager . compareDTSes ( options . versReportFile ) <EOL> diffTime = time . time ( ) - startedAt <EOL> modelXbrl . profileStat ( _ ( "<STR_LIT>" ) , diffTime ) <EOL> self . addToLog ( format_string ( self . modelManager . locale , <EOL> _ ( "<STR_LIT>" ) , <EOL> diffTime ) , <EOL> messageCode = "<STR_LIT:info>" , file = self . entrypointFile ) <EOL> except ModelDocument . LoadingException : <EOL> success = False <EOL> except Exception as err : <EOL> success = False <EOL> self . addToLog ( _ ( "<STR_LIT>" ) . format ( <EOL> err , <EOL> traceback . format_tb ( sys . exc_info ( ) [ <NUM_LIT:2> ] ) ) ) <EOL> if success : <EOL> try : <EOL> modelXbrl = self . modelManager . modelXbrl <EOL> hasFormulae = modelXbrl . hasFormulae <EOL> isAlreadyValidated = False <EOL> for pluginXbrlMethod in pluginClassMethods ( "<STR_LIT>" ) : <EOL> if pluginXbrlMethod ( modelXbrl ) : <EOL> isAlreadyValidated = True <EOL> if options . validate and not isAlreadyValidated : <EOL> startedAt = time . time ( ) <EOL> if options . formulaAction : <EOL> modelXbrl . hasFormulae = False <EOL> self . modelManager . validate ( ) <EOL> if options . formulaAction : <EOL> modelXbrl . hasFormulae = hasFormulae <EOL> self . addToLog ( format_string ( self . modelManager . locale , <EOL> _ ( "<STR_LIT>" ) , <EOL> time . time ( ) - startedAt ) , <EOL> messageCode = "<STR_LIT:info>" , file = self . entrypointFile ) <EOL> if ( options . formulaAction in ( "<STR_LIT>" , "<STR_LIT>" ) and <EOL> not isAlreadyValidated ) : <EOL> from arelle import ValidateXbrlDimensions , ValidateFormula <EOL> startedAt = time . time ( ) <EOL> if not options . validate : <EOL> ValidateXbrlDimensions . loadDimensionDefaults ( modelXbrl ) <EOL> modelXbrl . parameters = fo . typedParameters ( ) <EOL> ValidateFormula . validate ( modelXbrl , compileOnly = ( options . formulaAction != "<STR_LIT>" ) ) <EOL> self . addToLog ( format_string ( self . modelManager . locale , <EOL> _ ( "<STR_LIT>" ) <EOL> if options . formulaAction == "<STR_LIT>" <EOL> else _ ( "<STR_LIT>" ) , <EOL> time . time ( ) - startedAt ) , <EOL> messageCode = "<STR_LIT:info>" , file = self . entrypointFile ) <EOL> if options . testReport : <EOL> ViewFileTests . viewTests ( self . modelManager . modelXbrl , options . testReport , options . testReportCols ) <EOL> if options . rssReport : <EOL> ViewFileRssFeed . viewRssFeed ( self . modelManager . modelXbrl , options . rssReport , options . rssReportCols ) <EOL> if options . DTSFile : <EOL> ViewFileDTS . viewDTS ( modelXbrl , options . DTSFile ) <EOL> if options . factsFile : <EOL> ViewFileFactList . viewFacts ( modelXbrl , options . factsFile , labelrole = options . labelRole , lang = options . labelLang , cols = options . factListCols ) <EOL> if options . factTableFile : <EOL> ViewFileFactTable . viewFacts ( modelXbrl , options . factTableFile , labelrole = options . labelRole , lang = options . labelLang ) <EOL> if options . conceptsFile : <EOL> ViewFileConcepts . viewConcepts ( modelXbrl , options . conceptsFile , labelrole = options . labelRole , lang = options . labelLang ) <EOL> if options . preFile : <EOL> ViewFileRelationshipSet . viewRelationshipSet ( modelXbrl , options . preFile , "<STR_LIT>" , "<STR_LIT>" , labelrole = options . labelRole , lang = options . labelLang ) <EOL> if options . calFile : <EOL> ViewFileRelationshipSet . viewRelationshipSet ( modelXbrl , options . calFile , "<STR_LIT>" , "<STR_LIT>" , labelrole = options . labelRole , lang = options . labelLang ) <EOL> if options . dimFile : <EOL> ViewFileRelationshipSet . viewRelationshipSet ( modelXbrl , options . dimFile , "<STR_LIT>" , "<STR_LIT>" , labelrole = options . labelRole , lang = options . labelLang ) <EOL> if options . formulaeFile : <EOL> ViewFileFormulae . viewFormulae ( modelXbrl , options . formulaeFile , "<STR_LIT>" , lang = options . labelLang ) <EOL> if options . viewArcrole and options . viewFile : <EOL> ViewFileRelationshipSet . viewRelationshipSet ( modelXbrl , options . viewFile , os . path . basename ( options . viewArcrole ) , options . viewArcrole , labelrole = options . labelRole , lang = options . labelLang ) <EOL> if options . roleTypesFile : <EOL> ViewFileRoleTypes . viewRoleTypes ( modelXbrl , options . roleTypesFile , "<STR_LIT>" , isArcrole = False , lang = options . labelLang ) <EOL> if options . arcroleTypesFile : <EOL> ViewFileRoleTypes . viewRoleTypes ( modelXbrl , options . arcroleTypesFile , "<STR_LIT>" , isArcrole = True , lang = options . labelLang ) <EOL> for pluginXbrlMethod in pluginClassMethods ( "<STR_LIT>" ) : <EOL> pluginXbrlMethod ( self , options , modelXbrl , _entrypoint ) <EOL> except ( IOError , EnvironmentError ) as err : <EOL> self . addToLog ( _ ( "<STR_LIT>" ) . format ( err ) , <EOL> messageCode = "<STR_LIT>" , <EOL> file = options . entrypointFile , <EOL> level = logging . CRITICAL ) <EOL> success = False <EOL> except Exception as err : <EOL> self . addToLog ( _ ( "<STR_LIT>" ) . format ( <EOL> err , <EOL> traceback . format_tb ( sys . exc_info ( ) [ <NUM_LIT:2> ] ) ) , <EOL> messageCode = err . __class__ . __name__ , <EOL> file = options . entrypointFile , <EOL> level = logging . CRITICAL ) <EOL> success = False <EOL> if modelXbrl : <EOL> modelXbrl . profileStat ( _ ( "<STR_LIT>" ) , time . time ( ) - firstStartedAt ) <EOL> if options . collectProfileStats and modelXbrl : <EOL> modelXbrl . logProfileStats ( ) <EOL> if not options . keepOpen : <EOL> if modelDiffReport : <EOL> self . modelManager . close ( modelDiffReport ) <EOL> elif modelXbrl : <EOL> self . modelManager . close ( modelXbrl ) <EOL> if options . validate : <EOL> for pluginXbrlMethod in pluginClassMethods ( "<STR_LIT>" ) : <EOL> pluginXbrlMethod ( self , options , filesource , _entrypointFiles , sourceZipStream = sourceZipStream , responseZipStream = responseZipStream ) <EOL> for pluginXbrlMethod in pluginClassMethods ( "<STR_LIT>" ) : <EOL> pluginXbrlMethod ( self , options , filesource , _entrypointFiles , sourceZipStream = sourceZipStream , responseZipStream = responseZipStream ) <EOL> self . username = self . password = None <EOL> if options . statusPipe and getattr ( self , "<STR_LIT>" , None ) is not None : <EOL> win32file . WriteFile ( self . statusPipe , b"<STR_LIT:U+0020>" ) <EOL> win32file . FlushFileBuffers ( self . statusPipe ) <EOL> win32file . SetFilePointer ( self . statusPipe , <NUM_LIT:0> , win32file . FILE_BEGIN ) <EOL> win32file . CloseHandle ( self . statusPipe ) <EOL> self . statusPipe = None <EOL> return success <EOL> def internet_user_password ( self , host , realm ) : <EOL> return ( self . username , self . password ) <EOL> def showStatusOnPipe ( self , message , clearAfter = None ) : <EOL> if self . statusPipe is not None : <EOL> try : <EOL> if self . parentProcessHandle is not None : <EOL> if win32process . GetExitCodeProcess ( self . parentProcessHandle ) != STILL_ACTIVE : <EOL> sys . exit ( ) <EOL> win32file . WriteFile ( self . statusPipe , ( message or "<STR_LIT>" ) . encode ( "<STR_LIT:utf8>" ) ) <EOL> win32file . FlushFileBuffers ( self . statusPipe ) <EOL> win32file . SetFilePointer ( self . statusPipe , <NUM_LIT:0> , win32file . FILE_BEGIN ) <EOL> except Exception as ex : <EOL> system . exit ( ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> '''<STR_LIT>''' <EOL> main ( ) </s>
