Skip to content

Commit ac9a2bb

Browse files
committed
Use booleans where applicable.
1 parent 2660747 commit ac9a2bb

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

Lib/bdb.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def user_exception(self, frame, exc_info):
168168
def _set_stopinfo(self, stopframe, returnframe, stoplineno=0):
169169
self.stopframe = stopframe
170170
self.returnframe = returnframe
171-
self.quitting = 0
171+
self.quitting = False
172172
# stoplineno >= 0 means: stop at line >= the stoplineno
173173
# stoplineno -1 means: don't stop at all
174174
self.stoplineno = stoplineno
@@ -225,7 +225,7 @@ def set_continue(self):
225225
def set_quit(self):
226226
self.stopframe = self.botframe
227227
self.returnframe = None
228-
self.quitting = 1
228+
self.quitting = True
229229
sys.settrace(None)
230230

231231
# Derived classes and clients can call the following methods
@@ -235,7 +235,7 @@ def set_quit(self):
235235
# Call self.get_*break*() to see the breakpoints or better
236236
# for bp in Breakpoint.bpbynumber: if bp: bp.bpprint().
237237

238-
def set_break(self, filename, lineno, temporary=0, cond = None,
238+
def set_break(self, filename, lineno, temporary=False, cond=None,
239239
funcname=None):
240240
filename = self.canonic(filename)
241241
import linecache # Import as late as possible
@@ -391,7 +391,7 @@ def run(self, cmd, globals=None, locals=None):
391391
except BdbQuit:
392392
pass
393393
finally:
394-
self.quitting = 1
394+
self.quitting = True
395395
sys.settrace(None)
396396

397397
def runeval(self, expr, globals=None, locals=None):
@@ -407,7 +407,7 @@ def runeval(self, expr, globals=None, locals=None):
407407
except BdbQuit:
408408
pass
409409
finally:
410-
self.quitting = 1
410+
self.quitting = True
411411
sys.settrace(None)
412412

413413
def runctx(self, cmd, globals, locals):
@@ -425,7 +425,7 @@ def runcall(self, func, *args, **kwds):
425425
except BdbQuit:
426426
pass
427427
finally:
428-
self.quitting = 1
428+
self.quitting = True
429429
sys.settrace(None)
430430
return res
431431

@@ -457,19 +457,19 @@ class Breakpoint:
457457
# index 0 is unused, except for marking an
458458
# effective break .... see effective()
459459

460-
def __init__(self, file, line, temporary=0, cond=None, funcname=None):
460+
def __init__(self, file, line, temporary=False, cond=None, funcname=None):
461461
self.funcname = funcname
462462
# Needed if funcname is not None.
463463
self.func_first_executable_line = None
464464
self.file = file # This better be in canonical form!
465465
self.line = line
466466
self.temporary = temporary
467467
self.cond = cond
468-
self.enabled = 1
468+
self.enabled = True
469469
self.ignore = 0
470470
self.hits = 0
471471
self.number = Breakpoint.next
472-
Breakpoint.next = Breakpoint.next + 1
472+
Breakpoint.next += 1
473473
# Build the two lists
474474
self.bpbynumber.append(self)
475475
if (file, line) in self.bplist:
@@ -486,10 +486,10 @@ def deleteMe(self):
486486
del self.bplist[index]
487487

488488
def enable(self):
489-
self.enabled = 1
489+
self.enabled = True
490490

491491
def disable(self):
492-
self.enabled = 0
492+
self.enabled = False
493493

494494
def bpprint(self, out=None):
495495
if out is None:

Lib/pdb.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,14 @@ def find_function(funcname, filename):
9494
# consumer of this info expects the first line to be 1
9595
lineno = 1
9696
answer = None
97-
while 1:
97+
while True:
9898
line = fp.readline()
9999
if line == '':
100100
break
101101
if cre.match(line):
102102
answer = funcname, filename, lineno
103103
break
104-
lineno = lineno + 1
104+
lineno += 1
105105
fp.close()
106106
return answer
107107

@@ -140,7 +140,7 @@ def __init__(self, completekey='tab', stdin=None, stdout=None, skip=None):
140140
self.prompt = '(Pdb) '
141141
self.aliases = {}
142142
self.mainpyfile = ''
143-
self._wait_for_mainpyfile = 0
143+
self._wait_for_mainpyfile = False
144144
self.tb_lineno = {}
145145
# Try to load readline if it exists
146146
try:
@@ -235,9 +235,9 @@ def user_line(self, frame):
235235
"""This function is called when we stop or break at this line."""
236236
if self._wait_for_mainpyfile:
237237
if (self.mainpyfile != self.canonic(frame.f_code.co_filename)
238-
or frame.f_lineno<= 0):
238+
or frame.f_lineno <= 0):
239239
return
240-
self._wait_for_mainpyfile = 0
240+
self._wait_for_mainpyfile = False
241241
if self.bp_commands(frame):
242242
self.interaction(frame, None)
243243

@@ -337,7 +337,7 @@ def precmd(self, line):
337337
for tmpArg in args[1:]:
338338
line = line.replace("%" + str(ii),
339339
tmpArg)
340-
ii = ii + 1
340+
ii += 1
341341
line = line.replace("%*", ' '.join(args[1:]))
342342
args = line.split()
343343
# split into ';;' separated commands
@@ -962,7 +962,7 @@ def do_quit(self, arg):
962962
"""q(uit)\nexit
963963
Quit from the debugger. The program being executed is aborted.
964964
"""
965-
self._user_requested_quit = 1
965+
self._user_requested_quit = True
966966
self.set_quit()
967967
return 1
968968

@@ -974,7 +974,7 @@ def do_EOF(self, arg):
974974
Handles the receipt of EOF as a command.
975975
"""
976976
self.message('')
977-
self._user_requested_quit = 1
977+
self._user_requested_quit = True
978978
self.set_quit()
979979
return 1
980980

@@ -1326,9 +1326,9 @@ def _runscript(self, filename):
13261326
# events depends on python version). So we take special measures to
13271327
# avoid stopping before we reach the main script (see user_line and
13281328
# user_call for details).
1329-
self._wait_for_mainpyfile = 1
1329+
self._wait_for_mainpyfile = True
13301330
self.mainpyfile = self.canonic(filename)
1331-
self._user_requested_quit = 0
1331+
self._user_requested_quit = False
13321332
with open(filename, "rb") as fp:
13331333
statement = "exec(compile(%r, %r, 'exec'))" % \
13341334
(fp.read(), self.mainpyfile)

0 commit comments

Comments
 (0)