From 123703fa32a2d4fa68c429bf8d8813a625082732 Mon Sep 17 00:00:00 2001 From: IsaacVRey Date: Tue, 2 Apr 2024 13:13:39 -0600 Subject: [PATCH] Modify google style to numpy --- .../1348-update-docstring-zos_encode.yml | 2 +- plugins/modules/zos_encode.py | 118 +++++++++++------- 2 files changed, 75 insertions(+), 45 deletions(-) diff --git a/changelogs/fragments/1348-update-docstring-zos_encode.yml b/changelogs/fragments/1348-update-docstring-zos_encode.yml index 35550ff4f..de9c11c17 100644 --- a/changelogs/fragments/1348-update-docstring-zos_encode.yml +++ b/changelogs/fragments/1348-update-docstring-zos_encode.yml @@ -1,3 +1,3 @@ trivial: - - zos_encode - Updated docstrings to google style for visual aid to developers. + - zos_encode - Updated docstrings to numpy style for visual aid to developers. (https://github.com/ansible-collections/ibm_zos_core/pull/1348). \ No newline at end of file diff --git a/plugins/modules/zos_encode.py b/plugins/modules/zos_encode.py index 0be0678df..598f8fa82 100644 --- a/plugins/modules/zos_encode.py +++ b/plugins/modules/zos_encode.py @@ -295,17 +295,24 @@ def check_pds_member(ds, mem): - """Check pds member - - Arguments: - ds {str} -- Data set name - mem {str} -- Data set member name - - Returns: - bool --If it is a member of the data set - - Raises: - EncodeError: Can not find member in provided dataset + """Check pds member. + + Parameters + ---------- + ds : str + Data set name. + mem : str + Data set member name. + + Returns + ------- + bool + If it is a member of the data set. + + Raises + ------ + EncodeError + Can not find member in provided dataset. """ check_rc = False if mem in datasets.list_members(ds): @@ -316,17 +323,24 @@ def check_pds_member(ds, mem): def check_mvs_dataset(ds): - """To call data_set utils to check if the MVS data set exists or not - - Arguments: - ds {str} -- Data set name - - Returns: - list[bool,str] -- If the data set exists and it's type - - Raises: - EncodeError: If data set is not cataloged - EncodeError: Unable to determine data set type + """To call data_set utils to check if the MVS data set exists or not. + + Parameters + ---------- + ds : str + Data set name. + + Returns + ------- + list[bool,str] + If the data set exists and it's type. + + Raises + ------ + EncodeError + If data set is not cataloged. + EncodeError + Unable to determine data set type. """ check_rc = False ds_type = None @@ -344,16 +358,22 @@ def check_mvs_dataset(ds): def check_file(file): - """Check file is a USS file or an MVS data set - - Arguments: - file {str} -- File to check - - Returns: - list[bool,bool,str] -- If is USS file, MVS dataset, and the dataset type - - Raises: - EncodeError: The data set is not partitioned + """Check file is a USS file or an MVS data set. + + Parameters + ---------- + file : str + File to check. + + Returns + ------- + list[bool,bool,str] + If is USS file, MVS dataset, and the dataset type. + + Raises + ------ + EncodeError + The data set is not partitioned. """ is_uss = False is_mvs = False @@ -380,13 +400,17 @@ def check_file(file): def verify_uss_path_exists(file): - """Verify if USS path exists + """Verify if USS path exists. - Arguments: - file {str} -- Path of the file + Parameters + ---------- + file : str + Path of the file. - Raises: - EncodeError: File does not exist in the directory + Raises + ------ + EncodeError + File does not exist in the directory. """ if not path.exists(file): mypath = "/" + file.split("/")[0] + "/*" @@ -400,10 +424,12 @@ def verify_uss_path_exists(file): def run_module(): - """Runs the module + """Runs the module. - Raises: - fail_json: Exception during execution + Raises + ------ + fail_json + Exception during execution. """ module_args = dict( src=dict(type="str", required=True), @@ -576,13 +602,17 @@ def run_module(): class EncodeError(Exception): def __init__(self, message): - """Error during encoding + """Error during encoding. - Arguments: - message {str} -- Human readable string describing the exception + Parameters + ---------- + message : str + Human readable string describing the exception. Attributes - message {str} -- Human readable string describing the exception + ---------- + msg : str + Human readable string describing the exception. """ self.msg = 'An error occurred during encoding: "{0}"'.format(message) super(EncodeError, self).__init__(self.msg)