diff --git a/direct/src/http/webAIInspector.py b/direct/src/http/webAIInspector.py index 38f8c1709c..9e4d3f8ac3 100755 --- a/direct/src/http/webAIInspector.py +++ b/direct/src/http/webAIInspector.py @@ -351,7 +351,7 @@ class Inspector: keys.sort() for each in keys: self._partsList.append(each) - #if not hasattr(getattr(self.object, each), '__call__'): + #if not callable(getattr(self.object, each)): # self._partsList.append(each) def initializePartNames(self): @@ -373,7 +373,7 @@ class Inspector: def stringForPartNumber(self, partNumber): object = self.partNumber(partNumber) doc = None - if hasattr(object, '__call__'): + if callable(object): try: doc = object.__doc__ except: diff --git a/direct/src/interval/LerpInterval.py b/direct/src/interval/LerpInterval.py index 21c31881f2..c44b6e5435 100644 --- a/direct/src/interval/LerpInterval.py +++ b/direct/src/interval/LerpInterval.py @@ -57,7 +57,7 @@ class LerpNodePathInterval(CLerpNodePathInterval): # parameter. for param in params: - if hasattr(param, '__call__'): + if callable(param): return 1 return 0 @@ -67,7 +67,7 @@ class LerpNodePathInterval(CLerpNodePathInterval): # a callable functor, calls it; otherwise, uses the param # directly. if param != None: - if hasattr(param, '__call__'): + if callable(param): func(param()) else: func(param) diff --git a/direct/src/interval/ProjectileInterval.py b/direct/src/interval/ProjectileInterval.py index 684c99b729..e9df37a397 100755 --- a/direct/src/interval/ProjectileInterval.py +++ b/direct/src/interval/ProjectileInterval.py @@ -106,7 +106,7 @@ class ProjectileInterval(Interval): def doIndirections(*items): result = [] for item in items: - if hasattr(item, '__call__'): + if callable(item): item = item() result.append(item) return result diff --git a/direct/src/showbase/PythonUtil.py b/direct/src/showbase/PythonUtil.py index 1ba4e5e009..cd81af35cc 100644 --- a/direct/src/showbase/PythonUtil.py +++ b/direct/src/showbase/PythonUtil.py @@ -117,7 +117,7 @@ class Functor: _kargs.update(kargs) return self._function(*(self._args + args), **_kargs) - # this methoxd is used in place of __call__ if we are recording creation stacks + # this method is used in place of __call__ if we are recording creation stacks def _exceptionLoggedCreationStack__call__(self, *args, **kargs): try: return self._do__call__(*args, **kargs) @@ -510,7 +510,7 @@ def _pdir(obj, str = None, width = None, format = '%-' + repr(maxWidth) + 's' for key in keys: value = dict[key] - if hasattr(value, '__call__'): + if callable(value): strvalue = repr(Signature(value)) else: strvalue = repr(value) diff --git a/direct/src/tkpanels/Inspector.py b/direct/src/tkpanels/Inspector.py index 0989a5b7e9..95a5decc2e 100644 --- a/direct/src/tkpanels/Inspector.py +++ b/direct/src/tkpanels/Inspector.py @@ -88,7 +88,7 @@ class Inspector: keys.sort() for each in keys: self._partsList.append(each) - #if not hasattr(getattr(self.object, each), '__call__'): + #if not callable(getattr(self.object, each)): # self._partsList.append(each) def initializePartNames(self): @@ -110,7 +110,7 @@ class Inspector: def stringForPartNumber(self, partNumber): object = self.partNumber(partNumber) doc = None - if hasattr(object, '__call__'): + if callable(object): try: doc = object.__doc__ except: