mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 01:00:29 +08:00
lint fix
This commit is contained in:
parent
237d39b172
commit
ea285e3fec
@ -145,12 +145,12 @@ class Ocr:
|
|||||||
if left < right and top < bottom:
|
if left < right and top < bottom:
|
||||||
image_cropped = image.crop((left, top, right, bottom))
|
image_cropped = image.crop((left, top, right, bottom))
|
||||||
image.close()
|
image.close()
|
||||||
image = image_cropped
|
image = image_cropped # type: ignore
|
||||||
|
|
||||||
ImageOps.grayscale(image)
|
ImageOps.grayscale(image)
|
||||||
image_resized = image.resize((int(image.size[0] * 2), int(image.size[1] * 2)), PilImage.Resampling.BICUBIC)
|
image_resized = image.resize((int(image.size[0] * 2), int(image.size[1] * 2)), PilImage.Resampling.BICUBIC)
|
||||||
image.close()
|
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)
|
_libtess.TessBaseAPISetImage(api, image.tobytes("raw", "RGB"), image.width, image.height, 3, image.width * 3)
|
||||||
text_ptr = None
|
text_ptr = None
|
||||||
|
|||||||
@ -120,8 +120,8 @@ class _SpiPhy(BasePhy): # pylint: disable=too-many-instance-attributes
|
|||||||
return os.path.exists(f"/dev/spidev{self.__bus}.{self.__chip}")
|
return os.path.exists(f"/dev/spidev{self.__bus}.{self.__chip}")
|
||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def connected(self) -> Generator[_SpiPhyConnection, None, None]: # pylint: disable=contextmanager-generator-missing-cleanup # type: ignore
|
def connected(self) -> Generator[_SpiPhyConnection, None, None]: # type: ignore
|
||||||
with self.__sw_cs_connected() as switch_cs:
|
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:
|
with contextlib.closing(spidev.SpiDev(self.__bus, self.__chip)) as spi:
|
||||||
spi.mode = 0
|
spi.mode = 0
|
||||||
spi.no_cs = (not self.__hw_cs)
|
spi.no_cs = (not self.__hw_cs)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user