Skip to content

Commit

Permalink
Modify google style to numpy
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaacVRey committed Apr 2, 2024
1 parent ac883f8 commit 123703f
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 45 deletions.
2 changes: 1 addition & 1 deletion changelogs/fragments/1348-update-docstring-zos_encode.yml
Original file line number Diff line number Diff line change
@@ -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).
118 changes: 74 additions & 44 deletions plugins/modules/zos_encode.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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] + "/*"
Expand All @@ -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),
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 123703f

Please sign in to comment.