Skip to content

Commit cc5469f

Browse files
authored
Add missing docstrings (#776)
1 parent 4052d07 commit cc5469f

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

python/jupytercad_lab/jupytercad_lab/notebook/cad_document.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,25 @@ def _get_color(self, shape_id: str | int) -> str:
109109
return "#808080"
110110

111111
def remove(self, name: str) -> CadDocument:
112+
"""
113+
Remove an object from the document.
114+
115+
:param name: The name of the object to remove.
116+
:return: The document itself.
117+
"""
112118
index = self._get_yobject_index_by_name(name)
113119
if self._objects_array and index != -1:
114120
self._objects_array.pop(index)
115121
return self
116122

117123
def rename(self, old_name: str, new_name: str) -> CadDocument:
124+
"""
125+
Rename an object in the document.
126+
127+
:param old_name: The current name of the object.
128+
:param new_name: The new name for the object.
129+
:return: The document itself.
130+
"""
118131
if new_name == old_name:
119132
return self
120133
new_obj = self.get_object(old_name)
@@ -727,6 +740,12 @@ def _get_boolean_operands(self, shape1: str | int | None, shape2: str | int | No
727740
return shape1, shape2
728741

729742
def set_visible(self, name: str, value):
743+
"""
744+
Set the visibility of an object.
745+
746+
:param name: The name of the object.
747+
:param value: The visibility value (True or False).
748+
"""
730749
obj: Optional[Map] = self._get_yobject_by_name(name)
731750

732751
if obj is None:
@@ -735,6 +754,12 @@ def set_visible(self, name: str, value):
735754
obj["visible"] = value
736755

737756
def set_color(self, name: str, value: str):
757+
"""
758+
Set the color of an object.
759+
760+
:param name: The name of the object.
761+
:param value: The color in hex format (e.g., "#FF5733").
762+
"""
738763
obj: Optional[Map] = self._get_yobject_by_name(name)
739764

740765
if obj is None:

0 commit comments

Comments
 (0)