[asterisk-commits] russell: testsuite/asterisk/trunk r160 - /asterisk/trunk/lib/python/asterisk/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 30 15:22:17 CDT 2010


Author: russell
Date: Tue Mar 30 15:22:14 2010
New Revision: 160

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=160
Log:
Add some docstrings to existing modules.

Modified:
    asterisk/trunk/lib/python/asterisk/config.py
    asterisk/trunk/lib/python/asterisk/version.py

Modified: asterisk/trunk/lib/python/asterisk/config.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/config.py?view=diff&rev=160&r1=159&r2=160
==============================================================================
--- asterisk/trunk/lib/python/asterisk/config.py (original)
+++ asterisk/trunk/lib/python/asterisk/config.py Tue Mar 30 15:22:14 2010
@@ -1,5 +1,9 @@
 #!/usr/bin/env python
-"""
+"""Asterisk Configuration File Handling.
+
+This module implements interfaces for dealing with Asterisk configuration
+files.
+
 Copyright (C) 2010, Digium, Inc.
 Russell Bryant <russell at digium.com>
 
@@ -22,6 +26,13 @@
 
 
 class Category:
+    """A category in an Asterisk configuration file.
+
+    This is a helper class used along with ConfigFile.  A category is section
+    of an Asterisk configuration that will contain zero or more key/value pairs
+    of options.
+    """
+
     def __init__(self, name, template=False):
         self.options = []
         self.name = name
@@ -44,7 +55,17 @@
 
 
 class ConfigFile:
+    """An Asterisk Configuration File.
+
+    Parse an Asterisk configuration file.
+    """
+
     def __init__(self, fn, config_str=None):
+        """Construct an Asterisk configuration file object
+
+        The ConfigFile object will parse an Asterisk configuration file into a
+        python data structure.
+        """
         self.categories = []
         self.category_re = re.compile("""
             \s*                        # Leading Whitespace
@@ -149,6 +170,7 @@
         self.assertEqual(conf.categories[2].options[2][0], "astetcdir")
         self.assertEqual(conf.categories[2].options[2][1], "/etc/asterisk")
 
+
 def main(argv=None):
     if argv is None:
         argv = sys.argv

Modified: asterisk/trunk/lib/python/asterisk/version.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/version.py?view=diff&rev=160&r1=159&r2=160
==============================================================================
--- asterisk/trunk/lib/python/asterisk/version.py (original)
+++ asterisk/trunk/lib/python/asterisk/version.py Tue Mar 30 15:22:14 2010
@@ -1,11 +1,15 @@
 #!/usr/bin/env python
-'''
+"""Asterisk Version String Handling
+
+This module implements an Asterisk version string parser.  It can also compare
+version strings to determine which version is considered newer.
+
 Copyright (C) 2010, Digium, Inc.
 Russell Bryant <russell at digium.com>
 
 This program is free software, distributed under the terms of
 the GNU General Public License Version 2.
-'''
+"""
 
 import sys
 import re
@@ -16,7 +20,20 @@
 
 
 class AsteriskVersion:
+    """An Asterisk Version.
+
+    This class handles Asterisk version strings.
+    """
+
     def __init__(self, version=None, path=VERSION_HDR):
+        """Construct an Asterisk Version parser.
+
+        Keyword Arguments:
+        version -- The Asterisk version string to parse.
+        path -- If an Asterisk version string is not directly provided, look
+        for a version.h file in this location that will contain the Asterisk
+        version string to pull out and Parse.
+        """
         if version is not None:
             self.version_str = version
         else:




More information about the asterisk-commits mailing list