diff --git a/refex/python/matcher.py b/refex/python/matcher.py index c8c90b1..e63e99f 100644 --- a/refex/python/matcher.py +++ b/refex/python/matcher.py @@ -182,9 +182,7 @@ def _coerce_list(values): _IS_SUBMATCHER_LIST_ATTRIB = __name__ + '._IS_SUBMATCHER_LIST_ATTRIB' -def submatcher_attrib( - *args, - **kwargs: Any): # TODO: make walk a kwarg when Py2 support is dropped. +def submatcher_attrib(*args, walk: bool = True, **kwargs: Any): """Creates an attr.ib that is marked as a submatcher. This will cause the matcher to be automatically walked as part of the @@ -199,15 +197,13 @@ def submatcher_attrib( Returns: An attr.ib() """ - if kwargs.pop('walk', True): + if walk: kwargs.setdefault('metadata', {})[_IS_SUBMATCHER_ATTRIB] = True kwargs.setdefault('converter', coerce) return attr.ib(*args, **kwargs) -def submatcher_list_attrib( - *args, - **kwargs: Any): # TODO: make walk a kwarg when Py2 support is dropped. +def submatcher_list_attrib(*args, walk: bool = True, **kwargs: Any): """Creates an attr.ib that is marked as an iterable of submatchers. This will cause the matcher to be automatically walked as part of the @@ -222,7 +218,7 @@ def submatcher_list_attrib( Returns: An attr.ib() """ - if kwargs.pop('walk', True): + if walk: kwargs.setdefault('metadata', {})[_IS_SUBMATCHER_LIST_ATTRIB] = True kwargs.setdefault('converter', _coerce_list) return attr.ib(*args, **kwargs)