Skip to content

Commit 69e8c7f

Browse files
authored
Fixed docstrings (#221)
1 parent ce973d5 commit 69e8c7f

File tree

1 file changed

+16
-28
lines changed

1 file changed

+16
-28
lines changed

depthai_nodes/node/gather_data.py

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ def detections(self) -> List:
2929

3030

3131
class GatherData(dai.node.ThreadedHostNode, Generic[TReference, TGathered]):
32-
FPS_TOLERANCE_DIVISOR = 2.0
33-
INPUT_CHECKS_PER_FPS = 100
3432
"""A class for gathering data. Gathers n messages based on reference_data. To
3533
determine n, wait_count_fn function is used. The default wait_count_fn function is
3634
waiting for len(TReference.detection). This means the node works out-of-the-box with
@@ -50,6 +48,9 @@ class GatherData(dai.node.ThreadedHostNode, Generic[TReference, TGathered]):
5048
Output for gathered data.
5149
"""
5250

51+
FPS_TOLERANCE_DIVISOR = 2.0
52+
INPUT_CHECKS_PER_FPS = 100
53+
5354
def __init__(self) -> None:
5455
"""Initializes the GatherData node."""
5556
super().__init__()
@@ -79,32 +80,19 @@ def build(
7980
) -> "GatherData[TReference, TGathered]":
8081
"""Builds and configures the GatherData node with the specified parameters.
8182
82-
Parameters
83-
----------
84-
camera_fps : int
85-
The frames per second (FPS) setting for the camera. This affects the rate
86-
at which data is gathered.
87-
88-
wait_count_fn : Optional[Callable[[TReference], int]], default=None
89-
A function that takes a reference and returns the number of frames to wait
90-
before gathering data. This allows customizing the waiting behavior based on the reference data.
91-
If None, the default wait count function will be used. The default function matches based on length of TReference.detections array.
92-
93-
Returns
94-
-------
95-
GatherData[TReference, TGathered]
96-
The configured GatherData node instance.
97-
98-
Examples
99-
--------
100-
>>> gather_node = GatherData()
101-
>>> # Build with default wait count function
102-
>>> gather_node.build(camera_fps=30)
103-
>>>
104-
>>> # Build with custom wait count function that always waits for 2 messages
105-
>>> def custom_wait(ref):
106-
>>> return 2
107-
>>> gather_node.build(camera_fps=60, wait_count_fn=custom_wait)
83+
@param camera_fps: The frames per second (FPS) setting for the camera.
84+
@param wait_count_fn: A function that takes a reference and returns how many frames to wait.
85+
@type camera_fps: int
86+
@type wait_count_fn: Optional[Callable[[TReference], int]]
87+
88+
@return: The configured GatherData node instance.
89+
@rtype: GatherData[TReference, TGathered]
90+
91+
@example:
92+
>>> gather_node = GatherData()
93+
>>> gather_node.build(camera_fps=30)
94+
>>> def custom_wait(ref): return 2
95+
>>> gather_node.build(camera_fps=60, wait_count_fn=custom_wait)
10896
"""
10997
self.set_camera_fps(camera_fps)
11098
if wait_count_fn is None:

0 commit comments

Comments
 (0)