Skip to content
Snippets Groups Projects
Commit a62328ec authored by Yann Leboulanger's avatar Yann Leboulanger
Browse files

remove duplicate function, simplify logic

parent 371a38c9
No related branches found
No related tags found
No related merge requests found
......@@ -283,25 +283,7 @@ class Debug:
s=s+c
self._fh.write( '%s%s%s' % ( pre, s, suf ))
self._fh.flush()
def is_active( self, flag ):
'If given flag(s) should generate output.'
# try to abort early to quicken code
if not self.active:
return 0
if not flag or flag in self.active:
return 1
else:
# check for multi flag type:
if type( flag ) in ( type(()), type([]) ):
for s in flag:
if s in self.active:
return 1
return 0
def active_set( self, active_flags = None ):
"returns 1 if any flags where actually set, otherwise 0."
r = 0
......@@ -411,7 +393,7 @@ class Debug:
def is_active( self, flag ):
if not self.active: return 0
if not flag or flag in self.active and DBG_ALWAYS not in self.active or flag not in self.active and DBG_ALWAYS in self.active : return 1
if not flag or ((flag in self.active) ^ (DBG_ALWAYS in self.active)) : return 1
return 0
DBG_ALWAYS='always'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment