Show More
@@ -24,7 +24,6 b' from IPython.testing.skipdoctest import skip_doctest' | |||
|
24 | 24 | from IPython.utils.openpy import source_to_unicode |
|
25 | 25 | from IPython.utils.process import abbrev_cwd |
|
26 | 26 | from IPython.utils.terminal import set_term_title |
|
27 | from os import DirEntry | |
|
28 | 27 | |
|
29 | 28 | |
|
30 | 29 | @magics_class |
@@ -35,7 +34,7 b' class OSMagics(Magics):' | |||
|
35 | 34 | def __init__(self, shell=None, **kwargs): |
|
36 | 35 | |
|
37 | 36 | # Now define isexec in a cross platform manner. |
|
38 |
self.is_posix |
|
|
37 | self.is_posix = False | |
|
39 | 38 | self.execre = None |
|
40 | 39 | if os.name == 'posix': |
|
41 | 40 | self.is_posix = True |
@@ -52,29 +51,29 b' class OSMagics(Magics):' | |||
|
52 | 51 | |
|
53 | 52 | |
|
54 | 53 | @skip_doctest |
|
55 |
def _isexec_POSIX(self, f |
|
|
54 | def _isexec_POSIX(self, file): | |
|
56 | 55 | """ |
|
57 | 56 | Test for executible on a POSIX system |
|
58 | 57 | """ |
|
59 | return f.is_file() and os.access(f.path, os.X_OK) | |
|
58 | return file.is_file() and os.access(file.path, os.X_OK) | |
|
60 | 59 | |
|
61 | 60 | |
|
62 | 61 | @skip_doctest |
|
63 |
def _isexec_WIN(self, f |
|
|
62 | def _isexec_WIN(self, file): | |
|
64 | 63 | """ |
|
65 | 64 | Test for executible file on non POSIX system |
|
66 | 65 | """ |
|
67 | return f.is_file() and self.execre.match(f.name) is not None | |
|
66 | return file.is_file() and self.execre.match(file.name) is not None | |
|
68 | 67 | |
|
69 | 68 | @skip_doctest |
|
70 |
def isexec(self, f |
|
|
69 | def isexec(self, file): | |
|
71 | 70 | """ |
|
72 | 71 | Test for executible file on non POSIX system |
|
73 | 72 | """ |
|
74 | 73 | if self.is_posix: |
|
75 | return self._isexec_POSIX(f) | |
|
74 | return self._isexec_POSIX(file) | |
|
76 | 75 | else: |
|
77 | return self._isexec_WIN(f) | |
|
76 | return self._isexec_WIN(file) | |
|
78 | 77 | |
|
79 | 78 | |
|
80 | 79 | @skip_doctest |
@@ -212,7 +211,7 b' class OSMagics(Magics):' | |||
|
212 | 211 | try: |
|
213 | 212 | # write the whole loop for posix/Windows so we don't have an if in |
|
214 | 213 | # the innermost part |
|
215 |
if |
|
|
214 | if self.is_posix: | |
|
216 | 215 | for pdir in path: |
|
217 | 216 | try: |
|
218 | 217 | os.chdir(pdir) |
General Comments 0
You need to be logged in to leave comments.
Login now