Updated docstring to use rst format

master
GaboFDC 2016-03-08 10:33:39 -05:00
parent a974c479d2
commit 26ac52644c
5 changed files with 62 additions and 22 deletions

View File

@ -1,8 +1,9 @@
#!/usr/bin/env python2 #!/usr/bin/env python2
# vim: set et sw=4: # vim: set et sw=4:
"""agi """
.. module:: agi
This module contains functions and classes to implment AGI scripts in python. :synopsis: This module contains functions and classes to implment AGI scripts in python.
pyvr pyvr
{'agi_callerid' : 'mars.putland.int', {'agi_callerid' : 'mars.putland.int',
@ -17,6 +18,8 @@ pyvr
'agi_request' : 'pyst', 'agi_request' : 'pyst',
'agi_type' : 'IAX'} 'agi_type' : 'IAX'}
Specification
-------------
""" """
import sys import sys

View File

@ -1,20 +1,27 @@
"""More comprehensive traceback formatting for Python scripts. """
.. module:: agitb
:synopsis: More comprehensive traceback formatting for Python scripts.
Example
-------
To enable this module, do: To enable this module, do:
import asterisk.agitb, asterisk.agi .. code-block:: python
asterisk.agitb.enable(display = False, logdir = '/var/log/asterisk/')
agi = asterisk.agi.AGI() import asterisk.agitb, asterisk.agi
asterisk.agitb.enable(agi, False, '/var/log/asterisk') asterisk.agitb.enable(display = False, logdir = '/var/log/asterisk/')
agi = asterisk.agi.AGI()
asterisk.agitb.enable(agi, False, '/var/log/asterisk')
at the top of your script. The optional arguments to enable() are: at the top of your script. The optional arguments to enable() are:
agi - the agi handle to write verbose messages to * agi - the agi handle to write verbose messages to
display - if true, tracebacks are displayed on the asterisk console * display - if true, tracebacks are displayed on the asterisk console
(used with the agi option) (used with the agi option)
logdir - if set, tracebacks are written to files in this directory * logdir - if set, tracebacks are written to files in this directory
context - number of lines of source code to show for each stack frame * context - number of lines of source code to show for each stack frame
By default, tracebacks are displayed but not saved, and the context is 5 lines. By default, tracebacks are displayed but not saved, and the context is 5 lines.
@ -27,6 +34,9 @@ for you, call agitb.handler(). The optional argument to handler() is a
If you do not pass anything to handler() it will use sys.exc_info(). If you do not pass anything to handler() it will use sys.exc_info().
This script was adapted from Ka-Ping Yee's cgitb. This script was adapted from Ka-Ping Yee's cgitb.
Specification
-------------
""" """
__author__ = 'Matthew Nicholson' __author__ = 'Matthew Nicholson'

View File

@ -1,13 +1,19 @@
#!/usr/bin/env python #!/usr/bin/env python
# vim: set expandtab: # vim: set expandtab:
""" """
Parse Asterisk configuration files. .. module:: config
:synopsis: Parse Asterisk configuration files.
This module provides parsing functionality for asterisk config files. This module provides parsing functionality for asterisk config files.
Example
----------
.. code-block:: python
import asterisk.config import asterisk.config
import sys import sys
# load and parse the config file # load and parse the config file
try: try:
config = asterisk.config.Config('/etc/asterisk/extensions.conf') config = asterisk.config.Config('/etc/asterisk/extensions.conf')
@ -17,13 +23,17 @@ This module provides parsing functionality for asterisk config files.
except IOError as e: except IOError as e:
print "Error opening file: %s" % e.strerror print "Error opening file: %s" % e.strerror
sys.exit(1) sys.exit(1)
# print our parsed output # print our parsed output
for category in config.categories: for category in config.categories:
print '[%s]' % category.name # print the current category print '[%s]' % category.name # print the current category
for item in category.items: for item in category.items:
print ' %s = %s' % (item.name, item.value) print ' %s = %s' % (item.name, item.value)
Specification
-------------
""" """
import sys import sys

View File

@ -1,9 +1,17 @@
#!/usr/bin/env python #!/usr/bin/env python
# FastAGI service for Asterisk
# Requires modified pyst2 to support reading stdin/out/err """
# .. module:: fastagi
# Copyright 2011 VOICE1, LLC :synopsis: FastAGI service for Asterisk
# By: Ben Davis <ben@voice1-dot-me>
Requires modified pyst2 to support reading stdin/out/err
Copyright 2011 VOICE1, LLC
By: Ben Davis <ben@voice1-dot-me>
Specification
-------------
"""
import sys import sys
import SocketServer import SocketServer

View File

@ -2,10 +2,16 @@
# vim: set expandtab shiftwidth=4: # vim: set expandtab shiftwidth=4:
""" """
Python Interface for Asterisk Manager .. module:: manager
:synopsis: Python Interface for Asterisk Manager
This module provides a Python API for interfacing with the asterisk manager. This module provides a Python API for interfacing with the asterisk manager.
Example
-------
.. code-block:: python
import asterisk.manager import asterisk.manager
import sys import sys
@ -50,6 +56,9 @@ Remember all header, response, and event names are case sensitive.
Not all manager actions are implmented as of yet, feel free to add them Not all manager actions are implmented as of yet, feel free to add them
and submit patches. and submit patches.
Specification
-------------
""" """
import sys import sys