Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typos #144

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions isbnlib/_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,25 +59,25 @@ def ren(fp):
if not isbn: # pragma: no cover
return None
data = meta(isbn)
author = data.get('Authors', 'UNKOWN')
if author != 'UNKOWN': # pragma: no cover
author = data.get('Authors', 'UNKNOWN')
if author != 'UNKNOWN': # pragma: no cover
author = last_first(author[0])['last']
year = data.get('Year', 'UNKOWN')
year = data.get('Year', 'UNKNOWN')
maxlen = 98 - (20 + len(author) + len(year))
title = data.get('Title', 'UNKOWN')
if title != 'UNKOWN':
title = data.get('Title', 'UNKNOWN')
if title != 'UNKNOWN':
regex1 = re.compile(r'[.,_!?/\\]')
regex2 = re.compile(r'\s\s+')
title = regex1.sub(' ', title)
title = regex2.sub(' ', title)
title = title.strip()
if title == 'UNKOWN' or not title: # pragma: no cover
if title == 'UNKNOWN' or not title: # pragma: no cover
return None
if ' ' in title: # pragma: no cover
tokens = title.split(' ')
stitle = cutoff_tokens(tokens, maxlen)
title = ' '.join(stitle)
isbn13 = data.get('ISBN-13', 'UNKOWN')
isbn13 = data.get('ISBN-13', 'UNKNOWN')
new_name = f'{author}{year}_{title}_{isbn13}'
return cfp.baserename(new_name + cfp.ext)

Expand All @@ -89,6 +89,6 @@ def cover(isbn):


def desc(isbn):
"""Return a descripion of the ISBN."""
"""Return a description of the ISBN."""
isbn = EAN13(isbn)
return goo_desc(isbn) if isbn else ''
4 changes: 2 additions & 2 deletions isbnlib/dev/_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ def __str__(self):
class ISBNLibHTTPError(ISBNLibDevException):
"""Exception raised for HTTP related errors."""

message = 'an HTTP error has ocurred'
message = 'an HTTP error has occurred'


class ISBNLibURLError(ISBNLibDevException):
"""Exception raised for URL related errors."""

message = 'an URL error has ocurred'
message = 'an URL error has occurred'


class DataNotFoundAtServiceError(ISBNLibDevException):
Expand Down
2 changes: 1 addition & 1 deletion isbnlib/dev/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from hashlib import md5


def fake_isbn(title, author='unkown', publisher='unkown', sid=1):
def fake_isbn(title, author='unknown', publisher='unknown', sid=1):
"""Produce a fake ISBN from the (title, author, publisher) of the book."""
key = f'{title} {author} {publisher}'
# normalize
Expand Down