<s> from qisys import ui <EOL> import qisys . error <EOL> import qisys . parsers <EOL> import qidoc . builder <EOL> from qidoc . worktree import DocWorkTree , new_doc_project <EOL> def build_doc_parser ( parser ) : <EOL> """<STR_LIT>""" <EOL> group = parser . add_argument_group ( "<STR_LIT>" ) <EOL> group . add_argument ( "<STR_LIT>" ) <EOL> group . add_argument ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" ) <EOL> group . add_argument ( "<STR_LIT>" , action = "<STR_LIT>" , dest = "<STR_LIT>" ) <EOL> group . add_argument ( "<STR_LIT>" , action = "<STR_LIT>" , dest = "<STR_LIT>" , <EOL> const = "<STR_LIT>" ) <EOL> group . add_argument ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" ) <EOL> group . add_argument ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" ) <EOL> group . add_argument ( "<STR_LIT>" , action = "<STR_LIT:store_true>" , dest = "<STR_LIT>" ) <EOL> group . add_argument ( "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT>" ) <EOL> parser . set_defaults ( hosted = True , build_type = "<STR_LIT>" , werror = False , <EOL> spellcheck = False , language = "<STR_LIT>" ) <EOL> def get_doc_worktree ( args ) : <EOL> worktree = qisys . parsers . get_worktree ( args ) <EOL> doc_worktree = DocWorkTree ( worktree ) <EOL> ui . info ( ui . green , "<STR_LIT>" , ui . reset , <EOL> ui . bold , doc_worktree . root ) <EOL> return doc_worktree <EOL> def get_doc_projects ( doc_worktree , args , default_all = False ) : <EOL> parser = DocProjectParser ( doc_worktree ) <EOL> return parser . parse_args ( args , default_all = default_all ) <EOL> def get_one_doc_project ( doc_worktree , args ) : <EOL> parser = DocProjectParser ( doc_worktree ) <EOL> projects = parser . parse_args ( args ) <EOL> if not len ( projects ) == <NUM_LIT:1> : <EOL> raise qisys . error . Error ( "<STR_LIT>" ) <EOL> return projects [ <NUM_LIT:0> ] <EOL> def get_doc_builder ( args ) : <EOL> doc_worktree = get_doc_worktree ( args ) <EOL> doc_project = get_one_doc_project ( doc_worktree , args ) <EOL> doc_builder = qidoc . builder . DocBuilder ( doc_worktree ) <EOL> doc_builder . set_base_project ( doc_project . name ) <EOL> doc_builder . single = vars ( args ) . get ( "<STR_LIT>" , False ) <EOL> doc_builder . version = vars ( args ) . get ( "<STR_LIT:version>" ) <EOL> doc_builder . local = vars ( args ) . get ( "<STR_LIT>" , True ) <EOL> doc_builder . build_type = vars ( args ) . get ( "<STR_LIT>" ) <EOL> doc_builder . werror = vars ( args ) . get ( "<STR_LIT>" , False ) <EOL> doc_builder . spellcheck = vars ( args ) . get ( "<STR_LIT>" , False ) <EOL> doc_builder . language = vars ( args ) . get ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> return doc_builder <EOL> class DocProjectParser ( qisys . parsers . AbstractProjectParser ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , doc_worktree ) : <EOL> self . doc_worktree = doc_worktree <EOL> self . doc_projects = doc_worktree . doc_projects <EOL> def all_projects ( self , args ) : <EOL> return self . doc_projects <EOL> def parse_no_project ( self , args ) : <EOL> """<STR_LIT>""" <EOL> worktree = self . doc_worktree . worktree <EOL> parser = qisys . parsers . WorkTreeProjectParser ( worktree ) <EOL> worktree_projects = parser . parse_no_project ( args ) <EOL> if not worktree_projects : <EOL> raise CouldNotGuessProjectName ( ) <EOL> worktree_project = worktree_projects [ <NUM_LIT:0> ] <EOL> doc_project = new_doc_project ( self . doc_worktree , worktree_project ) <EOL> if not doc_project : <EOL> raise CouldNotGuessProjectName ( ) <EOL> return self . parse_one_project ( args , doc_project . name ) <EOL> def parse_one_project ( self , args , project_arg ) : <EOL> """<STR_LIT>""" <EOL> project = self . doc_worktree . get_doc_project ( project_arg , raises = True ) <EOL> return [ project ] <EOL> class CouldNotGuessProjectName ( qisys . error . Error ) : <EOL> def __str__ ( self ) : <EOL> return """<STR_LIT>""" </s>
