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 1, 2024
1 parent 1b987e1 commit f64e055
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
2 changes: 1 addition & 1 deletion changelogs/fragments/1336-update-docstring-validation.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
trivial:
- validation - Updated docstrings to google style for visual aid to developers.
- validation - Updated docstrings to numpy style for visual aid to developers.
(https://github.com/ansible-collections/ibm_zos_core/pull/1336).
32 changes: 21 additions & 11 deletions plugins/module_utils/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,20 @@ def validate_safe_path(path):
In this action plugin, path is on the controller.
Arguments:
path {str} -- A file's path.
Parameters
----------
path : str
A file's path.
Returns:
str -- The introduced path
Returns
-------
str
The introduced path
Raises:
DirectoryTraversalError: User does not have access to a directory.
Raises
------
DirectoryTraversalError
User does not have access to a directory.
"""
if not os.path.isabs(path):
real_path = os.path.realpath(path)
Expand All @@ -49,11 +55,15 @@ def validate_safe_path(path):
class DirectoryTraversalError(Exception):
"""User does not have access to a directory.
Arguments:
path {str} -- Directory path.
Attributes:
msg {str} -- Human readable string describing the exception.
Parameters
----------
path : str
Directory path.
Attributes
----------
msg : str
Human readable string describing the exception.
"""
def __init__(self, path):
self.msg = "Detected directory traversal, user does not have access to {0}".format(path)
Expand Down

0 comments on commit f64e055

Please sign in to comment.