summaryrefslogtreecommitdiffstats
path: root/Lib/argparse.py
diff options
context:
space:
mode:
authorFlorent Xicluna <florent.xicluna@gmail.com>2011-10-28 12:52:29 (GMT)
committerFlorent Xicluna <florent.xicluna@gmail.com>2011-10-28 12:52:29 (GMT)
commitaabbda5354407cfe35097c7f17717a716a3d80c4 (patch)
treee15e7fe42975e08e567879ec8a949d4986ca4493 /Lib/argparse.py
parentac73b0c95e352563ecf0a4643b30215b9bdee1a5 (diff)
parent5d1155c08edf7f53eca804b2b6538636c2dfe711 (diff)
downloadcpython-aabbda5354407cfe35097c7f17717a716a3d80c4.zip
cpython-aabbda5354407cfe35097c7f17717a716a3d80c4.tar.gz
cpython-aabbda5354407cfe35097c7f17717a716a3d80c4.tar.bz2
Merge 3.2
Diffstat (limited to 'Lib/argparse.py')
-rw-r--r--Lib/argparse.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/Lib/argparse.py b/Lib/argparse.py
index 236e1e8..87d0cef 100644
--- a/Lib/argparse.py
+++ b/Lib/argparse.py
@@ -93,10 +93,6 @@ import textwrap as _textwrap
from gettext import gettext as _, ngettext
-def _callable(obj):
- return hasattr(obj, '__call__') or hasattr(obj, '__bases__')
-
-
SUPPRESS = '==SUPPRESS=='
OPTIONAL = '?'
@@ -1311,13 +1307,13 @@ class _ActionsContainer(object):
# create the action object, and add it to the parser
action_class = self._pop_action_class(kwargs)
- if not _callable(action_class):
+ if not callable(action_class):
raise ValueError('unknown action "%s"' % (action_class,))
action = action_class(**kwargs)
# raise an error if the action type is not callable
type_func = self._registry_get('type', action.type, action.type)
- if not _callable(type_func):
+ if not callable(type_func):
raise ValueError('%r is not callable' % (type_func,))
# raise an error if the metavar does not match the type
@@ -2260,7 +2256,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
def _get_value(self, action, arg_string):
type_func = self._registry_get('type', action.type, action.type)
- if not _callable(type_func):
+ if not callable(type_func):
msg = _('%r is not callable')
raise ArgumentError(action, msg % type_func)