From 57ba081bff1c5a41ade44f88fa5fcb606d906ae7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 5 Sep 2024 00:11:15 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- readimc/mcd_file.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/readimc/mcd_file.py b/readimc/mcd_file.py index 484c473..d94c14a 100644 --- a/readimc/mcd_file.py +++ b/readimc/mcd_file.py @@ -174,7 +174,9 @@ def read_acquisition( img[:, ys, xs] = np.transpose(data[:, 3:]) return img - def read_slide(self, slide: Slide, raw: bool = False) -> Union[np.ndarray, bytes, None]: + def read_slide( + self, slide: Slide, raw: bool = False + ) -> Union[np.ndarray, bytes, None]: """Reads and decodes a slide image as numpy array using the ``imageio`` package. @@ -214,7 +216,9 @@ def read_slide(self, slide: Slide, raw: bool = False) -> Union[np.ndarray, bytes f"cannot read image for slide {slide.id}" ) from e - def read_panorama(self, panorama: Panorama, raw: bool = False) -> Union[np.ndarray, bytes, None]: + def read_panorama( + self, panorama: Panorama, raw: bool = False + ) -> Union[np.ndarray, bytes, None]: """Reads and decodes a panorama image as numpy array using the ``imageio`` package. @@ -248,8 +252,7 @@ def read_panorama(self, panorama: Panorama, raw: bool = False) -> Union[np.ndarr ) from e def read_before_ablation_image( - self, acquisition: Acquisition, - raw: bool = False + self, acquisition: Acquisition, raw: bool = False ) -> Union[np.ndarray, bytes, None]: """Reads and decodes a before-ablation image as numpy array using the ``imageio`` package. @@ -361,15 +364,17 @@ def _read_schema_xml( data = mm.read(end_index + len(end_sub_encoded) - start_index) return data.decode(encoding=encoding) - def _read_image(self, data_offset: int, data_size: int, raw: bool = False) -> Union[np.ndarray, bytes]: + def _read_image( + self, data_offset: int, data_size: int, raw: bool = False + ) -> Union[np.ndarray, bytes]: if self._fh is None: raise IOError(f"MCD file '{self.path.name}' has not been opened") self._fh.seek(data_offset) data = self._fh.read(data_size) if raw: - return data + return data else: - return imread(data) + return imread(data) def __repr__(self) -> str: return str(self._path)