![](/img/trans.png)
[英]Include a commented Python script into a Sphinx-generated documentation
[英]Sphinx python auto generated documentation failure
我想為名為 Ulyxes PyAPI 的 API 制作文檔。 我已經開始了,但是自動生成過程不起作用。 當我在我的 index.html 頁面中單擊自動生成的文檔鏈接時,我被引用到一個空頁面,其中沒有關於我的類和類的函數的信息
實際上,我的 API 中有 10 個以上的 python 文件,每個文件都包含一個對測量傳感器(機器人全站儀、GPS 等)進行建模的類。 在這個問題中,我只寫了其中的一小部分,以使我的問題易於理解。
我認為,無論是 code.rst 還是 leicameasureunit.py 都是錯誤的......
*.py 和 *.srt 文件位於與我的工作目錄相同的目錄中。 我使用 Windows 7 操作系統。
非常感謝!
...\\UlyxesPyApiDoc:
這些文件如下:
索引.srt:
.. Ulyxes PyAPI documentation master file, created by
sphinx-quickstart on Mon Oct 21 20:53:48 2013.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to Ulyxes PyAPI 's documentation!
=========================================
Ulyxes is an open source project to drive robotic total stations (RTS) and other
sensors and publish observation results on web based maps (GPL 2).
Requirmenets:
Contents:
.. toctree::
:maxdepth: 2
project
tutorial
code
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
代碼.rst:
Auto Generated Documentation
============================
.. autoclass:: leicameasureunit
:members:
項目.srt:
Project Summary
===============
Goals Achieved
--------------
Goal 1 to create a framework to drive robotic total stations from a computer and publish data on the Internet
Goal 2 we want to create a framework not a ready to use application
Goal 3 the project is based on several other open source projects
教程.srt:
Tutorial for driving RTSs
=========================
This is a short description about how to drive RTSs via serial port from PC/laptop
leicameasureunit.py:`
"""
Created on 29 July 2012
@author: Dani Moka
"""
from measureunit import *
from angle import *
import re
class LeicaMeasureUnit(MeasureUnit):
"""
This class models Leica robotic totals stations
"""
def __init__(self, name = 'Leica generic', type = 'TPS'):
# call super class init
super(LeicaMeasureUnit, self).__init__(name, type)
def MoveMsg(self, hz, v, units='RAD', atr=0):
"""
This function make instruments moving.
:arguments:
hz
Direction 1
units
uints in default RAD
"""
hz_rad = Angle(hz, units).GetAngle('RAD')
v_rad = Angle(v, units).GetAngle('RAD')
return '%%R1Q,9027:%f,%f,0,%d,0' % (hz_rad, v_rad, atr)
def SetATRMsg(self, atr):
"""
This function used for setting Automatic Target Recognition
:arguments:
atr
1 - on / 2 - off
units
1 - on / 2 - off
"""
return '%%R1Q,9018:%d' % (atr)
def GetATRMsg(self):
"""
This function used for getting the status of Automatic Target Recognition
"""
return '%R1Q,9019:'
`
在 code.rst 中,它說
.. autoclass:: leicameasureunit
它不起作用,因為沒有該名稱的類。 為了記錄leicameasureunit
模塊,請使用
.. automodule:: leicameasureunit
該模塊包含一個名為LeicaMeasureUnit
的類,因此您可以使用
.. autoclass:: leicameasureunit.LeicaMeasureUnit
只記錄那個類。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.