lists.arthurdejong.org
RSS feed

python-stdnum branch master updated. 1.10-4-gbb24c2f

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

python-stdnum branch master updated. 1.10-4-gbb24c2f



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  bb24c2fc8b2cdfe59c9acf35d0e6ca962c0984b2 (commit)
      from  069279a0613a4ae767987d7d3d65fd27cb355490 (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=bb24c2fc8b2cdfe59c9acf35d0e6ca962c0984b2

commit bb24c2fc8b2cdfe59c9acf35d0e6ca962c0984b2
Author: Mario Puntin <mario@silix.com.ar>
Date:   Fri Dec 7 12:15:10 2018 -0300

    Add format for Argentinian CUIT number
    
    Closes https://github.com/arthurdejong/python-stdnum/pull/89

diff --git a/stdnum/ar/cuit.py b/stdnum/ar/cuit.py
index 93ff696..fdf9ee0 100644
--- a/stdnum/ar/cuit.py
+++ b/stdnum/ar/cuit.py
@@ -41,6 +41,8 @@ InvalidFormat: ...
 Traceback (most recent call last):
     ...
 InvalidChecksum: ...
+>>> format('20267565393')
+'20-26756539-3'
 """
 
 from stdnum.exceptions import *
@@ -78,3 +80,9 @@ def is_valid(number):
         return bool(validate(number))
     except ValidationError:
         return False
+
+
+def format(number):
+    """Reformat the number to the standard presentation format."""
+    number = compact(number)
+    return (number[0:2] + '-' + number[2:10] + '-' + number[10:])

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

Summary of changes:
 stdnum/ar/cuit.py | 8 ++++++++
 1 file changed, 8 insertions(+)


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/