mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Convert a pile of obvious "yes/no" functions to return bool.
This commit is contained in:
parent
2f486b7fa6
commit
bc0e910826
34 changed files with 117 additions and 122 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue