提交 00a23bdd authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Whitespace fix

上级 e65a79fb
...@@ -42,15 +42,15 @@ class CLinkerType(CLinkerObject): ...@@ -42,15 +42,15 @@ class CLinkerType(CLinkerObject):
:Exceptions: :Exceptions:
- `MethodNotDefined`: Subclass does not implement this method - `MethodNotDefined`: Subclass does not implement this method
""" """
raise MethodNotDefined("c_literal", type(self), self.__class__.__name__) raise MethodNotDefined("c_literal", type(self), self.__class__.__name__)
def c_declare(self, name, sub): def c_declare(self, name, sub):
"""Required: Return c code to declare variables that will be """Required: Return c code to declare variables that will be
instantiated by `c_extract`. instantiated by `c_extract`.
Example: Example:
.. code-block: python .. code-block: python
return "PyObject ** addr_of_%(name)s;" return "PyObject ** addr_of_%(name)s;"
...@@ -82,7 +82,7 @@ class CLinkerType(CLinkerObject): ...@@ -82,7 +82,7 @@ class CLinkerType(CLinkerObject):
"""Required: Return c code to initialize the variables that were declared by """Required: Return c code to initialize the variables that were declared by
self.c_declare() self.c_declare()
Example: Example:
.. code-block: python .. code-block: python
return "addr_of_%(name)s = NULL;" return "addr_of_%(name)s = NULL;"
...@@ -110,7 +110,7 @@ class CLinkerType(CLinkerObject): ...@@ -110,7 +110,7 @@ class CLinkerType(CLinkerObject):
by this function. --jpt by this function. --jpt
Example: Example:
.. code-block: python .. code-block: python
return "if (py_%(name)s == Py_None)" + \\\ return "if (py_%(name)s == Py_None)" + \\\
...@@ -133,7 +133,7 @@ class CLinkerType(CLinkerObject): ...@@ -133,7 +133,7 @@ class CLinkerType(CLinkerObject):
""" """
raise MethodNotDefined("c_extract", type(self), self.__class__.__name__) raise MethodNotDefined("c_extract", type(self), self.__class__.__name__)
def c_cleanup(self, name, sub): def c_cleanup(self, name, sub):
"""Optional: Return c code to clean up after `c_extract`. """Optional: Return c code to clean up after `c_extract`.
...@@ -206,7 +206,7 @@ class PureType(object): ...@@ -206,7 +206,7 @@ class PureType(object):
def filter(self, data, strict=False, allow_downcast=None): def filter(self, data, strict=False, allow_downcast=None):
"""Required: Return data or an appropriately wrapped/converted data. """Required: Return data or an appropriately wrapped/converted data.
Subclass implementation should raise a TypeError exception if the data is not of an Subclass implementation should raise a TypeError exception if the data is not of an
acceptable type. acceptable type.
...@@ -231,7 +231,7 @@ class PureType(object): ...@@ -231,7 +231,7 @@ class PureType(object):
return True return True
except (TypeError, ValueError): except (TypeError, ValueError):
return False return False
def value_validity_msg(self, a): def value_validity_msg(self, a):
"""Optional: return a message explaining the output of is_valid_value""" """Optional: return a message explaining the output of is_valid_value"""
return "none" return "none"
...@@ -249,7 +249,7 @@ class PureType(object): ...@@ -249,7 +249,7 @@ class PureType(object):
def make_constant(self, value, name=None): def make_constant(self, value, name=None):
return self.Constant(type=self, data=value, name=name) return self.Constant(type=self, data=value, name=name)
def __call__(self, name = None): def __call__(self, name = None):
"""Return a new `Variable` instance of Type `self`. """Return a new `Variable` instance of Type `self`.
...@@ -331,7 +331,7 @@ class Type(object2, PureType, CLinkerType): ...@@ -331,7 +331,7 @@ class Type(object2, PureType, CLinkerType):
class SingletonType(Type): class SingletonType(Type):
"""Convenient Base class for a Type subclass with no attributes """Convenient Base class for a Type subclass with no attributes
It saves having to implement __eq__ and __hash__ It saves having to implement __eq__ and __hash__
""" """
__instance = None __instance = None
...@@ -348,13 +348,13 @@ class Generic(SingletonType): ...@@ -348,13 +348,13 @@ class Generic(SingletonType):
Represents a generic Python object. Represents a generic Python object.
This class implements the `PureType` and `CLinkerType` interfaces for generic PyObject This class implements the `PureType` and `CLinkerType` interfaces for generic PyObject
instances. instances.
EXAMPLE of what this means, or when you would use this type. EXAMPLE of what this means, or when you would use this type.
WRITEME WRITEME
""" """
def filter(self, data, strict=False, allow_downcast=None): def filter(self, data, strict=False, allow_downcast=None):
return data return data
...@@ -376,7 +376,7 @@ class Generic(SingletonType): ...@@ -376,7 +376,7 @@ class Generic(SingletonType):
Py_INCREF(py_%(name)s); Py_INCREF(py_%(name)s);
%(name)s = py_%(name)s; %(name)s = py_%(name)s;
""" % locals() """ % locals()
def c_cleanup(self, name, sub): def c_cleanup(self, name, sub):
return """ return """
Py_XDECREF(%(name)s); Py_XDECREF(%(name)s);
...@@ -391,4 +391,3 @@ class Generic(SingletonType): ...@@ -391,4 +391,3 @@ class Generic(SingletonType):
""" % locals() """ % locals()
generic = Generic() generic = Generic()
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论