From 8ce44dde44a724e3f909104f087f849c6c2aadd2 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 27 Oct 2005 04:50:25 +0000 Subject: [PATCH] --- doc/build/components/pydoc.myt | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/doc/build/components/pydoc.myt b/doc/build/components/pydoc.myt index 07191b242c..cbd5e11564 100644 --- a/doc/build/components/pydoc.myt +++ b/doc/build/components/pydoc.myt @@ -12,8 +12,10 @@ if not isclass: if hasattr(obj, '__ALL__'): objects = obj.__ALL__ + sort = False else: objects = obj.__dict__.keys() + sort = True if functions is None: functions = [getattr(obj, x, None) for x in objects @@ -21,7 +23,8 @@ (isinstance(getattr(obj,x), types.FunctionType)) and not getattr(obj,x).__name__[0] == '_' ] - functions.sort(lambda a, b: cmp(a.__name__, b.__name__)) + if sort: + functions.sort(lambda a, b: cmp(a.__name__, b.__name__)) if classes is None: classes = [getattr(obj, x, None) for x in objects @@ -30,26 +33,38 @@ or isinstance(getattr(obj,x), types.ClassType)) and not getattr(obj,x).__name__[0] == '_' ] - classes.sort(lambda a, b: cmp(a.__name__, b.__name__)) + if sort: + classes.sort(lambda a, b: cmp(a.__name__, b.__name__)) else: if functions is None: - functions = [getattr(obj, x).im_func for x in obj.__dict__.keys() if isinstance(getattr(obj,x), types.MethodType) and not getattr(obj,x).__name__[0] == '_'] + functions = [getattr(obj, x).im_func for x in obj.__dict__.keys() if isinstance(getattr(obj,x), types.MethodType) + and + (getattr(obj, x).__name__ == '__init__' or not getattr(obj,x).__name__[0] == '_') + ] functions.sort(lambda a, b: cmp(a.__name__, b.__name__)) if classes is None: classes = [] if isclass: description = "Class " + name + if hasattr(obj, '__mro__'): + description += "(" + obj.__mro__[1].__name__ + ")" else: description = "Module " + name <&|doclib.myt:item, name=obj.__name__, description=description &> +<&|formatting.myt:formatplain&><% obj.__doc__ %>
-<% obj.__doc__ %> -<% (obj.__doc__ and "

" or '') %> - -% if len(functions): +% if not isclass and len(functions): +<&|doclib.myt:item, name="modfunc", description="Module Functions" &> +<&|formatting.myt:paramtable&> +% for func in functions: + <& SELF:function_doc, func=func &> +% + + +% elif len(functions): <&|formatting.myt:paramtable&> % for func in functions: <& SELF:function_doc, func=func &> @@ -58,16 +73,15 @@ % % if len(classes): -

Classes

<&|formatting.myt:paramtable&> % for class_ in classes: <& SELF:obj_doc, obj=class_ &> % % - + <%method function_doc> @@ -92,6 +106,6 @@ <&| formatting.myt:function_doc, name="def " + func.__name__, arglist=argstrings &> - <% func.__doc__ %> + <&|formatting.myt:formatplain&><% func.__doc__ %> \ No newline at end of file -- 2.47.2