[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31315] branches/soc-2010-nexyon: Py API Docs:

Joerg Mueller nexyon at gmail.com
Fri Aug 13 13:49:54 CEST 2010


Revision: 31315
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31315
Author:   nexyon
Date:     2010-08-13 13:49:54 +0200 (Fri, 13 Aug 2010)

Log Message:
-----------
Py API Docs:
* Moving the alternative parser
* Checking for classmethods and staticmethods of builtin modules

Modified Paths:
--------------
    branches/soc-2010-nexyon/intern/audaspace/Python/AUD_PyAPI.cpp
    branches/soc-2010-nexyon/source/blender/python/doc/alternative/pyparser.py

Added Paths:
-----------
    branches/soc-2010-nexyon/source/blender/python/doc/alternative/

Removed Paths:
-------------
    branches/soc-2010-nexyon/intern/audaspace/Python/doc/

Modified: branches/soc-2010-nexyon/intern/audaspace/Python/AUD_PyAPI.cpp
===================================================================
--- branches/soc-2010-nexyon/intern/audaspace/Python/AUD_PyAPI.cpp	2010-08-13 10:50:29 UTC (rev 31314)
+++ branches/soc-2010-nexyon/intern/audaspace/Python/AUD_PyAPI.cpp	2010-08-13 11:49:54 UTC (rev 31315)
@@ -207,7 +207,7 @@
 PyDoc_STRVAR(M_aud_Factory_lowpass_doc,
 			 "lowpass(frequency, Q=0.5)\n\n"
 			 "Creates a second order lowpass filter based on the transfer "
-			 "function H(s) = 1 / (s^2 + s/Q + 1)"
+			 "function H(s) = 1 / (s^2 + s/Q + 1)\n\n"
 			 ":arg frequency: The cut off trequency of the lowpass.\n"
 			 ":type frequency: float\n"
 			 ":arg Q: Q factor of the lowpass.\n"
@@ -335,7 +335,7 @@
 PyDoc_STRVAR(M_aud_Factory_highpass_doc,
 			 "highpass(frequency, Q=0.5)\n\n"
 			 "Creates a second order highpass filter based on the transfer "
-			 "function H(s) = s^2 / (s^2 + s/Q + 1)"
+			 "function H(s) = s^2 / (s^2 + s/Q + 1)\n\n"
 			 ":arg frequency: The cut off trequency of the highpass.\n"
 			 ":type frequency: float\n"
 			 ":arg Q: Q factor of the lowpass.\n"

Copied: branches/soc-2010-nexyon/source/blender/python/doc/alternative (from rev 31314, branches/soc-2010-nexyon/intern/audaspace/Python/doc)

Modified: branches/soc-2010-nexyon/source/blender/python/doc/alternative/pyparser.py
===================================================================
--- branches/soc-2010-nexyon/intern/audaspace/Python/doc/pyparser.py	2010-08-13 10:50:29 UTC (rev 31314)
+++ branches/soc-2010-nexyon/source/blender/python/doc/alternative/pyparser.py	2010-08-13 11:49:54 UTC (rev 31315)
@@ -88,6 +88,10 @@
 		f = datatypes.Function(name, parent)
 		cls.get_doc(f, function)
 		sphinxparser.SphinxParser.parse_function(f)
+		if cls.is_classmethod(function):
+			f.decorator = 'class'
+		elif cls.is_staticmethod(function):
+			f.decorator = 'static'
 		return f
 	
 	@staticmethod
@@ -144,6 +148,14 @@
 		cls.get_doc(a, attribute)
 		return a
 	
+	@staticmethod
+	def is_staticmethod(obj):
+		return isinstance(obj, staticmethod)
+	
+	@staticmethod
+	def is_classmethod(obj):
+		return isinstance(obj, classmethod) or (isinstance(obj, types.BuiltinFunctionType) and hasattr(obj, '__self__') and obj.__self__ is not None)
+	
 	@classmethod
 	def parse_class(cls, name, _class, module):
 		c = datatypes.Class(name, module)
@@ -153,9 +165,9 @@
 			obj = getattr(_class, name)
 			
 			if inspect.isbuiltin(obj) or inspect.ismethoddescriptor(obj):
-				c.methods[name] = cls.parse_builtin(name, obj, c)
+				c.methods[name] = m = cls.parse_builtin(name, obj, c)
 			elif inspect.ismethod(obj):
-				c.methods[name] = cls.parse_function(name, obj, c)
+				c.methods[name] = m = cls.parse_function(name, obj, c)
 			elif inspect.isdatadescriptor(obj):
 				c.attributes[name] = cls.parse_attribute(name, obj, c)
 			else:





More information about the Bf-blender-cvs mailing list