Ioannis Tziakos avatar Ioannis Tziakos committed a2c110c

C:\Documents and Settings\ioannist\My Documents\currentchecge

Comments (0)

Files changed (2)

abstract-directive

+# HG changeset patch
+# Parent ce4bb37a14091d0fa968256d3cbce85ef322e272
+C:\Documents and Settings\ioannist\My Documents\currentchecge
+
+diff -r ce4bb37a1409 sphinx/domains/python.py
+--- a/sphinx/domains/python.py	Sat Feb 05 21:48:54 2011 +0100
++++ b/sphinx/domains/python.py	Wed Feb 16 19:12:18 2011 +0000
+@@ -299,6 +299,8 @@
+             return 'static '
+         elif self.objtype == 'classmethod':
+             return 'classmethod '
++        elif self.objtype == 'abstractmethod':
++            return 'abstractmethod '
+         return ''
+ 
+     def get_index_text(self, modname, name_cls):
+@@ -342,6 +344,19 @@
+                                                          clsname)
+             else:
+                 return _('%s() (%s class method)') % (methname, clsname)
++        elif self.objtype == 'abstractmethod':
++            try:
++                clsname, methname = name.rsplit('.', 1)
++            except ValueError:
++                if modname:
++                    return _('%s() (in module %s)') % (name, modname)
++                else:
++                    return '%s()' % name
++            if modname:
++                return _('%s() (%s.%s abstract method)') % (methname, modname,
++                                                         clsname)
++            else:
++                return _('%s() (%s abstract method)') % (methname, clsname)
+         elif self.objtype == 'attribute':
+             try:
+                 clsname, attrname = name.rsplit('.', 1)
+@@ -562,6 +577,7 @@
+         'method':       ObjType(l_('method'),        'meth', 'obj'),
+         'classmethod':  ObjType(l_('class method'),  'meth', 'obj'),
+         'staticmethod': ObjType(l_('static method'), 'meth', 'obj'),
++        'abstractmethod': ObjType(l_('abstract method'), 'meth', 'obj'),
+         'attribute':    ObjType(l_('attribute'),     'attr', 'obj'),
+         'module':       ObjType(l_('module'),        'mod', 'obj'),
+     }
+@@ -574,6 +590,7 @@
+         'method':          PyClassmember,
+         'classmethod':     PyClassmember,
+         'staticmethod':    PyClassmember,
++        'abstractmethod':    PyClassmember,
+         'attribute':       PyClassmember,
+         'module':          PyModule,
+         'currentmodule':   PyCurrentModule,
+diff -r ce4bb37a1409 sphinx/ext/autodoc.py
+--- a/sphinx/ext/autodoc.py	Sat Feb 05 21:48:54 2011 +0100
++++ b/sphinx/ext/autodoc.py	Wed Feb 16 19:12:18 2011 +0000
+@@ -1107,6 +1107,9 @@
+             elif isinstance(obj_from_parent, staticmethod):
+                 self.directivetype = 'staticmethod'
+                 self.member_order = self.member_order - 1
++            elif hasattr(obj_from_parent, '__isabstractmethod__'):
++                self.directivetype = 'abstractmethod'
++                self.member_order = self.member_order - 1
+             else:
+                 self.directivetype = 'method'
+             return ret
+@@ -1117,14 +1120,18 @@
+                    (isinstance(self.object, MethodType) and
+                     self.object.im_self is not None):
+                 self.directivetype = 'classmethod'
+-                # document class and static members before ordinary ones
++                # document class, abstract and static members before ordinary ones
+                 self.member_order = self.member_order - 1
+             elif isinstance(self.object, FunctionType) or \
+                  (isinstance(self.object, BuiltinFunctionType) and
+                   hasattr(self.object, '__self__') and
+                   self.object.__self__ is not None):
+                 self.directivetype = 'staticmethod'
+-                # document class and static members before ordinary ones
++                # document class, abstract and static members before ordinary ones
++                self.member_order = self.member_order - 1
++            elif hasattr(self.object, '__isabstractmethod__'):
++                self.directivetype = 'abstractmethod'
++                # document class, abstract and static members before ordinary ones
+                 self.member_order = self.member_order - 1
+             else:
+                 self.directivetype = 'method'
+diff -r ce4bb37a1409 sphinx/writers/texinfo.py
+--- a/sphinx/writers/texinfo.py	Sat Feb 05 21:48:54 2011 +0100
++++ b/sphinx/writers/texinfo.py	Wed Feb 16 19:12:18 2011 +0000
+@@ -1145,6 +1145,7 @@
+         'method': 'Method',
+         'classmethod': 'Class Method',
+         'staticmethod': 'Static Method',
++        'abstractmethod': 'Abstract Method',
+         'exception': 'Exception',
+         'data': 'Data',
+         'attribute': 'Attribute',
+diff -r ce4bb37a1409 tests/root/objects.txt
+--- a/tests/root/objects.txt	Sat Feb 05 21:48:54 2011 +0100
++++ b/tests/root/objects.txt	Wed Feb 16 19:12:18 2011 +0000
+@@ -28,6 +28,10 @@
+ 
+    .. staticmethod:: meths
+ 
++   .. classmethod:: methc
++
++   .. abstractmethod:: metha
++
+    .. attribute:: attr
+ 
+ .. explicit class given
+diff -r ce4bb37a1409 tests/test_autodoc.py
+--- a/tests/test_autodoc.py	Sat Feb 05 21:48:54 2011 +0100
++++ b/tests/test_autodoc.py	Wed Feb 16 19:12:18 2011 +0000
+@@ -11,6 +11,7 @@
+ """
+ 
+ import sys
++import abc
+ from StringIO import StringIO
+ 
+ from util import *
+@@ -427,14 +428,18 @@
+                    ('attribute', 'test_autodoc.Class.inst_attr_comment'),
+                    ('attribute', 'test_autodoc.Class.inst_attr_inline'),
+                    ('attribute', 'test_autodoc.Class.inst_attr_string'),
+-                   ('method', 'test_autodoc.Class.moore'),
++                   ('method', 'test_autodoc.Class.moorec'),
++                   ('method', 'test_autodoc.Class.moores'),
++                   ('method', 'test_autodoc.Class.moorea')
+                    ])
+     options.members = ALL
+     assert_processes(should, 'class', 'Class')
+     options.undoc_members = True
+     should.extend((('attribute', 'test_autodoc.Class.skipattr'),
+                    ('method', 'test_autodoc.Class.undocmeth'),
+-                   ('method', 'test_autodoc.Class.roger')))
++                   ('method', 'test_autodoc.Class.rogerc'),
++                   ('method', 'test_autodoc.Class.rogers'),
++                   ('method', 'test_autodoc.Class.rogera')))
+     assert_processes(should, 'class', 'Class')
+     options.inherited_members = True
+     should.append(('method', 'test_autodoc.Class.inheritedmeth'))
+@@ -497,8 +502,12 @@
+                   '   .. py:attribute:: Class.docattr',
+                   '   .. py:attribute:: Class.udocattr',
+                   '   .. py:attribute:: Class.mdocattr',
+-                  '   .. py:classmethod:: Class.roger(a, e=5, f=6)',
+-                  '   .. py:classmethod:: Class.moore(a, e, f) -> happiness',
++                  '   .. py:classmethod:: Class.rogerc(a, e=5, f=6)',
++                  '   .. py:classmethod:: Class.moorec(a, e, f) -> happiness',
++                  '   .. py:staticmethod:: Class.rogers(a, e=5, f=6)',
++                  '   .. py:staticmethod:: Class.moores(a, e, f) -> happiness',
++                  '   .. py:abstractmethod:: Class.rogera(a, e=5, f=6)',
++                  '   .. py:abstractmethod:: Class.moorea(a, e, f) -> happiness',
+                   '   .. py:attribute:: Class.inst_attr_comment',
+                   '   .. py:attribute:: Class.inst_attr_string',
+                   '   .. py:method:: Class.inheritedmeth()',
+@@ -519,8 +528,15 @@
+     assert_result_contains(
+         '   rest of docstring', 'method', 'test_autodoc.DocstringSig.meth')
+     assert_result_contains(
+-        '.. py:classmethod:: Class.moore(a, e, f) -> happiness', 'method',
+-        'test_autodoc.Class.moore')
++        '.. py:classmethod:: Class.moorec(a, e, f) -> happiness', 'method',
++        'test_autodoc.Class.moorec')
++    assert_result_contains(
++        '.. py:staticmethod:: Class.moores(a, e, f) -> happiness', 'method',
++        'test_autodoc.Class.moores')
++
++    assert_result_contains(
++        '.. py:abstractmethod:: Class.moorea(a, e, f) -> happiness', 'method',
++        'test_autodoc.Class.moorea')
+ 
+     # test new attribute documenter behavior
+     directive.env.temp_data['py:module'] = 'test_autodoc'
+@@ -580,6 +596,7 @@
+ 
+ class Class(Base):
+     """Class to document."""
++    __metaclass__ = abc.ABCMeta
+ 
+     descr = CustomDataDescriptor("Descriptor instance docstring.")
+ 
+@@ -616,10 +633,29 @@
+     mdocattr = StringIO()
+     """should be documented as well - süß"""
+ 
+-    roger = _funky_classmethod("roger", 2, 3, 4)
++    rogerc = _funky_classmethod("rogerc", 2, 3, 4)
+ 
+-    moore = _funky_classmethod("moore", 9, 8, 7,
+-        docstring="moore(a, e, f) -> happiness")
++    moorec = _funky_classmethod("moorec", 9, 8, 7,
++        docstring="moorec(a, e, f) -> happiness")
++
++    @staticmethod
++    def rogers(a , e=5, f=6):
++        return a, e, f
++
++    @staticmethod
++    def moores(a , e, f):
++         """moores(a, e, f) -> happiness"""
++         return a, e, f
++
++    @abc.abstractmethod
++    def rogera(a , e=5, f=6):
++        return a, e, f
++
++    @abc.abstractmethod
++    def moorea(a , e, f):
++         """moorea(a, e, f) -> happiness"""
++         return a, e, f
++
+ 
+     def __init__(self, arg):
+         self.inst_attr_inline = None #: an inline documented instance attr
+@@ -667,3 +703,4 @@
+ class AttCls(object):
+     a1 = StrRepr('hello\nworld')
+     a2 = None
++
+abstract-directive
 # Placed by Bitbucket
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.