added utils
This commit is contained in:
@ -15,6 +15,8 @@ from typing import (
|
|||||||
|
|
||||||
from option import NONE, Err, Ok, Option, Result, Some
|
from option import NONE, Err, Ok, Option, Result, Some
|
||||||
|
|
||||||
|
from utils.utils import indent
|
||||||
|
|
||||||
C = TypeVar("C", default=str)
|
C = TypeVar("C", default=str)
|
||||||
V = TypeVar("V", default=str)
|
V = TypeVar("V", default=str)
|
||||||
|
|
||||||
@ -54,11 +56,6 @@ class Tags(Generic[C, V]):
|
|||||||
return "\n".join(lines)
|
return "\n".join(lines)
|
||||||
|
|
||||||
|
|
||||||
def indent(text: str, spaces: int = 2) -> str:
|
|
||||||
prefix = " " * spaces
|
|
||||||
return "\n".join(prefix + line for line in text.splitlines())
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class QuizTask(Generic[C, V]):
|
class QuizTask(Generic[C, V]):
|
||||||
question: str
|
question: str
|
||||||
|
|||||||
0
utils/__init__.py
Normal file
0
utils/__init__.py
Normal file
3
utils/utils.py
Normal file
3
utils/utils.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
def indent(text: str, spaces: int = 2) -> str:
|
||||||
|
prefix = " " * spaces
|
||||||
|
return "\n".join(prefix + line for line in text.splitlines())
|
||||||
Reference in New Issue
Block a user