##// END OF EJS Templates
Add arguments dirs and files to the ils() constructor....
walter.doerwald -
Show More
@@ -1180,11 +1180,22 b' class ils(Table):'
1180 >>> ils("/usr/local/lib/python2.4")
1180 >>> ils("/usr/local/lib/python2.4")
1181 >>> ils("~")
1181 >>> ils("~")
1182 """
1182 """
1183 def __init__(self, base=os.curdir):
1183 def __init__(self, base=os.curdir, dirs=True, files=True):
1184 self.base = os.path.expanduser(base)
1184 self.base = os.path.expanduser(base)
1185 self.dirs = dirs
1186 self.files = files
1185
1187
1186 def __iter__(self):
1188 def __iter__(self):
1187 return xiter(ifile(self.base))
1189 for child in ifile(self.base).listdir():
1190 if self.dirs:
1191 if self.files:
1192 yield child
1193 else:
1194 if child.isdir():
1195 yield child
1196 elif self.files:
1197 if not child.isdir():
1198 yield child
1188
1199
1189 def __xrepr__(self, mode):
1200 def __xrepr__(self, mode):
1190 return ifile(self.base).__xrepr__(mode)
1201 return ifile(self.base).__xrepr__(mode)
@@ -1,3 +1,9 b''
1 2006-08-25 Walter Doerwald <walter@livinglogic.de>
2
3 * IPython/Extensions/ipipe.py (ils): Add arguments dirs and files to
4 the constructor, this makes it possible to get a list of only directories
5 or only files.
6
1 2006-08-12 Ville Vainio <vivainio@gmail.com>
7 2006-08-12 Ville Vainio <vivainio@gmail.com>
2
8
3 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
9 * Fakemodule.py, OInspect.py: Reverted 2006-08-11 mods,
General Comments 0
You need to be logged in to leave comments. Login now