Просмотр исходного кода

Add type hints: mwparserfromhell.definitions

pull/338/head
Jakub Klinkovský 1 год назад
Родитель
Сommit
31d99cfbe9
1 измененных файлов: 6 добавлений и 6 удалений
  1. +6
    -6
      src/mwparserfromhell/definitions.py

+ 6
- 6
src/mwparserfromhell/definitions.py Просмотреть файл

@@ -113,32 +113,32 @@ MARKUP_TO_HTML = {
}


def get_html_tag(markup):
def get_html_tag(markup: str) -> str:
"""Return the HTML tag associated with the given wiki-markup."""
return MARKUP_TO_HTML[markup]


def is_parsable(tag):
def is_parsable(tag: str) -> bool:
"""Return if the given *tag*'s contents should be passed to the parser."""
return tag.lower() not in PARSER_BLACKLIST


def is_visible(tag):
def is_visible(tag: str) -> bool:
"""Return whether or not the given *tag* contains visible text."""
return tag.lower() not in INVISIBLE_TAGS


def is_single(tag):
def is_single(tag: str) -> bool:
"""Return whether or not the given *tag* can exist without a close tag."""
return tag.lower() in SINGLE


def is_single_only(tag):
def is_single_only(tag: str) -> bool:
"""Return whether or not the given *tag* must exist without a close tag."""
return tag.lower() in SINGLE_ONLY


def is_scheme(scheme, slashes=True):
def is_scheme(scheme: str, slashes: bool = True) -> bool:
"""Return whether *scheme* is valid for external links."""
scheme = scheme.lower()
if slashes:


Загрузка…
Отмена
Сохранить