Skip to content

Commit

Permalink
Refactored basestring to str (#2030)
Browse files Browse the repository at this point in the history
  • Loading branch information
KZhu-ME authored Jun 24, 2021
1 parent a5ff5a4 commit 78ebf77
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Python/pywarpx/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def callbackfunclist(self):
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]
Expand All @@ -137,7 +137,7 @@ def callbackfunclist(self):
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
Expand Down Expand Up @@ -180,12 +180,12 @@ def uninstallfuncinlist(self,f):
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:
Expand All @@ -204,7 +204,7 @@ def isinstalledfuncinlist(self,f):
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
Expand Down

0 comments on commit 78ebf77

Please sign in to comment.