Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d37c42a

Browse files
committed
generics.py => utils/generics.py
1 parent 5a7d5d3 commit d37c42a

11 files changed

Lines changed: 21 additions & 16 deletions

File tree

IPython/Extensions/ipipe.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ def sorted(iterator, key=None, reverse=False):
133133
from IPython.external import path
134134

135135
try:
136-
from IPython import genutils, generics
136+
from IPython import genutils
137+
from IPython.utils import generics
137138
except ImportError:
138139
genutils = None
139140
generics = None

IPython/Extensions/ipy_fsops.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from IPython.external import mglob
2323
from IPython.external.path import path
2424
from IPython.ipapi import UsageError
25+
import IPython.utils.generics
2526

2627
def parse_args(args):
2728
""" Given arg string 'CMD files... target', return ([files], target) """
@@ -230,7 +231,7 @@ def complete_pathobj(obj, prev_completions):
230231
# just return normal attributes of 'path' object if the dir is empty
231232
raise IPython.ipapi.TryNext
232233

233-
complete_pathobj = IPython.generics.complete_object.when_type(PathObj)(complete_pathobj)
234+
complete_pathobj = IPython.utils.generics.complete_object.when_type(PathObj)(complete_pathobj)
234235

235236
def test_pathobj():
236237
#p = PathObj('c:/prj')

IPython/Extensions/ipy_greedycompleter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
do the same in default completer.
1010
1111
"""
12-
from IPython import generics,ipapi
12+
from IPython import ipapi
13+
from IPython.utils import generics
1314
from IPython.genutils import dir2
1415

1516
def attr_matches(self, text):

IPython/Magic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
from IPython.macro import Macro
5353
from IPython.genutils import *
5454
from IPython import platutils
55-
import IPython.generics
55+
import IPython.utils.generics
5656
import IPython.ipapi
5757
from IPython.ipapi import UsageError
5858
from IPython.testing import decorators as testdec
@@ -718,7 +718,7 @@ def _inspect(self,meth,oname,namespaces=None,**kw):
718718

719719
if info.found:
720720
try:
721-
IPython.generics.inspect_object(info.obj)
721+
IPython.utils.generics.inspect_object(info.obj)
722722
return
723723
except IPython.ipapi.TryNext:
724724
pass

IPython/Prompts.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from IPython.ipapi import TryNext
2727
from IPython.ipstruct import Struct
2828
from IPython.macro import Macro
29+
import IPython.utils.generics
2930

3031
from IPython.genutils import *
3132

@@ -573,7 +574,7 @@ def _display(self,arg):
573574
display, e.g. when your own objects need special formatting.
574575
"""
575576
try:
576-
return IPython.generics.result_display(arg)
577+
return IPython.utils.generics.result_display(arg)
577578
except TryNext:
578579
return self.shell.hooks.result_display(arg)
579580

IPython/core/completer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
import itertools
7575
from IPython.ipstruct import Struct
7676
from IPython import ipapi
77-
from IPython import generics
77+
from IPython.utils import generics
7878
import types
7979

8080
# Python 2.4 offers sets as a builtin

IPython/genutils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
from IPython.Itpl import Itpl,itpl,printpl
5050
from IPython import platutils
5151
from IPython.utils import DPyGetOpt
52-
from IPython.generics import result_display
52+
from IPython.utils.generics import result_display
5353
import IPython.ipapi
5454
from IPython.external.path import path
5555
if os.name == "nt":

IPython/kernel/core/prompts.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
from IPython import Release
3232
from IPython.ipapi import TryNext
3333
from IPython.genutils import *
34+
import IPython.utils.generics
3435

3536
#****************************************************************************
3637
#Color schemes for Prompts.
@@ -531,7 +532,7 @@ def _display(self,arg):
531532
display, e.g. when your own objects need special formatting.
532533
"""
533534
try:
534-
return IPython.generics.result_display(arg)
535+
return IPython.utils.generics.result_display(arg)
535536
except TryNext:
536537
return self.shell.hooks.result_display(arg)
537538

IPython/utils/tests/test_imports.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ def test_import_coloransi():
77
def test_import_DPyGetOpt():
88
from IPython.utils import DPyGetOpt
99

10+
def test_import_generics():
11+
from IPython.utils import generics
12+

0 commit comments

Comments
 (0)