python-stdnum branch master updated. 1.14-10-g2046f51
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
python-stdnum branch master updated. 1.14-10-g2046f51
- 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, python-stdnum-commits [at] lists.arthurdejong.org
- Subject: python-stdnum branch master updated. 1.14-10-g2046f51
- Date: Sun, 10 Jan 2021 14:17:16 +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 2046f51043c853a0c9030a30f0264d29c0a8029e (commit)
from cc3a970e893ebe6635982bcd49c48e6549cb5ac3 (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=2046f51043c853a0c9030a30f0264d29c0a8029e
commit 2046f51043c853a0c9030a30f0264d29c0a8029e
Author: Arthur de Jong <arthur@arthurdejong.org>
Date: Sun Jan 10 14:10:29 2021 +0100
Fix flake8 blind except Exception error
diff --git a/stdnum/damm.py b/stdnum/damm.py
index 9f36e40..e5fb256 100644
--- a/stdnum/damm.py
+++ b/stdnum/damm.py
@@ -1,6 +1,6 @@
# damm.py - functions for performing the Damm checksum algorithm
#
-# Copyright (C) 2016-2017 Arthur de Jong
+# Copyright (C) 2016-2021 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
@@ -85,7 +85,7 @@ def validate(number, table=None):
raise InvalidFormat()
try:
valid = checksum(number, table=table) == 0
- except Exception:
+ except Exception: # noqa: B902
raise InvalidFormat()
if not valid:
raise InvalidChecksum()
diff --git a/stdnum/eu/at_02.py b/stdnum/eu/at_02.py
index a8fa9bc..acafa90 100644
--- a/stdnum/eu/at_02.py
+++ b/stdnum/eu/at_02.py
@@ -65,7 +65,7 @@ def validate(number):
number = compact(number)
try:
test_number = _to_base10(number)
- except Exception:
+ except Exception: # noqa: B902
raise InvalidFormat()
# ensure that checksum is valid
mod_97_10.validate(test_number)
diff --git a/stdnum/gs1_128.py b/stdnum/gs1_128.py
index aee11d2..4bb5912 100644
--- a/stdnum/gs1_128.py
+++ b/stdnum/gs1_128.py
@@ -1,7 +1,7 @@
# gs1_128.py - functions for handling GS1-128 codes
#
# Copyright (C) 2019 Sergi Almacellas Abellana
-# Copyright (C) 2020 Arthur de Jong
+# Copyright (C) 2020-2021 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
@@ -253,7 +253,7 @@ def validate(number, separator=''):
return encode(info(number, separator), separator)
except ValidationError:
raise
- except Exception:
+ except Exception: # noqa: B902
# We wrap all other exceptions to ensure that we only return
# exceptions that are a subclass of ValidationError
# (the info() and encode() functions expect some semblance of valid
diff --git a/stdnum/iso7064/mod_11_10.py b/stdnum/iso7064/mod_11_10.py
index bab172f..32f52b1 100644
--- a/stdnum/iso7064/mod_11_10.py
+++ b/stdnum/iso7064/mod_11_10.py
@@ -1,6 +1,6 @@
# mod_11_10.py - functions for performing the ISO 7064 Mod 11, 10 algorithm
#
-# Copyright (C) 2010, 2011, 2012, 2013 Arthur de Jong
+# Copyright (C) 2010-2021 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
@@ -56,7 +56,7 @@ def validate(number):
"""Check whether the check digit is valid."""
try:
valid = checksum(number) == 1
- except Exception:
+ except Exception: # noqa: B902
raise InvalidFormat()
if not valid:
raise InvalidChecksum()
diff --git a/stdnum/iso7064/mod_11_2.py b/stdnum/iso7064/mod_11_2.py
index daee35d..166162d 100644
--- a/stdnum/iso7064/mod_11_2.py
+++ b/stdnum/iso7064/mod_11_2.py
@@ -1,6 +1,6 @@
# mod_11_2.py - functions for performing the ISO 7064 Mod 11, 2 algorithm
#
-# Copyright (C) 2010, 2011, 2012, 2013 Arthur de Jong
+# Copyright (C) 2010-2021 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
@@ -59,7 +59,7 @@ def validate(number):
"""Check whether the check digit is valid."""
try:
valid = checksum(number) == 1
- except Exception:
+ except Exception: # noqa: B902
raise InvalidFormat()
if not valid:
raise InvalidChecksum()
diff --git a/stdnum/iso7064/mod_37_2.py b/stdnum/iso7064/mod_37_2.py
index 99a5288..df740ff 100644
--- a/stdnum/iso7064/mod_37_2.py
+++ b/stdnum/iso7064/mod_37_2.py
@@ -1,6 +1,6 @@
# mod_37_2.py - functions for performing the ISO 7064 Mod 37, 2 algorithm
#
-# Copyright (C) 2010, 2011, 2012, 2013 Arthur de Jong
+# Copyright (C) 2010-2021 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
@@ -63,7 +63,7 @@ def validate(number,
alphabet='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ*'):
"""Check whether the check digit is valid."""
try:
valid = checksum(number, alphabet) == 1
- except Exception:
+ except Exception: # noqa: B902
raise InvalidFormat()
if not valid:
raise InvalidChecksum()
diff --git a/stdnum/iso7064/mod_37_36.py b/stdnum/iso7064/mod_37_36.py
index 6b3dea5..d05531f 100644
--- a/stdnum/iso7064/mod_37_36.py
+++ b/stdnum/iso7064/mod_37_36.py
@@ -1,6 +1,6 @@
# mod_37_36.py - functions for performing the ISO 7064 Mod 37, 36 algorithm
#
-# Copyright (C) 2010, 2011, 2012, 2013 Arthur de Jong
+# Copyright (C) 2010-2021 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
@@ -61,7 +61,7 @@ def validate(number,
alphabet='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'):
"""Check whether the check digit is valid."""
try:
valid = checksum(number, alphabet) == 1
- except Exception:
+ except Exception: # noqa: B902
raise InvalidFormat()
if not valid:
raise InvalidChecksum()
diff --git a/stdnum/iso7064/mod_97_10.py b/stdnum/iso7064/mod_97_10.py
index f5cae92..fbc9a11 100644
--- a/stdnum/iso7064/mod_97_10.py
+++ b/stdnum/iso7064/mod_97_10.py
@@ -1,6 +1,6 @@
# mod_97_10.py - functions for performing the ISO 7064 Mod 97, 10 algorithm
#
-# Copyright (C) 2010-2017 Arthur de Jong
+# Copyright (C) 2010-2021 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
@@ -39,11 +39,8 @@ from stdnum.exceptions import *
def _to_base10(number):
"""Prepare the number to its base10 representation."""
- try:
- return ''.join(
- str(int(x, 36)) for x in number)
- except Exception:
- raise InvalidFormat()
+ return ''.join(
+ str(int(x, 36)) for x in number)
def checksum(number):
@@ -61,7 +58,7 @@ def validate(number):
"""Check whether the check digit is valid."""
try:
valid = checksum(number) == 1
- except Exception:
+ except Exception: # noqa: B902
raise InvalidFormat()
if not valid:
raise InvalidChecksum()
diff --git a/stdnum/luhn.py b/stdnum/luhn.py
index afa4829..e41ce78 100644
--- a/stdnum/luhn.py
+++ b/stdnum/luhn.py
@@ -1,6 +1,6 @@
# luhn.py - functions for performing the Luhn and Luhn mod N algorithms
#
-# Copyright (C) 2010, 2011, 2012, 2013 Arthur de Jong
+# Copyright (C) 2010-2021 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
@@ -64,7 +64,7 @@ def validate(number, alphabet='0123456789'):
raise InvalidFormat()
try:
valid = checksum(number, alphabet) == 0
- except Exception:
+ except Exception: # noqa: B902
raise InvalidFormat()
if not valid:
raise InvalidChecksum()
diff --git a/stdnum/util.py b/stdnum/util.py
index 5c19425..5b0e4e8 100644
--- a/stdnum/util.py
+++ b/stdnum/util.py
@@ -1,7 +1,7 @@
# util.py - common utility functions
# coding: utf-8
#
-# Copyright (C) 2012-2019 Arthur de Jong
+# Copyright (C) 2012-2021 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
@@ -168,7 +168,7 @@ def clean(number, deletechars=''):
"""
try:
number = ''.join(x for x in number)
- except Exception:
+ except Exception: # noqa: B902
raise InvalidFormat()
if sys.version < '3' and isinstance(number, str): # pragma: no cover
(Python 2 specific code)
try:
diff --git a/stdnum/verhoeff.py b/stdnum/verhoeff.py
index e6af854..b6b0f20 100644
--- a/stdnum/verhoeff.py
+++ b/stdnum/verhoeff.py
@@ -1,6 +1,6 @@
# verhoeff.py - functions for performing the Verhoeff checksum
#
-# Copyright (C) 2010-2015 Arthur de Jong
+# Copyright (C) 2010-2021 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
@@ -92,7 +92,7 @@ def validate(number):
raise InvalidFormat()
try:
valid = checksum(number) == 0
- except Exception:
+ except Exception: # noqa: B902
raise InvalidFormat()
if not valid:
raise InvalidChecksum()
-----------------------------------------------------------------------
Summary of changes:
stdnum/damm.py | 4 ++--
stdnum/eu/at_02.py | 2 +-
stdnum/gs1_128.py | 4 ++--
stdnum/iso7064/mod_11_10.py | 4 ++--
stdnum/iso7064/mod_11_2.py | 4 ++--
stdnum/iso7064/mod_37_2.py | 4 ++--
stdnum/iso7064/mod_37_36.py | 4 ++--
stdnum/iso7064/mod_97_10.py | 11 ++++-------
stdnum/luhn.py | 4 ++--
stdnum/util.py | 4 ++--
stdnum/verhoeff.py | 4 ++--
11 files changed, 23 insertions(+), 26 deletions(-)
hooks/post-receive
--
python-stdnum
- python-stdnum branch master updated. 1.14-10-g2046f51,
Commits of the python-stdnum project