From 2f4b9271f54fc780a26ff9295f317810ec670722 Mon Sep 17 00:00:00 2001 From: Ben Shaw Date: Fri, 23 Aug 2019 09:29:22 +1200 Subject: [PATCH] feat(Py): Added Python args/kwargs parsing --- py/stencila/schema/interpreter.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/py/stencila/schema/interpreter.py b/py/stencila/schema/interpreter.py index 9e79879f..8f833da7 100644 --- a/py/stencila/schema/interpreter.py +++ b/py/stencila/schema/interpreter.py @@ -353,6 +353,12 @@ def parse_function_def(self, statement: ast.FunctionDef) -> None: f.parameters.append(p) + if statement.args.vararg: + f.parameters.append(Parameter(statement.args.vararg.arg, required=False, repeats=True)) + + if statement.args.kwarg: + f.parameters.append(Parameter(statement.args.kwarg.arg, required=False, extends=True)) + self.seen_vars.append(f.name) self.declares.append(f)