@@ -89,10 +89,10 @@ def try_load(names: list[str]) -> CDLL:
8989 except FileNotFoundError as exc :
9090 raise ModuleNotFoundError (
9191 "Couldn't locate OpenSlide DLL. "
92- " Try `pip install openslide-bin`, "
92+ ' Try `pip install openslide-bin`, '
9393 "or if you're using an OpenSlide binary package, "
9494 "ensure you've called os.add_dll_directory(). "
95- " https://openslide.org/api/python/#installing"
95+ ' https://openslide.org/api/python/#installing'
9696 ) from exc
9797 elif platform .system () == 'Darwin' :
9898 try :
@@ -107,8 +107,8 @@ def try_load(names: list[str]) -> CDLL:
107107 if lib is None :
108108 raise ModuleNotFoundError (
109109 "Couldn't locate OpenSlide dylib. "
110- " Try `pip install openslide-bin`. "
111- " https://openslide.org/api/python/#installing"
110+ ' Try `pip install openslide-bin`. '
111+ ' https://openslide.org/api/python/#installing'
112112 ) from exc
113113 return cdll .LoadLibrary (lib )
114114 else :
@@ -117,8 +117,8 @@ def try_load(names: list[str]) -> CDLL:
117117 except OSError as exc :
118118 raise ModuleNotFoundError (
119119 "Couldn't locate OpenSlide shared library. "
120- " Try `pip install openslide-bin`. "
121- " https://openslide.org/api/python/#installing"
120+ ' Try `pip install openslide-bin`. '
121+ ' https://openslide.org/api/python/#installing'
122122 ) from exc
123123
124124
@@ -170,11 +170,11 @@ def invalidate(self) -> None:
170170 @classmethod
171171 def from_param (cls , obj : _OpenSlide ) -> _OpenSlide :
172172 if obj .__class__ != cls :
173- raise ValueError (" Not an OpenSlide reference" )
173+ raise ValueError (' Not an OpenSlide reference' )
174174 if not obj ._as_parameter_ :
175- raise ValueError (" Passing undefined slide object" )
175+ raise ValueError (' Passing undefined slide object' )
176176 if not obj ._valid :
177- raise ValueError (" Passing closed slide object" )
177+ raise ValueError (' Passing closed slide object' )
178178 return obj
179179
180180
@@ -193,9 +193,9 @@ def __del__(self) -> None:
193193 @classmethod
194194 def from_param (cls , obj : _OpenSlideCache ) -> _OpenSlideCache :
195195 if obj .__class__ != cls :
196- raise ValueError (" Not an OpenSlide cache reference" )
196+ raise ValueError (' Not an OpenSlide cache reference' )
197197 if not obj ._as_parameter_ :
198- raise ValueError (" Passing undefined cache object" )
198+ raise ValueError (' Passing undefined cache object' )
199199 return obj
200200
201201
@@ -247,15 +247,15 @@ def from_param(cls, obj: int) -> c_size_t:
247247
248248
249249def _load_image (buf : _Buffer , size : tuple [int , int ]) -> Image .Image :
250- ''' buf must be a mutable buffer.'''
250+ """ buf must be a mutable buffer."""
251251 _convert .argb2rgba (buf )
252252 return Image .frombuffer ('RGBA' , size , buf , 'raw' , 'RGBA' , 0 , 1 )
253253
254254
255255# check for errors opening an image file and wrap the resulting handle
256256def _check_open (result : int | None , _func : Any , _args : Any ) -> _OpenSlide :
257257 if result is None :
258- raise OpenSlideUnsupportedFormatError (" Unsupported or missing image file" )
258+ raise OpenSlideUnsupportedFormatError (' Unsupported or missing image file' )
259259 slide = _OpenSlide (c_void_p (result ))
260260 err = get_error (slide )
261261 if err is not None :
@@ -303,7 +303,7 @@ def _check_name_list(result: _Pointer[c_char_p], func: Any, args: Any) -> list[s
303303
304304
305305class _FunctionUnavailable :
306- ''' Standin for a missing optional function. Fails when called.'''
306+ """ Standin for a missing optional function. Fails when called."""
307307
308308 def __init__ (self , minimum_version : str ):
309309 self ._minimum_version = minimum_version
@@ -434,7 +434,7 @@ def read_region(
434434 # OpenSlide would catch this, but not before we tried to allocate
435435 # a negative-size buffer
436436 raise OpenSlideError (
437- " negative width (%d) or negative height (%d) not allowed" % (w , h )
437+ ' negative width (%d) or negative height (%d) not allowed' % (w , h )
438438 )
439439 if w == 0 or h == 0 :
440440 # Image.frombuffer() would raise an exception
0 commit comments