Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Doc magic pdef #229

Closed
wants to merge 2 commits into from

2 participants

@vsowjanya

Added examples to "%pdef" as part of SciPy.in 2010 lndia sprint

vsowjanya added some commits
@vsowjanya vsowjanya Wrote 'usage' for 'colors' command
Work done as a team by:
 -- V Sowjanya <hai.sowjanya@gmail.com>
 -- N Rajender Reddy <raj.rajender007@gmail.com>
 -- R Srikanth <sri.rajan143@gmail.com>
aac03fd
@vsowjanya vsowjanya Wrote two examples for 'pdef'
Work done as a team by:
   -- V Sowjanya <hai.sowjanya@gmail.com>
   -- N Rajender Reddy <raj.rajender007@gmail.com>
   -- R Srikanth <sri.rajan143@gmail.com>
3911f0a
@takluyver takluyver commented on the diff
IPython/core/magic.py
@@ -2432,7 +2458,10 @@ Defaulting color scheme to 'NoColor'"""
['OFF','ON'][self.shell.pprint]
def magic_Exit(self, parameter_s=''):
- """Exit IPython."""
+ """
+ examples
@takluyver Owner

This bit is superfluous.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@takluyver takluyver commented on the diff
IPython/core/magic.py
@@ -2366,7 +2378,21 @@ Currently the magic system has the following functions:\n"""
Currently implemented schemes: NoColor, Linux, LightBG.
- Color scheme names are not case-sensitive."""
+ Color scheme names are not case-sensitive.
+
+ Usage
+ ------
+ %colors nocolor # It changes the color scheme for prompts, info system and exception handlers.Thus prompts, etc..
+
+ will be displayed as normal text.
+
+ %usage lightbg # It changes the color scheme for prompts, info system and exception handlers to light blue color.
@takluyver Owner

These should probably be %colors. But I think one example (with a short comment) is enough, anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@takluyver takluyver commented on the diff
IPython/core/magic.py
@@ -578,7 +578,19 @@ Currently the magic system has the following functions:\n"""
def magic_pdef(self, parameter_s='', namespaces=None):
"""Print the definition header for any callable object.
- If the object is a class, print the constructor information."""
+ If the object is a class, print the constructor information.
+
+ Examples
+ --------
+ In [6]: %pdef hist
+ hist(self, parameter_s='')
@takluyver Owner

Let's do the example inspecting a user defined function, rather than a magic function from IPython.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@takluyver
Owner

%pdef and %colors examples were merged into pull request #272. Thanks for this!

@damianavila damianavila referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 18, 2010
  1. @vsowjanya

    Wrote 'usage' for 'colors' command

    vsowjanya authored
    Work done as a team by:
     -- V Sowjanya <hai.sowjanya@gmail.com>
     -- N Rajender Reddy <raj.rajender007@gmail.com>
     -- R Srikanth <sri.rajan143@gmail.com>
  2. @vsowjanya

    Wrote two examples for 'pdef'

    vsowjanya authored
    Work done as a team by:
       -- V Sowjanya <hai.sowjanya@gmail.com>
       -- N Rajender Reddy <raj.rajender007@gmail.com>
       -- R Srikanth <sri.rajan143@gmail.com>
This page is out of date. Refresh to see the latest.
Showing with 32 additions and 3 deletions.
  1. +32 −3 IPython/core/magic.py
View
35 IPython/core/magic.py
@@ -578,7 +578,19 @@ def magic_pinfo2(self, parameter_s='', namespaces=None):
def magic_pdef(self, parameter_s='', namespaces=None):
"""Print the definition header for any callable object.
- If the object is a class, print the constructor information."""
+ If the object is a class, print the constructor information.
+
+ Examples
+ --------
+ In [6]: %pdef hist
+ hist(self, parameter_s='')
@takluyver Owner

Let's do the example inspecting a user defined function, rather than a magic function from IPython.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+
+ In [7]: %pdef pinfo
+ pinfo(self, parameter_s='', namespaces=None)
+
+
+
+ """
self._inspect('pdef',parameter_s, namespaces)
def magic_pdoc(self, parameter_s='', namespaces=None):
@@ -2366,7 +2378,21 @@ def magic_colors(self,parameter_s = ''):
Currently implemented schemes: NoColor, Linux, LightBG.
- Color scheme names are not case-sensitive."""
+ Color scheme names are not case-sensitive.
+
+ Usage
+ ------
+ %colors nocolor # It changes the color scheme for prompts, info system and exception handlers.Thus prompts, etc..
+
+ will be displayed as normal text.
+
+ %usage lightbg # It changes the color scheme for prompts, info system and exception handlers to light blue color.
@takluyver Owner

These should probably be %colors. But I think one example (with a short comment) is enough, anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+
+ %usage linux # It changes the color scheme for prompts, info system and exception handlers to green color.
+
+
+
+ """
def color_switch_err(name):
warn('Error changing %s color schemes.\n%s' %
@@ -2432,7 +2458,10 @@ def magic_Pprint(self, parameter_s=''):
['OFF','ON'][self.shell.pprint]
def magic_Exit(self, parameter_s=''):
- """Exit IPython."""
+ """
+ examples
@takluyver Owner

This bit is superfluous.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+
+ Exit IPython."""
self.shell.ask_exit()
Something went wrong with that request. Please try again.