Skip to content

Commit

Permalink
chg: optimized apply_attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbertWeichselbraun committed Jan 7, 2025
1 parent 3c39d1f commit 9dacbcd
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/inscriptis/model/attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,9 @@ def apply_attributes(
attributes: the list of attributes
html_element: the HTML element for which the attributes are parsed
"""
supported_attributes = (
(name, val)
for name, val in attributes.items()
if name in self.attribute_mapping
)
for attr_name, attr_value in supported_attributes:
self.attribute_mapping[attr_name](attr_value, html_element)
for attr_name, attr_value in attributes.items():
if attr_name in self.attribute_mapping:
self.attribute_mapping[attr_name](attr_value, html_element)
return html_element

def merge_attribute_map(self, annotations: List[ApplyAnnotation] = None) -> None:
Expand Down

0 comments on commit 9dacbcd

Please sign in to comment.