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