lists.arthurdejong.org
RSS feed

python-stdnum commit: r168 - in python-stdnum/stdnum: . eu gb gr hr hu ie iso7064 lt

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

python-stdnum commit: r168 - in python-stdnum/stdnum: . eu gb gr hr hu ie iso7064 lt



Author: arthur
Date: Sun Feb 26 16:08:37 2012
New Revision: 168
URL: http://arthurdejong.org/viewvc/python-stdnum?revision=168&view=revision

Log:
some more documentation improvements

Modified:
   python-stdnum/stdnum/eu/vat.py
   python-stdnum/stdnum/gb/vat.py
   python-stdnum/stdnum/gr/vat.py
   python-stdnum/stdnum/grid.py
   python-stdnum/stdnum/hr/oib.py
   python-stdnum/stdnum/hu/anum.py
   python-stdnum/stdnum/iban.py
   python-stdnum/stdnum/ie/pps.py
   python-stdnum/stdnum/ie/vat.py
   python-stdnum/stdnum/imei.py
   python-stdnum/stdnum/isan.py
   python-stdnum/stdnum/iso7064/__init__.py
   python-stdnum/stdnum/iso7064/mod_11_10.py
   python-stdnum/stdnum/iso7064/mod_11_2.py
   python-stdnum/stdnum/iso7064/mod_37_2.py
   python-stdnum/stdnum/iso7064/mod_37_36.py
   python-stdnum/stdnum/iso7064/mod_97_10.py
   python-stdnum/stdnum/lt/pvm.py
   python-stdnum/stdnum/luhn.py
   python-stdnum/stdnum/meid.py
   python-stdnum/stdnum/verhoeff.py

Modified: python-stdnum/stdnum/eu/vat.py
==============================================================================
--- python-stdnum/stdnum/eu/vat.py      Sun Feb 26 12:38:24 2012        (r167)
+++ python-stdnum/stdnum/eu/vat.py      Sun Feb 26 16:08:37 2012        (r168)
@@ -22,7 +22,11 @@
 
 The European Union VAT number consists of a 2 letter country code (ISO
 3166-1, except Greece which uses EL) followed by a number that is
-allocated per country. The format varies per country.
+allocated per country.
+
+The exact format of the numbers varies per country and a country-specific
+check is performed on the number using the VAT module that is relevant for
+that country.
 
 >>> is_valid('ATU 57194903')
 True
@@ -40,12 +44,13 @@
     'gr', 'hu', 'ie', 'it', 'lt', 'lu', 'lv', 'mt', 'nl', 'pl', 'pt', 'ro',
     'se', 'si', 'sk'
 ])
-"""The collection of country codes that are queried."""
+"""The collection of country codes that are queried. Greece is listed with
+a country code of gr while for VAT purposes el is used instead."""
 
 _country_modules = dict()
 
 vies_wsdl = 'http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl'
-"""The WSDL URL of the VAT Information Exchange System (VIES) """
+"""The WSDL URL of the VAT Information Exchange System (VIES)."""
 
 # a cached version of the suds client for VIES
 _vies_client = None
@@ -89,7 +94,7 @@
     """Guess the country code based on the provided number. This checks the
     provided number against each of the validation routines and returns
     the list of countries for which it is valid. This returns lower case
-    codes and returns gr (instead of el) for Greece."""
+    codes and returns gr (not el) for Greece."""
     return [cc
             for cc in country_codes
             if _get_cc_module(cc).is_valid(number)]

Modified: python-stdnum/stdnum/gb/vat.py
==============================================================================
--- python-stdnum/stdnum/gb/vat.py      Sun Feb 26 12:38:24 2012        (r167)
+++ python-stdnum/stdnum/gb/vat.py      Sun Feb 26 16:08:37 2012        (r168)
@@ -48,7 +48,8 @@
 
 
 def checksum(number):
-    """Calculate the checksum."""
+    """Calculate the checksum. The checksum is only used for the 9 digits
+    of the number and the result can either be 0 or 42."""
     weights = (8, 7, 6, 5, 4, 3, 2, 10, 1)
     return sum(weights[i] * int(n) for i, n in enumerate(number)) % 97
 

Modified: python-stdnum/stdnum/gr/vat.py
==============================================================================
--- python-stdnum/stdnum/gr/vat.py      Sun Feb 26 12:38:24 2012        (r167)
+++ python-stdnum/stdnum/gr/vat.py      Sun Feb 26 16:08:37 2012        (r168)
@@ -20,8 +20,7 @@
 
 """FPA, ΦΠΑ (Foros Prostithemenis Aksias, the Greek VAT number).
 
-The FPA (Foros Prostithemenis Aksias, ΦΠΑ) is used for VAT purposes. It is
-a 9-digit number with a simple checksum.
+The FPA is a 9-digit number with a simple checksum.
 
 >>> compact('GR 23456783')
 '023456783'

Modified: python-stdnum/stdnum/grid.py
==============================================================================
--- python-stdnum/stdnum/grid.py        Sun Feb 26 12:38:24 2012        (r167)
+++ python-stdnum/stdnum/grid.py        Sun Feb 26 16:08:37 2012        (r168)
@@ -19,8 +19,9 @@
 
 """GRid (Global Release Identifier).
 
-The GRid (Global Release Identifier) is used to identify releases of
-digital sound recordings.
+The Global Release Identifier is used to identify releases of digital
+sound recordings and uses the ISO 7064 Mod 37, 36 algorithm to verify the
+correctness of the number.
 
 >>> is_valid('A12425GABC1234002M')
 True

Modified: python-stdnum/stdnum/hr/oib.py
==============================================================================
--- python-stdnum/stdnum/hr/oib.py      Sun Feb 26 12:38:24 2012        (r167)
+++ python-stdnum/stdnum/hr/oib.py      Sun Feb 26 16:08:37 2012        (r168)
@@ -21,8 +21,8 @@
 """OIB (Osobni identifikacijski broj, Croatian identification number).
 
 The personal identification number is used to identify persons and legal
-entities and has 11 digits (sometimes prefixed by HR), contains no
-personal information and uses the ISO 7064 Mod 11, 10 checksum algorithm.
+entities in Croatia. It has 11 digits (sometimes prefixed by HR), contains
+no personal information and uses the ISO 7064 Mod 11, 10 checksum algorithm.
 
 >>> compact('HR 33392005961')
 '33392005961'

Modified: python-stdnum/stdnum/hu/anum.py
==============================================================================
--- python-stdnum/stdnum/hu/anum.py     Sun Feb 26 12:38:24 2012        (r167)
+++ python-stdnum/stdnum/hu/anum.py     Sun Feb 26 16:08:37 2012        (r168)
@@ -44,7 +44,7 @@
 
 
 def checksum(number):
-    """Calculate the checksum."""
+    """Calculate the checksum. Valid numbers should have a checksum of 0."""
     weights = (9, 7, 3, 1, 9, 7, 3, 1)
     return sum(weights[i] * int(n) for i, n in enumerate(number)) % 10
 

Modified: python-stdnum/stdnum/iban.py
==============================================================================
--- python-stdnum/stdnum/iban.py        Sun Feb 26 12:38:24 2012        (r167)
+++ python-stdnum/stdnum/iban.py        Sun Feb 26 16:08:37 2012        (r168)
@@ -19,7 +19,13 @@
 
 """IBAN (International Bank Account Number).
 
-The IBAN is used to identify bank accounts across national borders.
+The IBAN is used to identify bank accounts across national borders. The
+first two letters are a country code. The next two digits are check digits
+for the ISO 7064 Mod 97, 10 checksum. Each country uses it's own format
+for the remainder of the number.
+
+Some countries may also use checksum algorithms within their number but
+this is currently not checked by this number.
 
 >>> is_valid('GR16 0110 1050 0000 1054 7023 795')
 True

Modified: python-stdnum/stdnum/ie/pps.py
==============================================================================
--- python-stdnum/stdnum/ie/pps.py      Sun Feb 26 12:38:24 2012        (r167)
+++ python-stdnum/stdnum/ie/pps.py      Sun Feb 26 16:08:37 2012        (r168)
@@ -19,10 +19,10 @@
 
 """PPS No (Personal Public Service Number, Irish personal number).
 
-The PPS (Personal Public Service) number consists of 8 digits. The first
-seven are numeric and the last is the check character. The number is
-sometimes be followed by an extra letter, which is ignored for the check
-algorithm, and can be a 'W', 'T' or an 'X'.
+The Personal Public Service number consists of 8 digits. The first seven
+are numeric and the last is the check character. The number is sometimes
+be followed by an extra letter that can be a 'W', 'T' or an 'X' and is
+ignored for the check algorithm.
 
 >>> compact('6433435F')
 '6433435F'

Modified: python-stdnum/stdnum/ie/vat.py
==============================================================================
--- python-stdnum/stdnum/ie/vat.py      Sun Feb 26 12:38:24 2012        (r167)
+++ python-stdnum/stdnum/ie/vat.py      Sun Feb 26 16:08:37 2012        (r168)
@@ -20,7 +20,7 @@
 """VAT (Irish VAT number).
 
 The Irish VAT number consists of 8 digits. The last digit is a check
-letter, the second may be a number, letter, "+" or "*".
+letter, the second digit may be a number, a letter, "+" or "*".
 
 >>> compact('IE 6433435F')
 '6433435F'

Modified: python-stdnum/stdnum/imei.py
==============================================================================
--- python-stdnum/stdnum/imei.py        Sun Feb 26 12:38:24 2012        (r167)
+++ python-stdnum/stdnum/imei.py        Sun Feb 26 16:08:37 2012        (r168)
@@ -20,8 +20,8 @@
 
 """IMEI (International Mobile Equipment Identity).
 
-The  IMEI (International Mobile Equipment Identity) is used to identify
-mobile phones.
+The  IMEI is used to identify mobile phones. The IMEI may optionally
+include a check digit which is validated using the Luhn algorithm.
 
 >>> is_valid('35686800-004141-20')
 True

Modified: python-stdnum/stdnum/isan.py
==============================================================================
--- python-stdnum/stdnum/isan.py        Sun Feb 26 12:38:24 2012        (r167)
+++ python-stdnum/stdnum/isan.py        Sun Feb 26 16:08:37 2012        (r168)
@@ -23,6 +23,12 @@
 The ISAN (International Standard Audiovisual Number) is used to identify
 audiovisual works.
 
+The number is hexadecimal and can consists of at least a root identifier,
+and an episode or part. After that an optional check digit, optional
+version and optionally another check digit can be provided. The check
+digits are validated using the ISO 7064 Mod 37, 36 algorithm.
+
+
 >>> is_valid('000000018947000000000000')
 True
 >>> compact('0000-0000-D07A-0090-Q-0000-0000-X')

Modified: python-stdnum/stdnum/iso7064/__init__.py
==============================================================================
--- python-stdnum/stdnum/iso7064/__init__.py    Sun Feb 26 12:38:24 2012        
(r167)
+++ python-stdnum/stdnum/iso7064/__init__.py    Sun Feb 26 16:08:37 2012        
(r168)
@@ -1,6 +1,6 @@
 # __init__.py - functions for performing the ISO 7064 algorithms
 #
-# Copyright (C) 2010 Arthur de Jong
+# Copyright (C) 2010, 2012 Arthur de Jong
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -20,11 +20,11 @@
 """Collection of the ISO 7064 algorithms.
 
 This package provides a number of modules for calculation and verification
-of numbers using collection of ISO 7064 algorithms.
+of numbers using one of the ISO 7064 algorithms.
 
 Note that these functions were not implemented using the ISO text itself
 because the text is not available for free. These functions were
 implemented based on information on the algorithms found online and some
 reverse engineering. If anyone can provide a legal copy of the ISO/IEC
-7064 standard these functions can be validated and maybe improved.
+7064 standard these functions can be validated and perhaps improved.
 """

Modified: python-stdnum/stdnum/iso7064/mod_11_10.py
==============================================================================
--- python-stdnum/stdnum/iso7064/mod_11_10.py   Sun Feb 26 12:38:24 2012        
(r167)
+++ python-stdnum/stdnum/iso7064/mod_11_10.py   Sun Feb 26 16:08:37 2012        
(r168)
@@ -1,6 +1,6 @@
 # mod_11_10.py - functions for performing the ISO 7064 Mod 11, 10 algorithm
 #
-# Copyright (C) 2010, 2011 Arthur de Jong
+# Copyright (C) 2010, 2011, 2012 Arthur de Jong
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -22,11 +22,8 @@
 The Mod 11, 10 algorithm uses a number of calculations modulo 11 and 10 to
 determine a checksum.
 
-Validation can be done with is_valid(). A valid number can be made by
-calculating the check digit and appending it.
-
-For an module that can do generic Mod x+1, x calculations see the
-stdnum.iso7064.mod_37_36 module.
+For a module that can do generic Mod x+1, x calculations see the
+:mod:`stdnum.iso7064.mod_37_36` module.
 
 >>> calc_check_digit('79462')
 '3'

Modified: python-stdnum/stdnum/iso7064/mod_11_2.py
==============================================================================
--- python-stdnum/stdnum/iso7064/mod_11_2.py    Sun Feb 26 12:38:24 2012        
(r167)
+++ python-stdnum/stdnum/iso7064/mod_11_2.py    Sun Feb 26 16:08:37 2012        
(r168)
@@ -1,6 +1,6 @@
 # mod_11_2.py - functions for performing the ISO 7064 Mod 11, 2 algorithm
 #
-# Copyright (C) 2010, 2011 Arthur de Jong
+# Copyright (C) 2010, 2011, 2012 Arthur de Jong
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -22,8 +22,8 @@
 The Mod 11, 2 algorithm is a simple module 11 checksum where the check
 digit can be an X to make the number valid.
 
-Validation can be done with is_valid(). A valid number can be made by
-calculating the check digit and appending it.
+For a module that can do generic Mod x, 2 calculations see the
+:mod:`stdnum.iso7064.mod_37_2` module.
 
 >>> calc_check_digit('0794')
 '0'

Modified: python-stdnum/stdnum/iso7064/mod_37_2.py
==============================================================================
--- python-stdnum/stdnum/iso7064/mod_37_2.py    Sun Feb 26 12:38:24 2012        
(r167)
+++ python-stdnum/stdnum/iso7064/mod_37_2.py    Sun Feb 26 16:08:37 2012        
(r168)
@@ -1,6 +1,6 @@
 # mod_37_2.py - functions for performing the ISO 7064 Mod 37, 2 algorithm
 #
-# Copyright (C) 2010, 2011 Arthur de Jong
+# Copyright (C) 2010, 2011, 2012 Arthur de Jong
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -22,9 +22,6 @@
 The Mod 37, 2 checksum can be used for alphanumeric numbers and the check
 digit may also be numeric, a letter or '*'.
 
-Validation can be done with is_valid(). A valid number can be made by
-calculating the check digit and appending it.
-
 >>> calc_check_digit('G123489654321')
 'Y'
 >>> is_valid('G123489654321Y')

Modified: python-stdnum/stdnum/iso7064/mod_37_36.py
==============================================================================
--- python-stdnum/stdnum/iso7064/mod_37_36.py   Sun Feb 26 12:38:24 2012        
(r167)
+++ python-stdnum/stdnum/iso7064/mod_37_36.py   Sun Feb 26 16:08:37 2012        
(r168)
@@ -1,6 +1,6 @@
 # mod_37_36.py - functions for performing the ISO 7064 Mod 37, 36 algorithm
 #
-# Copyright (C) 2010, 2011 Arthur de Jong
+# Copyright (C) 2010, 2011, 2012 Arthur de Jong
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -22,9 +22,6 @@
 The Mod 37, 36 algorithm uses an alphanumeric check digit and the number
 itself may also contain letters.
 
-Validation can be done with is_valid(). A valid number can be made by
-calculating the check digit and appending it.
-
 >>> checksum('A12425GABC1234002M')
 1
 >>> calc_check_digit('A12425GABC1234002')

Modified: python-stdnum/stdnum/iso7064/mod_97_10.py
==============================================================================
--- python-stdnum/stdnum/iso7064/mod_97_10.py   Sun Feb 26 12:38:24 2012        
(r167)
+++ python-stdnum/stdnum/iso7064/mod_97_10.py   Sun Feb 26 16:08:37 2012        
(r168)
@@ -1,6 +1,6 @@
 # mod_97_10.py - functions for performing the ISO 7064 Mod 97, 10 algorithm
 #
-# Copyright (C) 2010, 2011 Arthur de Jong
+# Copyright (C) 2010, 2011, 2012 Arthur de Jong
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -22,10 +22,6 @@
 The Mod 97, 10 algorithm evaluates the whole number as an integer which is
 valid if the number modulo 97 is 1. As such it has two check digits.
 
-Validation can be done with is_valid(). A valid number can be made by
-calculating the check digits and appending them.
-
-
 >>> calc_check_digits('99991234567890121414')
 '90'
 >>> is_valid('9999123456789012141490')

Modified: python-stdnum/stdnum/lt/pvm.py
==============================================================================
--- python-stdnum/stdnum/lt/pvm.py      Sun Feb 26 12:38:24 2012        (r167)
+++ python-stdnum/stdnum/lt/pvm.py      Sun Feb 26 16:08:37 2012        (r168)
@@ -20,10 +20,10 @@
 
 """PVM (Pridėtinės vertės mokestis mokėtojo kodas, Lithuanian VAT number).
 
-The PVM (Pridėtinės vertės mokestis mokėtojo kodas) is used for VAT
-purposes in Lithuania. Itis 9 digits (for legal entities) or 12 digits
-long (for temporarily registered taxpayers). This module does not check
-the format of Lithuanian personal codes (Asmens kodas).
+The PVM is used for VAT purposes in Lithuania. It is 9 digits (for legal
+entities) or 12 digits long (for temporarily registered taxpayers). This
+module does not check the format of Lithuanian personal codes (Asmens
+kodas).
 
 >>> compact('LT 100001919017')
 '100001919017'

Modified: python-stdnum/stdnum/luhn.py
==============================================================================
--- python-stdnum/stdnum/luhn.py        Sun Feb 26 12:38:24 2012        (r167)
+++ python-stdnum/stdnum/luhn.py        Sun Feb 26 16:08:37 2012        (r168)
@@ -1,6 +1,6 @@
 # luhn.py - functions for performing the Luhn and Luhn mod N algorithms
 #
-# Copyright (C) 2010, 2011 Arthur de Jong
+# Copyright (C) 2010, 2011, 2012 Arthur de Jong
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -19,13 +19,9 @@
 
 """The Luhn and Luhn mod N algorithms.
 
-The Luhn algorithm to detect most accidental errors in various
+The Luhn algorithm is used to detect most accidental errors in various
 identification numbers.
 
-Validation can be done with is_valid() which validates that the calculated
-checksum is 0. A valid number can be made by calculating the check digit
-and appending it.
-
 >>> is_valid('7894')
 False
 >>> checksum('7894')

Modified: python-stdnum/stdnum/meid.py
==============================================================================
--- python-stdnum/stdnum/meid.py        Sun Feb 26 12:38:24 2012        (r167)
+++ python-stdnum/stdnum/meid.py        Sun Feb 26 16:08:37 2012        (r168)
@@ -19,8 +19,8 @@
 
 """MEID (Mobile Equipment Identifier).
 
-The MEID (Mobile Equipment Identifier) is used to identify a physical piece
-of CDMA mobile station equipment.
+The Mobile Equipment Identifier is used to identify a physical piece of
+CDMA mobile station equipment.
 
 >>> compact('AF 01 23 45 0A BC DE C')
 'AF0123450ABCDE'

Modified: python-stdnum/stdnum/verhoeff.py
==============================================================================
--- python-stdnum/stdnum/verhoeff.py    Sun Feb 26 12:38:24 2012        (r167)
+++ python-stdnum/stdnum/verhoeff.py    Sun Feb 26 16:08:37 2012        (r168)
@@ -1,6 +1,6 @@
 # verhoeff.py - functions for performing the Verhoeff checksum
 #
-# Copyright (C) 2010, 2011 Arthur de Jong
+# Copyright (C) 2010, 2011, 2012 Arthur de Jong
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -22,10 +22,6 @@
 The Verhoeff algorithm uses two tables for permutations and
 multiplications to calculate a checksum.
 
-Validation can be done with is_valid() which validates that the calculated
-checksum is 0. A valid number can be made by calculating the check digit
-and appending it.
-
 >>> is_valid('1234')
 False
 >>> checksum('1234')
-- 
To unsubscribe send an email to
python-stdnum-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/python-stdnum-commits/