Fix small issues

Fix spelling errors
Remove Redundant exception types
Remove dead code
Change the forum link to point to GitHub discussions
This commit is contained in:
Timmy Welch 2022-06-07 20:22:33 -07:00
parent 3369a24343
commit ff73cbf2f9
19 changed files with 37 additions and 36 deletions

View File

@ -77,7 +77,7 @@ pip install -r requirements-GUI.txt -r requirements-CBR.txt
pip install .
```
6. (optionall) run pytest to ensure that their are no failures (xfailed means expected failure)
6. (optionally) run pytest to ensure that their are no failures (xfailed means expected failure)
```
$ pytest
============================= test session starts ==============================

View File

@ -1,4 +1,10 @@
[![Build](https://github.com/comictagger/comictagger/actions/workflows/build.yaml/badge.svg)](https://github.com/comictagger/comictagger/actions/workflows/build.yaml)
[![CI](https://github.com/comictagger/comictagger/actions/workflows/build.yaml/badge.svg?branch=develop&event=push)](https://github.com/comictagger/comictagger/actions/workflows/build.yaml)
[![GitHub release (latest by date)](https://img.shields.io/github/downloads/comictagger/comictagger/latest/total)](https://github.com/comictagger/comictagger/releases/latest)
[![PyPI](https://img.shields.io/pypi/v/comictagger)](https://pypi.org/project/comictagger/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/comictagger)](https://pypistats.org/packages/comictagger)
[![PyPI - License](https://img.shields.io/pypi/l/comictagger)](https://opensource.org/licenses/Apache-2.0)
[![GitHub Discussions](https://img.shields.io/github/discussions/comictagger/comictagger)](https://github.com/comictagger/comictagger/discussions)
[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/comictagger/community)
[![Google Group](https://img.shields.io/badge/discuss-on%20groups-%23207de5)](https://groups.google.com/forum/#!forum/comictagger)
[![Twitter](https://img.shields.io/badge/%40comictagger-twitter-lightgrey)](https://twitter.com/comictagger)

View File

@ -318,7 +318,7 @@ class ZipArchiver(UnknownArchiver):
file_length = statinfo.st_size
try:
with open(filename, mode="r+b") as fo:
with open(filename, mode="r+b") as file:
# the starting position, relative to EOF
pos = -4
@ -327,8 +327,8 @@ class ZipArchiver(UnknownArchiver):
# walk backwards to find the "End of Central Directory" record
while (not found) and (-pos != file_length):
# seek, relative to EOF
fo.seek(pos, 2)
value = fo.read(4)
file.seek(pos, 2)
value = file.read(4)
# look for the end of central directory signature
if bytearray(value) == bytearray([0x50, 0x4B, 0x05, 0x06]):
@ -341,19 +341,19 @@ class ZipArchiver(UnknownArchiver):
# now skip forward 20 bytes to the comment length word
pos += 20
fo.seek(pos, 2)
file.seek(pos, 2)
# Pack the length of the comment string
fmt = "H" # one 2-byte integer
comment_length = struct.pack(fmt, len(comment)) # pack integer in a binary string
# write out the length
fo.write(comment_length)
fo.seek(pos + 2, 2)
file.write(comment_length)
file.seek(pos + 2, 2)
# write out the comment itself
fo.write(comment.encode("utf-8"))
fo.truncate()
file.write(comment.encode("utf-8"))
file.truncate()
else:
raise Exception("Could not find the End of Central Directory record!")
except Exception as e:
@ -636,7 +636,7 @@ class FolderArchiver(UnknownArchiver):
def get_filename_list(self) -> list[str]:
filenames = []
try:
for root, dirs, files in os.walk(self.path):
for root, _dirs, files in os.walk(self.path):
for f in files:
filenames.append(os.path.relpath(os.path.join(root, f), self.path).replace(os.path.sep, "/"))
return filenames
@ -855,7 +855,7 @@ class ComicArchive:
if filename:
try:
image_data = self.archiver.read_file(filename) or bytes()
except (OSError, Exception):
except Exception:
logger.error("Error reading in page %d. Substituting logo page.", index)
image_data = ComicArchive.logo_data
@ -1026,7 +1026,7 @@ class ComicArchive:
return b""
try:
raw_cix = self.archiver.read_file(self.ci_xml_filename) or b""
except (OSError, Exception) as e:
except Exception as e:
logger.error("Error reading in raw CIX! for %s: %s", self.path, e)
raw_cix = bytes()
return raw_cix

View File

@ -210,7 +210,7 @@ def update_publishers(new_publishers: Mapping[str, Mapping[str, str]]) -> None:
class ImprintDict(dict):
"""
ImprintDict takes a publisher and a dict or mapping of lowercased
imprint names to the proper imprint name. Retreiving a value from an
imprint names to the proper imprint name. Retrieving a value from an
ImprintDict returns a tuple of (imprint, publisher, keyExists).
if the key does not exist the key is returned as the publisher unchanged
"""

View File

@ -4,11 +4,6 @@ from __future__ import annotations
import localefix
from comictaggerlib.main import ctmain
def main():
pass
if __name__ == "__main__":
localefix.configure_locale()
ctmain()

View File

@ -397,7 +397,7 @@ def process_file_cli(
if opts.verbose:
IssueIdentifier.default_write_output(text)
# use our overlayed MD struct to search
# use our overlaid MD struct to search
ii.set_additional_metadata(md)
ii.only_use_additional_meta_data = True
ii.wait_and_retry_on_rate_limit = opts.wait_on_cv_rate_limit
@ -568,7 +568,7 @@ def process_file_cli(
else:
msg = msg_hdr + f"Dry-run: Would try to create {os.path.split(new_file)[1]}"
if opts.delete_after_zip_export:
msg += " and delete orginal."
msg += " and delete original."
print(msg)
return

View File

@ -86,7 +86,7 @@ class ComicVineTalker:
@staticmethod
def get_rate_limit_message() -> str:
if ComicVineTalker.api_key == "":
return "Comic Vine rate limit exceeded. You should configue your own Comic Vine API key."
return "Comic Vine rate limit exceeded. You should configure your own Comic Vine API key."
return "Comic Vine rate limit exceeded. Please wait a bit."

View File

@ -30,7 +30,7 @@ logger = logging.getLogger(__name__)
class ImageHasher:
def __init__(self, path: str | None = None, data: bytes = bytes(), width: int = 8, height: int = 8) -> None:
def __init__(self, path: str | None = None, data: bytes = b"", width: int = 8, height: int = 8) -> None:
self.width = width
self.height = height

View File

@ -277,7 +277,7 @@ class IssueIdentifier:
use_remote_alternates: bool = False,
use_log: bool = True,
) -> Score:
# local_cover_hash_list is a list of pre-calculated hashs.
# local_cover_hash_list is a list of pre-calculated hashes.
# use_remote_alternates - indicates to use alternate covers from CV
try:

View File

@ -49,7 +49,7 @@ try:
"""
if QtWidgets.QApplication.instance() is not None:
errorbox = QtWidgets.QMessageBox()
errorbox.setText(f"Oops. An unexpected error occured:\n{log_msg}")
errorbox.setText(f"Oops. An unexpected error occurred:\n{log_msg}")
errorbox.exec()
QtWidgets.QApplication.exit(1)
else:

View File

@ -177,7 +177,7 @@ def define_args() -> argparse.ArgumentParser:
parser.add_argument(
"--overwrite",
action="store_true",
help="""Overwite all existing metadata.\nMay be used in conjunction with -o, -f and -m.\n\n""",
help="""Overwrite all existing metadata.\nMay be used in conjunction with -o, -f and -m.\n\n""",
)
parser.add_argument(
"--raw", action="store_true", help="""With -p, will print out the raw tag block(s)\nfrom the file.\n"""

View File

@ -104,7 +104,7 @@ class ComicTaggerSettings:
self.exact_series_matches_first = True
self.always_use_publisher_filter = False
# CBL Tranform settings
# CBL Transform settings
self.assume_lone_credit_is_primary = False
self.copy_characters_to_tags = False

View File

@ -2019,7 +2019,7 @@ Have fun!
webbrowser.open("https://github.com/comictagger/comictagger/issues")
def show_forum(self) -> None:
webbrowser.open("http://comictagger.forumotion.com/")
webbrowser.open("https://github.com/comictagger/comictagger/discussions")
def front_cover_changed(self) -> None:
self.metadata.pages = self.page_list_editor.get_page_list()

View File

@ -112,7 +112,7 @@
</sizepolicy>
</property>
<property name="text">
<string>Don't use publication year in indentification process</string>
<string>Don't use publication year in identification process</string>
</property>
</widget>
</item>

View File

@ -332,14 +332,14 @@
<item>
<widget class="QCheckBox" name="cbxSortByYear">
<property name="text">
<string>Initally sort Series search results by Starting Year instead of No. Issues</string>
<string>Initially sort Series search results by Starting Year instead of No. Issues</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbxExactMatches">
<property name="text">
<string>Initally show Series Name exact matches first</string>
<string>Initially show Series Name exact matches first</string>
</property>
</widget>
</item>

View File

@ -1392,7 +1392,7 @@
</action>
<action name="actionComicTaggerForum">
<property name="text">
<string>ComicTagger Forum...</string>
<string>ComicTagger Discussions...</string>
</property>
</action>
<action name="actionWiki">

View File

@ -241,7 +241,7 @@ class VolumeSelectionWindow(QtWidgets.QDialog):
QtWidgets.QMessageBox.information(
self,
"Auto-Select Result",
" Found a match, but cover doesn't seem the same. Verify before commiting!",
" Found a match, but cover doesn't seem the same. Verify before committing!",
)
found_match = matches[0]
elif result == self.ii.result_found_match_but_not_first_page:
@ -364,7 +364,7 @@ class VolumeSelectionWindow(QtWidgets.QDialog):
logger.exception("bad data error filtering publishers")
# pre sort the data - so that we can put exact matches first afterwards
# compare as str incase extra chars ie. '1976?'
# compare as str in case extra chars ie. '1976?'
# - missing (none) values being converted to 'None' - consistent with prior behaviour in v1.2.3
# sort by start_year if set
if self.settings.sort_series_by_year:

View File

@ -1,4 +1,4 @@
This file is a placeholder that will automaticlly be replaced with a symlink to
This file is a placeholder that will automatically be replaced with a symlink to
the local machine's Python framework python binary.
When pip does an uninstall, it will remove the link.

View File

@ -236,7 +236,7 @@ fnames = [
),
(
" X-Men-V1-067.cbr",
"hyphen separated with hyphen in series", # only parses corretly because v1 designates the volume
"hyphen separated with hyphen in series", # only parses correctly because v1 designates the volume
{
"issue": "67",
"series": "X-Men",