Przeglądaj źródła

Add type hints: mwparserfromhell.nodes.comment

pull/338/head
Jakub Klinkovský 1 rok temu
rodzic
commit
3543e59c32
1 zmienionych plików z 6 dodań i 4 usunięć
  1. +6
    -4
      src/mwparserfromhell/nodes/comment.py

+ 6
- 4
src/mwparserfromhell/nodes/comment.py Wyświetl plik

@@ -19,6 +19,8 @@
# SOFTWARE. # SOFTWARE.




from typing import Any

from ._base import Node from ._base import Node


__all__ = ["Comment"] __all__ = ["Comment"]
@@ -27,18 +29,18 @@ __all__ = ["Comment"]
class Comment(Node): class Comment(Node):
"""Represents a hidden HTML comment, like ``<!-- foobar -->``.""" """Represents a hidden HTML comment, like ``<!-- foobar -->``."""


def __init__(self, contents):
def __init__(self, contents: str):
super().__init__() super().__init__()
self.contents = contents self.contents = contents


def __str__(self):
def __str__(self) -> str:
return "<!--" + self.contents + "-->" return "<!--" + self.contents + "-->"


@property @property
def contents(self):
def contents(self) -> str:
"""The hidden text contained between ``<!--`` and ``-->``.""" """The hidden text contained between ``<!--`` and ``-->``."""
return self._contents return self._contents


@contents.setter @contents.setter
def contents(self, value):
def contents(self, value: Any) -> None:
self._contents = str(value) self._contents = str(value)

Ładowanie…
Anuluj
Zapisz