Don't use using etree.Element in Boolean context.
This avoids a deprecation warning.
Also f-strings.
@@ -38,7 +38,7 @@ class XmlDocBuilder:
libdoc.inits = self._create_keywords(spec, 'inits/init', libdoc.source)
libdoc.keywords = self._create_keywords(spec, 'keywords/kw', libdoc.source)
# RF >= 5 have 'typedocs', RF >= 4 have 'datatypes', older/custom may have neither.
- if spec.find('typedocs'):
+ if spec.find('typedocs') is not None:
libdoc.type_docs = self._parse_type_docs(spec)
else:
libdoc.type_docs = self._parse_data_types(spec)
@@ -46,11 +46,11 @@ class XmlDocBuilder:
def _parse_spec(self, path):
if not os.path.isfile(path):
- raise DataError("Spec file '%s' does not exist." % path)
+ raise DataError(f"Spec file '{path}' does not exist.")
with ETSource(path) as source:
root = ET.parse(source).getroot()
if root.tag != 'keywordspec':
- raise DataError("Invalid spec file '%s'." % path)
+ raise DataError(f"Invalid spec file '{path}'.")
version = root.get('specversion')
if version not in ('3', '4'):
raise DataError(f"Invalid spec file version '{version}'. "
