Skip to content

Commit 7aab3fe

Browse files
committed
MNT: use non-clashing name for local variable
Make it different from any prior or current special attribute name.
1 parent 0bfa087 commit 7aab3fe

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

src/diffpy/srfit/fitbase/recipeorganizer.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -454,9 +454,9 @@ def registerCalculator(self, f, argnames = None):
454454
self._addObject(f, self._calculators)
455455
# Register arguments of the calculator
456456
if argnames is None:
457-
func_code = f.__call__.__func__.__code__
458-
argnames = list(func_code.co_varnames)
459-
argnames = argnames[1:func_code.co_argcount]
457+
fncode = f.__call__.__func__.__code__
458+
argnames = list(fncode.co_varnames)
459+
argnames = argnames[1:fncode.co_argcount]
460460

461461
for pname in argnames:
462462
if pname not in self._eqfactory.builders:
@@ -513,37 +513,37 @@ def registerFunction(self, f, name = None, argnames = None):
513513

514514
import inspect
515515

516-
func_code = None
516+
fncode = None
517517

518518
# This will let us offset the argument list to eliminate 'self'
519519
offset = 0
520520

521521
# check regular functions
522522
if inspect.isfunction(f):
523-
func_code = f.__code__
523+
fncode = f.__code__
524524
# check class method
525525
elif inspect.ismethod(f):
526-
func_code = f.__func__.__code__
526+
fncode = f.__func__.__code__
527527
offset = 1
528528
# check functor
529529
elif hasattr(f, "__call__") and hasattr(f.__call__, '__func__'):
530-
func_code = f.__call__.__func__.__code__
530+
fncode = f.__call__.__func__.__code__
531531
offset = 1
532532
else:
533533
m = "Cannot extract name or argnames"
534534
raise ValueError(m)
535535

536536
# Extract the name
537537
if name is None:
538-
name = func_code.co_name
538+
name = fncode.co_name
539539
if name == '<lambda>':
540540
m = "You must supply a name name for a lambda function"
541541
raise ValueError(m)
542542

543543
# Extract the arguments
544544
if argnames is None:
545-
argnames = list(func_code.co_varnames)
546-
argnames = argnames[offset:func_code.co_argcount]
545+
argnames = list(fncode.co_varnames)
546+
argnames = argnames[offset:fncode.co_argcount]
547547

548548
#### End introspection code
549549

0 commit comments

Comments
 (0)