(format)
Get the appropriate IPython display class for `format`.

    Returns `IPython.display.SVG` if format=='svg', otherwise
    `IPython.display.Image`.

    If IPython is not importable, return dummy function that swallows its
    arguments and returns None.
Get the appropriate IPython display class for `format`.
Get the appropriate IPython display class for format .
def _get_display_cls(format):
    """
    Get the appropriate IPython display class for `format`.

    Returns `IPython.display.SVG` if format=='svg', otherwise
    `IPython.display.Image`.

    If IPython is not importable, return dummy function that swallows its
    arguments and returns None.
    """
    dummy = lambda *args, **kwargs: None
    try:
        import IPython.display as display
    except ImportError:
        # Can't return a display object if no IPython.
        return dummy

    if format in IPYTHON_NO_DISPLAY_FORMATS:
        # IPython can't display this format natively, so just return None.
        return dummy
    elif format in IPYTHON_IMAGE_FORMATS:
        # Partially apply `format` so that `Image` and `SVG` supply a uniform
        # interface to the caller.
        return partial(display.Image, format=format)
    elif format == "svg":
        return display.SVG
    else:
        raise ValueError("Unknown format '%s' passed to `dot_graph`" % format)
def _get_display_cls ( format ) : dummy = lambda * args , * * kwargs : None try : import IPython . display as display except ImportError : # Can't return a display object if no IPython. return dummy if format in IPYTHON_NO_DISPLAY_FORMATS : # IPython can't display this format natively, so just return None. return dummy elif format in IPYTHON_IMAGE_FORMATS : # Partially apply `format` so that `Image` and `SVG` supply a uniform # interface to the caller. return partial ( display . Image , format = format ) elif format == "svg" : return display . SVG else : raise ValueError ( "Unknown format '%s' passed to `dot_graph`" % format )