From d3d81f7639b58ae0626d15e78223af99c9d9a421 Mon Sep 17 00:00:00 2001 From: Dr-Blank <64108942+Dr-Blank@users.noreply.github.com> Date: Tue, 16 Jan 2024 01:26:32 -0500 Subject: [PATCH 1/2] Refactor attribute filtering in PlexObject class - minor performance imporvement --- plexapi/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plexapi/base.py b/plexapi/base.py index 4e6d59d8b..67c1e876f 100644 --- a/plexapi/base.py +++ b/plexapi/base.py @@ -439,7 +439,7 @@ def _getAttrValue(self, elem, attrstr, results=None): attrstr = parts[1] if len(parts) == 2 else None if attrstr: results = [] if results is None else results - for child in [c for c in elem if c.tag.lower() == attr.lower()]: + for child in filter(lambda c: c.tag.lower() == attr.lower(), elem): results += self._getAttrValue(child, attrstr, results) return [r for r in results if r is not None] # check were looking for the tag From 244df26105421c7669526cfc461d4c2b52eef4c4 Mon Sep 17 00:00:00 2001 From: "Dr.Blank" <64108942+Dr-Blank@users.noreply.github.com> Date: Mon, 5 Feb 2024 08:36:26 -0500 Subject: [PATCH 2/2] Update plexapi/base.py Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> --- plexapi/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plexapi/base.py b/plexapi/base.py index 67c1e876f..5b8b00a60 100644 --- a/plexapi/base.py +++ b/plexapi/base.py @@ -439,7 +439,7 @@ def _getAttrValue(self, elem, attrstr, results=None): attrstr = parts[1] if len(parts) == 2 else None if attrstr: results = [] if results is None else results - for child in filter(lambda c: c.tag.lower() == attr.lower(), elem): + for child in (c for c in elem if c.tag.lower() == attr.lower()): results += self._getAttrValue(child, attrstr, results) return [r for r in results if r is not None] # check were looking for the tag