INNER CODE UNIT · Python

format_property

volfpeter/htmy · htmy/core.py:173

    def format_property(cls, _: Any) -> Never:
        """Property formatter that raises a `SkipProperty` error regardless of the received value."""
        raise cls("skip-property")


class Text(str):
    """Marker class for differentiating text content from other strings."""

    ...


class SafeStr(Text):
    """
    String subclass whose instances shouldn't get escaped during rendering.

    Note: any operation on `SafeStr` instances will result in plain `str` instances which
    will be rendered normally. Make sure the `str` to `SafeStr` conversion (`SafeStr(my_string)`)
    takes when there's no string operation afterwards.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…