Skip to content

Commit

Permalink
Corrected docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoran Simic committed May 2, 2022
1 parent 54091c0 commit 65c2a63
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 24 deletions.
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build-system]
requires = ["setuptools", "wheel"]
22 changes: 11 additions & 11 deletions src/runez/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def copy(source, destination, ignore=None, overwrite=True, fatal=True, logger=UN
overwrite (bool | None): True: replace existing, False: fail if destination exists, None: no destination check
fatal (type | bool | None): True: abort execution on failure, False: don't abort but log, None: don't abort, don't log
logger (callable | bool | None): Logger to use, True to print(), False to trace(), None to disable log chatter
dryrun (bool): Optionally override current dryrun setting
dryrun (bool | UNSET | None): Optionally override current dryrun setting
Returns:
(int): In non-fatal mode, 1: successfully done, 0: was no-op, -1: failed
Expand All @@ -82,7 +82,7 @@ def delete(path, fatal=True, logger=UNSET, dryrun=UNSET):
path (str | Path | None): Path to file or folder to delete
fatal (type | bool | None): True: abort execution on failure, False: don't abort but log, None: don't abort, don't log
logger (callable | bool | None): Logger to use, True to print(), False to trace(), None to disable log chatter
dryrun (bool): Optionally override current dryrun setting
dryrun (bool | UNSET | None): Optionally override current dryrun setting
Returns:
(int): In non-fatal mode, 1: successfully done, 0: was no-op, -1: failed
Expand Down Expand Up @@ -112,7 +112,7 @@ def ensure_folder(path, clean=False, fatal=True, logger=UNSET, dryrun=UNSET):
clean (bool): True: If True, ensure folder is clean (delete any file/folder it may have)
fatal (type | bool | None): True: abort execution on failure, False: don't abort but log, None: don't abort, don't log
logger (callable | bool | None): Logger to use, True to print(), False to trace(), None to disable log chatter
dryrun (bool): Optionally override current dryrun setting
dryrun (bool | UNSET | None): Optionally override current dryrun setting
Returns:
(int): In non-fatal mode, >=1: successfully done, 0: was no-op, -1: failed
Expand Down Expand Up @@ -326,7 +326,7 @@ def move(source, destination, overwrite=True, fatal=True, logger=UNSET, dryrun=U
overwrite (bool | None): True: replace existing, False: fail if destination exists, None: no destination check
fatal (type | bool | None): True: abort execution on failure, False: don't abort but log, None: don't abort, don't log
logger (callable | bool | None): Logger to use, True to print(), False to trace(), None to disable log chatter
dryrun (bool): Optionally override current dryrun setting
dryrun (bool | UNSET | None): Optionally override current dryrun setting
Returns:
(int): In non-fatal mode, 1: successfully done, 0: was no-op, -1: failed
Expand All @@ -344,7 +344,7 @@ def symlink(source, destination, must_exist=True, overwrite=True, fatal=True, lo
overwrite (bool | None): True: replace existing, False: fail if destination exists, None: no destination check
fatal (type | bool | None): True: abort execution on failure, False: don't abort but log, None: don't abort, don't log
logger (callable | bool | None): Logger to use, True to print(), False to trace(), None to disable log chatter
dryrun (bool): Optionally override current dryrun setting
dryrun (bool | UNSET | None): Optionally override current dryrun setting
Returns:
(int): In non-fatal mode, 1: successfully done, 0: was no-op, -1: failed
Expand All @@ -362,7 +362,7 @@ def compress(source, destination, arcname=UNSET, ext=None, overwrite=True, fatal
overwrite (bool | None): True: replace existing, False: fail if destination exists, None: no destination check
fatal (type | bool | None): True: abort execution on failure, False: don't abort but log, None: don't abort, don't log
logger (callable | bool | None): Logger to use, True to print(), False to trace(), None to disable log chatter
dryrun (bool): Optionally override current dryrun setting
dryrun (bool | UNSET | None): Optionally override current dryrun setting
Returns:
(int): In non-fatal mode, 1: successfully done, 0: was no-op, -1: failed
Expand Down Expand Up @@ -400,7 +400,7 @@ def decompress(source, destination, ext=None, overwrite=True, simplify=False, fa
simplify (bool): If True and source has only one sub-folder, extract that one sub-folder to destination
fatal (type | bool | None): True: abort execution on failure, False: don't abort but log, None: don't abort, don't log
logger (callable | bool | None): Logger to use, True to print(), False to trace(), None to disable log chatter
dryrun (bool): Optionally override current dryrun setting
dryrun (bool | UNSET | None): Optionally override current dryrun setting
Returns:
(int): In non-fatal mode, 1: successfully done, 0: was no-op, -1: failed
Expand All @@ -424,7 +424,7 @@ def __init__(self, anchor=True, dryrun=UNSET, follow=True):
"""
Args:
anchor (bool): If True, short-ify paths relative to used temp folder
dryrun (bool): Optionally override current dryrun setting
dryrun (bool | UNSET | None): Optionally override current dryrun setting
follow (bool): If True, change working dir to temp folder (and restore)
"""
self.anchor = anchor
Expand Down Expand Up @@ -467,7 +467,7 @@ def touch(path, fatal=True, logger=UNSET, dryrun=UNSET):
path (str | Path | None): Path to file to touch
fatal (type | bool | None): True: abort execution on failure, False: don't abort but log, None: don't abort, don't log
logger (callable | bool | None): Logger to use, True to print(), False to trace(), None to disable log chatter
dryrun (bool): Optionally override current dryrun setting
dryrun (bool | UNSET | None): Optionally override current dryrun setting
Returns:
(int): In non-fatal mode, 1: successfully done, 0: was no-op, -1: failed
Expand All @@ -483,7 +483,7 @@ def write(path, contents, fatal=True, logger=UNSET, dryrun=UNSET):
contents (str | bytes | None): Contents to write (only touch file if None)
fatal (type | bool | None): True: abort execution on failure, False: don't abort but log, None: don't abort, don't log
logger (callable | bool | None): Logger to use, True to print(), False to trace(), None to disable log chatter
dryrun (bool): Optionally override current dryrun setting
dryrun (bool | UNSET | None): Optionally override current dryrun setting
Returns:
(int): In non-fatal mode, 1: successfully done, 0: was no-op, -1: failed
Expand Down Expand Up @@ -639,7 +639,7 @@ def _file_op(source, destination, func, overwrite, fatal, logger, dryrun, must_e
overwrite (bool | None): True: replace existing, False: fail if destination exists, None: no destination check
fatal (type | bool | None): True: abort execution on failure, False: don't abort but log, None: don't abort, don't log
logger (callable | bool | None): Logger to use, True to print(), False to trace(), None to disable log chatter
dryrun (bool): Optionally override current dryrun setting
dryrun (bool | UNSET | None): Optionally override current dryrun setting
must_exist (bool): If True, verify that source does indeed exist
ignore (callable | list | str | None): Names to be ignored
**extra: Passed-through to 'func'
Expand Down
16 changes: 8 additions & 8 deletions src/runez/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def close(self):
def wrapped(cls, dryrun, data, json, files, filepaths):
"""
Args:
dryrun (bool): Optionally override current dryrun setting
dryrun (bool | UNSET | None): Optionally override current dryrun setting
data (dict | tuple | bytes | file | None): Data to send in the body
json: (optional) json to send in the body
files (dict | None): File-like-objects for multipart encoding upload.
Expand Down Expand Up @@ -659,7 +659,7 @@ def decompress(self, url, destination, simplify=False, fatal=True, logger=UNSET,
simplify (bool): If True and source has only one sub-folder, extract that one sub-folder to destination
fatal (type | bool | None): True: abort execution on failure, False: don't abort but log, None: don't abort, don't log
logger (callable | bool | None): Logger to use, True to print(), False to trace(), None to disable log chatter
dryrun (bool): Optionally override current dryrun setting
dryrun (bool | UNSET | None): Optionally override current dryrun setting
**kwargs: Passed through to underlying client
Returns:
Expand All @@ -683,7 +683,7 @@ def download(self, url, destination, fatal=True, logger=UNSET, dryrun=UNSET, **k
destination (str | Path): Path to local file where to store the download
fatal (type | bool | None): True: abort execution on failure, False: don't abort but log, None: don't abort, don't log
logger (callable | bool | None): Logger to use, True to print(), False to trace(), None to disable log chatter
dryrun (bool): Optionally override current dryrun setting
dryrun (bool | UNSET | None): Optionally override current dryrun setting
**kwargs: Passed through to underlying client
Returns:
Expand Down Expand Up @@ -726,7 +726,7 @@ def delete(self, url, fatal=True, logger=UNSET, dryrun=UNSET, **kwargs):
url (str): URL to query (can be absolute, or relative to self.base_url)
fatal (type | bool | None): True: abort execution on failure, False: don't abort but log, None: don't abort, don't log
logger (callable | bool | None): Logger to use, True to print(), False to trace(), None to disable log chatter
dryrun (bool): Optionally override current dryrun setting
dryrun (bool | UNSET | None): Optionally override current dryrun setting
**kwargs: Passed through to underlying client
Returns:
Expand Down Expand Up @@ -769,7 +769,7 @@ def post(self, url, fatal=True, logger=UNSET, dryrun=UNSET, data=None, json=None
url (str): URL to query (can be absolute, or relative to self.base_url)
fatal (type | bool | None): True: abort execution on failure, False: don't abort but log, None: don't abort, don't log
logger (callable | bool | None): Logger to use, True to print(), False to trace(), None to disable log chatter
dryrun (bool): Optionally override current dryrun setting
dryrun (bool | UNSET | None): Optionally override current dryrun setting
data (dict | tuple | bytes | file | None): Data to send in the body
json: (optional) json to send in the body
files (dict | None): File-like-objects for multipart encoding upload.
Expand All @@ -789,7 +789,7 @@ def purge(self, url, fatal=True, logger=UNSET, dryrun=UNSET, **kwargs):
url (str): URL to query (can be absolute, or relative to self.base_url)
fatal (type | bool | None): True: abort execution on failure, False: don't abort but log, None: don't abort, don't log
logger (callable | bool | None): Logger to use, True to print(), False to trace(), None to disable log chatter
dryrun (bool): Optionally override current dryrun setting
dryrun (bool | UNSET | None): Optionally override current dryrun setting
**kwargs: Passed through to underlying client
Returns:
Expand All @@ -803,7 +803,7 @@ def put(self, url, fatal=True, logger=UNSET, dryrun=UNSET, data=None, json=None,
url (str): URL to query (can be absolute, or relative to self.base_url)
fatal (type | bool | None): True: abort execution on failure, False: don't abort but log, None: don't abort, don't log
logger (callable | bool | None): Logger to use, True to print(), False to trace(), None to disable log chatter
dryrun (bool): Optionally override current dryrun setting
dryrun (bool | UNSET | None): Optionally override current dryrun setting
data (dict | tuple | bytes | file | None): Data to send in the body
json: (optional) json to send in the body
files (dict | None): File-like-objects for multipart encoding upload.
Expand Down Expand Up @@ -884,7 +884,7 @@ def _get_response(self, method, url, fatal, logger, dryrun=False, state=None, ac
url (str): Remote URL (may be absolute, or relative to self.base_url)
fatal (type | bool | None): True: abort execution on failure, False: don't abort but log, None: don't abort, don't log
logger (callable | bool | None): Logger to use, True to print(), False to trace(), None to disable log chatter
dryrun (bool): Optionally override current dryrun setting
dryrun (bool | UNSET | None): Optionally override current dryrun setting
state (DataState | None): For PUT/POST requests
action (str | None): Action to refer to in dryrun message (default: method)
**kwargs: Passed through to underlying client
Expand Down
2 changes: 1 addition & 1 deletion src/runez/logsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,7 @@ def hdry(cls, message, dryrun=UNSET, logger=UNSET):
Args:
message (str | callable | None): Message to log
dryrun (bool): Optionally override current dryrun setting
dryrun (bool | UNSET | None): Optionally override current dryrun setting
logger (callable | bool | None): Logger to use, True to print(), False to trace(), None to disable log chatter
Returns:
Expand Down
4 changes: 2 additions & 2 deletions src/runez/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def make_executable(path, fatal=True, logger=UNSET, dryrun=UNSET):
path (str): chmod file with 'path' as executable
fatal (type | bool | None): True: abort execution on failure, False: don't abort but log, None: don't abort, don't log
logger (callable | bool | None): Logger to use, True to print(), False to trace(), None to disable log chatter
dryrun (bool): Optionally override current dryrun setting
dryrun (bool | UNSET | None): Optionally override current dryrun setting
Returns:
(int): In non-fatal mode, 1: successfully done, 0: was no-op, -1: failed
Expand Down Expand Up @@ -279,7 +279,7 @@ def run(
background (bool): When True, background the spawned process (detach from console and current process)
fatal (type | bool | None): True: abort execution on failure, False: don't abort but log, None: don't abort, don't log
logger (callable | bool | None): Logger to use, True to print(), False to trace(), None to disable log chatter
dryrun (bool): Optionally override current dryrun setting
dryrun (bool | UNSET | None): Optionally override current dryrun setting
short_exe (str | bool | None): Try to log a compact representation of executable
passthrough (bool | file | None): If True-ish, pass-through stderr/stdout in addition to capturing it
as well as 'passthrough' itself if it has a write() function
Expand Down
2 changes: 1 addition & 1 deletion src/runez/serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ def save_json(data, path, stringify=stringified, dt=str, none=False, indent=2, s
sort_keys (bool): Whether keys should be sorted
fatal (type | bool | None): True: abort execution on failure, False: don't abort but log, None: don't abort, don't log
logger (callable | bool | None): Logger to use, True to print(), False to trace(), None to disable log chatter
dryrun (bool): Optionally override current dryrun setting
dryrun (bool | UNSET | None): Optionally override current dryrun setting
Returns:
(int): In non-fatal mode, 1: successfully done, 0: was no-op, -1: failed
Expand Down
2 changes: 1 addition & 1 deletion tests/extra-validations
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ API_EXCEPTIONS = {
IO_API_DOCSTRINGS = dict(
fatal="fatal (type | bool | None): True: abort execution on failure, False: don't abort but log, None: don't abort, don't log",
logger="logger (callable | bool | None): Logger to use, True to print(), False to trace(), None to disable log chatter",
dryrun="dryrun (bool): Optionally override current dryrun setting",
dryrun="dryrun (bool | UNSET | None): Optionally override current dryrun setting",
)
IO_API_CATEGORIZED = collections.defaultdict(list)

Expand Down

0 comments on commit 65c2a63

Please sign in to comment.