epydoc اداة لتوليد الوثائق لوحدات بايثون بناء على سلاسل التوثيق ال docstrings
وهناك لغة ترميز epytext تستطيع استخدامها لتجهيز سلاسل التوثيق لإضافة معلومات عن الوحدات والكلاسات والدوال عن الحقول الخاصة كالparameters وال instance variables
نبدأ بمعلومات عن الوحدة
"""
Created by U{Epydoc<http://epydoc.sourceforge.net>}
@author: Ahmed Youssef
@license: GPL v3
@summary: simple moduel for testing epydoc
"""
اولا U
U{text<target>}
بتتكون من النص الظاهر على اللينك واللينك الهدف
@author
اسم الكاتب
@license
الرخصة
@summary
الملخص
فى fields كتير تقدر تراجعها هنا
http://epydoc.sourceforge.net/fields.html#fieldsهنعمل مثالين على دالة وعلى صف
دالة المضروب
def factorial(n):
"""
factorial of a positive integer n, denoted by n!, is the product of all positive integers less than or equal to n
@type n: number
@param n: number to calculate the factorial for.
@rtype: number
@return: the factorial (the product of all positive integers less than or equal to n)
"""
return math.factorial(n)
فى البداية بنكتب وصف للدالة وبعد كدا المعاملات بنحدد ليها النوع والوصف عن طريق @type, @param
ونحدد نوع الناتج من الدالة عن طريق @rtype ووصف العائد من الدالة عن طريق @return
لاحظ ان الدالة بتستخدم دالة factorial الموجودة فى وحدة math
نيجى للصفوف
class Human(object):
"""
Humans are a Cancer of the Earth
@ivar name: a language unit by which a person or thing is known
@cvar nhands: number of hands
"""
nhands=2
def __init__(self, name):
"""
Initializing instance variables
@type name: str
@param name: a language unit by which a person or thing is known
@rtype: None
"""
self.name=name
اولا عندنا وصف للكلاس ومتغيرات الكائن instance variables معرفة عن طريق @ivar والمتغيرات الخاصة بالصف عن طريق @cvar
بس بعد كدا عليك تنفيذ الأمر epydoc او استخدام epydocgui لانشاء التوثيق
epydoc module.py
راجع epytext للمزيد حول الفقرات والقوائم والأقسام وغيرها
http://epydoc.sourceforge.net/epytext.htmlمشاريع مرتبطة
http://epydoc.sourceforge.net/relatedprojects.html