From 71571026f84e6fcfc57b7696b6058b239b4d0e81 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Wed, 16 Feb 2022 12:59:08 +0100 Subject: [PATCH] Fix up macros type annotation We only create XmlMacroDef later on. --- lib/galaxy/util/__init__.py | 2 ++ lib/galaxy/util/xml_macros.py | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/util/__init__.py b/lib/galaxy/util/__init__.py index c45285715b1..f581f8a4aed 100644 --- a/lib/galaxy/util/__init__.py +++ b/lib/galaxy/util/__init__.py @@ -50,9 +50,11 @@ from boltons.iterutils import ( LXML_AVAILABLE = True try: from lxml import etree + Element = etree._Element except ImportError: LXML_AVAILABLE = False import xml.etree.ElementTree as etree # type: ignore[assignment,no-redef] + Element = etree.Element from requests.adapters import HTTPAdapter from requests.packages.urllib3.util.retry import Retry diff --git a/lib/galaxy/util/xml_macros.py b/lib/galaxy/util/xml_macros.py index 42c6680d71d..c55ce64d56f 100644 --- a/lib/galaxy/util/xml_macros.py +++ b/lib/galaxy/util/xml_macros.py @@ -2,7 +2,10 @@ import os from copy import deepcopy from typing import Dict, List -from galaxy.util import parse_xml +from galaxy.util import ( + Element, + parse_xml, +) REQUIRED_PARAMETER = object() @@ -20,7 +23,7 @@ def load_with_references(path): if macros_el is None: return tree, [] - macros: Dict[str, List[XmlMacroDef]] = {} + macros: Dict[str, List[Element]] = {} macro_paths = _import_macros(macros_el, path, macros) macros_el.clear()