الفرق بين المراجعتين لصفحة: «دليل الرسائل القصيرة السريعة للمطورين/توثيق البرنامج بستخدام inline و docstring»

تم حذف المحتوى تمت إضافة المحتوى
ط روبوت: تغييرات تجميلية
سطر 12:
== تعليقات (Comments) ==
== Docstring ==
== التوثيق ==
== ملاحظة هامة ==
<div dir="LTR" style="background-color: #f8f8ff; border: 0px solid #663300;">
سطر 25:
</div>
 
المثال أعلاه هو مجرد برنامج صغير يطلب منك إدخال بعض المعلومات ، كما تلاحظ Docstring تأتي مباشرة بعد تعرف الموديول أو الكلاس أو الدالة ؛ بيثون يستخرج Docstring من برنامجك بطريقة برمجيه و إليك مثال كيف يكون الناتج :
<div dir="LTR" style="background-color: #f8f8ff; border: 0px solid #663300;">
<pre>
سطر 42:
</pre>
</div>
كان هذا مثل على كيفية توثيق الموديول ؛ الطريقة المثلى للتوثيق ليس فقط توثيق الموديول و لكن كتابة تعريف بسيط لتطبيق الذي قمت بإنشائه.
مثال على كيفية كتابة معلومات عن برنامجك :
<div dir="LTR" style="background-color: #f8f8ff; border: 0px solid #663300;">
سطر 58:
</div>
 
في المثال السابق ، لاحظ كيفية كتابة Docstring، في غالب الأحيان في السطر الأول قم بكتابة تعريف مختصر عن برنامجك. في السطر الذي يليه قم بسرد كل دالات برنامجك و قم بتعريف كل دالة على حدا .
في المثال التالي تلاحظ كيفية عرض Docstring من قبل أمر Help
<div dir="LTR" style="background-color: #f8f8ff; border: 0px solid #663300;">
<pre>
| Survey RapidSMS App
|
| Handles an sms-collected survey
| help: Display the way you should write you SMS
| survey: command to enter the user profile information
| stat: returns number of records
| find: list of people in activity
|
| Method resolution order:
| App
| rapidsms.app.App
| rapidsms.component.Component
| __builtin__.object
|
| Methods defined here:
|
| find(self, message, keyw)
| returns list of people from one category
| Format: find CAT_CODE
| CAT_code is from Activity Model
|
| handle(self, message)
| Searchs for the right function and then call it
|
| help(self, message)
| Displays how to use the commands
|
| stat(self, message)
| returns the total Number of Profile in Database
| Format: stat
|
| survey(self, message, first, last, sex, age, Act)
| receivces from the user the requisted data to be inserted in DB
| Format : survey [ Your Profile information-be careful to write it in right order]
 
</pre>