def to_yaml(cls, r: Representer, n: "Sub") -> Any: fmt = n.v._ig_format._ig_value kwargs = {} for k, v in n.v._ig_kwargs._ig_value.items(): old = new = f"${{{k._ig_value}}}" if isinstance(v, core.Parameter): new = f"${{{_getidn(v._ig_name)}}}" elif isinstance(v, core.Ref): new = f"${{{_getnidn(v._ig_node)}}}" elif isinstance(v, core.Attribute): new = f"${{{_getnidn(v._ig_node)}.{_getaidn(v._ig_name)}}}" elif isinstance(getattr(v, "_ig_value", None), (str, int, float)): new = f"{v._ig_value}" else: kwargs[k] = v fmt = fmt.replace(old, new) if not kwargs: return r.represent_scalar(cls.tag, _t(fmt)) return r.represent_sequence(cls.tag, _t([fmt, kwargs]))
def to_yaml(cls, representer: Representer, node: Enum) -> Any: return representer.represent_scalar( "!" + cls.__name__, node._name_ # type: ignore )
def to_yaml(cls, r: Representer, n: "RefValue") -> Any: return r.represent_scalar(cls.tag, n.v, style=n.style)
def to_yaml(cls, r: Representer, n: "Ref") -> Any: return r.represent_scalar(cls.tag, _getnidn(n.v._ig_node))
def to_yaml(cls, r: Representer, n: "GetAtt") -> Any: return r.represent_scalar( cls.tag, f"{_getnidn(n.v._ig_node)}.{_getaidn(n.v._ig_name)}", )
def to_yaml(cls, r: Representer, n: "MultilineStr") -> Any: return r.represent_scalar(cls.tag, n.v, style="|")