"""
Utilities for managing IPython 3/4 compat.
"""
import IPython

SUPPORTED_VERSIONS = {3, 4}
IPY_MAJOR = IPython.version_info[0]
if IPY_MAJOR not in SUPPORTED_VERSIONS:
    raise ImportError("IPython version %d is not supported." % IPY_MAJOR)
IPY3 = (IPY_MAJOR == 3)
IPY4 = (IPY_MAJOR == 4)

if IPY3:
    from IPython.config import Config
    from IPython.html.services.contents.manager import ContentsManager
    from IPython.html.services.contents.checkpoints import (
        Checkpoints,
        GenericCheckpointsMixin,
    )
    from IPython.html.services.contents.filemanager import FileContentsManager
    from IPython.html.services.contents.filecheckpoints import (
        GenericFileCheckpoints
    )
    from IPython.html.services.contents.tests.test_manager import (
        TestContentsManager
    )
    from IPython.html.services.contents.tests.test_contents_api import (
        APITest
    )
    from IPython.html.utils import to_os_path
    from IPython.nbformat import from_dict, reads, writes
    from IPython.nbformat.v4.nbbase import (
        new_code_cell,
        new_markdown_cell,
        new_notebook,
        new_raw_cell,
    )
    from IPython.nbformat.v4.rwbase import strip_transient
    from IPython.utils.traitlets import (
        Any,
        Bool,
        Dict,
        Instance,
        Integer,
        HasTraits,
        Unicode,
    )
else:
    from traitlets.config import Config
    from notebook.services.contents.checkpoints import (
        Checkpoints,
        GenericCheckpointsMixin,
    )
    from notebook.services.contents.filemanager import FileContentsManager
    from notebook.services.contents.filecheckpoints import (
        GenericFileCheckpoints
    )
    from notebook.services.contents.manager import ContentsManager
    from notebook.services.contents.tests.test_manager import (
        TestContentsManager
    )
    from notebook.services.contents.tests.test_contents_api import (
        APITest
    )
    from notebook.utils import to_os_path
    from nbformat import from_dict, reads, writes
    from nbformat.v4.nbbase import (
        new_code_cell,
        new_markdown_cell,
        new_notebook,
        new_raw_cell,
    )
    from nbformat.v4.rwbase import strip_transient
    from traitlets import (
        Any,
        Bool,
        Dict,
        Instance,
        Integer,
        HasTraits,
        Unicode,
    )

__all__ = [
    'APITest',
    'Any',
    'Bool',
    'Checkpoints',
    'Config',
    'ContentsManager',
    'Dict',
    'FileContentsManager',
    'GenericCheckpointsMixin',
    'GenericFileCheckpoints',
    'HasTraits',
    'Instance',
    'Integer',
    'TestContentsManager',
    'Unicode',
    'from_dict',
    'new_code_cell',
    'new_markdown_cell',
    'new_notebook',
    'new_raw_cell',
    'reads',
    'strip_transient',
    'to_os_path',
    'writes',
]

@@ -86,16 +86,19 @@
  = %7B3, 4
+, 5
 %7D%0AIPY_MA
@@ -241,16 +241,17 @@
 _MAJOR)%0A
+%0A
 IPY3 = (
@@ -269,32 +269,8 @@
 = 3)
-%0AIPY4 = (IPY_MAJOR == 4)
 %0A%0Aif

Allow IPython 5.