Skip to content

Commit

Permalink
lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mdevaev committed Jul 19, 2024
1 parent 44e58d8 commit 8ef1545
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions kvmd/apps/kvmd/ocr.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,12 @@ def __inner_recognize(self, data: bytes, langs: list[str], left: int, top: int,
if left < right and top < bottom:
image_cropped = image.crop((left, top, right, bottom))
image.close()
image = image_cropped
image = image_cropped # type: ignore

ImageOps.grayscale(image)
image_resized = image.resize((int(image.size[0] * 2), int(image.size[1] * 2)), PilImage.Resampling.BICUBIC)
image.close()
image = image_resized
image = image_resized # type: ignore

_libtess.TessBaseAPISetImage(api, image.tobytes("raw", "RGB"), image.width, image.height, 3, image.width * 3)
text_ptr = None
Expand Down
4 changes: 2 additions & 2 deletions kvmd/plugins/hid/spi.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ def has_device(self) -> bool:
return os.path.exists(f"/dev/spidev{self.__bus}.{self.__chip}")

@contextlib.contextmanager
def connected(self) -> Generator[_SpiPhyConnection, None, None]: # pylint: disable=contextmanager-generator-missing-cleanup # type: ignore
with self.__sw_cs_connected() as switch_cs:
def connected(self) -> Generator[_SpiPhyConnection, None, None]: # type: ignore
with self.__sw_cs_connected() as switch_cs: # pylint: disable=contextmanager-generator-missing-cleanup
with contextlib.closing(spidev.SpiDev(self.__bus, self.__chip)) as spi:
spi.mode = 0
spi.no_cs = (not self.__hw_cs)
Expand Down

0 comments on commit 8ef1545

Please sign in to comment.