From 12ed8b752c51ecdf83d55ffb631c5b7fa569c294 Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Mon, 15 Nov 2021 17:46:42 +0000 Subject: [PATCH] simplify and do el.attrib.get('id') as per review --- Lib/fontTools/subset/svg.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/fontTools/subset/svg.py b/Lib/fontTools/subset/svg.py index 8467350d8..ea1a809cd 100644 --- a/Lib/fontTools/subset/svg.py +++ b/Lib/fontTools/subset/svg.py @@ -111,8 +111,7 @@ def subset_elements(el: etree.Element, retained_ids: Set[str]) -> bool: # Keep elements if their id is in the subset, or any of their children's id is. # Drop elements whose id is not in the subset, and either have no children, # or all their children are being dropped. - el_id = el.attrib.get("id") - if el_id is not None and el_id in retained_ids: + if el.attrib.get("id") in retained_ids: # if id is in the set, don't recurse; keep whole subtree return True keep = False