Boost logo

Boost-Commit :

From: nickm_at_[hidden]
Date: 2007-09-18 13:32:07


Author: nikiml
Date: 2007-09-18 13:32:06 EDT (Tue, 18 Sep 2007)
New Revision: 39371
URL: http://svn.boost.org/trac/boost/changeset/39371

Log:
epydoc friendlier formatting
Text files modified:
   trunk/libs/python/test/args.py | 25 +++---
   trunk/libs/python/test/auto_ptr.py | 24 +++---
   trunk/libs/python/test/back_reference.py | 4
   trunk/libs/python/test/defaults.py | 29 ++++---
   trunk/libs/python/test/docstring.py | 143 ++++++++++++++++++++++-----------------
   trunk/libs/python/test/implicit.py | 16 ++--
   trunk/libs/python/test/keywords_test.py | 6 +
   trunk/libs/python/test/newtest.py | 4
   trunk/libs/python/test/pytype_function.py | 2
   9 files changed, 138 insertions(+), 115 deletions(-)

Modified: trunk/libs/python/test/args.py
==============================================================================
--- trunk/libs/python/test/args.py (original)
+++ trunk/libs/python/test/args.py 2007-09-18 13:32:06 EDT (Tue, 18 Sep 2007)
@@ -84,24 +84,27 @@
 (2, 4.25, 'wow')
>>> q.f1()
 (1, 4.25, 'wow')
->>> q.f2.__doc__.splitlines()[-3]
-"f2( (X)self [, (int)x [, (float)y [, (str)z]]]) -> tuple : f2's docstring"
+>>> q.f2.__doc__.splitlines()[1]
+'f2( (X)self [, (int)x [, (float)y [, (str)z]]]) -> tuple :'
 
->>> X.f.__doc__.splitlines()[:2]
-["f( (X)self, (int)x, (float)y, (str)z) -> tuple : This is X.f's docstring", ' C++ signature:']
+>>> q.f2.__doc__.splitlines()[2]
+" f2's docstring"
+
+>>> X.f.__doc__.splitlines()[1:5]
+['f( (X)self, (int)x, (float)y, (str)z) -> tuple :', " This is X.f's docstring", '', ' C++ signature :']
 
>>> xfuncs = (X.inner0, X.inner1, X.inner2, X.inner3, X.inner4, X.inner5)
>>> for f in xfuncs:
 ... print f(q,1).value(),
 ... print f(q, n = 1).value(),
 ... print f(q, n = 0).value(),
-... print f.__doc__.splitlines()[:2]
-1 1 0 ['inner0( (X)self, (bool)n) -> Y : docstring', ' C++ signature:']
-1 1 0 ['inner1( (X)self, (bool)n) -> Y : docstring', ' C++ signature:']
-1 1 0 ['inner2( (X)self, (bool)n) -> Y : docstring', ' C++ signature:']
-1 1 0 ['inner3( (X)self, (bool)n) -> Y : docstring', ' C++ signature:']
-1 1 0 ['inner4( (X)self, (bool)n) -> Y : docstring', ' C++ signature:']
-1 1 0 ['inner5( (X)self, (bool)n) -> Y : docstring', ' C++ signature:']
+... print f.__doc__.splitlines()[1:5]
+1 1 0 ['inner0( (X)self, (bool)n) -> Y :', ' docstring', '', ' C++ signature :']
+1 1 0 ['inner1( (X)self, (bool)n) -> Y :', ' docstring', '', ' C++ signature :']
+1 1 0 ['inner2( (X)self, (bool)n) -> Y :', ' docstring', '', ' C++ signature :']
+1 1 0 ['inner3( (X)self, (bool)n) -> Y :', ' docstring', '', ' C++ signature :']
+1 1 0 ['inner4( (X)self, (bool)n) -> Y :', ' docstring', '', ' C++ signature :']
+1 1 0 ['inner5( (X)self, (bool)n) -> Y :', ' docstring', '', ' C++ signature :']
 
>>> x = X(a1 = 44, a0 = 22)
>>> x.inner0(0).value()

Modified: trunk/libs/python/test/auto_ptr.py
==============================================================================
--- trunk/libs/python/test/auto_ptr.py (original)
+++ trunk/libs/python/test/auto_ptr.py 2007-09-18 13:32:06 EDT (Tue, 18 Sep 2007)
@@ -64,23 +64,23 @@
 ... except TypeError: pass
 ... else: print 'expected a TypeError exception'
 
->>> print look.__doc__.splitlines()[0]
-look( (X)arg1) -> int :
+>>> print look.__doc__.splitlines()[1]
+look( (X)arg1) -> int :
 
->>> print steal.__doc__.splitlines()[0]
-steal( (X)arg1) -> int :
+>>> print steal.__doc__.splitlines()[1]
+steal( (X)arg1) -> int :
 
->>> print maybe_steal.__doc__.splitlines()[0]
-maybe_steal( (X)arg1, (bool)arg2) -> int :
+>>> print maybe_steal.__doc__.splitlines()[1]
+maybe_steal( (X)arg1, (bool)arg2) -> int :
 
->>> print make.__doc__.splitlines()[0]
-make() -> X :
+>>> print make.__doc__.splitlines()[1]
+make() -> X :
 
->>> print callback.__doc__.splitlines()[0]
-callback( (object)arg1) -> X :
+>>> print callback.__doc__.splitlines()[1]
+callback( (object)arg1) -> X :
 
->>> print extract.__doc__.splitlines()[0]
-extract( (object)arg1) -> X :
+>>> print extract.__doc__.splitlines()[1]
+extract( (object)arg1) -> X :
 
 '''
 

Modified: trunk/libs/python/test/back_reference.py
==============================================================================
--- trunk/libs/python/test/back_reference.py (original)
+++ trunk/libs/python/test/back_reference.py 2007-09-18 13:32:06 EDT (Tue, 18 Sep 2007)
@@ -17,8 +17,8 @@
>>> y_equality(y, y)
 1
 
->>> print y_identity.__doc__.splitlines()[0]
-y_identity( (Y)arg1) -> object :
+>>> print y_identity.__doc__.splitlines()[1]
+y_identity( (Y)arg1) -> object :
 '''
 
 def run(args = None):

Modified: trunk/libs/python/test/defaults.py
==============================================================================
--- trunk/libs/python/test/defaults.py (original)
+++ trunk/libs/python/test/defaults.py 2007-09-18 13:32:06 EDT (Tue, 18 Sep 2007)
@@ -113,19 +113,22 @@
 ... doc = obj.__doc__.splitlines()
 ... return "\\n".join(["|"+doc[i] for i in args])
 
->>> print selected_doc(X.__init__, 0, 1, 3, 4)
-|__init__( (object)self [, (int)a [, (str)b [, (str)c [, (float)d]]]]) -> None : doc of init
-| C++ signature:
-| __init__( (object)self, (str)s, (bool)b) -> None :
-| C++ signature:
-
->>> print selected_doc(Y.__init__, 0, 1)
-|__init__( (object)arg1) -> None : doc of Y init
-| C++ signature:
-
->>> print selected_doc(X.bar2, 0, 1)
-|bar2( (X)arg1 [, (int)arg2 [, (str)arg3 [, (str)arg4 [, (float)arg5]]]]) -> Y : doc of X::bar2
-| C++ signature:
+>>> print selected_doc(X.__init__, 1, 2, 4, 7, 9)
+|__init__( (object)self [, (int)a [, (str)b [, (str)c [, (float)d]]]]) -> None :
+| doc of init
+| C++ signature :
+|__init__( (object)self, (str)s, (bool)b) -> None :
+| C++ signature :
+
+>>> print selected_doc(Y.__init__, 1, 2, 4)
+|__init__( (object)arg1) -> None :
+| doc of Y init
+| C++ signature :
+
+>>> print selected_doc(X.bar2, 1, 2, 4)
+|bar2( (X)arg1 [, (int)arg2 [, (str)arg3 [, (str)arg4 [, (float)arg5]]]]) -> Y :
+| doc of X::bar2
+| C++ signature :
 
 """
 def run(args = None):

Modified: trunk/libs/python/test/docstring.py
==============================================================================
--- trunk/libs/python/test/docstring.py (original)
+++ trunk/libs/python/test/docstring.py 2007-09-18 13:32:06 EDT (Tue, 18 Sep 2007)
@@ -8,98 +8,113 @@
 ... doc = obj.__doc__.splitlines()
 ... return "\\n".join(["|"+doc[i] for i in args])
 
->>> print selected_doc(X.__init__, 0, 1, 2)
-|__init__( (object)self, (int)value) -> None : this is the __init__ function
-|its documentation has two lines.
-| C++ signature:
-
->>> print selected_doc(X.value, 0, 1, 3, 4)
-|value( (X)self) -> int : gets the value of the object
-| C++ signature:
-| value( (X)self) -> int : also gets the value of the object
-| C++ signature:
-
->>> print selected_doc(create, 0, 1)
-|create( (int)value) -> X : creates a new X object
-| C++ signature:
-
->>> print selected_doc(fact, 0, 1)
-|fact( (int)n) -> int : compute the factorial
-| C++ signature:
+>>> print selected_doc(X.__init__, 1, 2, 3, 4, 5)
+|__init__( (object)self, (int)value) -> None :
+| this is the __init__ function
+| its documentation has two lines.
+|
+| C++ signature :
+
+>>> print selected_doc(X.value, 1, 2, 4, 7, 8, 10)
+|value( (X)self) -> int :
+| gets the value of the object
+| C++ signature :
+|value( (X)self) -> int :
+| also gets the value of the object
+| C++ signature :
+
+>>> print selected_doc(create, 1, 2, 3, 4)
+|create( (int)value) -> X :
+| creates a new X object
+|
+| C++ signature :
+
+>>> print selected_doc(fact, 1, 2, 3, 4)
+|fact( (int)n) -> int :
+| compute the factorial
+|
+| C++ signature :
 
>>> len(fact_usr_off_1.__doc__.splitlines())
-3
->>> print selected_doc(fact_usr_off_1, 0, 1)
-|fact_usr_off_1( (int)n) -> int :
-| C++ signature:
+5
+>>> print selected_doc(fact_usr_off_1, 1, 3)
+|fact_usr_off_1( (int)n) -> int :
+| C++ signature :
>>> len(fact_usr_on_1.__doc__.splitlines())
-3
->>> print selected_doc(fact_usr_on_1, 0, 1)
-|fact_usr_on_1( (int)n) -> int : usr on 1
-| C++ signature:
+6
+>>> print selected_doc(fact_usr_on_1, 1, 2, 4)
+|fact_usr_on_1( (int)n) -> int :
+| usr on 1
+| C++ signature :
>>> len(fact_usr_off_2.__doc__.splitlines())
-3
->>> print selected_doc(fact_usr_off_2, 0,1)
-|fact_usr_off_2( (int)n) -> int :
-| C++ signature:
+5
+>>> print selected_doc(fact_usr_off_2, 1, 3)
+|fact_usr_off_2( (int)n) -> int :
+| C++ signature :
>>> len(fact_usr_on_2.__doc__.splitlines())
-3
->>> print selected_doc(fact_usr_on_2, 0, 1)
-|fact_usr_on_2( (int)n) -> int : usr on 2
-| C++ signature:
+6
+>>> print selected_doc(fact_usr_on_2, 1, 2, 4)
+|fact_usr_on_2( (int)n) -> int :
+| usr on 2
+| C++ signature :
 
 
>>> len(fact_sig_off_1.__doc__.splitlines())
-1
->>> print selected_doc(fact_sig_off_1, 0)
+2
+>>> print selected_doc(fact_sig_off_1, 1)
 |sig off 1
>>> len(fact_sig_on_1.__doc__.splitlines())
-3
->>> print selected_doc(fact_sig_on_1, 0, 1)
-|fact_sig_on_1( (int)n) -> int : sig on 1
-| C++ signature:
+6
+>>> print selected_doc(fact_sig_on_1, 1, 2, 4)
+|fact_sig_on_1( (int)n) -> int :
+| sig on 1
+| C++ signature :
 
>>> len(fact_sig_off_2.__doc__.splitlines())
-1
->>> print selected_doc(fact_sig_off_2, 0)
+2
+>>> print selected_doc(fact_sig_off_2, 1)
 |sig off 2
>>> len(fact_sig_on_2.__doc__.splitlines())
-3
->>> print selected_doc(fact_sig_on_2, 0, 1)
-|fact_sig_on_2( (int)n) -> int : sig on 2
-| C++ signature:
+6
+>>> print selected_doc(fact_sig_on_2, 1, 2, 4)
+|fact_sig_on_2( (int)n) -> int :
+| sig on 2
+| C++ signature :
 
 
>>> print fact_usr_off_sig_off_1.__doc__
 None
>>> len(fact_usr_on_sig_on_1.__doc__.splitlines())
-3
->>> print selected_doc(fact_usr_on_sig_on_1, 0, 1)
-|fact_usr_on_sig_on_1( (int)n) -> int : usr on sig on 1
-| C++ signature:
+6
+>>> print selected_doc(fact_usr_on_sig_on_1, 1, 2, 4)
+|fact_usr_on_sig_on_1( (int)n) -> int :
+| usr on sig on 1
+| C++ signature :
 
>>> len(fact_usr_on_sig_off_1.__doc__.splitlines())
-1
->>> print selected_doc(fact_usr_on_sig_off_1, 0)
+2
+>>> print selected_doc(fact_usr_on_sig_off_1, 1)
 |usr on sig off 1
>>> len(fact_usr_on_sig_on_2.__doc__.splitlines())
-3
->>> print selected_doc(fact_usr_on_sig_on_2, 0, 1)
-|fact_usr_on_sig_on_2( (int)n) -> int : usr on sig on 2
-| C++ signature:
+6
+>>> print selected_doc(fact_usr_on_sig_on_2, 1, 2, 4)
+|fact_usr_on_sig_on_2( (int)n) -> int :
+| usr on sig on 2
+| C++ signature :
+
+>>> print selected_doc(fact_usr_on_psig_on_csig_off_1, 1, 2)
+|fact_usr_on_psig_on_csig_off_1( (int)n) -> int :
+| usr on psig on csig off 1
 
->>> print fact_usr_on_psig_on_csig_off_1.__doc__
-fact_usr_on_psig_on_csig_off_1( (int)n) -> int : usr on psig on csig off 1
-
->>> print selected_doc(fact_usr_on_psig_off_csig_on_1, 0, 1)
+>>> print selected_doc(fact_usr_on_psig_off_csig_on_1, 1, 3)
 |usr on psig off csig on 1
-| C++ signature:
+|C++ signature :
 
->>> print fact_usr_off_psig_on_csig_off_1.__doc__
+>>> print fact_usr_off_psig_on_csig_off_1.__doc__.splitlines()[1]
 fact_usr_off_psig_on_csig_off_1( (int)n) -> int
 
->>> print selected_doc(fact_usr_off_psig_off_csig_on_1,0)
-| C++ signature:
+>>> print selected_doc(fact_usr_off_psig_off_csig_on_1,1)
+|C++ signature :
 
 
 '''

Modified: trunk/libs/python/test/implicit.py
==============================================================================
--- trunk/libs/python/test/implicit.py (original)
+++ trunk/libs/python/test/implicit.py 2007-09-18 13:32:06 EDT (Tue, 18 Sep 2007)
@@ -14,17 +14,17 @@
 ... except TypeError: pass
 ... else: print 'no error'
 
->>> print x_value.__doc__.splitlines()[0]
-x_value( (X)arg1) -> int :
+>>> print x_value.__doc__.splitlines()[1]
+x_value( (X)arg1) -> int :
 
->>> print make_x.__doc__.splitlines()[0]
-make_x( (object)arg1) -> X :
+>>> print make_x.__doc__.splitlines()[1]
+make_x( (object)arg1) -> X :
 
->>> print X.value.__doc__.splitlines()[0]
-value( (X)arg1) -> int :
+>>> print X.value.__doc__.splitlines()[1]
+value( (X)arg1) -> int :
 
->>> print X.set.__doc__.splitlines()[0]
-set( (X)arg1, (object)arg2) -> None :
+>>> print X.set.__doc__.splitlines()[1]
+set( (X)arg1, (object)arg2) -> None :
 
 '''
 

Modified: trunk/libs/python/test/keywords_test.py
==============================================================================
--- trunk/libs/python/test/keywords_test.py (original)
+++ trunk/libs/python/test/keywords_test.py 2007-09-18 13:32:06 EDT (Tue, 18 Sep 2007)
@@ -80,8 +80,10 @@
>>> f.set(1,1.0,"1")
>>> f.a(), f.b(), f.n()
 (1, 1.0, '1')
->>> f.set2.__doc__.splitlines()[-3]
-"set2( (Bar)arg1 [, (int)arg2 [, (float)arg3 [, (str)arg4]]]) -> None : set2's docstring"
+>>> f.set2.__doc__.splitlines()[1]
+'set2( (Bar)arg1 [, (int)arg2 [, (float)arg3 [, (str)arg4]]]) -> None :'
+>>> f.set2.__doc__.splitlines()[2]
+" set2's docstring"
 '''
 
 

Modified: trunk/libs/python/test/newtest.py
==============================================================================
--- trunk/libs/python/test/newtest.py (original)
+++ trunk/libs/python/test/newtest.py 2007-09-18 13:32:06 EDT (Tue, 18 Sep 2007)
@@ -183,8 +183,8 @@
>>> dd = take_d(d_as_a)
>>> dd.name()
 'D'
->>> print g.__doc__.splitlines()[0]
-g( (Simple)arg1) -> Simple :
+>>> print g.__doc__.splitlines()[1]
+g( (Simple)arg1) -> Simple :
 
 """
 

Modified: trunk/libs/python/test/pytype_function.py
==============================================================================
--- trunk/libs/python/test/pytype_function.py (original)
+++ trunk/libs/python/test/pytype_function.py 2007-09-18 13:32:06 EDT (Tue, 18 Sep 2007)
@@ -5,7 +5,7 @@
>>> from pytype_function_ext import *
 
>>> print (' ').join(func.__doc__.splitlines())
-func( (A)arg1) -> A : C++ signature: struct B func(struct B)
+ func( (A)arg1) -> A : C++ signature : struct B func(struct B)
 
 """
 def run(args = None):


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk