'Read tool configuration from the element `root` and fill in `self`.'

def parse(self, tool_source, guid=None):

    self.profile = float(tool_source.parse_profile())
    self.old_id = tool_source.parse_id()
    if (guid is None):
        self.id = self.old_id
    else:
        self.id = guid
    if (not self.id):
        raise Exception(("Missing    tool    'id'    for    tool    at    '%s'" % tool_source))
    profile = LooseVersion(str(self.profile))
    if ((profile >= LooseVersion('16.04')) and (LooseVersion(VERSION_MAJOR) < profile)):
        template = 'The    tool    %s    targets    version    %s    of    Galaxy,    you    should    upgrade    Galaxy    to    ensure    proper    functioning    of    this    tool.'
        message = (template % (self.id, self.profile))
        raise Exception(message)
    self.name = tool_source.parse_name()
    if (not self.name):
        raise Exception(("Missing    tool    'name'    for    tool    with    id    '%s'    at    '%s'" % (self.id, tool_source)))
    self.version = tool_source.parse_version()
    if (not self.version):
        if (self.profile < 16.04):
            self.version = '1.0.0'
        else:
            raise Exception(("Missing    tool    'version'    for    tool    with    id    '%s'    at    '%s'" % (self.id, tool_source)))
    self.edam_operations = tool_source.parse_edam_operations()
    self.edam_topics = tool_source.parse_edam_topics()
    self.is_multi_byte = tool_source.parse_is_multi_byte()
    self.force_history_refresh = False
    self.display_interface = tool_source.parse_display_interface(default=self.display_interface)
    self.require_login = tool_source.parse_require_login(self.require_login)
    request_param_translation_elem = tool_source.parse_request_param_translation_elem()
    if (request_param_translation_elem is not None):
        self.input_translator = ToolInputTranslator.from_element(request_param_translation_elem)
    else:
        self.input_translator = None
    self.parse_command(tool_source)
    self.environment_variables = self.parse_environment_variables(tool_source)
    redirect_url_params = tool_source.parse_redirect_url_params_elem()
    if ((redirect_url_params is not None) and (redirect_url_params.text is not None)):
        redirect_url_params = redirect_url_params.text.strip()
        self.redirect_url_params = redirect_url_params.replace('    ', '**^**')
    else:
        self.redirect_url_params = ''
    self.description = tool_source.parse_description()
    self.version_string_cmd = None
    version_command = tool_source.parse_version_command()
    if (version_command is not None):
        self.version_string_cmd = version_command.strip()
        version_cmd_interpreter = tool_source.parse_version_command_interpreter()
        if version_cmd_interpreter:
            executable = self.version_string_cmd.split()[0]
            abs_executable = os.path.abspath(os.path.join(self.tool_dir, executable))
            command_line = self.version_string_cmd.replace(executable, abs_executable, 1)
            self.version_string_cmd = ((version_cmd_interpreter + '    ') + command_line)
    self.parallelism = tool_source.parse_parallelism()
    self_ids = [self.id.lower()]
    if (self.old_id != self.id):
        self_ids = [self.id.lower(), self.id.lower().rsplit('/', 1)[0], self.old_id.lower()]
    self.all_ids = self_ids
    if hasattr(self.app, 'job_config'):
        self.job_tool_configurations = self.app.job_config.get_job_tool_configurations(self_ids)
    self.hidden = tool_source.parse_hidden()
    self.__parse_legacy_features(tool_source)
    self.options = dict(sanitize=tool_source.parse_sanitize(), refresh=tool_source.parse_refresh())
    self.options = Bunch(**self.options)
    self.parse_inputs(tool_source)
    self.parse_help(tool_source)
    self.parse_outputs(tool_source)
    self.parse_stdio(tool_source)
    self.strict_shell = tool_source.parse_strict_shell()
    self.__parse_config_files(tool_source)
    action = tool_source.parse_action_module()
    if (action is None):
        self.tool_action = self.default_tool_action()
    else:
        (module, cls) = action
        mod = __import__(module, globals(), locals(), [cls])
        self.tool_action = getattr(mod, cls)()
    self.__parse_tests(tool_source)
    (requirements, containers) = tool_source.parse_requirements_and_containers()
    self.requirements = requirements
    self.containers = containers
    self.citations = self._parse_citations(tool_source)
    self.is_workflow_compatible = self.check_workflow_compatible(tool_source)
    self.__parse_trackster_conf(tool_source)
