Show More
@@ -24,6 +24,7 b' import time' | |||
|
24 | 24 | # Our own packages |
|
25 | 25 | import IPython.utils.io |
|
26 | 26 | |
|
27 | from IPython.testing import decorators as testdec | |
|
27 | 28 | from IPython.utils.pickleshare import PickleShareDB |
|
28 | 29 | from IPython.utils.io import ask_yes_no |
|
29 | 30 | from IPython.utils.warn import warn |
@@ -305,6 +306,7 b' class HistorySaveThread(threading.Thread):' | |||
|
305 | 306 | self.exit_now.set() |
|
306 | 307 | self.join() |
|
307 | 308 | |
|
309 | @testdec.skip_doctest | |
|
308 | 310 | def magic_history(self, parameter_s = ''): |
|
309 | 311 | """Print input history (_i<n> variables), with most recent last. |
|
310 | 312 | |
@@ -347,6 +349,15 b" def magic_history(self, parameter_s = ''):" | |||
|
347 | 349 | -f FILENAME: instead of printing the output to the screen, redirect it to |
|
348 | 350 | the given file. The file is always overwritten, though IPython asks for |
|
349 | 351 | confirmation first if it already exists. |
|
352 | ||
|
353 | Examples | |
|
354 | -------- | |
|
355 | :: | |
|
356 | ||
|
357 | In [6]: %hist -n 4 6 | |
|
358 | 4:a = 12 | |
|
359 | 5:print a**2 | |
|
360 | ||
|
350 | 361 | """ |
|
351 | 362 | |
|
352 | 363 | if not self.shell.displayhook.do_full_cache: |
@@ -575,10 +575,19 b' Currently the magic system has the following functions:\\n"""' | |||
|
575 | 575 | self.shell._inspect('pinfo', parameter_s, detail_level=1, |
|
576 | 576 | namespaces=namespaces) |
|
577 | 577 | |
|
578 | @testdec.skip_doctest | |
|
578 | 579 | def magic_pdef(self, parameter_s='', namespaces=None): |
|
579 | 580 | """Print the definition header for any callable object. |
|
580 | 581 | |
|
581 |
If the object is a class, print the constructor information. |
|
|
582 | If the object is a class, print the constructor information. | |
|
583 | ||
|
584 | Examples | |
|
585 | -------- | |
|
586 | :: | |
|
587 | ||
|
588 | In [3]: %pdef urllib.urlopen | |
|
589 | urllib.urlopen(url, data=None, proxies=None) | |
|
590 | """ | |
|
582 | 591 | self._inspect('pdef',parameter_s, namespaces) |
|
583 | 592 | |
|
584 | 593 | def magic_pdoc(self, parameter_s='', namespaces=None): |
@@ -2423,7 +2432,14 b' Currently the magic system has the following functions:\\n"""' | |||
|
2423 | 2432 | |
|
2424 | 2433 | Currently implemented schemes: NoColor, Linux, LightBG. |
|
2425 | 2434 | |
|
2426 |
Color scheme names are not case-sensitive. |
|
|
2435 | Color scheme names are not case-sensitive. | |
|
2436 | ||
|
2437 | Examples | |
|
2438 | -------- | |
|
2439 | To get a plain black and white terminal:: | |
|
2440 | ||
|
2441 | %colors nocolor | |
|
2442 | """ | |
|
2427 | 2443 | |
|
2428 | 2444 | def color_switch_err(name): |
|
2429 | 2445 | warn('Error changing %s color schemes.\n%s' % |
@@ -2660,11 +2676,21 b' Defaulting color scheme to \'NoColor\'"""' | |||
|
2660 | 2676 | db['syscmdlist'] = syscmdlist |
|
2661 | 2677 | finally: |
|
2662 | 2678 | os.chdir(savedir) |
|
2663 |
|
|
|
2679 | ||
|
2680 | @testdec.skip_doctest | |
|
2664 | 2681 | def magic_pwd(self, parameter_s = ''): |
|
2665 |
"""Return the current working directory path. |
|
|
2682 | """Return the current working directory path. | |
|
2683 | ||
|
2684 | Examples | |
|
2685 | -------- | |
|
2686 | :: | |
|
2687 | ||
|
2688 | In [9]: pwd | |
|
2689 | Out[9]: '/home/tsuser/sprint/ipython' | |
|
2690 | """ | |
|
2666 | 2691 | return os.getcwd() |
|
2667 | ||
|
2692 | ||
|
2693 | @testdec.skip_doctest | |
|
2668 | 2694 | def magic_cd(self, parameter_s=''): |
|
2669 | 2695 | """Change the current working directory. |
|
2670 | 2696 | |
@@ -2695,7 +2721,15 b' Defaulting color scheme to \'NoColor\'"""' | |||
|
2695 | 2721 | since the default prompts do not display path information. |
|
2696 | 2722 | |
|
2697 | 2723 | Note that !cd doesn't work for this purpose because the shell where |
|
2698 |
!command runs is immediately discarded after executing 'command'. |
|
|
2724 | !command runs is immediately discarded after executing 'command'. | |
|
2725 | ||
|
2726 | Examples | |
|
2727 | -------- | |
|
2728 | :: | |
|
2729 | ||
|
2730 | In [10]: cd parent/child | |
|
2731 | /home/tsuser/parent/child | |
|
2732 | """ | |
|
2699 | 2733 | |
|
2700 | 2734 | parameter_s = parameter_s.strip() |
|
2701 | 2735 | #bkms = self.shell.persist.get("bookmarks",{}) |
@@ -545,6 +545,17 b' class TerminalInteractiveShell(InteractiveShell):' | |||
|
545 | 545 | See also |
|
546 | 546 | -------- |
|
547 | 547 | paste: automatically pull code from clipboard. |
|
548 | ||
|
549 | Examples | |
|
550 | -------- | |
|
551 | :: | |
|
552 | ||
|
553 | In [8]: %cpaste | |
|
554 | Pasting code; enter '--' alone on the line to stop. | |
|
555 | :>>> a = ["world!", "Hello"] | |
|
556 | :>>> print " ".join(sorted(a)) | |
|
557 | :-- | |
|
558 | Hello world! | |
|
548 | 559 | """ |
|
549 | 560 | |
|
550 | 561 | opts,args = self.parse_options(parameter_s,'rs:',mode='string') |
General Comments 0
You need to be logged in to leave comments.
Login now