Skip to content

Commit

Permalink
use bundled argparse if system argparse is < 1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
minrk committed Aug 23, 2011
1 parent 25aaf34 commit 45cf186
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions IPython/external/argparse/__init__.py
@@ -1,13 +1,11 @@
try:
import argparse
# Workaround an argparse bug, FIXED in argparse 1.1.0
if 'RawTextHelpFormatterArgumentDefaultsHelpFormatter' in argparse.__all__:
import itertools
argparse.__all__ = list(itertools.chain( [i for i in argparse.__all__
if i != 'RawTextHelpFormatterArgumentDefaultsHelpFormatter'],
['RawTextHelpFormatter', 'ArgumentDefaultsHelpFormatter']))
argparse.__all__.append('SUPPRESS')
from argparse import *
except ImportError:
# don't use system argparse if older than 1.1:
if argparse.__version__ < '1.1':
raise ImportError
else:
from argparse import *
from argparse import SUPPRESS
except (ImportError, AttributeError):
from _argparse import *
from _argparse import SUPPRESS

0 comments on commit 45cf186

Please sign in to comment.