Convert a pile of obvious "yes/no" functions to return bool.

This commit is contained in:
Tim Peters 2002-04-04 22:55:58 +00:00
parent 2f486b7fa6
commit bc0e910826
34 changed files with 117 additions and 122 deletions

View file

@ -35,19 +35,13 @@ class SymbolTableFactory:
newSymbolTable = SymbolTableFactory()
def bool(x):
"""Helper to force boolean result to 1 or 0"""
if x:
return 1
return 0
def is_free(flags):
if (flags & (USE | DEF_FREE)) \
and (flags & (DEF_LOCAL | DEF_PARAM | DEF_GLOBAL)):
return 1
return True
if flags & DEF_FREE_CLASS:
return 1
return 0
return True
return False
class SymbolTable:
def __init__(self, raw_table, filename):
@ -206,10 +200,10 @@ class Symbol:
def is_free(self):
if (self.__flags & (USE | DEF_FREE)) \
and (self.__flags & (DEF_LOCAL | DEF_PARAM | DEF_GLOBAL)):
return 1
return True
if self.__flags & DEF_FREE_CLASS:
return 1
return 0
return True
return False
def is_imported(self):
return bool(self.__flags & DEF_IMPORT)