docstring::ClassMethodDocInject
时间: 2023-09-13 19:04:54 浏览: 151
nose-docstring-modifier:此插件使您可以在原始文档字符串旁边显示属性
ClassMethodDocInject is a decorator that can be used to inject docstrings into a class method. It takes a string argument that will be used as the docstring for the decorated method.
Example usage:
```
class MyClass:
@ClassMethodDocInject("This method does something.")
def my_method(cls, arg1, arg2):
# method implementation goes here
```
In the example above, the `my_method` class method of `MyClass` is decorated with `ClassMethodDocInject`. The docstring for the method is specified as an argument to the decorator.
Note that the `cls` parameter is used to indicate that this is a class method, and not an instance method.
阅读全文