lists.arthurdejong.org
RSS feed

python-stdnum branch master updated. 1.10-22-g4e25e31

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

python-stdnum branch master updated. 1.10-22-g4e25e31



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  4e25e319c85cf51bcef1dce645f502147db4e119 (commit)
       via  d5d812b88e0d261ad93a2a7f6555096ae31c00c4 (commit)
       via  60cb8879fe73fc2d40cfa0d339200d9473e74276 (commit)
       via  39b8ace8c02445a4c4a5d639da10dc19635aa795 (commit)
       via  ab91d87f6f08e4ff9452e833df0a125f2dd38397 (commit)
       via  6eadca15146b6dc3e34ea8ba2b886e3ee63ea908 (commit)
      from  9daa1b0cbcfdc74022387430c6f4229485e1ffa8 (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=4e25e319c85cf51bcef1dce645f502147db4e119

commit 4e25e319c85cf51bcef1dce645f502147db4e119
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Sun Mar 3 17:34:39 2019 +0100

    Add Moldavian IDNO

diff --git a/stdnum/md/__init__.py b/stdnum/md/__init__.py
new file mode 100644
index 0000000..f922065
--- /dev/null
+++ b/stdnum/md/__init__.py
@@ -0,0 +1,21 @@
+# __init__.py - collection of Moldavian numbers
+# coding: utf-8
+#
+# Copyright (C) 2019 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
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301 USA
+
+"""Collection of Moldavian numbers."""
diff --git a/stdnum/md/idno.py b/stdnum/md/idno.py
new file mode 100644
index 0000000..a8e15e1
--- /dev/null
+++ b/stdnum/md/idno.py
@@ -0,0 +1,75 @@
+# rnc.py - functions for handling Moldavian company identification numbers
+# coding: utf-8
+#
+# Copyright (C) 2019 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
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301 USA
+
+"""IDNO (Moldavian company identification number).
+
+The IDNO is used in Moldavia as unique identifier for legal entities. The
+number consists of 13 digits. The first digit identifies the registry,
+followed by three digits for the year the code was assigned. The number ends
+with five identifier digits and a check digit.
+
+More information:
+
+* https://www.idno.md
+
+>>> validate('1008600038413')
+'1008600038413'
+>>> validate('1008600038412')
+Traceback (most recent call last):
+    ...
+InvalidChecksum: ...
+"""
+
+from stdnum.exceptions import *
+from stdnum.util import clean
+
+
+def compact(number):
+    """Convert the number to the minimal representation. This strips the
+    number of any valid separators and removes surrounding whitespace."""
+    return clean(number, ' ').strip()
+
+
+def calc_check_digit(number):
+    """Calculate the check digit."""
+    weights = (7, 3, 1, 7, 3, 1, 7, 3, 1, 7, 3, 1)
+    return str(sum(w * int(n) for w, n in zip(weights, number)) % 10)
+
+
+def validate(number):
+    """Check if the number provided is valid. This checks the length,
+    formatting and check digit."""
+    number = compact(number)
+    if not number.isdigit():
+        raise InvalidFormat()
+    if len(number) != 13:
+        raise InvalidLength()
+    if number[-1] != calc_check_digit(number):
+        raise InvalidChecksum()
+    return number
+
+
+def is_valid(number):
+    """Check if the number provided is valid. This checks the length,
+    formatting and check digit."""
+    try:
+        return bool(validate(number))
+    except ValidationError:
+        return False
diff --git a/tests/test_md_idno.doctest b/tests/test_md_idno.doctest
new file mode 100644
index 0000000..36f2a51
--- /dev/null
+++ b/tests/test_md_idno.doctest
@@ -0,0 +1,235 @@
+test_md_idno.doctest - more detailed doctests for stdnum.md.idno module
+
+Copyright (C) 2019 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
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA
+
+
+This file contains more detailed doctests for the stdnum.md.idno. It tries
+to cover more corner cases and detailed functionality that is not really
+useful as module documentation.
+
+>>> from stdnum.md import idno
+
+
+These have been found online and should all be valid numbers.
+
+>>> numbers = '''
+...
+... 1002600000283
+... 1002600001028
+... 1002600001338
+... 1002600008094
+... 1002600010033
+... 1002600010457
+... 1002600019461
+... 1002600022348
+... 1002600029347
+... 1002600032246
+... 1002600033391
+... 1002600037724
+... 1002600043853
+... 1002600048951
+... 1002600049383
+... 1002601002723
+... 1002602002719
+... 1002602003554
+... 1002606000311
+... 1002606001374
+... 1002610000125
+... 1003600004015
+... 1003600007577
+... 1003600010708
+... 1003600011613
+... 1003600013813
+... 1003600024394
+... 1003600028842
+... 1003600044846
+... 1003600057022
+... 1003600061928
+... 1003600068673
+... 1003600080381
+... 1003600084426
+... 1003600095402
+... 1003600097956
+... 1003600124700
+... 1003600126117
+... 1003600126494
+... 1003600150509
+... 1003600151643
+... 1003600158022
+... 1003600158468
+... 1003600160588
+... 1003600161954
+... 1003601000988
+... 1003602009014
+... 1003602014168
+... 1003602024240
+... 1003602026761
+... 1003602150732
+... 1003602150994
+... 1003603003271
+... 1003603005356
+... 1003603152168
+... 1003604012571
+... 1003607000706
+... 1003607018161
+... 1003608004594
+... 1003609002508
+... 1003609006827
+... 1003611007483
+... 1003611151021
+... 1004600024988
+... 1004600052987
+... 1004600059850
+... 1004600073229
+... 1004601002255
+... 1004602008977
+... 1004607000666
+... 1005600033978
+... 1005602001621
+... 1005607000917
+... 1006600010112
+... 1006600032989
+... 1006600052073
+... 1006600055546
+... 1006601001311
+... 1006601003430
+... 1006601003832
+... 1006601004507
+... 1006601004758
+... 1006601004943
+... 1006609000860
+... 1007600001506
+... 1007600007379
+... 1007600017532
+... 1007600047580
+... 1007601000160
+... 1007601000218
+... 1007601000540
+... 1007601000562
+... 1007601000609
+... 1007601001972
+... 1007601002290
+... 1007601002382
+... 1007601003220
+... 1007601004283
+... 1007601004294
+... 1007601004308
+... 1007601004342
+... 1007601004870
+... 1007601004939
+... 1007601005224
+... 1007601005501
+... 1007601005545
+... 1007601006508
+... 1007601006575
+... 1007601008384
+... 1007601009037
+... 1007601009163
+... 1007601009325
+... 1007601009521
+... 1007601009587
+... 1007601009912
+... 1007601010013
+... 1007601010932
+... 1007601011087
+... 1007601011168
+... 1007601011272
+... 1007602000972
+... 1007602006262
+... 1007611002202
+... 1007611005052
+... 1008600035526
+... 1008600044793
+... 1008600045022
+... 1008600059490
+... 1008601000031
+... 1008601000422
+... 1008601000994
+... 1008606007301
+... 1008607004857
+... 1009603004306
+... 1009611003177
+... 1009620001650
+... 1010611001827
+... 1010620003711
+... 1010620005726
+... 1011600023877
+... 1011601000295
+... 1011605002057
+... 1011606002700
+... 1011620003730
+... 1011620006041
+... 1011620006812
+... 1012601000177
+... 1012605003408
+... 1012606001995
+... 1012607004177
+... 1012608001036
+... 1012608001748
+... 1012609001549
+... 1012609002409
+... 1012620008743
+... 1012620009005
+... 1012620009348
+... 1012620009474
+... 1012620009658
+... 1012620010438
+... 1012620011424
+... 1012620011505
+... 1012620011963
+... 1012620012177
+... 1012620012199
+... 1012620012236
+... 1013600024487
+... 1013600025635
+... 1013600028120
+... 1013600036596
+... 1013600039715
+... 1013601000152
+... 1013601000222
+... 1013601000624
+... 1013602004249
+... 1013603003180
+... 1013605001386
+... 1013606004155
+... 1013607003177
+... 1013607003258
+... 1013620000043
+... 1013620000168
+... 1013620000238
+... 1013620000342
+... 1013620000630
+... 1013620000847
+... 1013620001165
+... 1013620003387
+... 1013620007086
+... 1014600025229
+... 1014600038494
+... 1014601000056
+... 1014602001418
+... 1014607002465
+... 1014620000121
+... 1015605000121
+... 1015620001365
+... 1016600004372
+... 1017600052680
+... 1018600006266
+...
+... '''
+>>> [x for x in numbers.splitlines() if x and not idno.is_valid(x)]
+[]

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

commit d5d812b88e0d261ad93a2a7f6555096ae31c00c4
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Sun Mar 3 17:26:45 2019 +0100

    Add more tests for Bulgarian EGN

diff --git a/tests/test_bg_egn.doctest b/tests/test_bg_egn.doctest
new file mode 100644
index 0000000..2eccb60
--- /dev/null
+++ b/tests/test_bg_egn.doctest
@@ -0,0 +1,42 @@
+test_bg_egn.doctest - more detailed doctests for stdnum.bg.egn module
+
+Copyright (C) 2019 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
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA
+
+
+This file contains more detailed doctests for the stdnum.bg.egn module. It
+tries to cover more corner cases and detailed functionality that is not
+really useful as module documentation.
+
+>>> from stdnum.bg import egn
+
+
+These have been found online and should all be valid numbers.
+
+>>> numbers = '''
+...
+... 0010100100
+... 7501020018
+... 7523169263
+... 7542011030
+... 7552010005
+... 8001010008
+... 8032056031
+...
+... '''
+>>> [x for x in numbers.splitlines() if x and not egn.is_valid(x)]
+[]

https://arthurdejong.org/git/python-stdnum/commit/?id=60cb8879fe73fc2d40cfa0d339200d9473e74276

commit 60cb8879fe73fc2d40cfa0d339200d9473e74276
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Sun Mar 3 15:15:12 2019 +0100

    Rename MAC check_manufacturer to validate_manufacturer
    
    For consistency with the other validation modules that have an extra
    argument to disable or enable certain parts of the validation.

diff --git a/stdnum/mac.py b/stdnum/mac.py
index fbef943..6ca29fb 100644
--- a/stdnum/mac.py
+++ b/stdnum/mac.py
@@ -123,28 +123,28 @@ def is_locally_administered(number):
     return not is_universally_administered(number)
 
 
-def validate(number, check_manufacturer=None):
+def validate(number, validate_manufacturer=None):
     """Check if the number provided is a valid MAC address.
 
     The existence of the manufacturer is by default only checked for
     universally administered addresses but can be explicitly set with the
-    `check_manufacturer` argument.
+    `validate_manufacturer` argument.
     """
     number = compact(number)
     if len(number) != 17:
         raise InvalidLength()
     if not _mac_re.match(number):
         raise InvalidFormat()
-    if check_manufacturer is not False:
-        if check_manufacturer or is_universally_administered(number):
+    if validate_manufacturer is not False:
+        if validate_manufacturer or is_universally_administered(number):
             get_manufacturer(number)
     return number
 
 
-def is_valid(number, check_manufacturer=None):
+def is_valid(number, validate_manufacturer=None):
     """Check if the number provided is a valid IBAN."""
     try:
-        return bool(validate(number, check_manufacturer=check_manufacturer))
+        return bool(validate(number, 
validate_manufacturer=validate_manufacturer))
     except ValidationError:
         return False
 
diff --git a/tests/test_mac.doctest b/tests/test_mac.doctest
index 7b5547d..aab8339 100644
--- a/tests/test_mac.doctest
+++ b/tests/test_mac.doctest
@@ -94,11 +94,11 @@ addresses but can be forced or disabled.
 Traceback (most recent call last):
     ...
 InvalidComponent: ...
->>> mac.validate('fd:ff:ff:84:a2:a0', check_manufacturer=False)
+>>> mac.validate('fd:ff:ff:84:a2:a0', validate_manufacturer=False)
 'fd:ff:ff:84:a2:a0'
 >>> mac.validate('fe:54:00:76:07:0a')  # locally administered
 'fe:54:00:76:07:0a'
->>> mac.validate('fe:54:00:76:07:0a', check_manufacturer=True)
+>>> mac.validate('fe:54:00:76:07:0a', validate_manufacturer=True)
 Traceback (most recent call last):
     ...
 InvalidComponent: ...

https://arthurdejong.org/git/python-stdnum/commit/?id=39b8ace8c02445a4c4a5d639da10dc19635aa795

commit 39b8ace8c02445a4c4a5d639da10dc19635aa795
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Sun Mar 3 15:12:41 2019 +0100

    Add Lithuanian Asmens kodas

diff --git a/stdnum/lt/asmens.py b/stdnum/lt/asmens.py
new file mode 100644
index 0000000..086a3d3
--- /dev/null
+++ b/stdnum/lt/asmens.py
@@ -0,0 +1,72 @@
+# asmens.py - functions for handling Lithuanian personal numbers
+# coding: utf-8
+#
+# Copyright (C) 2019 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
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301 USA
+
+"""Asmens kodas (Lithuanian, personal numbers).
+
+The Asmens kodas consists of 11 digits. The first digits denotes the gender
+and birth century, the second through seventh denotes the birth date,
+followed by a three-digit serial and a check digit.
+
+More information:
+
+* https://lt.wikipedia.org/wiki/Asmens_kodas
+* https://en.wikipedia.org/wiki/National_identification_number#Lithuania
+
+>>> validate('33309240064')
+'33309240064'
+>>> validate('33309240164')
+Traceback (most recent call last):
+    ...
+InvalidChecksum: ...
+"""
+
+from stdnum.ee.ik import calc_check_digit, get_birth_date
+from stdnum.exceptions import *
+from stdnum.util import clean
+
+
+def compact(number):
+    """Convert the number to the minimal representation. This strips the
+    number of any valid separators and removes surrounding whitespace."""
+    return clean(number, ' ').strip()
+
+
+def validate(number, validate_birth_date=True):
+    """Check if the number provided is valid. This checks the length,
+    formatting, embedded date and check digit."""
+    number = compact(number)
+    if not number.isdigit():
+        raise InvalidFormat()
+    if len(number) != 11:
+        raise InvalidLength()
+    if validate_birth_date and number[0] != '9':
+        get_birth_date(number)
+    if number[-1] != calc_check_digit(number):
+        raise InvalidChecksum()
+    return number
+
+
+def is_valid(number, validate_birth_date=True):
+    """Check if the number provided is valid. This checks the length,
+    formatting, embedded date and check digit."""
+    try:
+        return bool(validate(number, validate_birth_date))
+    except ValidationError:
+        return False
diff --git a/tests/test_lt_asmens.doctest b/tests/test_lt_asmens.doctest
new file mode 100644
index 0000000..e472700
--- /dev/null
+++ b/tests/test_lt_asmens.doctest
@@ -0,0 +1,51 @@
+test_lt_asmens.doctest - more detailed doctests for stdnum.lt.asmens module
+
+Copyright (C) 2019 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
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA
+
+
+This file contains more detailed doctests for the stdnum.lt.asmens. It tries
+to cover more corner cases and detailed functionality that is not really
+useful as module documentation.
+
+>>> from stdnum.lt import asmens
+
+
+>>> asmens.validate('36805280109')
+'36805280109'
+>>> asmens.validate('36813280103')  # invalid date
+Traceback (most recent call last):
+    ...
+InvalidComponent: ...
+>>> asmens.validate('36813280103', validate_birth_date=False)  # invalid date
+'36813280103'
+>>> asmens.validate('96813280109')  # invalid date but starts with a 9
+'96813280109'
+
+
+These have been found online and should all be valid numbers.
+
+>>> numbers = '''
+...
+... 33309240064
+... 35002125431
+... 48504140959
+... 61205010081
+...
+... '''
+>>> [x for x in numbers.splitlines() if x and not asmens.is_valid(x)]
+[]

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

commit ab91d87f6f08e4ff9452e833df0a125f2dd38397
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Wed Feb 27 22:46:53 2019 +0100

    Add Greek AMKA social security number

diff --git a/stdnum/gr/amka.py b/stdnum/gr/amka.py
new file mode 100644
index 0000000..5f9ac9c
--- /dev/null
+++ b/stdnum/gr/amka.py
@@ -0,0 +1,101 @@
+# amka.py - functions for handling Greek social security numbers
+# coding: utf-8
+#
+# Copyright (C) 2019 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
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301 USA
+
+"""AMKA (Αριθμός Μητρώου Κοινωνικής Ασφάλισης, Greek social security number).
+
+The Αριθμός Μητρώου Κοινωνικής Ασφάλισης (AMKA or Arithmos Mitroou Koinonikis
+Asfalisis) is the personal identifier that is used for social security
+purposes in Greece. The number consists of 11 digits and includes the
+person's date of birth and gender.
+
+More information:
+
+* http://www.amka.gr/tieinai_en.html
+
+>>> validate('01013099997')
+'01013099997'
+>>> validate('01013099999')
+Traceback (most recent call last):
+    ...
+InvalidChecksum: ...
+>>> get_birth_date('01013099997')
+datetime.date(1930, 1, 1)
+>>> get_gender('01013099997')
+'M'
+"""
+
+import datetime
+
+from stdnum import luhn
+from stdnum.exceptions import *
+from stdnum.util import clean
+
+
+def compact(number):
+    """Convert the number to the minimal representation. This strips the
+    number of any valid separators and removes surrounding whitespace."""
+    return clean(number, ' -').strip()
+
+
+def get_birth_date(number):
+    """Split the date parts from the number and return the date of birth.
+    Since only two digits are used for the year, the century may be
+    incorrect."""
+    number = compact(number)
+    day = int(number[0:2])
+    month = int(number[2:4])
+    year = int(number[4:6]) + 1900
+    try:
+        return datetime.date(year, month, day)
+    except ValueError:
+        try:
+            return datetime.date(year + 100, month, day)
+        except ValueError:
+            raise InvalidComponent()
+
+
+def get_gender(number):
+    """Get the gender (M/F) from the person's AMKA."""
+    number = compact(number)
+    if int(number[9]) % 2:
+        return 'M'
+    else:
+        return 'F'
+
+
+def validate(number):
+    """Check if the number is a valid AMKA. This checks the length,
+    formatting and check digit."""
+    number = compact(number)
+    if not number.isdigit():
+        raise InvalidFormat()
+    if len(number) != 11:
+        raise InvalidLength()
+    luhn.validate(number)
+    get_birth_date(number)
+    return number
+
+
+def is_valid(number):
+    """Check if the number is a valid AMKA."""
+    try:
+        return bool(validate(number))
+    except ValidationError:
+        return False
diff --git a/tests/test_gr_amka.doctest b/tests/test_gr_amka.doctest
new file mode 100644
index 0000000..6b8815f
--- /dev/null
+++ b/tests/test_gr_amka.doctest
@@ -0,0 +1,147 @@
+test_gr_amka.doctest - more detailed doctests for stdnum.gr.amka module
+
+Copyright (C) 2019 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
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA
+
+
+This file contains more detailed doctests for the stdnum.gr.amka module. It
+tries to test more corner cases and detailed functionality that is not really
+useful as module documentation.
+
+>>> from stdnum.gr import amka
+
+
+Tests for some corner cases.
+
+>>> amka.get_gender('01014719866')
+'F'
+>>> amka.get_birth_date('29020012349')  # the year 1900 wasn't a leap year
+datetime.date(2000, 2, 29)
+>>> amka.get_birth_date('99887712349')
+Traceback (most recent call last):
+    ...
+InvalidComponent: ...
+
+
+These have been found online and should all be valid numbers.
+
+>>> numbers = '''
+...
+... 01015734500
+... 01017902501
+... 01037200308
+... 01086004429
+... 01086104112
+... 01115904128
+... 02027000252
+... 02037500945
+... 02065702405
+... 03016601845
+... 03026603674
+... 03037202441
+... 03076103047
+... 03106501681
+... 03117200869
+... 04087402360
+... 04116301831
+... 05086500989
+... 06067504867
+... 06097603465
+... 06105502253
+... 07017100129
+... 07018502224
+... 07106303022
+... 07107300886
+... 08016701602
+... 08017702609
+... 08017704126
+... 08036603580
+... 08116303002
+... 08117501117
+... 09106001291
+... 09116602260
+... 10026004050
+... 10047602601
+... 10096900187
+... 11014803107
+... 11016400969
+... 11025702967
+... 11046703861
+... 12047200899
+... 12105704402
+... 13077802109
+... 13096701340
+... 13125502677
+... 14025500902
+... 14046001336
+... 14066303158
+... 14067000407
+... 15017306430
+... 16016804169
+... 16056702307
+... 16077801260
+... 17025100797
+... 17116903224
+... 18025400765
+... 18058302342
+... 19017803057
+... 19025503111
+... 19055702252
+... 19076801638
+... 20017802123
+... 20035603156
+... 20036305348
+... 20057401257
+... 21028001986
+... 21086800642
+... 21117500724
+... 22016501151
+... 22027901325
+... 22065701165
+... 22105800084
+... 23096100682
+... 24047005699
+... 24086202793
+... 25036505284
+... 25047902066
+... 25088700387
+... 25098700203
+... 25125700721
+... 26107300183
+... 26126301089
+... 27056500807
+... 27065801162
+... 27087200989
+... 27116400865
+... 27126702243
+... 28036104546
+... 28057902661
+... 28087800729
+... 28096101861
+... 28126002196
+... 29095401419
+... 30046801046
+... 30067201225
+... 30096101065
+... 30126002077
+... 31035902076
+... 31057004512
+... 31085501570
+...
+... '''
+>>> [x for x in numbers.splitlines() if x and not amka.is_valid(x)]
+[]

https://arthurdejong.org/git/python-stdnum/commit/?id=6eadca15146b6dc3e34ea8ba2b886e3ee63ea908

commit 6eadca15146b6dc3e34ea8ba2b886e3ee63ea908
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Wed Feb 20 23:37:00 2019 +0100

    Switch from import-order to isort

diff --git a/setup.cfg b/setup.cfg
index 49ee58d..73fec46 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -36,3 +36,7 @@ ignore =
   W504  # we put the binary operator on the preceding line
 max-complexity = 15
 max-line-length = 120
+
+[isort]
+lines_after_imports = 2
+multi_line_output = 4
diff --git a/setup.py b/setup.py
index 016e77d..5514b77 100755
--- a/setup.py
+++ b/setup.py
@@ -23,10 +23,12 @@
 
 import os
 import sys
-from setuptools import setup, find_packages
+
+from setuptools import find_packages, setup
 
 import stdnum
 
+
 # fix permissions for sdist
 if 'sdist' in sys.argv:
     os.system('chmod -R a+rX .')
diff --git a/stdnum/__init__.py b/stdnum/__init__.py
index 02ce1ee..b32d9e3 100644
--- a/stdnum/__init__.py
+++ b/stdnum/__init__.py
@@ -39,6 +39,7 @@ parsing, validation, formatting or conversion functions.
 
 from stdnum.util import get_cc_module
 
+
 __all__ = ('get_cc_module', '__version__')
 
 # the version number of the library
diff --git a/stdnum/bic.py b/stdnum/bic.py
index 367abc8..a4f2a50 100644
--- a/stdnum/bic.py
+++ b/stdnum/bic.py
@@ -52,6 +52,7 @@ import re
 from stdnum.exceptions import *
 from stdnum.util import clean
 
+
 _bic_re = re.compile(r'^[A-Z]{6}[0-9A-Z]{2}([0-9A-Z]{3})?$')
 
 
diff --git a/stdnum/cl/__init__.py b/stdnum/cl/__init__.py
index 1c7a834..f31595e 100644
--- a/stdnum/cl/__init__.py
+++ b/stdnum/cl/__init__.py
@@ -21,5 +21,5 @@
 """Collection of Chilean numbers."""
 
 # provide vat and run as an alias
-from stdnum.cl import rut as vat  # noqa: F401
-from stdnum.cl import rut as run  # noqa: F401
+from stdnum.cl import rut as vat  # noqa: F401, isort:skip
+from stdnum.cl import rut as run  # noqa: F401, isort:skip
diff --git a/stdnum/co/__init__.py b/stdnum/co/__init__.py
index a72d843..de40a0c 100644
--- a/stdnum/co/__init__.py
+++ b/stdnum/co/__init__.py
@@ -21,5 +21,5 @@
 """Collection of Colombian numbers."""
 
 # provide vat and rut as an alias
-from stdnum.co import nit as vat  # noqa: F401
-from stdnum.co import nit as rut  # noqa: F401
+from stdnum.co import nit as vat  # noqa: F401, isort:skip
+from stdnum.co import nit as rut  # noqa: F401, isort:skip
diff --git a/stdnum/eu/at_02.py b/stdnum/eu/at_02.py
index 8f1147b..a8fa9bc 100644
--- a/stdnum/eu/at_02.py
+++ b/stdnum/eu/at_02.py
@@ -42,6 +42,7 @@ from stdnum.exceptions import *
 from stdnum.iso7064 import mod_97_10
 from stdnum.util import clean
 
+
 # the valid characters we have
 _alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
diff --git a/stdnum/iso6346.py b/stdnum/iso6346.py
index b16fd99..225b8a9 100644
--- a/stdnum/iso6346.py
+++ b/stdnum/iso6346.py
@@ -44,8 +44,7 @@ InvalidChecksum: ...
 
 import re
 
-from stdnum.exceptions import InvalidChecksum, InvalidFormat, InvalidLength, \
-    ValidationError
+from stdnum.exceptions import *
 from stdnum.util import clean
 
 
diff --git a/stdnum/iso9362.py b/stdnum/iso9362.py
index 321e531..1902d3b 100644
--- a/stdnum/iso9362.py
+++ b/stdnum/iso9362.py
@@ -29,5 +29,5 @@ warnings.warn(
 
 
 # We ensure that stdnum.bic is exposed in this module's place
-import stdnum.bic
+import stdnum.bic  # isort:skip
 sys.modules[__name__] = stdnum.bic
diff --git a/stdnum/numdb.py b/stdnum/numdb.py
index 503f539..003708f 100644
--- a/stdnum/numdb.py
+++ b/stdnum/numdb.py
@@ -87,6 +87,7 @@ import re
 
 from pkg_resources import resource_stream
 
+
 _line_re = re.compile(
     r'^(?P<indent> *)'
     r'(?P<ranges>([^-,\s]+(-[^-,\s]+)?)(,[^-,\s]+(-[^-,\s]+)?)*)\s*'
diff --git a/stdnum/sk/rc.py b/stdnum/sk/rc.py
index 84eb9c9..f43dc79 100644
--- a/stdnum/sk/rc.py
+++ b/stdnum/sk/rc.py
@@ -50,4 +50,6 @@ InvalidLength: ...
 # since this number is essentially the same as the Czech counterpart
 # (until 1993 the Czech Republic and Slovakia were one country)
 from stdnum.cz.rc import compact, format, is_valid, validate
+
+
 __all__ = ['compact', 'validate', 'is_valid', 'format']
diff --git a/stdnum/us/tin.py b/stdnum/us/tin.py
index c32c789..72ccddc 100644
--- a/stdnum/us/tin.py
+++ b/stdnum/us/tin.py
@@ -52,6 +52,7 @@ from stdnum.exceptions import *
 from stdnum.us import atin, ein, itin, ptin, ssn
 from stdnum.util import clean
 
+
 _tin_modules = (ssn, itin, ein, ptin, atin)
 
 
diff --git a/tox.ini b/tox.ini
index f2bfcde..940e30a 100644
--- a/tox.ini
+++ b/tox.ini
@@ -24,7 +24,7 @@ deps = flake8
        flake8-deprecated
        flake8-docstrings
        flake8-exact-pin
-       flake8-import-order
+       flake8-isort
        flake8-print
        flake8-quotes
        flake8-tidy-imports
diff --git a/update/at_postleitzahl.py b/update/at_postleitzahl.py
index 9ac43d3..4d2a993 100755
--- a/update/at_postleitzahl.py
+++ b/update/at_postleitzahl.py
@@ -29,15 +29,15 @@ import os.path
 import re
 import urllib
 
+import BeautifulSoup
+import xlrd
+
+
 try:
     from urllib.parse import urljoin
 except ImportError:
     from urlparse import urljoin
 
-import BeautifulSoup
-
-import xlrd
-
 
 # The page that contains a link to the downloadable spreadsheet with current
 # Austrian postal codes
diff --git a/update/do_whitelists.py b/update/do_whitelists.py
index c70471d..f242c51 100755
--- a/update/do_whitelists.py
+++ b/update/do_whitelists.py
@@ -32,11 +32,12 @@ import textwrap
 import urllib
 import zipfile
 
-# Ensure that we use our local stdnum implementation is used
+
+# Ensure that our local stdnum implementation is used
 sys.path.insert(0, os.path.normpath(
     os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')))
 
-from stdnum.do import cedula, rnc  # noqa
+from stdnum.do import cedula, rnc  # noqa, isort:skip
 
 
 # The URL of the zip file with all valid numbers
diff --git a/update/my_bp.py b/update/my_bp.py
index 49d7ffa..ad9bc60 100755
--- a/update/my_bp.py
+++ b/update/my_bp.py
@@ -26,7 +26,6 @@ import re
 from collections import defaultdict
 
 import BeautifulSoup
-
 import requests
 
 
diff --git a/update/numlist.py b/update/numlist.py
index 933cc8d..8d6d086 100755
--- a/update/numlist.py
+++ b/update/numlist.py
@@ -25,11 +25,12 @@ suitable to be included in the README and stdnum package 
description."""
 import os.path
 import sys
 
-# Ensure that we use our local stdnum implementation is used
+
+# Ensure that our local stdnum implementation is used
 sys.path.insert(0, os.path.normpath(
     os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')))
 
-from stdnum import util  # noqa
+from stdnum import util  # noqa, isort:skip
 
 
 # these are excluded

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

Summary of changes:
 setup.cfg                                          |   4 +
 setup.py                                           |   4 +-
 stdnum/__init__.py                                 |   1 +
 stdnum/bic.py                                      |   1 +
 stdnum/cl/__init__.py                              |   4 +-
 stdnum/co/__init__.py                              |   4 +-
 stdnum/eu/at_02.py                                 |   1 +
 stdnum/{cu/ni.py => gr/amka.py}                    |  80 ++++---
 stdnum/iso6346.py                                  |   3 +-
 stdnum/iso9362.py                                  |   2 +-
 stdnum/{ee/registrikood.py => lt/asmens.py}        |  54 ++---
 stdnum/mac.py                                      |  12 +-
 stdnum/{cu => md}/__init__.py                      |   4 +-
 stdnum/{at/vnr.py => md/idno.py}                   |  42 ++--
 stdnum/numdb.py                                    |   1 +
 stdnum/sk/rc.py                                    |   2 +
 stdnum/us/tin.py                                   |   1 +
 tests/{test_in_pan.doctest => test_bg_egn.doctest} |  26 +--
 tests/test_gr_amka.doctest                         | 147 +++++++++++++
 ...est_fr_siren.doctest => test_lt_asmens.doctest} |  42 ++--
 tests/test_mac.doctest                             |   4 +-
 tests/test_md_idno.doctest                         | 235 +++++++++++++++++++++
 tox.ini                                            |   2 +-
 update/at_postleitzahl.py                          |   8 +-
 update/do_whitelists.py                            |   5 +-
 update/my_bp.py                                    |   1 -
 update/numlist.py                                  |   5 +-
 27 files changed, 539 insertions(+), 156 deletions(-)
 copy stdnum/{cu/ni.py => gr/amka.py} (56%)
 copy stdnum/{ee/registrikood.py => lt/asmens.py} (57%)
 copy stdnum/{cu => md}/__init__.py (90%)
 copy stdnum/{at/vnr.py => md/idno.py} (61%)
 copy tests/{test_in_pan.doctest => test_bg_egn.doctest} (65%)
 create mode 100644 tests/test_gr_amka.doctest
 copy tests/{test_fr_siren.doctest => test_lt_asmens.doctest} (50%)
 create mode 100644 tests/test_md_idno.doctest


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/