python-stdnum branch master updated. 1.0-3-g3a7c9f7
[
Date Prev][Date Next]
[
Thread Prev][Thread Next]
python-stdnum branch master updated. 1.0-3-g3a7c9f7
- From: Commits of the python-stdnum project <python-stdnum-commits [at] lists.arthurdejong.org>
- To: python-stdnum-commits [at] lists.arthurdejong.org
- Reply-to: python-stdnum-users [at] lists.arthurdejong.org
- Subject: python-stdnum branch master updated. 1.0-3-g3a7c9f7
- Date: Sat, 1 Nov 2014 13:47:59 +0100 (CET)
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 3a7c9f7d2ffe14a9d2f9bc37f6eaeba4f897970c (commit)
via 6e332b138b10dc8c8f75116b4d5cb32c0b8d7bd6 (commit)
via 3fa795d807c5f6e7e2c179c18f983651eb2cb71c (commit)
from 147eeb11337d7feb2efffb96065e38140abe94dd (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 -----------------------------------------------------------------
http://arthurdejong.org/git/python-stdnum/commit/?id=3a7c9f7d2ffe14a9d2f9bc37f6eaeba4f897970c
commit 3a7c9f7d2ffe14a9d2f9bc37f6eaeba4f897970c
Author: Arthur de Jong <arthur@arthurdejong.org>
Date: Sat Nov 1 13:43:45 2014 +0100
Fix common spelling mistake
diff --git a/stdnum/bg/vat.py b/stdnum/bg/vat.py
index e04141d..f00e0da 100644
--- a/stdnum/bg/vat.py
+++ b/stdnum/bg/vat.py
@@ -22,7 +22,7 @@
The Bulgarian VAT (Данък върху добавената стойност) number is either 9
(for legal entities) or 10 digits (for physical persons, foreigners and
-others) long. Each type of number has it's own check digit algorithm.
+others) long. Each type of number has its own check digit algorithm.
>>> compact('BG 175 074 752')
'175074752'
diff --git a/stdnum/eu/at_02.py b/stdnum/eu/at_02.py
index d436308..fa5d707 100644
--- a/stdnum/eu/at_02.py
+++ b/stdnum/eu/at_02.py
@@ -50,7 +50,7 @@ def compact(number):
def _to_base10(number):
- """Prepare the number to it's base10 representation so it can be checked
+ """Prepare the number to its base10 representation so it can be checked
with the ISO 7064 Mod 97, 10 algorithm. That means excluding positions
5 to 7 and moving the first four digits to the end"""
return ''.join(str(_alphabet.index(x)) for x in number[7:] + number[:4])
diff --git a/stdnum/iban.py b/stdnum/iban.py
index fe3b093..84c2b68 100644
--- a/stdnum/iban.py
+++ b/stdnum/iban.py
@@ -21,7 +21,7 @@
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 ISO 7064 Mod 97, 10 checksum. Each country uses its own format
for the remainder of the number.
Some countries may also use checksum algorithms within their number but
@@ -62,7 +62,7 @@ def compact(number):
def _to_base10(number):
- """Prepare the number to it's base10 representation (also moving the
+ """Prepare the number to its base10 representation (also moving the
check digits to the end) so it can be checked with the ISO 7064
Mod 97, 10 algorithm."""
# TODO: find out whether this should be in the mod_97_10 module
diff --git a/stdnum/isan.py b/stdnum/isan.py
index bd956dd..24438f5 100644
--- a/stdnum/isan.py
+++ b/stdnum/isan.py
@@ -136,7 +136,7 @@ def format(number, separator='-', strip_check_digits=False,
add_check_digits=Tru
def to_binary(number):
- """Convert the number to it's binary representation (without the check
+ """Convert the number to its binary representation (without the check
digits)."""
import sys
number = compact(number, strip_check_digits=True)
diff --git a/stdnum/meid.py b/stdnum/meid.py
index 6004af2..5d38608 100644
--- a/stdnum/meid.py
+++ b/stdnum/meid.py
@@ -174,7 +174,7 @@ def format(number, separator=' ', format=None,
add_check_digit=False):
def to_binary(number):
- """Convert the number to it's binary representation (without the check
+ """Convert the number to its binary representation (without the check
digit)."""
import sys
number = compact(number, strip_check_digit=True)
diff --git a/stdnum/numdb.py b/stdnum/numdb.py
index e8ea96a..a21e7e7 100644
--- a/stdnum/numdb.py
+++ b/stdnum/numdb.py
@@ -96,7 +96,7 @@ _open_databases = {}
# [ length, low, high, props, children ]
# ...
# ]
-# where children is a prefixes structure in it's own right
+# where children is a prefixes structure in its own right
# (there is no expected ordering within the list)
http://arthurdejong.org/git/python-stdnum/commit/?id=6e332b138b10dc8c8f75116b4d5cb32c0b8d7bd6
commit 6e332b138b10dc8c8f75116b4d5cb32c0b8d7bd6
Author: Matt McDonald <mmcdonald@google.com>
Date: Fri Oct 31 21:31:30 2014 +0100
Fix for invalidating MEIDs with invalid decimal bit length
See: http://arthurdejong.org/trac/python-stdnum/ticket/10
diff --git a/stdnum/meid.py b/stdnum/meid.py
index 1f44b09..6004af2 100644
--- a/stdnum/meid.py
+++ b/stdnum/meid.py
@@ -115,7 +115,11 @@ def validate(number, strip_check_digit=True):
if cd:
luhn.validate(number + cd)
# convert to hex
- number = '%08X%06X' % (int(number[0:10]), int(number[10:18]))
+ manufacturer_code = int(number[0:10])
+ serial_num = int(number[10:18])
+ if manufacturer_code.bit_length() > 32 or serial_num.bit_length() > 24:
+ raise InvalidComponent()
+ number = '%08X%06X' % (manufacturer_code, serial_num)
cd = calc_check_digit(number)
elif number.isdigit():
# if the remaining hex format is fully decimal it is an IMEI number
diff --git a/tests/test_meid.doctest b/tests/test_meid.doctest
index c517bc6..1cb551a 100644
--- a/tests/test_meid.doctest
+++ b/tests/test_meid.doctest
@@ -73,6 +73,20 @@ Traceback (most recent call last):
...
InvalidFormat: ...
+Decimal format MEIDs with manufacturer code exceeding 32-bits should fail.
+
+>>> meid.validate('99999 99999 0070 3710 4')
+Traceback (most recent call last):
+ ...
+InvalidComponent: ...
+
+Decimal format MEIDs with serial number exceeding 24-bits should fail.
+
+>>> meid.validate('29360 87365 9999 9999 4')
+Traceback (most recent call last):
+ ...
+InvalidComponent: ...
+
The compact method should convert to HEX if needed and can optionally leave
the check digit intact.
http://arthurdejong.org/git/python-stdnum/commit/?id=3fa795d807c5f6e7e2c179c18f983651eb2cb71c
commit 3fa795d807c5f6e7e2c179c18f983651eb2cb71c
Author: Arthur de Jong <arthur@arthurdejong.org>
Date: Mon Oct 20 18:27:33 2014 +0200
Restore section for on homepage
diff --git a/getnumlist.py b/getnumlist.py
index 0a3eb1f..97c91bc 100755
--- a/getnumlist.py
+++ b/getnumlist.py
@@ -56,3 +56,8 @@ if __name__ == '__main__':
print ''
for module in get_number_modules():
print ' %s' % module.__name__.replace('stdnum.', '')
+ print ''
+ print 'For index.xml:'
+ print ''
+ for module in get_number_modules():
+ print ' <li>%s</li>' % util.get_module_name(module)
-----------------------------------------------------------------------
Summary of changes:
getnumlist.py | 5 +++++
stdnum/bg/vat.py | 2 +-
stdnum/eu/at_02.py | 2 +-
stdnum/iban.py | 4 ++--
stdnum/isan.py | 2 +-
stdnum/meid.py | 8 ++++++--
stdnum/numdb.py | 2 +-
tests/test_meid.doctest | 14 ++++++++++++++
8 files changed, 31 insertions(+), 8 deletions(-)
hooks/post-receive
--
python-stdnum
--
To unsubscribe send an email to
python-stdnum-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/python-stdnum-commits/
- python-stdnum branch master updated. 1.0-3-g3a7c9f7,
Commits of the python-stdnum project