From b83b2be68ff2f5a24e6509e7dadfb0add9b5846d Mon Sep 17 00:00:00 2001 From: Simon Cozens Date: Mon, 2 Sep 2024 17:43:28 +0100 Subject: [PATCH] Lint fixes --- Lib/shaperglot/checks/shaping_differs.py | 5 ++++- Lib/shaperglot/cli/check.py | 4 ++-- Lib/shaperglot/cli/report.py | 1 - Lib/shaperglot/reporter.py | 3 +-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Lib/shaperglot/checks/shaping_differs.py b/Lib/shaperglot/checks/shaping_differs.py index a1e695a..af2789d 100644 --- a/Lib/shaperglot/checks/shaping_differs.py +++ b/Lib/shaperglot/checks/shaping_differs.py @@ -95,7 +95,10 @@ def execute(self, checker) -> None: checker.results.fail( check_name="shaping-differs", result_code="too-few-glyphs", - message=f"Test asked for glyph {glyph_ix} but shaper only returned {len(buffer)} glyphs", + message=( + f"Test asked for glyph {glyph_ix} but " + f"shaper only returned {len(buffer)} glyphs" + ), context={ "input1": self.inputs[0].check_yaml, "input2": self.inputs[0].check_yaml, diff --git a/Lib/shaperglot/cli/check.py b/Lib/shaperglot/cli/check.py index 73a40c5..9dd5acd 100644 --- a/Lib/shaperglot/cli/check.py +++ b/Lib/shaperglot/cli/check.py @@ -57,9 +57,9 @@ def check(options) -> None: show_how_to_fix(fixes_needed) -def show_how_to_fix(fixes: Reporter): +def show_how_to_fix(reporter: Reporter): print("\nTo add full support to nearly-supported languages:") - for category, fixes in fixes.items(): + for category, fixes in reporter.items(): plural = "s" if len(fixes) > 1 else "" print(f" * {category.replace("_", ' ').capitalize()}{plural}: ", end="") print("; ".join(sorted(fixes))) diff --git a/Lib/shaperglot/cli/report.py b/Lib/shaperglot/cli/report.py index fdbb4fb..3869ae5 100644 --- a/Lib/shaperglot/cli/report.py +++ b/Lib/shaperglot/cli/report.py @@ -13,7 +13,6 @@ def report(options) -> None: """Report which languages are supported by the given font""" checker = Checker(options.font) langs = Languages() - messages = [] nearly = [] supported = [] unsupported = [] diff --git a/Lib/shaperglot/reporter.py b/Lib/shaperglot/reporter.py index 4a9e4e8..b83520f 100644 --- a/Lib/shaperglot/reporter.py +++ b/Lib/shaperglot/reporter.py @@ -2,7 +2,6 @@ from collections.abc import Sequence from dataclasses import dataclass, field from enum import Enum -import json from typing import Dict from termcolor import colored @@ -94,4 +93,4 @@ def unique_fixes(self) -> Dict[str, list[str]]: def count_fixes(self) -> int: """Return the number of fixes required to pass all checks""" fixes = self.unique_fixes() - return sum([len(stuff) for stuff in fixes.values()]) + return sum(len(stuff) for stuff in fixes.values())