Refactor attribute filtering in PlexObject class (#1341)

* Refactor attribute filtering in PlexObject class

- minor performance imporvement

* Update plexapi/base.py

Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>

---------

Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
This commit is contained in:
Dr.Blank 2024-02-17 17:16:21 -05:00 committed by GitHub
parent 9d9dca8f44
commit 41f6b9cf93
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -440,7 +440,7 @@ class PlexObject:
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 (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