Skip to content

Commit 5ea4415

Browse files
committed
don't drop default argparser args by default, improve comments
Signed-off-by: Zen <[email protected]>
1 parent 67188c1 commit 5ea4415

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "zenlib"
7-
version = "1.7.3"
7+
version = "1.7.4"
88
authors = [
99
{ name="Desultory", email="[email protected]" },
1010
]

src/zenlib/util/check_dict.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ def check_dict(key, validate_dict=None, value=None, value_arg=None,
1212
log_level=10, message=None):
1313
"""
1414
Adds a check for a dict key to a function.
15-
If the dict is nto passed, uses the first argument of the function (often self).
15+
If the dict is not passed, uses the first argument of the function (often self).
1616
If a value is specified, checks that the value of the key matches the value.
17+
If unset is True, checks that the key is not in the dict.
18+
If not_empty is True, checks that the key is not empty.
1719
"""
1820
def decorator(func):
1921
@wraps(func)

src/zenlib/util/main_funcs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def process_args(argparser, logger=None):
8787
return args
8888

8989

90-
def get_args_n_logger(package, description: str, arguments=[], drop_default=True):
90+
def get_args_n_logger(package, description: str, arguments=[], drop_default=False):
9191
""" Takes a package name and description
9292
If arguments are passed, they are added to argparser.
9393
Returns the parsed args and logger.
@@ -110,7 +110,7 @@ def get_args_n_logger(package, description: str, arguments=[], drop_default=True
110110
return args, logger
111111

112112

113-
def get_kwargs(package, description: str, arguments=[], base_kwargs={}, drop_default=True, drop_base=True):
113+
def get_kwargs(package, description: str, arguments=[], base_kwargs={}, drop_default=False, drop_base=True):
114114
""" Like get_args_n_logger, but only returns kwargs """
115115
args, logger = get_args_n_logger(package, description, arguments, drop_default=drop_default)
116116
return get_kwargs_from_args(args, logger=logger, base_kwargs=base_kwargs, drop_base=drop_base)

0 commit comments

Comments
 (0)