Compare commits

..

4 Commits

2 changed files with 6 additions and 6 deletions

View File

@ -45,7 +45,7 @@ class Question(str):
"""
A single question with a defined header.
"""
header = '=== QUESTION ==='
header: Final[str] = '=== QUESTION ==='
def __new__(cls: Type[QuestionInst], string: str) -> QuestionInst:
"""
@ -67,7 +67,7 @@ class Answer(str):
"""
A single answer with a defined header.
"""
header = '=== ANSWER ==='
header: Final[str] = '=== ANSWER ==='
def __new__(cls: Type[AnswerInst], string: str) -> AnswerInst:
"""

View File

@ -1,7 +1,7 @@
"""
Module implementing tag related functions and classes.
"""
from typing import Type, TypeVar, Optional
from typing import Type, TypeVar, Optional, Final
TagInst = TypeVar('TagInst', bound='Tag')
TagLineInst = TypeVar('TagLineInst', bound='TagLine')
@ -16,9 +16,9 @@ class Tag(str):
A single tag. A string that can contain anything but the default separator (' ').
"""
# default separator
default_separator = ' '
default_separator: Final[str] = ' '
# alternative separators (e. g. for backwards compatibility)
alternative_separators = [',']
alternative_separators: Final[list[str]] = [',']
def __new__(cls: Type[TagInst], string: str) -> TagInst:
"""
@ -98,7 +98,7 @@ class TagLine(str):
the tags.
"""
# the prefix
prefix = 'TAGS:'
prefix: Final[str] = 'TAGS:'
def __new__(cls: Type[TagLineInst], string: str) -> TagLineInst:
"""