Skip to content

Commit

Permalink
chore: ruff fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
phil65 committed Oct 8, 2024
1 parent 1ff534d commit 94d593a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion mknodes/basenodes/mknode/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def __hash__(self):
return hash(self.to_markdown())

def __eq__(self, other):
if not type(other) is type(self):
if type(other) is not type(self):
return False
dct_1 = self.__dict__.copy()
dct_2 = other.__dict__.copy()
Expand Down
12 changes: 6 additions & 6 deletions mknodes/utils/icons.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import functools
from typing import TYPE_CHECKING, Any, Literal
import xml.etree.ElementTree as etree
import xml.etree.ElementTree as ET

from mknodes import paths

Expand Down Expand Up @@ -160,8 +160,8 @@ def to_svg(

add_attributes(options, attributes)

return etree.Element("img", attributes)
el = etree.Element("span", {"class": options.get("classes", index)})
return ET.Element("img", attributes)
el = ET.Element("span", {"class": options.get("classes", index)})
svg_path = md.inlinePatterns["emoji"].emoji_index["emoji"][shortname]["path"] # type: ignore[attr-defined]
svg = get_icon_svg(svg_path)
el.text = md.htmlStash.store(svg)
Expand Down Expand Up @@ -266,16 +266,16 @@ def get_emoji_slug(icon: str) -> str:
return f":{get_pyconify_key(icon).replace(':', '-')}:"


def get_icon_xml(icon: str) -> etree.Element:
def get_icon_xml(icon: str) -> ET.Element:
"""Return a xmlElement for given MaterialIcon.
Arguments:
icon: Icon to fetch. If iconname is not explicit (aka does not contain "/"),
then it will try to get the icon from material/ folder.
"""
etree.register_namespace("", "http://www.w3.org/2000/svg")
ET.register_namespace("", "http://www.w3.org/2000/svg")
svg_text = get_icon_svg(icon)
return etree.fromstring(svg_text)
return ET.fromstring(svg_text)


def write_icon_index():
Expand Down

0 comments on commit 94d593a

Please sign in to comment.