summaryrefslogtreecommitdiff
path: root/extras/optparse.py
diff options
context:
space:
mode:
authorstrank <strank@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2008-07-28 15:24:27 +0000
committerstrank <strank@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2008-07-28 15:24:27 +0000
commit2ec2ed70dfae0edfb9c8df437cfa20b41e971fd1 (patch)
tree94b3b00b24408e3df8c0ef6ade26549f7355dcec /extras/optparse.py
parentce856ebd1cf2b6781a5c84b4627db2e47c9ffa04 (diff)
downloaddocutils-2ec2ed70dfae0edfb9c8df437cfa20b41e971fd1.tar.gz
Merged trunk r5043:5619 to adjacent-citations branch.
git-svn-id: http://svn.code.sf.net/p/docutils/code/branches/adjacent-citations@5621 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'extras/optparse.py')
-rw-r--r--extras/optparse.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/extras/optparse.py b/extras/optparse.py
index c21663c55..dcc36fd84 100644
--- a/extras/optparse.py
+++ b/extras/optparse.py
@@ -472,7 +472,7 @@ class Option:
def _set_attrs (self, attrs):
for attr in self.ATTRS:
- if attrs.has_key(attr):
+ if attr in attrs:
setattr(self, attr, attrs[attr])
del attrs[attr]
else:
@@ -676,7 +676,7 @@ class Values:
are silently ignored.
"""
for attr in dir(self):
- if dict.has_key(attr):
+ if attr in dict:
dval = dict[attr]
if dval is not None:
setattr(self, attr, dval)
@@ -704,7 +704,7 @@ class Values:
def read_file (self, filename, mode="careful"):
vars = {}
- execfile(filename, vars)
+ exec(open(filename).read(), vars)
self._update(vars, mode)
def ensure_value (self, attr, value):
@@ -786,10 +786,10 @@ class OptionContainer:
def _check_conflict (self, option):
conflict_opts = []
for opt in option._short_opts:
- if self._short_opt.has_key(opt):
+ if opt in self._short_opt:
conflict_opts.append((opt, self._short_opt[opt]))
for opt in option._long_opts:
- if self._long_opt.has_key(opt):
+ if opt in self._long_opt:
conflict_opts.append((opt, self._long_opt[opt]))
if conflict_opts:
@@ -837,7 +837,7 @@ class OptionContainer:
if option.dest is not None: # option has a dest, we need a default
if option.default is not NO_DEFAULT:
self.defaults[option.dest] = option.default
- elif not self.defaults.has_key(option.dest):
+ elif option.dest not in self.defaults:
self.defaults[option.dest] = None
return option
@@ -853,8 +853,8 @@ class OptionContainer:
self._long_opt.get(opt_str))
def has_option (self, opt_str):
- return (self._short_opt.has_key(opt_str) or
- self._long_opt.has_key(opt_str))
+ return (opt_str in self._short_opt or
+ opt_str in self._long_opt)
def remove_option (self, opt_str):
option = self._short_opt.get(opt_str)
@@ -1393,7 +1393,7 @@ def _match_abbrev (s, wordmap):
'words', raise BadOptionError.
"""
# Is there an exact match?
- if wordmap.has_key(s):
+ if s in wordmap:
return s
else:
# Isolate all words with s as a prefix.