@contextfilter
def parent_filter(ctx, value):
    """Returns the name of the parent directory of the given file path

    :param ctx: the context
    :param value: the file path
    :returns: the name of the parent directory
    """
    if isinstance(value, JipUndefined):
        return "${%s|parent}" % (value._undefined_name)
    from os.path import dirname
    try:
        value = __resolve_options(ctx, value)

        if not isinstance(value, Option):
            v = str(value)
        else:
            v = value.get()
        return dirname(v)
    except:
        return value
dataset/ETHPy150Open thasso/pyjip/jip/templates.py/parent_filter/original