Add "is None" checks, instead of infering
This commit is contained in:
@ -13,7 +13,7 @@ class Post:
|
||||
self.tags: list[str] = tags.copy()
|
||||
|
||||
self._thumbnail_data: bytes | None = thumbnail
|
||||
self._thumbnail: ImageFile | None = Image.open(BytesIO(thumbnail)) if thumbnail else None
|
||||
self._thumbnail: ImageFile | None = None
|
||||
|
||||
self._image_format: str | None = None
|
||||
self._image_data: bytes | None = None
|
||||
@ -21,14 +21,14 @@ class Post:
|
||||
|
||||
|
||||
def get_thumbnail(self) -> ImageFile:
|
||||
if self._thumbnail:
|
||||
if self._thumbnail is not None:
|
||||
return self._thumbnail
|
||||
self._thumbnail = Image.open(BytesIO(self.get_thumbnail_data()))
|
||||
return self._thumbnail
|
||||
|
||||
|
||||
def get_thumbnail_data(self) -> bytes:
|
||||
if self._thumbnail_data:
|
||||
if self._thumbnail_data is not None:
|
||||
return self._thumbnail_data
|
||||
self._thumbnail_data = scraper.get(ThumbnailURL(self.image_dir, self.image_id))
|
||||
return self._thumbnail_data
|
||||
|
||||
Reference in New Issue
Block a user