environment/lib/python2.7/site-packages/IPython/extensions/sympyprinting.py
def load_ipython_extension(ip):
    """Load the extension in IPython."""
    import sympy

    # sympyprinting extension has been moved to SymPy as of 0.7.2, if it
    # exists there, warn the user and import it
    try:
        import sympy.interactive.ipythonprinting
    except ImportError:
        pass
    else:
        warnings.warn("The sympyprinting extension in IPython is deprecated, "
            "use sympy.interactive.ipythonprinting")
        ip.extension_manager.load_extension('sympy.interactive.ipythonprinting')
        return

    global _loaded
    if not _loaded:
        plaintext_formatter = ip.display_formatter.formatters['text/plain']

        for cls in (object, str):
            plaintext_formatter.for_type(cls, print_basic_unicode)

        printable_containers = [list, tuple]

        # set and frozen set were broken with SymPy's latex() function, but
        # was fixed in the 0.7.1-git development version. See
        # http://code.google.com/p/sympy/issues/detail?id=3062.
        if sympy.__version__ > '0.7.1':
            printable_containers += [set, frozenset]
        else:
            plaintext_formatter.for_type(cls, print_basic_unicode)

        plaintext_formatter.for_type_by_name(
            'sympy.core.basic', 'Basic', print_basic_unicode
        )
        plaintext_formatter.for_type_by_name(
            'sympy.matrices.matrices', 'Matrix', print_basic_unicode
        )

        png_formatter = ip.display_formatter.formatters['image/png']

        png_formatter.for_type_by_name(
            'sympy.core.basic', 'Basic', print_png
        )
        png_formatter.for_type_by_name(
            'sympy.matrices.matrices', 'Matrix', print_display_png
        )
        for cls in [dict, int, long, float] + printable_containers:
            png_formatter.for_type(cls, print_png)

        latex_formatter = ip.display_formatter.formatters['text/latex']
        latex_formatter.for_type_by_name(
            'sympy.core.basic', 'Basic', print_latex
        )
        latex_formatter.for_type_by_name(
            'sympy.matrices.matrices', 'Matrix', print_latex
        )

        for cls in printable_containers:
            # Use LaTeX only if every element is printable by latex
            latex_formatter.for_type(cls, print_latex)

        _loaded = True
def load_ipython_extension(ip):
    """Load the extension in IPython."""
    import sympy

    # sympyprinting extension has been moved to SymPy as of 0.7.2, if it
    # exists there, warn the user and import it
    try:
        import sympy.interactive.ipythonprinting
    except ImportError:
        pass
    else:
        warnings.warn("The sympyprinting extension in IPython is deprecated, "
            "use sympy.interactive.ipythonprinting")
        ip.extension_manager.load_extension('sympy.interactive.ipythonprinting')
        return

    global _loaded
    if not _loaded:
        plaintext_formatter = ip.display_formatter.formatters['text/plain']

        for cls in (object, str):
            plaintext_formatter.for_type(cls, print_basic_unicode)

        printable_containers = [list, tuple]

        # set and frozen set were broken with SymPy's latex() function, but
        # was fixed in the 0.7.1-git development version. See
        # http://code.google.com/p/sympy/issues/detail?id=3062.
        if sympy.__version__ > '0.7.1':
            printable_containers += [set, frozenset]
        else:
            plaintext_formatter.for_type(cls, print_basic_unicode)

        plaintext_formatter.for_type_by_name(
            'sympy.core.basic', 'Basic', print_basic_unicode
        )
        plaintext_formatter.for_type_by_name(
            'sympy.matrices.matrices', 'Matrix', print_basic_unicode
        )

        png_formatter = ip.display_formatter.formatters['image/png']

        png_formatter.for_type_by_name(
            'sympy.core.basic', 'Basic', print_png
        )
        png_formatter.for_type_by_name(
            'sympy.matrices.matrices', 'Matrix', print_display_png
        )
        for cls in [dict, int, long, float] + printable_containers:
            png_formatter.for_type(cls, print_png)

        latex_formatter = ip.display_formatter.formatters['text/latex']
        latex_formatter.for_type_by_name(
            'sympy.core.basic', 'Basic', print_latex
        )
        latex_formatter.for_type_by_name(
            'sympy.matrices.matrices', 'Matrix', print_latex
        )

        for cls in printable_containers:
            # Use LaTeX only if every element is printable by latex
            latex_formatter.for_type(cls, print_latex)

        _loaded = True
def load_ipython_extension ( ip ) : import sympy # sympyprinting extension has been moved to SymPy as of 0.7.2, if it # exists there, warn the user and import it try : import sympy . interactive . ipythonprinting except ImportError : pass else : warnings . warn ( "The sympyprinting extension in IPython is deprecated, " "use sympy.interactive.ipythonprinting" ) ip . extension_manager . load_extension ( 'sympy.interactive.ipythonprinting' ) return global _loaded if not _loaded : plaintext_formatter = ip . display_formatter . formatters [ 'text/plain' ] for cls in ( object , str ) : plaintext_formatter . for_type ( cls , print_basic_unicode ) printable_containers = [ list , tuple ] # set and frozen set were broken with SymPy's latex() function, but # was fixed in the 0.7.1-git development version. See # http://code.google.com/p/sympy/issues/detail?id=3062. if sympy . __version__ > '0.7.1' : printable_containers += [ set , frozenset ] else : plaintext_formatter . for_type ( cls , print_basic_unicode ) plaintext_formatter . for_type_by_name ( 'sympy.core.basic' , 'Basic' , print_basic_unicode ) plaintext_formatter . for_type_by_name ( 'sympy.matrices.matrices' , 'Matrix' , print_basic_unicode ) png_formatter = ip . display_formatter . formatters [ 'image/png' ] png_formatter . for_type_by_name ( 'sympy.core.basic' , 'Basic' , print_png ) png_formatter . for_type_by_name ( 'sympy.matrices.matrices' , 'Matrix' , print_display_png ) for cls in [ dict , int , long , float ] + printable_containers : png_formatter . for_type ( cls , print_png ) latex_formatter = ip . display_formatter . formatters [ 'text/latex' ] latex_formatter . for_type_by_name ( 'sympy.core.basic' , 'Basic' , print_latex ) latex_formatter . for_type_by_name ( 'sympy.matrices.matrices' , 'Matrix' , print_latex ) for cls in printable_containers : # Use LaTeX only if every element is printable by latex latex_formatter . for_type ( cls , print_latex ) _loaded = True
Load the extension in IPython.
Load the extension in IPython .