From 78ebf77e84f458eb6eb8917f333196acaa84e1c0 Mon Sep 17 00:00:00 2001 From: kzhu-ME <86268612+kzhu-ME@users.noreply.github.com> Date: Thu, 24 Jun 2021 00:43:41 -0700 Subject: Refactored basestring to str (#2030) --- Python/pywarpx/callbacks.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Python/pywarpx/callbacks.py') diff --git a/Python/pywarpx/callbacks.py b/Python/pywarpx/callbacks.py index d0b1688a9..4ccaa479d 100644 --- a/Python/pywarpx/callbacks.py +++ b/Python/pywarpx/callbacks.py @@ -117,7 +117,7 @@ class CallbackFunctions(object): self.funcs.remove(f) continue result = getattr(object,f[1]) - elif isinstance(f,basestring): + elif isinstance(f,str): import __main__ if f in __main__.__dict__: result = __main__.__dict__[f] @@ -137,7 +137,7 @@ class CallbackFunctions(object): print("by something not callable. This can happen during restart") print("if a function name had later been used as a variable name.") print(self.name) - if isinstance(f,basestring): + if isinstance(f,str): print("The name of the call back is %s"%f) print("\n\n") continue @@ -180,12 +180,12 @@ class CallbackFunctions(object): if f.im_self is object and f.__name__ == func[1]: self.funcs.remove(func) return - elif isinstance(func,basestring): + elif isinstance(func,str): if f.__name__ == func: self.funcs.remove(func) return - elif isinstance(f,basestring): - if isinstance(func,basestring): funcname = func + elif isinstance(f,str): + if isinstance(func,str): funcname = func elif isinstance(func,list): funcname = None else: funcname = func.__name__ if f == funcname: @@ -204,7 +204,7 @@ class CallbackFunctions(object): object = self._getmethodobject(func) if f.im_self is object and f.__name__ == func[1]: return 1 - elif isinstance(func,basestring): + elif isinstance(func,str): if f.__name__ == func: return 1 return 0 -- cgit v1.2.3