nac3-spec/toy-impl/helper.py

10 lines
278 B
Python

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) + "}"