@@ -88,10 +88,11 @@ def get_arg_ctx(
8888 for (idx , (n , p_ )) in enumerate (arg_sig .parameters .items ()):
8989 p : inspect .Parameter = p_
9090 # _logger.debug(f"get_arg_ctx: {f}: idx={idx} n={n} p={p}")
91- if p .kind != Parameter .POSITIONAL_OR_KEYWORD :
91+ if p .kind not in ( Parameter .POSITIONAL_OR_KEYWORD , Parameter . VAR_KEYWORD ) :
9292 raise NotImplementedError (
9393 f"Argument type not understood: { p .kind } { f } { arg_sig } "
9494 )
95+ h : Optional [PyHash ]
9596 if idx < num_args :
9697 # It is a list argument
9798 # TODO: should it discard arguments of not-whitelisted types?
@@ -110,6 +111,9 @@ def get_arg_ctx(
110111 # TODO: should it discard arguments of not-whitelisted types?
111112 # TODO: raise a warning for non-whitelisted objects
112113 h = dds_hash (p .default or "__none__" )
114+ elif p .kind == Parameter .VAR_KEYWORD :
115+ # kwargs: for now, just ignored
116+ h = None
113117 else :
114118 raise NotImplementedError (
115119 f"Cannot deal with argument name { n } { p .kind } { f } { arg_sig } "
@@ -145,7 +149,11 @@ def process_arg(node: ast.AST) -> Optional[PyHash]:
145149 p : inspect .Parameter = p_
146150 # _logger.debug(f"get_arg_ctx: {f}: idx={idx} n={n} p={p}")
147151 h : Optional [PyHash ]
148- if p .kind != Parameter .POSITIONAL_OR_KEYWORD :
152+ if p .kind not in (
153+ Parameter .POSITIONAL_OR_KEYWORD ,
154+ Parameter .VAR_KEYWORD ,
155+ Parameter .VAR_POSITIONAL ,
156+ ):
149157 raise NotImplementedError (
150158 f"Argument type not understood { p .kind } { f } { arg_sig } "
151159 )
0 commit comments