Skip to content

Commit 3fa4697

Browse files
[Documentation][file] Standarize docstrings on module-utils/file.py (#1362)
* Standarize docstrings on modules/file.py to numpy style * Add changelog fragment * Standarize numpy style * Fixed year --------- Co-authored-by: Fernando Flores <[email protected]>
1 parent 7dd44a6 commit 3fa4697

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
trivial:
2+
- file - Updated docstrings to numpy style for visual aid to developers.
3+
(https://github.com/ansible-collections/ibm_zos_core/pull/1362).

plugins/module_utils/file.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) IBM Corporation 2020
1+
# Copyright (c) IBM Corporation 2020, 2024
22
# Licensed under the Apache License, Version 2.0 (the "License");
33
# you may not use this file except in compliance with the License.
44
# You may obtain a copy of the License at
@@ -22,11 +22,15 @@ def _get_dir_mode(path):
2222
"""Get the mode of an existing directory.
2323
Defaults to 0600 if directory not found.
2424
25-
Arguments:
26-
path {str} -- The absolute path to retrieve directory mode from.
25+
Parameters
26+
----------
27+
path : str
28+
The absolute path to retrieve directory mode from.
2729
28-
Returns:
29-
int -- The mode of the directory.
30+
Returns
31+
-------
32+
int
33+
The mode of the directory.
3034
"""
3135
mask = S_IREAD | S_IWRITE
3236
if os.path.isdir(path):
@@ -41,11 +45,15 @@ def make_dirs(path, mode_from=None):
4145
If path does not end in "/", assumes end of path is
4246
a file.
4347
44-
Arguments:
45-
path {str} -- The path to ensure subdirectories are created for.
48+
Parameters
49+
----------
50+
path : str
51+
The path to ensure subdirectories are created for.
4652
47-
Keyword Arguments:
48-
mode_from {str} -- Path to existing dir to retrieve the mode from.
53+
Keyword Parameters
54+
------------------
55+
mode_from : str
56+
Path to existing dir to retrieve the mode from.
4957
Mode will be used for new directories. (default: {None})
5058
"""
5159
mode = _get_dir_mode(mode_from) if mode_from is not None else S_IREAD | S_IWRITE

0 commit comments

Comments
 (0)