Style and typo fixes

This commit is contained in:
Timmy Welch 2022-10-04 16:15:55 -07:00
parent a6d55cd21a
commit 2daf9b3ed8
No known key found for this signature in database
5 changed files with 12 additions and 9 deletions

View File

@ -88,9 +88,9 @@ class CoMet:
assign("readingDirection", "rtl")
if md.year is not None:
date_str = str(md.year).zfill(4)
date_str = f"{md.year:04}"
if md.month is not None:
date_str += "-" + str(md.month).zfill(2)
date_str += f"-{md.month:02}"
assign("date", date_str)
assign("coverImage", md.cover_image)

View File

@ -32,10 +32,13 @@ from text2digits import text2digits
from comicapi import filenamelexer, issuestring
logger = logging.getLogger(__name__)
t2d = text2digits.Text2Digits(add_ordinal_ending=False)
t2do = text2digits.Text2Digits(add_ordinal_ending=True)
logger = logging.getLogger(__name__)
placeholders_no_dashes = [re.compile(r"[-_]"), re.compile(r" +")]
placeholders_allow_dashes = [re.compile(r"[_]"), re.compile(r" +")]
class FileNameParser:
@ -54,9 +57,9 @@ class FileNameParser:
def fix_spaces(self, string: str, remove_dashes: bool = True) -> str:
if remove_dashes:
placeholders = [r"[-_]", r" +"]
placeholders = placeholders_no_dashes
else:
placeholders = [r"[_]", r" +"]
placeholders = placeholders_allow_dashes
for ph in placeholders:
string = re.sub(ph, self.repl, string)
return string

View File

@ -524,7 +524,7 @@ class IssueIdentifier:
self.log_msg("")
if len(self.match_list) == 0:
self.log_msg(":-(no matches!")
self.log_msg(":-( no matches!")
self.search_result = self.result_no_matches
return self.match_list

View File

@ -340,9 +340,9 @@ class PageListEditor(QtWidgets.QWidget):
else:
text += " (Error: " + page_dict["Type"] + ")"
if "DoublePage" in page_dict:
text += " " + "\U00002461"
text += " "
if "Bookmark" in page_dict:
text += " " + "\U0001F516"
text += " 🔖"
return text
def get_page_list(self) -> list[ImageMetadata]:

View File

@ -1712,7 +1712,7 @@ Have fun!
)
if dlg.ignore_leading_digits_in_filename and md.series is not None:
# remove all leading numbers
md.series = re.sub(r"([\d.]*)(.*)", "\\2", md.series)
md.series = re.sub(r"([\d.]*)(.*)", r"\2", md.series)
# use the dialog specified search string
if dlg.search_string: