lists.arthurdejong.org
RSS feed

python-stdnum commit: r18 - in python-stdnum: . stdnum stdnum/isbn

[Date Prev][Date Next] [Thread Prev][Thread Next]

python-stdnum commit: r18 - in python-stdnum: . stdnum stdnum/isbn



Author: arthur
Date: Tue Jul 27 22:19:54 2010
New Revision: 18
URL: http://arthurdejong.org/viewvc/python-stdnum?view=rev&revision=18

Log:
rename validate() function to is_valid()

Modified:
   python-stdnum/README
   python-stdnum/stdnum/bsn.py
   python-stdnum/stdnum/isbn/__init__.py
   python-stdnum/stdnum/issn.py

Modified: python-stdnum/README
==============================================================================
--- python-stdnum/README        Tue Jul 27 22:14:40 2010        (r17)
+++ python-stdnum/README        Tue Jul 27 22:19:54 2010        (r18)
@@ -21,7 +21,7 @@
 
 Most of these modules implement the following functions:
 
-validate() - returns either True or False depending on whether the
+is_valid() - returns either True or False depending on whether the
              passed number is in any supported and valid form
 compact() - return a compact representation of the number or code
             this function generally does not do validation but may raise

Modified: python-stdnum/stdnum/bsn.py
==============================================================================
--- python-stdnum/stdnum/bsn.py Tue Jul 27 22:14:40 2010        (r17)
+++ python-stdnum/stdnum/bsn.py Tue Jul 27 22:19:54 2010        (r18)
@@ -20,9 +20,9 @@
 """Module for handling BSNs (Burgerservicenummer), the
 Dutch national identification number.
 
->>> validate('111222333')
+>>> is_valid('111222333')
 True
->>> validate('111252333')
+>>> is_valid('111252333')
 False
 >>> compact('1234.56.782')
 '123456782'
@@ -42,7 +42,7 @@
     """Calculate the checksum over the number."""
     return sum( (9-i) * int(number[i]) for i in range(8) ) - int(number[8])
 
-def validate(number):
+def is_valid(number):
     """Checks to see if the number provided is a valid BSN. This checks
     the length and whether the check digit is correct."""
     try:

Modified: python-stdnum/stdnum/isbn/__init__.py
==============================================================================
--- python-stdnum/stdnum/isbn/__init__.py       Tue Jul 27 22:14:40 2010        
(r17)
+++ python-stdnum/stdnum/isbn/__init__.py       Tue Jul 27 22:19:54 2010        
(r18)
@@ -21,9 +21,9 @@
 module handles both numbers in ISBN10 (10-digit) and ISBN13 (13-digit)
 format.
 
->>> validate('978-9024538270')
+>>> is_valid('978-9024538270')
 True
->>> validate('978-9024538271') # incorrect check digit
+>>> is_valid('978-9024538271') # incorrect check digit
 False
 >>> compact('1-85798-218-5')
 '1857982185'
@@ -81,7 +81,7 @@
     else:
         return None
 
-def validate(number):
+def is_valid(number):
     """Checks to see if the number provided is a valid ISBN (either a legacy
     10-digit one or a 13-digit one). This checks the length and the check
     bit but does not check if the group and publisher are valid (use split()

Modified: python-stdnum/stdnum/issn.py
==============================================================================
--- python-stdnum/stdnum/issn.py        Tue Jul 27 22:14:40 2010        (r17)
+++ python-stdnum/stdnum/issn.py        Tue Jul 27 22:19:54 2010        (r18)
@@ -20,9 +20,9 @@
 """Module for handling ISSNs (International Standard Serial Number), the
 standard code to identify serial publications.
 
->>> validate('0024-9319')
+>>> is_valid('0024-9319')
 True
->>> validate('0032147X') # incorrect check digit
+>>> is_valid('0032147X') # incorrect check digit
 False
 >>> compact('0032-1478')
 '00321478'
@@ -43,7 +43,7 @@
     check = (11 - sum( (8 - i) * int(number[i]) for i in range(len(number)) ) 
) % 11
     return 'X' if check == 10 else str(check)
 
-def validate(number):
+def is_valid(number):
     """Checks to see if the number provided is a valid ISSN. This checks
     the length and whether the check digit is correct."""
     try:
--
To unsubscribe send an email to
python-stdnum-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/python-stdnum-commits