From f2ad417069022849aa150bc32b95599a107a1d58 Mon Sep 17 00:00:00 2001 From: lordwelch Date: Sun, 22 May 2022 20:02:49 -0700 Subject: [PATCH 1/2] Cleanup setCheckState Fix word splitting when auto-tagging Remove commented code --- comicapi/filenamelexer.py | 8 -------- comicapi/filenameparser.py | 1 - comicapi/utils.py | 19 ------------------- 3 files changed, 28 deletions(-) diff --git a/comicapi/filenamelexer.py b/comicapi/filenamelexer.py index 03de6ec..7fce422 100644 --- a/comicapi/filenamelexer.py +++ b/comicapi/filenamelexer.py @@ -138,13 +138,6 @@ class Lexer: self.backup() - # NextItem returns the next item from the input. - # Called by the parser, not in the lexing goroutine. - # def next_item(self) -> Item: - # item: Item = self.items.get() - # self.lastPos = item.pos - # return item - def scan_number(self) -> bool: digits = "0123456789" @@ -253,7 +246,6 @@ def lex_filename(lex: Lexer) -> Optional[Callable[[Lexer], Optional[Callable]]]: if lex.sbrace_depth < 0: return errorf(lex, "unexpected right brace " + r) elif is_symbol(r): - # L.backup() lex.emit(ItemType.Symbol) else: return errorf(lex, "unrecognized character in action: " + r) diff --git a/comicapi/filenameparser.py b/comicapi/filenameparser.py index efea26a..7fe7c48 100644 --- a/comicapi/filenameparser.py +++ b/comicapi/filenameparser.py @@ -404,7 +404,6 @@ def parse(p: Parser) -> Optional[Callable[[Parser], Optional[Callable]]]: if item.typ == filenamelexer.ItemType.Number: likely_year = False if p.firstItem and p.first_is_alt: - # raise Exception("fuck you") p.alt = True return parse_issue_number diff --git a/comicapi/utils.py b/comicapi/utils.py index b4e19af..83e1764 100644 --- a/comicapi/utils.py +++ b/comicapi/utils.py @@ -34,25 +34,6 @@ class UtilsVars: already_fixed_encoding = False -def get_actual_preferred_encoding() -> str: - preferred_encoding = locale.getpreferredencoding() - if platform.system() == "Darwin": - preferred_encoding = "utf-8" - return preferred_encoding - - -# def fix_output_encoding() -> None: -# if not UtilsVars.already_fixed_encoding: -# # this reads the environment and inits the right locale -# locale.setlocale(locale.LC_ALL, "") - -# # try to make stdout/stderr encodings happy for unicode printing -# preferred_encoding = get_actual_preferred_encoding() -# sys.stdout = codecs.getwriter(preferred_encoding)(sys.stdout) -# sys.stderr = codecs.getwriter(preferred_encoding)(sys.stderr) -# UtilsVars.already_fixed_encoding = True - - def get_recursive_filelist(pathlist: List[str]) -> List[str]: """Get a recursive list of of all files under all path items in the list""" From a80c17bf36f93120d1748d407cbd3ff0a189ffee Mon Sep 17 00:00:00 2001 From: lordwelch Date: Tue, 24 May 2022 11:44:26 -0700 Subject: [PATCH 2/2] Remove unused imports --- comicapi/utils.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/comicapi/utils.py b/comicapi/utils.py index 83e1764..a64e1c4 100644 --- a/comicapi/utils.py +++ b/comicapi/utils.py @@ -15,11 +15,9 @@ # limitations under the License. import json -import locale import logging import os import pathlib -import platform import re import unicodedata from collections import defaultdict