nac3-spec/toy-impl/helper.py

10 lines
278 B
Python
Raw Normal View History

2020-12-18 13:03:36 +08:00
class CustomError(Exception):
def __init__(self, msg):
self.msg = msg
def stringify_subst(subst):
if isinstance(subst, str):
return subst
elements = [f"{key}: {str(value)}" for key, value in subst.items()]
return "{" + ', '.join(elements) + "}"