[open-ils-commits] r19819 - trunk/Open-ILS/src/python/oils/utils (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Sat Mar 19 01:00:45 EDT 2011


Author: dbs
Date: 2011-03-19 01:00:42 -0400 (Sat, 19 Mar 2011)
New Revision: 19819

Modified:
   trunk/Open-ILS/src/python/oils/utils/utils.py
Log:
Provide a top-level docstring for oils/utils/utils.py

Also, standardize on triple-double-quoted docstrings, per PEP257.


Modified: trunk/Open-ILS/src/python/oils/utils/utils.py
===================================================================
--- trunk/Open-ILS/src/python/oils/utils/utils.py	2011-03-19 04:56:06 UTC (rev 19818)
+++ trunk/Open-ILS/src/python/oils/utils/utils.py	2011-03-19 05:00:42 UTC (rev 19819)
@@ -1,3 +1,7 @@
+"""
+Grab-bag of general utility functions
+"""
+
 # -----------------------------------------------------------------------
 # Copyright (C) 2007  Georgia Public Library Service
 # Bill Erickson <billserickson at gmail.com>
@@ -16,25 +20,30 @@
 import hashlib
 import osrf.ses
 
-# -----------------------------------------------------------------------
-# Grab-bag of general utility functions
-# -----------------------------------------------------------------------
+def md5sum(string):
+    """
+    Return an MD5 message digest for a given input string
+    """
 
-def md5sum(string):
-    """Return an MD5 message digest for a given input string"""
     md5 = hashlib.md5()
     md5.update(string)
     return md5.hexdigest()
 
 def unique(arr):
-    ''' Unique-ify a list.  only works if list items are hashable '''
+    """
+    Unique-ify a list.  only works if list items are hashable
+    """
+
     o = {}
     for x in arr:
         o[x] = 1
     return o.keys()
 
 def is_db_true(data):
-    ''' Returns true if the data provided matches what the database considers a true value '''
+    """
+    Returns PostgreSQL's definition of "truth" for the supplied data, roughly.
+    """
+
     if not data or data == 'f' or str(data) == '0':
         return False
     return True



More information about the open-ils-commits mailing list