summaryrefslogtreecommitdiff
path: root/Lib/optparse.py
diff options
context:
space:
mode:
authorCollin Winter <collinw@gmail.com>2007-08-30 01:19:48 +0000
committerCollin Winter <collinw@gmail.com>2007-08-30 01:19:48 +0000
commitce36ad8a467d914eb5c91f33835b9eaea18ee93b (patch)
tree05bf654f3359e20b455dc300bd860bba5d291c8d /Lib/optparse.py
parent8b3febef2f96c35e9aad9db2ef499db040fdefae (diff)
downloadcpython-git-ce36ad8a467d914eb5c91f33835b9eaea18ee93b.tar.gz
Raise statement normalization in Lib/.
Diffstat (limited to 'Lib/optparse.py')
-rw-r--r--Lib/optparse.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/Lib/optparse.py b/Lib/optparse.py
index bae10500d3..b3de41157b 100644
--- a/Lib/optparse.py
+++ b/Lib/optparse.py
@@ -239,10 +239,10 @@ class HelpFormatter:
self.level -= 1
def format_usage(self, usage):
- raise NotImplementedError, "subclasses must implement"
+ raise NotImplementedError("subclasses must implement")
def format_heading(self, heading):
- raise NotImplementedError, "subclasses must implement"
+ raise NotImplementedError("subclasses must implement")
def _format_text(self, text):
"""
@@ -805,7 +805,7 @@ class Option:
parser.print_version()
parser.exit()
else:
- raise RuntimeError, "unknown action %r" % self.action
+ raise RuntimeError("unknown action %r" % self.action)
return 1
@@ -865,7 +865,7 @@ class Values:
elif mode == "loose":
self._update_loose(dict)
else:
- raise ValueError, "invalid update mode: %r" % mode
+ raise ValueError("invalid update mode: %r" % mode)
def read_module(self, modname, mode="careful"):
__import__(modname)
@@ -944,7 +944,7 @@ class OptionContainer:
def set_conflict_handler(self, handler):
if handler not in ("error", "resolve"):
- raise ValueError, "invalid conflict_resolution value %r" % handler
+ raise ValueError("invalid conflict_resolution value %r" % handler)
self.conflict_handler = handler
def set_description(self, description):
@@ -999,9 +999,9 @@ class OptionContainer:
elif len(args) == 1 and not kwargs:
option = args[0]
if not isinstance(option, Option):
- raise TypeError, "not an Option instance: %r" % option
+ raise TypeError("not an Option instance: %r" % option)
else:
- raise TypeError, "invalid arguments"
+ raise TypeError("invalid arguments")
self._check_conflict(option)
@@ -1310,11 +1310,11 @@ class OptionParser (OptionContainer):
elif len(args) == 1 and not kwargs:
group = args[0]
if not isinstance(group, OptionGroup):
- raise TypeError, "not an OptionGroup instance: %r" % group
+ raise TypeError("not an OptionGroup instance: %r" % group)
if group.parser is not self:
- raise ValueError, "invalid OptionGroup (wrong parser)"
+ raise ValueError("invalid OptionGroup (wrong parser)")
else:
- raise TypeError, "invalid arguments"
+ raise TypeError("invalid arguments")
self.option_groups.append(group)
return group