Skip to content

Inconsistent docstring format across codebase #499

@yousefmoazzam

Description

@yousefmoazzam

Some docstrings use the google convention:

httomo/httomo/methods.py

Lines 20 to 30 in 8a55c4d

def calculate_stats(
data: np.ndarray,
) -> Tuple[float, float, float, int]:
"""Calculating the statistics of the given array
Args:
data: (np.ndarray): a numpy array
Returns:
tuple[(float, float, float, int)]: (min, max, sum, total_elements)
"""

whereas other docstrings use the numpy convention:

def make_method_wrapper(
method_repository: MethodRepository,
module_path: str,
method_name: str,
comm: Comm,
save_result: Optional[bool] = None,
output_mapping: Dict[str, str] = {},
**kwargs,
) -> MethodWrapper:
"""Factory function to generate the appropriate wrapper based on the module
path and method name. Clients do not need to be concerned about which particular
derived class is returned.
Parameters
----------
method_repository: MethodRepository
Repository of methods that we can use the query properties
module_path: str
Path to the module where the method is in python notation, e.g. "httomolibgpu.prep.normalize"
method_name: str
Name of the method (function within the given module)
comm: Comm
MPI communicator object
save_result: Optional[bool]
Should the method's result be saved to an intermediate h5 file? If not given (or None),
it queries the method database for the default value.
output_mapping: Dict[str, str]
A dictionary mapping output names to translated ones. The side outputs will be renamed
as specified, if the parameter is given. If not, no side outputs will be passed on.
kwargs:
Arbitrary keyword arguments that get passed to the method as parameters.
Returns
-------
MethodWrapper
An instance of a wrapper class
"""

Picking one convention and sticking with it feels better than having docstrings of various appearances in the source code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions