##// END OF EJS Templates
use pathlib for utils.text.paths...
Min RK -
Show More
@@ -19,7 +19,11 b' import random'
19 19 import sys
20 20
21 21 import nose.tools as nt
22 import path
22 try:
23 from pathlib import Path
24 except ImportError:
25 # Python 2 backport
26 from pathlib2 import Path
23 27
24 28 from IPython.utils import text
25 29
@@ -207,7 +211,7 b' def test_LSString():'
207 211 nt.assert_equal(lss.l, ['abc', 'def'])
208 212 nt.assert_equal(lss.s, 'abc def')
209 213 lss = text.LSString(os.getcwd())
210 nt.assert_is_instance(lss.p[0], path.path)
214 nt.assert_is_instance(lss.p[0], Path)
211 215
212 216 def test_SList():
213 217 sl = text.SList(['a 11', 'b 1', 'a 2'])
@@ -14,6 +14,11 b' import re'
14 14 import sys
15 15 import textwrap
16 16 from string import Formatter
17 try:
18 from pathlib import Path
19 except ImportError:
20 # Python 2 backport
21 from pathlib2 import Path
17 22
18 23 from IPython.testing.skipdoctest import skip_doctest_py3, skip_doctest
19 24 from IPython.utils import py3compat
@@ -64,11 +69,10 b' class LSString(str):'
64 69 n = nlstr = property(get_nlstr)
65 70
66 71 def get_paths(self):
67 from path import path
68 72 try:
69 73 return self.__paths
70 74 except AttributeError:
71 self.__paths = [path(p) for p in self.split('\n') if os.path.exists(p)]
75 self.__paths = [Path(p) for p in self.split('\n') if os.path.exists(p)]
72 76 return self.__paths
73 77
74 78 p = paths = property(get_paths)
@@ -123,11 +127,10 b' class SList(list):'
123 127 n = nlstr = property(get_nlstr)
124 128
125 129 def get_paths(self):
126 from path import path
127 130 try:
128 131 return self.__paths
129 132 except AttributeError:
130 self.__paths = [path(p) for p in self if os.path.exists(p)]
133 self.__paths = [Path(p) for p in self if os.path.exists(p)]
131 134 return self.__paths
132 135
133 136 p = paths = property(get_paths)
@@ -182,7 +182,7 b' extras_require = dict('
182 182 parallel = ['ipyparallel'],
183 183 qtconsole = ['qtconsole'],
184 184 doc = ['Sphinx>=1.3'],
185 test = ['nose>=0.10.1', 'requests', 'testpath', 'pygments', 'path.py'],
185 test = ['nose>=0.10.1', 'requests', 'testpath', 'pygments'],
186 186 terminal = [],
187 187 kernel = ['ipykernel'],
188 188 nbformat = ['nbformat'],
@@ -205,6 +205,7 b' install_requires = ['
205 205 # but requires pip >= 6. pip < 6 ignores these.
206 206
207 207 extras_require.update({
208 ':python_version == "2.7" or python_version == "3.3"': ['pathlib2'],
208 209 ':sys_platform != "win32"': ['pexpect'],
209 210 ':sys_platform == "darwin"': ['appnope'],
210 211 ':sys_platform == "win32"': ['colorama'],
General Comments 0
You need to be logged in to leave comments. Login now