lists.arthurdejong.org
RSS feed

python-stdnum branch master updated. 1.14-17-gdf0623b

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

python-stdnum branch master updated. 1.14-17-gdf0623b



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  df0623b41efed2451d6d9b2f2e138cc3209f68bb (commit)
      from  b202eeeca63ca52f9a8540376a92fe3034f97277 (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=df0623b41efed2451d6d9b2f2e138cc3209f68bb

commit df0623b41efed2451d6d9b2f2e138cc3209f68bb
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Sun Jan 10 23:28:53 2021 +0100

    Drop pinning of isort now flake8-isort has been fixed
    
    This changes a few inline imports in the code to pass with the new
    isort.
    
    Reverts 291b831

diff --git a/stdnum/by/unp.py b/stdnum/by/unp.py
index 14b7a0e..5b9c324 100644
--- a/stdnum/by/unp.py
+++ b/stdnum/by/unp.py
@@ -112,10 +112,10 @@ def check_nalog(number, timeout=30):  # pragma: no cover 
(not part of normal tes
     """
     # this function isn't automatically tested because it would require
     # network access for the tests and unnecessarily load the web service
-    import requests
-    from pkg_resources import resource_filename
     # Since the nalog.gov.by web site currently provides an incomplete
     # certificate chain, we provide our own.
+    import requests
+    from pkg_resources import resource_filename
     certificate = resource_filename(__name__, 'portal.nalog.gov.by.crt')
     response = requests.get(
         'https://www.portal.nalog.gov.by/grp/getData',
diff --git a/stdnum/do/ncf.py b/stdnum/do/ncf.py
index a85e4c7..c9a3a13 100644
--- a/stdnum/do/ncf.py
+++ b/stdnum/do/ncf.py
@@ -168,7 +168,7 @@ def check_dgii(rnc, ncf, timeout=30):  # pragma: no cover
     Will return None if the number is invalid or unknown."""
     import lxml.html
     import requests
-    from stdnum.do.rnc import compact as rnc_compact
+    from stdnum.do.rnc import compact as rnc_compact  # noqa: I003
     rnc = rnc_compact(rnc)
     ncf = compact(ncf)
     url = 
'https://dgii.gov.do/app/WebApps/ConsultasWeb2/ConsultasWeb/consultas/ncf.aspx'
diff --git a/stdnum/imsi.py b/stdnum/imsi.py
index 8cc9fc0..ceb1549 100644
--- a/stdnum/imsi.py
+++ b/stdnum/imsi.py
@@ -52,10 +52,10 @@ def compact(number):
 def split(number):
     """Split the specified IMSI into a Mobile Country Code (MCC), a Mobile
     Network Code (MNC), a Mobile Station Identification Number (MSIN)."""
-    from stdnum import numdb
     # clean up number
     number = compact(number)
     # split the number
+    from stdnum import numdb
     return tuple(numdb.get('imsi').split(number))
 
 
@@ -73,10 +73,10 @@ def validate(number):
 
 def info(number):
     """Return a dictionary of data about the supplied number."""
-    from stdnum import numdb
     # clean up number
     number = compact(number)
     # split the number
+    from stdnum import numdb
     info = dict(number=number)
     mcc_info, mnc_info, msin_info = numdb.get('imsi').info(number)
     info['mcc'] = mcc_info[0]
diff --git a/stdnum/isbn.py b/stdnum/isbn.py
index 06af4e8..b868be6 100644
--- a/stdnum/isbn.py
+++ b/stdnum/isbn.py
@@ -177,7 +177,6 @@ def split(number, convert=False):
     registrant, an item number and a check-digit. If the number is in ISBN-10
     format the returned EAN.UCC prefix is '978'. If the covert parameter is
     True the number is converted to ISBN-13 format first."""
-    from stdnum import numdb
     # clean up number
     number = compact(number, convert)
     # get Bookland prefix if any
@@ -186,6 +185,7 @@ def split(number, convert=False):
         number = '978' + number
         delprefix = True
     # split the number
+    from stdnum import numdb
     result = numdb.get('isbn').split(number[:-1])
     itemnr = result.pop() if result else ''
     prefix = result.pop(0) if result else ''
diff --git a/stdnum/meid.py b/stdnum/meid.py
index 5dedd8f..9f25379 100644
--- a/stdnum/meid.py
+++ b/stdnum/meid.py
@@ -118,9 +118,9 @@ def validate(number, strip_check_digit=True):
     """Check if the number is a valid MEID number. This converts the
     representation format of the number (if it is decimal it is not converted
     to hexadecimal)."""
-    from stdnum import luhn
     # first parse the number
     number, cd = _parse(number)
+    from stdnum import luhn
     if len(number) == 18:
         # decimal format can be easily determined
         if cd:
@@ -194,7 +194,7 @@ def to_binary(number):
 def to_pseudo_esn(number):
     """Convert the provided MEID to a pseudo ESN (pESN). The ESN is returned
     in compact hexadecimal representation."""
-    import hashlib
     # return the last 6 digits of the SHA1  hash prefixed with the reserved
     # manufacturer code
+    import hashlib
     return '80' + hashlib.sha1(to_binary(number)).hexdigest()[-6:].upper()
diff --git a/tox.ini b/tox.ini
index 282b836..d7ae91d 100644
--- a/tox.ini
+++ b/tox.ini
@@ -31,9 +31,6 @@ deps = flake8
        flake8-tidy-imports
        flake8-tuple
        pep8-naming
-       # keep the following until this is fixed:
-       # https://github.com/gforcada/flake8-isort/issues/88
-       isort<5
 commands = flake8 stdnum tests update setup.py
 
 [testenv:docs]

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

Summary of changes:
 stdnum/by/unp.py | 4 ++--
 stdnum/do/ncf.py | 2 +-
 stdnum/imsi.py   | 4 ++--
 stdnum/isbn.py   | 2 +-
 stdnum/meid.py   | 4 ++--
 tox.ini          | 3 ---
 6 files changed, 8 insertions(+), 11 deletions(-)


hooks/post-receive
-- 
python-stdnum