lists.arthurdejong.org
RSS feed

python-stdnum branch master updated. 1.7-29-gfbb9d24

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

python-stdnum branch master updated. 1.7-29-gfbb9d24



This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "python-stdnum".

The branch, master has been updated
       via  fbb9d24b79688f6e76f1f58396af81525af13455 (commit)
      from  7bb0e5f5eb65a4089e222459f2ab82db4ec6a93f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://arthurdejong.org/git/python-stdnum/commit/?id=fbb9d24b79688f6e76f1f58396af81525af13455

commit fbb9d24b79688f6e76f1f58396af81525af13455
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Wed Jan 3 16:51:20 2018 +0100

    Move get_cc_module() function to package for public use

diff --git a/docs/index.rst b/docs/index.rst
index 2ae70b2..e1bdb6c 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -9,26 +9,26 @@ Common Interface
 
 Most of the number format modules implement the following functions:
 
-.. function:: validate(number)
+.. function:: module.validate(number)
 
    Validate the number and return a compact, consistent representation of
    the number or code. If the validation fails,
    :mod:`an exception <.exceptions>` is raised that indicates the type of
    error.
 
-.. function:: is_valid(number)
+.. function:: module.is_valid(number)
 
    Return either ``True`` or ``False`` depending on whether the passed number
    is in any supported and valid form and passes all embedded checks of the
    number. This function should never raise an exception.
 
-.. function:: compact(number)
+.. function:: module.compact(number)
 
    Return a compact representation of the number or code. This function
    generally does not do validation but may raise exceptions for wildly
    invalid numbers.
 
-.. function:: format(number)
+.. function:: module.format(number)
 
    Return a formatted version of the number in the preferred format.
    This function generally expects to be passed a valid number or code and
@@ -36,13 +36,13 @@ Most of the number format modules implement the following 
functions:
 
 The check digit modules generally also provide the following functions:
 
-.. function:: checksum(number)
+.. function:: module.checksum(number)
 
    Calculate the checksum over the provided number. This is generally a
    number that can be used to determine whether the provided number is
    valid. It depends on the algorithm which checksum is considered valid.
 
-.. function:: calc_check_digit(number)
+.. function:: module.calc_check_digit(number)
 
    Calculate the check digit that should be added to the number to make it
    valid.
@@ -51,14 +51,33 @@ Apart from the above, the modules may add extra parsing, 
validation or
 conversion functions.
 
 
-Helper modules
---------------
+Helper functions and modules
+----------------------------
 
 .. autosummary::
    :toctree:
 
    exceptions
 
+.. autofunction:: get_cc_module
+
+   Searches the stdnum collection of modules for a number format for a
+   particular country. `name` may be an aliased name. For example:
+
+       >>> from stdnum import get_cc_module
+       >>> get_cc_module('nl', 'vat')
+       <module 'stdnum.nl.btw' from '...'>
+
+   Will return ``None`` if no module could be found. The generic names that
+   are currently in use:
+
+   * ``'vat'`` for value added tax numbers
+   * ``'businessid'`` for generic business identifiers (although some countries
+     may have multiple)
+   * ``'personalid'`` for generic personal identifiers (some countries may have
+     multiple, especially for tax purposes)
+   * ``'postcal_code'`` for address postal codes
+
 
 Generic check digit algorithms
 ------------------------------
diff --git a/stdnum/__init__.py b/stdnum/__init__.py
index e915184..ff4478c 100644
--- a/stdnum/__init__.py
+++ b/stdnum/__init__.py
@@ -37,6 +37,9 @@ Apart from the validate() function, many modules provide extra
 parsing, validation, formatting or conversion functions.
 """
 
+from stdnum.util import get_cc_module
+
+__all__ = ('get_cc_module', '__version__')
 
 # the version number of the library
 __version__ = '1.7'

-----------------------------------------------------------------------

Summary of changes:
 docs/index.rst     | 35 +++++++++++++++++++++++++++--------
 stdnum/__init__.py |  3 +++
 2 files changed, 30 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
python-stdnum
-- 
To unsubscribe send an email to
python-stdnum-commits-unsubscribe@lists.arthurdejong.org or see
https://lists.arthurdejong.org/python-stdnum-commits/