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
# vim: set et sw=4:
"""agi
This module contains functions and classes to implment AGI scripts in python.
"""
.. module:: agi
:synopsis: This module contains functions and classes to implment AGI scripts in python.
pyvr
{'agi_callerid' : 'mars.putland.int',
@ -17,6 +18,8 @@ pyvr
'agi_request' : 'pyst',
'agi_type' : 'IAX'}
Specification
-------------
"""
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:
import asterisk.agitb, asterisk.agi
asterisk.agitb.enable(display = False, logdir = '/var/log/asterisk/')
.. code-block:: python
agi = asterisk.agi.AGI()
asterisk.agitb.enable(agi, False, '/var/log/asterisk')
import asterisk.agitb, asterisk.agi
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:
agi - the agi handle to write verbose messages to
display - if true, tracebacks are displayed on the asterisk console
(used with the agi option)
logdir - if set, tracebacks are written to files in this directory
context - number of lines of source code to show for each stack frame
* agi - the agi handle to write verbose messages to
* display - if true, tracebacks are displayed on the asterisk console
(used with the agi option)
* logdir - if set, tracebacks are written to files in this directory
* 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.
@ -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().
This script was adapted from Ka-Ping Yee's cgitb.
Specification
-------------
"""
__author__ = 'Matthew Nicholson'

View File

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

View File

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

View File

@ -2,10 +2,16 @@
# 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.
Example
-------
.. code-block:: python
import asterisk.manager
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
and submit patches.
Specification
-------------
"""
import sys