Skip to content

Commit

Permalink
chg: code cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbertWeichselbraun committed Jan 8, 2024
1 parent ffef3f9 commit 57120ce
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions src/inscriptis/annotation/output/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ def _get_label_colors(labels: List[str]) -> Dict[str, str]:
A mapping between the available labels and the corresponding color
from the COLOR_SCHEMA.
"""
return {label: color
for label, color in zip({a[2] for a in sorted(labels)},
cycle(COLOR_SCHEMA))}
return dict(zip({a[2] for a in sorted(labels)}, cycle(COLOR_SCHEMA)))

def _get_css(self, labels: List[str]) -> str:
"""Compute the CSS to be included into the HTML output.
Expand Down
4 changes: 2 additions & 2 deletions src/inscriptis/html_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def handle_starttag(self, tag, attrs):
tag, DEFAULT_HTML_ELEMENT).__copy__().set_tag(tag)))
self.tags.append(cur)

handler = self.start_tag_handler_dict.get(tag, None)
handler = self.start_tag_handler_dict.get(tag)
if handler:
handler(attrs)

Expand All @@ -150,7 +150,7 @@ def handle_endtag(self, tag):
Args:
tag: the HTML end tag to process.
"""
handler = self.end_tag_handler_dict.get(tag, None)
handler = self.end_tag_handler_dict.get(tag)
if handler:
handler()

Expand Down

0 comments on commit 57120ce

Please sign in to comment.