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

Function set_comment

box/comments.py:88–104  ·  view source on GitHub ↗
(obj, key, text, position=None)

Source from the content-addressed store, hash-verified

86
87
88def 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
107def del_comment(obj, key) -> None:

Callers

nothing calls this directly

Calls 7

normalizeFunction · 0.85
setdefaultMethod · 0.80
_comment_ownerMethod · 0.45
_comment_check_frozenMethod · 0.45
_comment_documentMethod · 0.45
_comment_storeMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected