"""A part of a challenge."""
from abc import ABCMeta, abstractmethod

import mistune
from flask import render_template


class Part(metaclass=ABCMeta):
    """A part of a challenge."""

    @abstractmethod
    def render(self) -> str:
        """Render as html."""
        raise NotImplementedError


class TemplatePart(Part, metaclass=ABCMeta):
    """A part that renders as a template."""

    template_name: str

    def render(self) -> str:
        """Render as html."""
        return render_template(self.template_name, part=self)


class TextSubmissionPart(TemplatePart):
    """Submit a text form."""

    def __init__(self, name: str):
        self.name = name

    template_name = "part_text_submission.html"


class MarkdownPart(Part):
    """A part that renders some markdown."""

    def __init__(self, content: str) -> None:
        self.content = content

    def render(self) -> str:
        """Render as html."""
        return mistune.markdown(self.content)

b869a2d2c57b38dfb2c69a9ab13617d85687fd3c
<mask token>


class TemplatePart(Part, metaclass=ABCMeta):
    """A part that renders as a template."""
    template_name: str

    def render(self) ->str:
        """Render as html."""
        return render_template(self.template_name, part=self)


class TextSubmissionPart(TemplatePart):
    """Submit a text form."""

    def __init__(self, name: str):
        self.name = name
    template_name = 'part_text_submission.html'


class MarkdownPart(Part):
    """A part that renders some markdown."""

    def __init__(self, content: str) ->None:
        self.content = content

    def render(self) ->str:
        """Render as html."""
        return mistune.markdown(self.content)

<mask token>


class Part(metaclass=ABCMeta):
    <mask token>
    <mask token>


class TemplatePart(Part, metaclass=ABCMeta):
    """A part that renders as a template."""
    template_name: str

    def render(self) ->str:
        """Render as html."""
        return render_template(self.template_name, part=self)


class TextSubmissionPart(TemplatePart):
    """Submit a text form."""

    def __init__(self, name: str):
        self.name = name
    template_name = 'part_text_submission.html'


class MarkdownPart(Part):
    """A part that renders some markdown."""

    def __init__(self, content: str) ->None:
        self.content = content

    def render(self) ->str:
        """Render as html."""
        return mistune.markdown(self.content)

<mask token>


class Part(metaclass=ABCMeta):
    <mask token>

    @abstractmethod
    def render(self) ->str:
        """Render as html."""
        raise NotImplementedError


class TemplatePart(Part, metaclass=ABCMeta):
    """A part that renders as a template."""
    template_name: str

    def render(self) ->str:
        """Render as html."""
        return render_template(self.template_name, part=self)


class TextSubmissionPart(TemplatePart):
    """Submit a text form."""

    def __init__(self, name: str):
        self.name = name
    template_name = 'part_text_submission.html'


class MarkdownPart(Part):
    """A part that renders some markdown."""

    def __init__(self, content: str) ->None:
        self.content = content

    def render(self) ->str:
        """Render as html."""
        return mistune.markdown(self.content)

<mask token>


class Part(metaclass=ABCMeta):
    """A part of a challenge."""

    @abstractmethod
    def render(self) ->str:
        """Render as html."""
        raise NotImplementedError


class TemplatePart(Part, metaclass=ABCMeta):
    """A part that renders as a template."""
    template_name: str

    def render(self) ->str:
        """Render as html."""
        return render_template(self.template_name, part=self)


class TextSubmissionPart(TemplatePart):
    """Submit a text form."""

    def __init__(self, name: str):
        self.name = name
    template_name = 'part_text_submission.html'


class MarkdownPart(Part):
    """A part that renders some markdown."""

    def __init__(self, content: str) ->None:
        self.content = content

    def render(self) ->str:
        """Render as html."""
        return mistune.markdown(self.content)

"""A part of a challenge."""
from abc import ABCMeta, abstractmethod

import mistune
from flask import render_template


class Part(metaclass=ABCMeta):
    """A part of a challenge."""

    @abstractmethod
    def render(self) -> str:
        """Render as html."""
        raise NotImplementedError


class TemplatePart(Part, metaclass=ABCMeta):
    """A part that renders as a template."""

    template_name: str

    def render(self) -> str:
        """Render as html."""
        return render_template(self.template_name, part=self)


class TextSubmissionPart(TemplatePart):
    """Submit a text form."""

    def __init__(self, name: str):
        self.name = name

    template_name = "part_text_submission.html"


class MarkdownPart(Part):
    """A part that renders some markdown."""

    def __init__(self, content: str) -> None:
        self.content = content

    def render(self) -> str:
        """Render as html."""
        return mistune.markdown(self.content)
