rainbowadn/rainbowadn/core/hash_point_format.py
2022-07-10 21:14:02 +03:00

28 lines
659 B
Python

from .hashpoint import *
from .mentionable import *
from .recursivementionable import *
__all__ = ('hash_point_format', 'tabulate',)
async def hash_point_format(hash_point: HashPoint, tab: int) -> str:
assert isinstance(hash_point, HashPoint)
assert isinstance(tab, int)
value: Mentionable = await hash_point.resolve()
assert isinstance(value, Mentionable)
if isinstance(value, RecursiveMentionable):
return await value.str(tab)
else:
return str(value)
newline = False
def tabulate(tab: int) -> str:
assert isinstance(tab, int)
if newline:
return '\n' + ' ' * tab
else:
return ' '