Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Feb 4, 2024
1 parent feeb58e commit fb8ed6f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/AutoSplitImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def __init__(self, path: str):
self.image_type = ImageType.SPLIT

def __parse_text_file(self, path: str):
with open(path, "r") as f:
with open(path) as f:
data = toml.load(f)
self.texts = data["texts"]
self.__x = data["top_left"]
Expand Down
3 changes: 2 additions & 1 deletion src/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ def extract_and_compare_text(capture: MatLike, texts: list[str]):
png = np.array(cv2.imencode(".png", capture)[1]).tobytes()
# If the string is found 1:1 in the string extracted from the image a 1 is returned.
# Otherwise the levenshtein ratio is calculated between the two strings and gets returned.
# Especially with stylised characters, OCR could conceivably get the right letter, but mix up the casing (m/M, o/O, t/T, etc.)
# Especially with stylised characters, OCR could conceivably get the right
# letter, but mix up the casing (m/M, o/O, t/T, etc.)
image_string = run_tesseract(png).lower().strip()

Check failure on line 144 in src/compare.py

View workflow job for this annotation

GitHub Actions / Pyright (ubuntu-22.04, 3.10)

Type of "image_string" is unknown (reportUnknownVariableType)

Check failure on line 144 in src/compare.py

View workflow job for this annotation

GitHub Actions / Pyright (ubuntu-22.04, 3.10)

Type of "lower" is unknown (reportUnknownMemberType)

Check failure on line 144 in src/compare.py

View workflow job for this annotation

GitHub Actions / Pyright (ubuntu-22.04, 3.10)

Type of "strip" is unknown (reportUnknownMemberType)

Check failure on line 144 in src/compare.py

View workflow job for this annotation

GitHub Actions / Pyright (ubuntu-22.04, 3.11)

Type of "image_string" is unknown (reportUnknownVariableType)

Check failure on line 144 in src/compare.py

View workflow job for this annotation

GitHub Actions / Pyright (ubuntu-22.04, 3.11)

Type of "lower" is unknown (reportUnknownMemberType)

Check failure on line 144 in src/compare.py

View workflow job for this annotation

GitHub Actions / Pyright (ubuntu-22.04, 3.11)

Type of "strip" is unknown (reportUnknownMemberType)

Check failure on line 144 in src/compare.py

View workflow job for this annotation

GitHub Actions / Pyright (windows-latest, 3.11)

Type of "image_string" is unknown (reportUnknownVariableType)

Check failure on line 144 in src/compare.py

View workflow job for this annotation

GitHub Actions / Pyright (windows-latest, 3.11)

Type of "lower" is unknown (reportUnknownMemberType)

Check failure on line 144 in src/compare.py

View workflow job for this annotation

GitHub Actions / Pyright (windows-latest, 3.11)

Type of "strip" is unknown (reportUnknownMemberType)

Check failure on line 144 in src/compare.py

View workflow job for this annotation

GitHub Actions / Pyright (windows-latest, 3.10)

Type of "image_string" is unknown (reportUnknownVariableType)

Check failure on line 144 in src/compare.py

View workflow job for this annotation

GitHub Actions / Pyright (windows-latest, 3.10)

Type of "lower" is unknown (reportUnknownMemberType)

Check failure on line 144 in src/compare.py

View workflow job for this annotation

GitHub Actions / Pyright (windows-latest, 3.10)

Type of "strip" is unknown (reportUnknownMemberType)

Check failure on line 144 in src/compare.py

View workflow job for this annotation

GitHub Actions / Pyright (windows-latest, 3.12)

Type of "image_string" is unknown (reportUnknownVariableType)

Check failure on line 144 in src/compare.py

View workflow job for this annotation

GitHub Actions / Pyright (windows-latest, 3.12)

Type of "lower" is unknown (reportUnknownMemberType)

Check failure on line 144 in src/compare.py

View workflow job for this annotation

GitHub Actions / Pyright (windows-latest, 3.12)

Type of "strip" is unknown (reportUnknownMemberType)

ratio = 0.0
Expand Down
3 changes: 1 addition & 2 deletions src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ def subprocess_args():
This code snippet was copied from https://github.com/madmaze/pytesseract
"""

kwargs = {

Check failure on line 223 in src/utils.py

View workflow job for this annotation

GitHub Actions / Pyright (ubuntu-22.04, 3.10)

Type of "kwargs" is partially unknown   Type of "kwargs" is "dict[str, Unknown | _Environ[str] | None]" (reportUnknownVariableType)

Check failure on line 223 in src/utils.py

View workflow job for this annotation

GitHub Actions / Pyright (ubuntu-22.04, 3.11)

Type of "kwargs" is partially unknown   Type of "kwargs" is "dict[str, Unknown | _Environ[str] | None]" (reportUnknownVariableType)

Check failure on line 223 in src/utils.py

View workflow job for this annotation

GitHub Actions / Pyright (windows-latest, 3.11)

Type of "kwargs" is partially unknown   Type of "kwargs" is "dict[str, Unknown | _Environ[str] | None]" (reportUnknownVariableType)

Check failure on line 223 in src/utils.py

View workflow job for this annotation

GitHub Actions / Pyright (windows-latest, 3.10)

Type of "kwargs" is partially unknown   Type of "kwargs" is "dict[str, Unknown | _Environ[str] | None]" (reportUnknownVariableType)

Check failure on line 223 in src/utils.py

View workflow job for this annotation

GitHub Actions / Pyright (windows-latest, 3.12)

Type of "kwargs" is partially unknown   Type of "kwargs" is "dict[str, Unknown | _Environ[str] | None]" (reportUnknownVariableType)
"stdin": subprocess.PIPE,

Check failure on line 224 in src/utils.py

View workflow job for this annotation

GitHub Actions / Pyright (ubuntu-22.04, 3.10)

"subprocess" is not defined (reportUndefinedVariable)

Check failure on line 224 in src/utils.py

View workflow job for this annotation

GitHub Actions / Pyright (ubuntu-22.04, 3.10)

Type of "PIPE" is unknown (reportUnknownMemberType)

Check failure on line 224 in src/utils.py

View workflow job for this annotation

GitHub Actions / Pyright (ubuntu-22.04, 3.11)

"subprocess" is not defined (reportUndefinedVariable)

Check failure on line 224 in src/utils.py

View workflow job for this annotation

GitHub Actions / Pyright (ubuntu-22.04, 3.11)

Type of "PIPE" is unknown (reportUnknownMemberType)

Check failure on line 224 in src/utils.py

View workflow job for this annotation

GitHub Actions / Pyright (windows-latest, 3.11)

"subprocess" is not defined (reportUndefinedVariable)

Check failure on line 224 in src/utils.py

View workflow job for this annotation

GitHub Actions / Pyright (windows-latest, 3.11)

Type of "PIPE" is unknown (reportUnknownMemberType)

Check failure on line 224 in src/utils.py

View workflow job for this annotation

GitHub Actions / Pyright (windows-latest, 3.10)

"subprocess" is not defined (reportUndefinedVariable)

Check failure on line 224 in src/utils.py

View workflow job for this annotation

GitHub Actions / Pyright (windows-latest, 3.10)

Type of "PIPE" is unknown (reportUnknownMemberType)

Check failure on line 224 in src/utils.py

View workflow job for this annotation

GitHub Actions / Pyright (windows-latest, 3.12)

"subprocess" is not defined (reportUndefinedVariable)

Check failure on line 224 in src/utils.py

View workflow job for this annotation

GitHub Actions / Pyright (windows-latest, 3.12)

Type of "PIPE" is unknown (reportUnknownMemberType)
"stdout": subprocess.PIPE,
Expand All @@ -244,7 +243,7 @@ def run_tesseract(png: bytes):
@param capture: PNG encoded image
@return: The recognized output string from tesseract
"""
p = subprocess.Popen(TESSERACT_CMD, **subprocess_args()) # noqa: S603
p = subprocess.Popen(TESSERACT_CMD, **subprocess_args())
output = p.communicate(input=png)[0]
return output.decode(DEFAULT_ENCODING)

Expand Down

0 comments on commit fb8ed6f

Please sign in to comment.