python-stdnum branch master updated. 1.18-21-g7d3ddab
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
python-stdnum branch master updated. 1.18-21-g7d3ddab
- 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.18-21-g7d3ddab
- Date: Sat, 17 Jun 2023 18:40:08 +0200 (CEST)
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 7d3ddab7ed289580401d29e9a79574174e39f56b (commit)
from 90044e27d9cbe49c8d8374732dfa8ddc10685ce0 (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=7d3ddab7ed289580401d29e9a79574174e39f56b
commit 7d3ddab7ed289580401d29e9a79574174e39f56b
Author: Chales Horn <charles.horn@gmail.com>
Date: Thu Jun 1 12:37:16 2023 +1200
Minor ISSN and ISBN documentation fixes
Fix a comment that claimed incorrect ISSN length and use slightly more
consistent terminology around check digits in ISSN and ISBN.
Closes https://github.com/arthurdejong/python-stdnum/pull/415
diff --git a/stdnum/isbn.py b/stdnum/isbn.py
index 9e4d521..0a36661 100644
--- a/stdnum/isbn.py
+++ b/stdnum/isbn.py
@@ -81,7 +81,7 @@ def compact(number, convert=False):
def _calc_isbn10_check_digit(number):
"""Calculate the ISBN check digit for 10-digit numbers. The number passed
- should not have the check bit included."""
+ should not have the check digit included."""
check = sum((i + 1) * int(n)
for i, n in enumerate(number)) % 11
return 'X' if check == 10 else str(check)
@@ -89,7 +89,7 @@ def _calc_isbn10_check_digit(number):
def validate(number, convert=False):
"""Check if the number provided is a valid ISBN (either a legacy 10-digit
- one or a 13-digit one). This checks the length and the check bit but does
+ one or a 13-digit one). This checks the length and the check digit but does
not check if the group and publisher are valid (use split() for that)."""
number = compact(number, convert=False)
if not isdigits(number[:-1]):
@@ -123,7 +123,7 @@ def isbn_type(number):
def is_valid(number):
"""Check if the number provided is a valid ISBN (either a legacy 10-digit
- one or a 13-digit one). This checks the length and the check bit but does
+ one or a 13-digit one). This checks the length and the check digit but does
not check if the group and publisher are valid (use split() for that)."""
try:
return bool(validate(number))
@@ -174,7 +174,7 @@ def to_isbn10(number):
def split(number, convert=False):
"""Split the specified ISBN into an EAN.UCC prefix, a group prefix, a
- registrant, an item number and a check-digit. If the number is in ISBN-10
+ 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 convert parameter is
True the number is converted to ISBN-13 format first."""
# clean up number
@@ -198,7 +198,7 @@ def split(number, convert=False):
def format(number, separator='-', convert=False):
"""Reformat the number to the standard presentation format with the
EAN.UCC prefix (if any), the group prefix, the registrant, the item
- number and the check-digit separated (if possible) by the specified
+ number and the check digit separated (if possible) by the specified
separator. Passing an empty separator should equal compact() though this
is less efficient. If the convert parameter is True the number is
converted to ISBN-13 format first."""
diff --git a/stdnum/issn.py b/stdnum/issn.py
index 10c6af9..7b821a7 100644
--- a/stdnum/issn.py
+++ b/stdnum/issn.py
@@ -61,8 +61,8 @@ def compact(number):
def calc_check_digit(number):
- """Calculate the ISSN check digit for 10-digit numbers. The number passed
- should not have the check bit included."""
+ """Calculate the ISSN check digit for 8-digit numbers. The number passed
+ should not have the check digit included."""
check = (11 - sum((8 - i) * int(n)
for i, n in enumerate(number))) % 11
return 'X' if check == 10 else str(check)
-----------------------------------------------------------------------
Summary of changes:
stdnum/isbn.py | 10 +++++-----
stdnum/issn.py | 4 ++--
2 files changed, 7 insertions(+), 7 deletions(-)
hooks/post-receive
--
python-stdnum
- python-stdnum branch master updated. 1.18-21-g7d3ddab,
Commits of the python-stdnum project