(obj, key, text, position=None)
| 86 | |
| 87 | |
| 88 | def set_comment(obj, key, text, position=None) -> None: |
| 89 | owner, key = obj._comment_owner(key) |
| 90 | owner._comment_check_frozen() |
| 91 | document = key is None |
| 92 | position = position or ("start" if document else "eol") |
| 93 | value = normalize(position, text, document=document) |
| 94 | if document: |
| 95 | entry = owner._comment_document() |
| 96 | else: |
| 97 | store = owner._comment_store() |
| 98 | entry = store.setdefault(key, {}) |
| 99 | if value is None: |
| 100 | entry.pop(position, None) |
| 101 | else: |
| 102 | entry[position] = value |
| 103 | if not document and not entry: |
| 104 | del store[key] |
| 105 | |
| 106 | |
| 107 | def del_comment(obj, key) -> None: |
nothing calls this directly
no test coverage detected