Replace __call__ in dir(*) with callable(*) for performance gain
svn: r10856
This commit is contained in:
parent
dda6988dfc
commit
709c58b4eb
@ -53,7 +53,7 @@ class UpdateCallback:
|
|||||||
@param interval: number of seconds at most between the updates
|
@param interval: number of seconds at most between the updates
|
||||||
@type interval: int
|
@type interval: int
|
||||||
"""
|
"""
|
||||||
if '__call__' in dir(callback): # callback is really callable
|
if callable(callback): # callback is really callable
|
||||||
self.update = self.update_real
|
self.update = self.update_real
|
||||||
self.callback = callback
|
self.callback = callback
|
||||||
self.interval = interval
|
self.interval = interval
|
||||||
|
@ -237,7 +237,7 @@ class CSVWriter:
|
|||||||
self.cl = cl
|
self.cl = cl
|
||||||
self.filename = filename
|
self.filename = filename
|
||||||
self.callback = callback
|
self.callback = callback
|
||||||
if '__call__' in dir(self.callback): # callback is really callable
|
if callable(self.callback): # callback is really callable
|
||||||
self.update = self.update_real
|
self.update = self.update_real
|
||||||
else:
|
else:
|
||||||
self.update = self.update_empty
|
self.update = self.update_empty
|
||||||
|
@ -136,7 +136,7 @@ class CalendarWriter:
|
|||||||
self.cl = cl
|
self.cl = cl
|
||||||
self.filename = filename
|
self.filename = filename
|
||||||
self.callback = callback
|
self.callback = callback
|
||||||
if '__call__' in dir(self.callback): # callback is really callable
|
if callable(self.callback): # callback is really callable
|
||||||
self.update = self.update_real
|
self.update = self.update_real
|
||||||
else:
|
else:
|
||||||
self.update = self.update_empty
|
self.update = self.update_empty
|
||||||
|
@ -133,7 +133,7 @@ class CardWriter:
|
|||||||
self.cl = cl
|
self.cl = cl
|
||||||
self.filename = filename
|
self.filename = filename
|
||||||
self.callback = callback
|
self.callback = callback
|
||||||
if '__call__' in dir(self.callback): # callback is really callable
|
if callable(self.callback): # callback is really callable
|
||||||
self.update = self.update_real
|
self.update = self.update_real
|
||||||
else:
|
else:
|
||||||
self.update = self.update_empty
|
self.update = self.update_empty
|
||||||
|
@ -141,7 +141,7 @@ class FtreeWriter:
|
|||||||
self.cl = cl
|
self.cl = cl
|
||||||
self.filename = filename
|
self.filename = filename
|
||||||
self.callback = callback
|
self.callback = callback
|
||||||
if '__call__' in dir(self.callback): # callback is really callable
|
if callable(self.callback): # callback is really callable
|
||||||
self.update = self.update_real
|
self.update = self.update_real
|
||||||
else:
|
else:
|
||||||
self.update = self.update_empty
|
self.update = self.update_empty
|
||||||
|
@ -162,7 +162,7 @@ class GeneWebWriter:
|
|||||||
self.cl = cl
|
self.cl = cl
|
||||||
self.filename = filename
|
self.filename = filename
|
||||||
self.callback = callback
|
self.callback = callback
|
||||||
if '__call__' in dir(self.callback): # callback is really callable
|
if callable(self.callback): # callback is really callable
|
||||||
self.update = self.update_real
|
self.update = self.update_real
|
||||||
else:
|
else:
|
||||||
self.update = self.update_empty
|
self.update = self.update_empty
|
||||||
|
Loading…
Reference in New Issue
Block a user