environment/lib/python2.7/site-packages/IPython/core/magic_arguments.py
def construct_parser(magic_func):
    """ Construct an argument parser using the function decorations.
    """
    kwds = getattr(magic_func, 'argcmd_kwds', {})
    if 'description' not in kwds:
        kwds['description'] = getattr(magic_func, '__doc__', None)
    arg_name = real_name(magic_func)
    parser = MagicArgumentParser(arg_name, **kwds)
    # Reverse the list of decorators in order to apply them in the
    # order in which they appear in the source.
    group = None
    for deco in magic_func.decorators[::-1]:
        result = deco.add_to_parser(parser, group)
        if result is not None:
            group = result

    # Replace the starting 'usage: ' with IPython's %.
    help_text = parser.format_help()
    if help_text.startswith('usage: '):
        help_text = help_text.replace('usage: ', '%', 1)
    else:
        help_text = '%' + help_text

    # Replace the magic function's docstring with the full help text.
    magic_func.__doc__ = help_text

    return parser
def construct_parser(magic_func):
    kwds = getattr(magic_func, 'argcmd_kwds', {})
    if 'description' not in kwds:
        kwds['description'] = getattr(magic_func, '__doc__', None)
    arg_name = real_name(magic_func)
    parser = MagicArgumentParser(arg_name, **kwds)
    # Reverse the list of decorators in order to apply them in the
    # order in which they appear in the source.
    group = None
    for deco in magic_func.decorators[::-1]:
        result = deco.add_to_parser(parser, group)
        if result is not None:
            group = result

    # Replace the starting 'usage: ' with IPython's %.
    help_text = parser.format_help()
    if help_text.startswith('usage: '):
        help_text = help_text.replace('usage: ', '%', 1)
    else:
        help_text = '%' + help_text

    # Replace the magic function's docstring with the full help text.
    magic_func.__doc__ = help_text

    return parser
def construct_parser ( magic_func ) : kwds = getattr ( magic_func , 'argcmd_kwds' , { } ) if 'description' not in kwds : kwds [ 'description' ] = getattr ( magic_func , '__doc__' , None ) arg_name = real_name ( magic_func ) parser = MagicArgumentParser ( arg_name , * * kwds ) # Reverse the list of decorators in order to apply them in the # order in which they appear in the source. group = None for deco in magic_func . decorators [ : : - 1 ] : result = deco . add_to_parser ( parser , group ) if result is not None : group = result # Replace the starting 'usage: ' with IPython's %. help_text = parser . format_help ( ) if help_text . startswith ( 'usage: ' ) : help_text = help_text . replace ( 'usage: ' , '%' , 1 ) else : help_text = '%' + help_text # Replace the magic function's docstring with the full help text. magic_func . __doc__ = help_text return parser
Construct an argument parser using the function decorations.
Construct an argument parser using the function decorations .