Show More
@@ -48,7 +48,6 b' from IPython.core.shellapp import (' | |||||
48 | InteractiveShellApp, shell_flags, shell_aliases |
|
48 | InteractiveShellApp, shell_flags, shell_aliases | |
49 | ) |
|
49 | ) | |
50 | from IPython.frontend.terminal.interactiveshell import TerminalInteractiveShell |
|
50 | from IPython.frontend.terminal.interactiveshell import TerminalInteractiveShell | |
51 | from IPython.lib import inputhook |
|
|||
52 | from IPython.utils import warn |
|
51 | from IPython.utils import warn | |
53 | from IPython.utils.path import get_ipython_dir, check_for_old_config |
|
52 | from IPython.utils.path import get_ipython_dir, check_for_old_config | |
54 | from IPython.utils.traitlets import ( |
|
53 | from IPython.utils.traitlets import ( |
@@ -23,7 +23,6 b' import __main__' | |||||
23 |
|
23 | |||
24 | import os |
|
24 | import os | |
25 | import re |
|
25 | import re | |
26 | import shutil |
|
|||
27 | import sys |
|
26 | import sys | |
28 | import textwrap |
|
27 | import textwrap | |
29 | from string import Formatter |
|
28 | from string import Formatter | |
@@ -403,31 +402,6 b' def indent(instr,nspaces=4, ntabs=0, flatten=False):' | |||||
403 | else: |
|
402 | else: | |
404 | return outstr |
|
403 | return outstr | |
405 |
|
404 | |||
406 | def native_line_ends(filename,backup=1): |
|
|||
407 | """Convert (in-place) a file to line-ends native to the current OS. |
|
|||
408 |
|
||||
409 | If the optional backup argument is given as false, no backup of the |
|
|||
410 | original file is left. """ |
|
|||
411 |
|
||||
412 | backup_suffixes = {'posix':'~','dos':'.bak','nt':'.bak','mac':'.bak'} |
|
|||
413 |
|
||||
414 | bak_filename = filename + backup_suffixes[os.name] |
|
|||
415 |
|
||||
416 | original = open(filename).read() |
|
|||
417 | shutil.copy2(filename,bak_filename) |
|
|||
418 | try: |
|
|||
419 | new = open(filename,'wb') |
|
|||
420 | new.write(os.linesep.join(original.splitlines())) |
|
|||
421 | new.write(os.linesep) # ALWAYS put an eol at the end of the file |
|
|||
422 | new.close() |
|
|||
423 | except: |
|
|||
424 | os.rename(bak_filename,filename) |
|
|||
425 | if not backup: |
|
|||
426 | try: |
|
|||
427 | os.remove(bak_filename) |
|
|||
428 | except: |
|
|||
429 | pass |
|
|||
430 |
|
||||
431 |
|
405 | |||
432 | def list_strings(arg): |
|
406 | def list_strings(arg): | |
433 | """Always return a list of strings, given a string or list of strings |
|
407 | """Always return a list of strings, given a string or list of strings |
General Comments 0
You need to be logged in to leave comments.
Login now