Skip to content

Commit 98933dd

Browse files
authored
Merge pull request #66 from MoseleyBioinformaticsLab/granular
Improves documentation of sub_tracker.py
2 parents a32a68c + 7309456 commit 98933dd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/gpu_tracker/sub_tracker.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ class SubTracker:
1919
def __init__(
2020
self, code_block_name: str | None = None, code_block_attribute: str | None = None, sub_tracking_file: str | None = None):
2121
"""
22-
:param code_block_name: The name of the code block within a ``Tracker`` context that is being sub-tracked. Defaults to the file path followed by a colon followed by the ``code_block_attribute``.
23-
:param code_block_attribute: Only used if ``code_block_name`` is ``None``. Defaults to the line number where the SubTracker context is started.
22+
:param code_block_name: The name of the code block within a ``Tracker`` context that is being sub-tracked. Defaults to the file path where the ``SubTracker`` context is started followed by a colon followed by the ``code_block_attribute``.
23+
:param code_block_attribute: Only used if ``code_block_name`` is ``None``. Defaults to the line number where the ``SubTracker`` context is started.
2424
:param sub_tracking_file: The path to the file to log the time stamps of the code block being sub-tracked. To avoid file lock errors when a sub-tracking file is created in multiple different processes (i.e. multiple processes attempting to access the same file at the same time), the sub-tracking file of each process must have a unique name. For example, the ID of the process where the SubTracker context is created. Defaults to this process ID as the file name and in CSV format.
2525
"""
2626
if code_block_name is not None:
@@ -52,11 +52,11 @@ def __exit__(self, *_):
5252

5353
def sub_track(code_block_name: str | None = None, code_block_attribute: str | None = None, sub_tracking_file: str | None = None):
5454
"""
55-
Decorator for sub tracking calls to a specified function.
55+
Decorator for sub tracking calls to a specified function. Creates a ``SubTracker`` context that wraps the function call.
5656
57-
:param code_block_name: The name of the code block within a ``Tracker`` context that is being sub-tracked. Defaults to the file path followed by a colon followed by the ``code_block_attribute``.
58-
:param code_block_attribute: Only used if ``code_block_name`` is ``None``. Defaults to the name of the decorated function i.e. the function being sub-tracked.
59-
:param sub_tracking_file: The path to the file to log the time stamps of the code block being sub-tracked. Defaults to the ID of the process where the SubTracker context is created and in CSV format.
57+
:param code_block_name: The ``code_block_name`` argument passed to the ``SubTracker``. Defaults to the file path where the decorated function is defined followed by a colon followed by the ``code_block_attribute``.
58+
:param code_block_attribute: The ``code_block_attribute`` argument passed to the ``SubTracker``. Defaults to the name of the decorated function.
59+
:param sub_tracking_file: the ``sub_tracking_file`` argument passed to the ``SubTracker``. Same default as the ``SubTracker`` constructor.
6060
"""
6161
def decorator(func):
6262
nonlocal code_block_name, code_block_attribute, sub_tracking_file

0 commit comments

Comments
 (0)