From 1f774403be6d9cc196fcf252d10f824d4951bcb1 Mon Sep 17 00:00:00 2001 From: Brinton Eldridge <90061933+kombatEldridge@users.noreply.github.com> Date: Thu, 5 Sep 2024 14:05:56 -0500 Subject: [PATCH] Changes to _eval_step_func (#2895) * changes to _eval_step_func * Update simulation.py * double to single quotes * incorrect if statement * reverted _eval_step_func, rm get_name_args, edited get_num_args * Update python/simulation.py * Update python/simulation.py * Update python/simulation.py * if statement readability update * added space from pre-check --------- Co-authored-by: Steven G. Johnson --- python/simulation.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/python/simulation.py b/python/simulation.py index 60538271d..3bf01a092 100644 --- a/python/simulation.py +++ b/python/simulation.py @@ -3,6 +3,7 @@ """ import functools +import inspect import math import numbers import os @@ -93,11 +94,12 @@ def fix_dft_args(args, i): def get_num_args(func): - return ( - 2 - if isinstance(func, Harminv) or isinstance(func, PadeDFT) - else func.__code__.co_argcount - ) + if isinstance(func, Harminv) or isinstance(func, PadeDFT): + return 2 + elif inspect.ismethod(func): + return func.__code__.co_argcount - 1 # remove 'self' from count + else: + return func.__code__.co_argcount def vec(*args):