Skip to content

Commit 67912ff

Browse files
committed
Add docstrings
1 parent 983522d commit 67912ff

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
@@ -161,12 +161,25 @@ def _get_color(self, shape_id: str | int) -> str:
161161
return "#808080"
162162

163163
def remove(self, name: str) -> CadDocument:
164+
"""
165+
Remove an object from the document.
166+
167+
:param name: The name of the object to remove.
168+
:return: The document itself.
169+
"""
164170
index = self._get_yobject_index_by_name(name)
165171
if self._objects_array and index != -1:
166172
self._objects_array.pop(index)
167173
return self
168174

169175
def rename(self, old_name: str, new_name: str) -> CadDocument:
176+
"""
177+
Rename an object in the document.
178+
179+
:param old_name: The current name of the object.
180+
:param new_name: The new name for the object.
181+
:return: The document itself.
182+
"""
170183
if new_name == old_name:
171184
return self
172185
new_obj = self.get_object(old_name)
@@ -779,6 +792,12 @@ def _get_boolean_operands(self, shape1: str | int | None, shape2: str | int | No
779792
return shape1, shape2
780793

781794
def set_visible(self, name: str, value):
795+
"""
796+
Set the visibility of an object.
797+
798+
:param name: The name of the object.
799+
:param value: The visibility value (True or False).
800+
"""
782801
obj: Optional[Map] = self._get_yobject_by_name(name)
783802

784803
if obj is None:
@@ -787,6 +806,12 @@ def set_visible(self, name: str, value):
787806
obj["visible"] = value
788807

789808
def set_color(self, name: str, value: str):
809+
"""
810+
Set the color of an object.
811+
812+
:param name: The name of the object.
813+
:param value: The color in hex format (e.g., "#FF5733").
814+
"""
790815
obj: Optional[Map] = self._get_yobject_by_name(name)
791816

792817
if obj is None:

0 commit comments

Comments
 (0)