Skip to content

Commit

Permalink
Remove extraneous semi-colons, spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Vince committed Oct 27, 2023
1 parent 9e10ce0 commit 4a4621c
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions se/se_epub_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ def _find_ebook_section(section_id: str, sections: List[EbookSection]) -> Union[
OUTPUTS
The entry from sections, if any, that contains section_id
"""
"""

for section in sections:
if section.section_id == section_id:
Expand All @@ -622,7 +622,7 @@ def _lint_metadata_checks(self) -> list:
A list of LintMessage objects
"""

messages = [];
messages = []
metadata_xml = self.metadata_dom.to_string()
missing_metadata_elements = []

Expand Down Expand Up @@ -1063,7 +1063,7 @@ def _lint_css_checks(self, local_css_path: Path, abbr_with_whitespace: list) ->
OUTPUTS
A list of LintMessage objects
"""
messages = [];
messages = []

# lxml has not implemented the following in cssselect: *:first-of-type, *:last-of-type, *:nth-of-type, *:nth-last-of-type, *:only-of-type
# BUT ONLY WHEN USED ON *. This includes for example: `section [epub|type~="test"]:first-of-type` (note the `*` is implicit)
Expand Down Expand Up @@ -1162,7 +1162,7 @@ def _lint_image_checks(self, filename: Path) -> list:
OUTPUTS
A list of LintMessage objects.
"""
messages = [];
messages = []

if filename.suffix == ".jpeg":
messages.append(LintMessage("f-011", "JPEG files must end in [path].jpg[/].", se.MESSAGE_TYPE_ERROR, filename))
Expand Down Expand Up @@ -1212,7 +1212,7 @@ def _lint_svg_checks(filename: Path, file_contents: str, svg_dom: se.easy_xml.Ea
A list of LintMessage objects.
"""

messages = [];
messages = []

if f"{os.sep}src{os.sep}" not in root:
if self.cover_path and filename.name == self.cover_path.name:
Expand Down Expand Up @@ -1291,7 +1291,7 @@ def _lint_special_file_checks(filename: Path, dom: se.easy_xml.EasyXmlTree, file
A list of LintMessage objects.
"""

messages = [];
messages = []
source_links = self.metadata_dom.xpath("/package/metadata/dc:source/text()")

if special_file in ("colophon", "imprint"):
Expand Down Expand Up @@ -1524,7 +1524,7 @@ def _lint_xhtml_css_checks(filename: Path, dom: se.easy_xml.EasyXmlTree, local_c
A list of LintMessage objects
"""

messages = [];
messages = []

# Do we have any elements that have specified border color?
# `transparent` and `none` are allowed values for border-color
Expand Down Expand Up @@ -1620,7 +1620,7 @@ def _lint_xhtml_metadata_checks(filename: Path, dom: se.easy_xml.EasyXmlTree, se
A list of LintMessage objects
"""

messages = [];
messages = []

# Check for missing MARC relators
# Don't check the landmarks as that may introduce duplicate errors
Expand Down Expand Up @@ -1664,7 +1664,7 @@ def _lint_xhtml_syntax_checks(filename: Path, dom: se.easy_xml.EasyXmlTree, self
A list of LintMessage objects
"""

messages = [];
messages = []
section_tree: List[EbookSection] = _build_section_tree(self)

# This block is useful for pretty-printing section_tree should we need to debug it in the future
Expand Down Expand Up @@ -2251,7 +2251,7 @@ def _lint_xhtml_typography_checks(filename: Path, dom: se.easy_xml.EasyXmlTree,
tuple
"""

messages = [];
messages = []

# Check for punctuation outside quotes. We don't check single quotes because contractions are too common.
matches = regex.findall(fr"[\p{{Letter}}]+”[,\.](?!{se.WORD_JOINER}{se.WORD_JOINER}…)", file_contents)
Expand Down Expand Up @@ -2733,7 +2733,7 @@ def _lint_xhtml_xhtml_checks(filename: Path, dom: se.easy_xml.EasyXmlTree, file_
A list of LintMessage objects
"""

messages = [];
messages = []

# Check for uppercase letters in IDs or classes
nodes = dom.xpath("//*[re:test(@id, '[A-Z]') or re:test(@class, '[A-Z]') or re:test(@epub:type, '[A-Z]')]")
Expand Down Expand Up @@ -2801,7 +2801,7 @@ def _lint_xhtml_typo_checks(filename: Path, dom: se.easy_xml.EasyXmlTree, file_c
A list of LintMessage objects
"""

messages = [];
messages = []
typos: List[str] = []

if special_file != "titlepage":
Expand Down Expand Up @@ -3032,7 +3032,7 @@ def _lint_image_metadata_checks(self, has_images: bool) -> list:
A list of LintMessage objects
"""

messages = [];
messages = []

# Check for some accessibility metadata regarding images
has_visual_accessmode = len(self.metadata_dom.xpath("/package/metadata/meta[@property='schema:accessMode' and text() = 'visual']")) > 0
Expand Down Expand Up @@ -3395,7 +3395,7 @@ def lint(self, skip_lint_ignore: bool, allowed_messages: Optional[List[str]] = N

if filename.suffix in BINARY_EXTENSIONS or filename.name == "core.css":
if filename.suffix in (".jpg", ".jpeg", ".tif", ".tiff", ".png"):
messages = messages + _lint_image_checks(self, filename)
messages = messages + _lint_image_checks(self, filename)
continue

# Read the file and start doing some serious checks!
Expand Down

0 comments on commit 4a4621c

Please sign in to comment.