nasa/Kamodo

Getting empty argument list from kamodo

Closed this issue · 0 comments

I am getting an empty argument list from the get_function_args function in kamodo.py (line 271). Changing the current return line to the following solved the issue:

return symbols([a for a in signature(func).parameters if a not in hidden_args])

This only occurred for wrapped functions, such as those produced by the kamodo plasmapy wrapper (https://github.com/rebeccaringuette/KamodofyPlasmaPy.git), specifically those with dimensionless argument units, dimensionless return units, and wrapped by the _Astropy wrapper. The problem did not occur for functions wrapped by the _Astropy wrapper when at least one of the argument or return units were not dimensionless.
Additionally, this change removes kamodo's dependency on the inspect.getfullargspec() function, which is being replaced by the inspect.signature function.

Example code to produce the error:

import KamodofyPlasmaPy as KPP
kamodo_list = KPP.ListPlasmaPy('plasmapy.formulary.mathematics.Fermi_integral')

You may need to change the import statement in KPP that imports Kamodo and kamodofy to reflect your kamodo installation. I don't expect this will change any behavior, as the output object is a list with the same behavior.