diff --git a/IPython/Extensions/ipipe.py b/IPython/Extensions/ipipe.py index 7f9029a..1ff37f1 100644 --- a/IPython/Extensions/ipipe.py +++ b/IPython/Extensions/ipipe.py @@ -133,7 +133,8 @@ from IPython.external import simplegeneric from IPython.external import path try: - from IPython import genutils, generics + from IPython import genutils + from IPython.utils import generics except ImportError: genutils = None generics = None diff --git a/IPython/Extensions/ipy_fsops.py b/IPython/Extensions/ipy_fsops.py index a8cd2eb..4e2ae9f 100644 --- a/IPython/Extensions/ipy_fsops.py +++ b/IPython/Extensions/ipy_fsops.py @@ -22,6 +22,7 @@ import shutil,os,shlex from IPython.external import mglob from IPython.external.path import path from IPython.ipapi import UsageError +import IPython.utils.generics def parse_args(args): """ Given arg string 'CMD files... target', return ([files], target) """ @@ -230,7 +231,7 @@ def complete_pathobj(obj, prev_completions): # just return normal attributes of 'path' object if the dir is empty raise IPython.ipapi.TryNext -complete_pathobj = IPython.generics.complete_object.when_type(PathObj)(complete_pathobj) +complete_pathobj = IPython.utils.generics.complete_object.when_type(PathObj)(complete_pathobj) def test_pathobj(): #p = PathObj('c:/prj') diff --git a/IPython/Extensions/ipy_greedycompleter.py b/IPython/Extensions/ipy_greedycompleter.py index 38dcb29..0c74bb3 100644 --- a/IPython/Extensions/ipy_greedycompleter.py +++ b/IPython/Extensions/ipy_greedycompleter.py @@ -9,7 +9,8 @@ only whitespace as completer delimiter. If this works well, we will do the same in default completer. """ -from IPython import generics,ipapi +from IPython import ipapi +from IPython.utils import generics from IPython.genutils import dir2 def attr_matches(self, text): diff --git a/IPython/Magic.py b/IPython/Magic.py index ab93cf5..6bd84a7 100644 --- a/IPython/Magic.py +++ b/IPython/Magic.py @@ -52,7 +52,7 @@ from IPython.ipstruct import Struct from IPython.macro import Macro from IPython.genutils import * from IPython import platutils -import IPython.generics +import IPython.utils.generics import IPython.ipapi from IPython.ipapi import UsageError from IPython.testing import decorators as testdec @@ -718,7 +718,7 @@ Currently the magic system has the following functions:\n""" if info.found: try: - IPython.generics.inspect_object(info.obj) + IPython.utils.generics.inspect_object(info.obj) return except IPython.ipapi.TryNext: pass diff --git a/IPython/Prompts.py b/IPython/Prompts.py index 8ad8db1..7299055 100644 --- a/IPython/Prompts.py +++ b/IPython/Prompts.py @@ -26,6 +26,7 @@ from IPython.external.Itpl import ItplNS from IPython.ipapi import TryNext from IPython.ipstruct import Struct from IPython.macro import Macro +import IPython.utils.generics from IPython.genutils import * @@ -573,7 +574,7 @@ class CachedOutput: display, e.g. when your own objects need special formatting. """ try: - return IPython.generics.result_display(arg) + return IPython.utils.generics.result_display(arg) except TryNext: return self.shell.hooks.result_display(arg) diff --git a/IPython/core/completer.py b/IPython/core/completer.py index b8b5334..f51da08 100644 --- a/IPython/core/completer.py +++ b/IPython/core/completer.py @@ -74,7 +74,7 @@ import IPython.rlineimpl as readline import itertools from IPython.ipstruct import Struct from IPython import ipapi -from IPython import generics +from IPython.utils import generics import types # Python 2.4 offers sets as a builtin diff --git a/IPython/genutils.py b/IPython/genutils.py index ee0ef66..6fc5a6a 100644 --- a/IPython/genutils.py +++ b/IPython/genutils.py @@ -49,7 +49,7 @@ import IPython from IPython.Itpl import Itpl,itpl,printpl from IPython import platutils from IPython.utils import DPyGetOpt -from IPython.generics import result_display +from IPython.utils.generics import result_display import IPython.ipapi from IPython.external.path import path if os.name == "nt": diff --git a/IPython/kernel/core/prompts.py b/IPython/kernel/core/prompts.py index 8815881..5d9017c 100644 --- a/IPython/kernel/core/prompts.py +++ b/IPython/kernel/core/prompts.py @@ -31,6 +31,7 @@ from IPython.utils import coloransi from IPython import Release from IPython.ipapi import TryNext from IPython.genutils import * +import IPython.utils.generics #**************************************************************************** #Color schemes for Prompts. @@ -531,7 +532,7 @@ class CachedOutput: display, e.g. when your own objects need special formatting. """ try: - return IPython.generics.result_display(arg) + return IPython.utils.generics.result_display(arg) except TryNext: return self.shell.hooks.result_display(arg) diff --git a/IPython/generics.py b/IPython/utils/generics.py similarity index 100% rename from IPython/generics.py rename to IPython/utils/generics.py diff --git a/IPython/utils/tests/test_imports.py b/IPython/utils/tests/test_imports.py index 4be75e8..ebd3577 100644 --- a/IPython/utils/tests/test_imports.py +++ b/IPython/utils/tests/test_imports.py @@ -7,3 +7,6 @@ def test_import_coloransi(): def test_import_DPyGetOpt(): from IPython.utils import DPyGetOpt +def test_import_generics(): + from IPython.utils import generics + diff --git a/docs/source/development/reorg.txt b/docs/source/development/reorg.txt index 4a372e2..0226556 100644 --- a/docs/source/development/reorg.txt +++ b/docs/source/development/reorg.txt @@ -107,8 +107,12 @@ Where things will be moved * :file:`dtutils.py`. Move to :file:`IPython.deathrow`. +* :file:`excolors.py`. Move to :file:`IPython.core` or :file:`IPython.config`. + Maybe move to :mod:`IPython.lib` or :mod:`IPython.python`? + * :file:`FakeModule.py`. Move to :file:`IPython/core/fakemodule.py`. +* :file:`generics.py`. Move to :file:`IPython.python`. * :file:`Extensions`. This needs to be gone through separately. Minimally, the package should be renamed to :file:`extensions`. @@ -149,17 +153,10 @@ Where things will be moved * :file:`config`. Good where it is! - - - -* :file:`excolors.py`. Move to :file:`IPython.core` or :file:`IPython.config`. - Maybe move to :mod:`IPython.lib` or :mod:`IPython.python`? - * :file:`external`. Good where it is! * :file:`frontend`. Good where it is! -* :file:`generics.py`. Move to :file:`IPython.python`. * :file:`genutils.py`. Move to :file:`IPython.python` and break up into different modules.