Return the comments of `key` as ``{"before": text, "eol": text}`` (a position without a comment is left out), or None. ``key=None`` returns the document comments ``{"start": ..., "end": ...}``. With box_dots, `key` can be a dotted path.
(self, key: Any = None)
| 919 | # ---- Comments (#184): kept outside the data, written by to_yaml with ruamel.yaml ---- |
| 920 | |
| 921 | def get_comment(self, key: Any = None) -> dict | None: |
| 922 | """ |
| 923 | Return the comments of `key` as ``{"before": text, "eol": text}`` (a position without a comment |
| 924 | is left out), or None. ``key=None`` returns the document comments ``{"start": ..., "end": ...}``. |
| 925 | With box_dots, `key` can be a dotted path. |
| 926 | """ |
| 927 | return _comments.get_comment(self, key) |
| 928 | |
| 929 | def set_comment(self, key: Any, text: Any, position: str | None = None) -> None: |
| 930 | """ |
no outgoing calls