MCPcopy Create free account
hub / github.com/cdgriffith/Box / _add_eol_comment

Function _add_eol_comment

box/comments.py:263–272  ·  view source on GitHub ↗

End of line comment two spaces after the value, wherever it is (ruamel otherwise aligns it with a neighbouring comment, or uses one space when there is none).

(out, key, text)

Source from the content-addressed store, hash-verified

261
262
263def _add_eol_comment(out, key, text):
264 """End of line comment two spaces after the value, wherever it is (ruamel otherwise aligns it
265 with a neighbouring comment, or uses one space when there is none)."""
266 try:
267 from ruamel.yaml.error import CommentMark
268 from ruamel.yaml.tokens import CommentToken
269
270 out._yaml_add_eol_comment([CommentToken(f" # {text}", CommentMark(0)), None], key=key)
271 except (ImportError, AttributeError, TypeError): # pragma: no cover (other ruamel versions)
272 out.yaml_add_eol_comment(text, key)
273
274
275def _set_ruamel_comment(out, key, comment, indent):

Callers 1

_set_ruamel_commentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected