diff options
author | Tim Peters <tim.peters@gmail.com> | 2002-04-04 22:55:58 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2002-04-04 22:55:58 (GMT) |
commit | bc0e9108261693b6278687f4fb4709ff76c2e543 (patch) | |
tree | afef5d4734034ed0268950cf06321aefd4154ff3 /Tools/idle | |
parent | 2f486b7fa6451b790b154e6e4751239d69d46952 (diff) | |
download | cpython-bc0e9108261693b6278687f4fb4709ff76c2e543.zip cpython-bc0e9108261693b6278687f4fb4709ff76c2e543.tar.gz cpython-bc0e9108261693b6278687f4fb4709ff76c2e543.tar.bz2 |
Convert a pile of obvious "yes/no" functions to return bool.
Diffstat (limited to 'Tools/idle')
-rw-r--r-- | Tools/idle/EditorWindow.py | 6 | ||||
-rw-r--r-- | Tools/idle/IOBinding.py | 8 | ||||
-rw-r--r-- | Tools/idle/ObjectBrowser.py | 4 | ||||
-rw-r--r-- | Tools/idle/PyShell.py | 6 | ||||
-rw-r--r-- | Tools/idle/ReplaceDialog.py | 12 | ||||
-rw-r--r-- | Tools/idle/SearchDialog.py | 10 |
6 files changed, 23 insertions, 23 deletions
diff --git a/Tools/idle/EditorWindow.py b/Tools/idle/EditorWindow.py index f924c45..9dd51b6 100644 --- a/Tools/idle/EditorWindow.py +++ b/Tools/idle/EditorWindow.py @@ -375,16 +375,16 @@ class EditorWindow: def ispythonsource(self, filename): if not filename: - return 1 + return True base, ext = os.path.splitext(os.path.basename(filename)) if os.path.normcase(ext) in (".py", ".pyw"): - return 1 + return True try: f = open(filename) line = f.readline() f.close() except IOError: - return 0 + return False return line[:2] == '#!' and string.find(line, 'python') >= 0 def close_hook(self): diff --git a/Tools/idle/IOBinding.py b/Tools/idle/IOBinding.py index 5d41d35..dfea0b6 100644 --- a/Tools/idle/IOBinding.py +++ b/Tools/idle/IOBinding.py @@ -92,7 +92,7 @@ class IOBinding: f.close() except IOError, msg: tkMessageBox.showerror("I/O Error", str(msg), master=self.text) - return 0 + return False self.text.delete("1.0", "end") self.set_filename(None) self.text.insert("1.0", chars) @@ -100,7 +100,7 @@ class IOBinding: self.set_filename(filename) self.text.mark_set("insert", "1.0") self.text.see("insert") - return 1 + return True def maybesave(self): if self.get_saved(): @@ -154,11 +154,11 @@ class IOBinding: f.write(chars) f.close() ## print "saved to", `filename` - return 1 + return True except IOError, msg: tkMessageBox.showerror("I/O Error", str(msg), master=self.text) - return 0 + return False def fixlastline(self): c = self.text.get("end-2c") diff --git a/Tools/idle/ObjectBrowser.py b/Tools/idle/ObjectBrowser.py index c235a75..416be5a 100644 --- a/Tools/idle/ObjectBrowser.py +++ b/Tools/idle/ObjectBrowser.py @@ -59,7 +59,7 @@ class ObjectTreeItem(TreeItem): class InstanceTreeItem(ObjectTreeItem): def IsExpandable(self): - return 1 + return True def GetSubList(self): sublist = ObjectTreeItem.GetSubList(self) sublist.insert(0, @@ -68,7 +68,7 @@ class InstanceTreeItem(ObjectTreeItem): class ClassTreeItem(ObjectTreeItem): def IsExpandable(self): - return 1 + return True def GetSubList(self): sublist = ObjectTreeItem.GetSubList(self) if len(self.object.__bases__) == 1: diff --git a/Tools/idle/PyShell.py b/Tools/idle/PyShell.py index 03b4684..2c471de 100644 --- a/Tools/idle/PyShell.py +++ b/Tools/idle/PyShell.py @@ -439,7 +439,7 @@ class PyShell(OutputWindow): def ispythonsource(self, filename): # Override this so EditorWindow never removes the colorizer - return 1 + return True def short_title(self): return self.shell_title @@ -482,7 +482,7 @@ class PyShell(OutputWindow): return line def isatty(self): - return 1 + return True def cancel_callback(self, event): try: @@ -685,7 +685,7 @@ class PseudoFile: pass def isatty(self): - return 1 + return True usage_msg = """\ diff --git a/Tools/idle/ReplaceDialog.py b/Tools/idle/ReplaceDialog.py index 83462f9..1e46f36 100644 --- a/Tools/idle/ReplaceDialog.py +++ b/Tools/idle/ReplaceDialog.py @@ -111,24 +111,24 @@ class ReplaceDialog(SearchDialogBase): def do_find(self, ok=0): if not self.engine.getprog(): - return 0 + return False text = self.text res = self.engine.search_text(text, None, ok) if not res: text.bell() - return 0 + return False line, m = res i, j = m.span() first = "%d.%d" % (line, i) last = "%d.%d" % (line, j) self.show_hit(first, last) self.ok = 1 - return 1 + return True def do_replace(self): prog = self.engine.getprog() if not prog: - return 0 + return False text = self.text try: first = pos = text.index("sel.first") @@ -141,7 +141,7 @@ class ReplaceDialog(SearchDialogBase): chars = text.get("%d.0" % line, "%d.0" % (line+1)) m = prog.match(chars, col) if not prog: - return 0 + return False new = self._expand(m, self.replvar.get()) text.mark_set("insert", first) text.undo_block_start() @@ -152,7 +152,7 @@ class ReplaceDialog(SearchDialogBase): text.undo_block_stop() self.show_hit(first, text.index("insert")) self.ok = 0 - return 1 + return True def _expand(self, m, template): # XXX This code depends on internals of the regular expression diff --git a/Tools/idle/SearchDialog.py b/Tools/idle/SearchDialog.py index 0f0cb18..8d275c4 100644 --- a/Tools/idle/SearchDialog.py +++ b/Tools/idle/SearchDialog.py @@ -34,9 +34,9 @@ class SearchDialog(SearchDialogBase): def find_again(self, text): if not self.engine.getpat(): self.open(text) - return 0 + return False if not self.engine.getprog(): - return 0 + return False res = self.engine.search_text(text) if res: line, m = res @@ -48,17 +48,17 @@ class SearchDialog(SearchDialogBase): sellast = text.index("sel.last") if selfirst == first and sellast == last: text.bell() - return 0 + return False except TclError: pass text.tag_remove("sel", "1.0", "end") text.tag_add("sel", first, last) text.mark_set("insert", self.engine.isback() and first or last) text.see("insert") - return 1 + return True else: text.bell() - return 0 + return False def find_selection(self, text): pat = text.get("sel.first", "sel.last") |