跳转到主要内容

用于从父类继承方法说明的工具。

项目描述

==================
python-doc-inherit
==================
用于从父类继承方法说明的工具。

徽章
------

.. image:: https://img.shields.io/travis/kavdev/python-doc-inherit/master.svg?style=flat-square
:target: https://travis-ci.org/kavdev/python-doc-inherit
.. image:: https://img.shields.io/codecov/c/github/kavdev/python-doc-inherit/master.svg?style=flat-square
:target: http://codecov.io/github/kavdev/python-doc-inherit?branch=master
.. image:: https://img.shields.io/requires/github/kavdev/python-doc-inherit.svg?style=flat-square
:target: https://requires.io/github/kavdev/python-doc-inherit/requirements/?branch=master
.. image:: https://img.shields.io/codacy/75dbe2685efe47c3aa203a53154c9e7e.svg?style=flat-square
:target: https://www.codacy.com/app/kavanaugh-development/python-doc-inherit/dashboard

.. image:: https://img.shields.io/pypi/v/python-doc-inherit.svg?style=flat-square
:target: https://pypi.python.org/pypi/python-doc-inherit
.. image:: https://img.shields.io/pypi/dw/python-doc-inherit.svg?style=flat-square
:target: https://pypi.python.org/pypi/python-doc-inherit

.. image:: https://img.shields.io/github/issues/kavdev/python-doc-inherit.svg?style=flat-square
:target: https://github.com/kavdev/python-doc-inherit/issues
.. image:: https://img.shields.io/github/license/kavdev/python-doc-inherit.svg?style=flat-square
:target: https://github.com/kavdev/python-doc-inherit/blob/master/LICENSE

安装
------------

安装python-doc-inherit

.. code-block:: bash

pip安装python-doc-inherit

用法
-----

简单方法装饰器(将导致其他装饰器失败)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code-block:: python

from doc_inherit import method_doc_inherit

class Foo(object)

def foo(self)
"""Frobber"""

pass

class Bar(Foo)

@method_doc_inherit
def foo(self)
pass

现在,``Bar.foo.__doc__ == Bar().foo.__doc__ == Foo.foo.__doc__ == "Frobber"``


简单类装饰器
~~~~~~~~~~~~~~~~~~~~~~

.. code-block:: python

from doc_inherit import class_doc_inherit

class Foo(object)

def foo(self)
"""Frobber"""

pass

@class_doc_inherit
class Bar(Foo)

def foo(self)
pass

现在,``Bar.foo.__doc__ == Bar().foo.__doc__ == Foo.foo.__doc__ == "Frobber"``


元类
~~~~~~~~~

.. code-block:: python

from doc_inherit.metaclasses import DocStringInheritor
from six import add_metaclass # 注意:Six不包括在此发行版中。

class Animal
def move_to(self, dest)
"""移动到 *dest*"""
pass

@add_metaclass(DocStringInheritor)
class Bird(Animal)
def move_to(self, dest)
pass

现在,``Animal.move_to.__doc__ == Bird.move_to.__doc__ == "移动到 *dest*"""


运行测试
------------------

.. code-block:: bash

pip install -r requirements/test.txt
./runtests.py





变更
=======

0.1.1 (2016-06-18)
----------------------

* 一些小修复

0.1.0 (2016-06-18)
----------------------

* 首次发布

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源代码分发

python-doc-inherit-0.3.0.tar.gz (6.1 kB 查看哈希值)

上传时间 源代码

构建分发

python_doc_inherit-0.3.0-py2.py3-none-any.whl (5.9 kB 查看哈希值)

上传时间 Python 2 Python 3