Show More
@@ -212,14 +212,13 b' class OSMagics(Magics):' | |||
|
212 | 212 | # write the whole loop for posix/Windows so we don't have an if in |
|
213 | 213 | # the innermost part |
|
214 | 214 | if self.is_posix: |
|
215 | print(path) | |
|
216 | 215 | for pdir in path: |
|
217 | 216 | try: |
|
218 | 217 | os.chdir(pdir) |
|
219 | 218 | except OSError: |
|
220 | 219 | continue |
|
221 | 220 | |
|
222 | # use with notation for python 3.6 onward | |
|
221 | # for python 3.6+ rewrite to: with os.scandir(pdir) as dirlist: | |
|
223 | 222 | dirlist = os.scandir(path=pdir) |
|
224 | 223 | for ff in dirlist: |
|
225 | 224 | if self.isexec(ff): |
@@ -242,7 +241,7 b' class OSMagics(Magics):' | |||
|
242 | 241 | except OSError: |
|
243 | 242 | continue |
|
244 | 243 | |
|
245 | # use with notation for python 3.6 onward | |
|
244 | # for python 3.6+ rewrite to: with os.scandir(pdir) as dirlist: | |
|
246 | 245 | dirlist = os.scandir(pdir) |
|
247 | 246 | for ff in dirlist: |
|
248 | 247 | fname = ff.name |
@@ -258,6 +257,7 b' class OSMagics(Magics):' | |||
|
258 | 257 | except InvalidAliasError: |
|
259 | 258 | pass |
|
260 | 259 | syscmdlist.append(fname) |
|
260 | ||
|
261 | 261 | self.shell.db['syscmdlist'] = syscmdlist |
|
262 | 262 | finally: |
|
263 | 263 | os.chdir(savedir) |
@@ -98,7 +98,7 b' def list_profiles_in(path):' | |||
|
98 | 98 | """list profiles in a given root directory""" |
|
99 | 99 | profiles = [] |
|
100 | 100 | |
|
101 | # use with notation for python 3.6 onward | |
|
101 | # for python 3.6+ rewrite to: with os.scandir(path) as dirlist: | |
|
102 | 102 | files = os.scandir(path) |
|
103 | 103 | for f in files: |
|
104 | 104 | if f.is_dir() and f.name.startswith('profile_'): |
@@ -111,7 +111,7 b' def list_bundled_profiles():' | |||
|
111 | 111 | path = os.path.join(get_ipython_package_dir(), u'core', u'profile') |
|
112 | 112 | profiles = [] |
|
113 | 113 | |
|
114 | # use with notation for python 3.6 onward | |
|
114 | # for python 3.6+ rewrite to: with os.scandir(path) as dirlist: | |
|
115 | 115 | files = os.scandir(path) |
|
116 | 116 | for profile in files: |
|
117 | 117 | if profile.is_dir() and profile.name != "__pycache__": |
General Comments 0
You need to be logged in to leave comments.
Login now