Skip to content

Commit

Permalink
Use if TYPE_CHECKING
Browse files Browse the repository at this point in the history
Change-Id: I63c4c7909f7d7060a4b557f41cff4ba9010e004c
  • Loading branch information
MarkDaoust committed Sep 27, 2024
1 parent 780dc67 commit 7581a75
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions google/generativeai/vision_models/_vision_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,22 @@
from proto.marshal.collections import repeated


# pylint: disable=g-import-not-at-top
try:
# pylint: disable=g-import-not-at-top\
if typing.TYPE_CHECKING:
from IPython import display as IPython_display
except ImportError:
IPython_display = None

try:
from PIL import Image as PIL_Image
except ImportError:
PIL_Image = None
else:
try:
from IPython import display as IPython_display
except ImportError:
IPython_display = None

if typing.TYPE_CHECKING:
import PIL.Image as PIL_Image
else:
try:
from PIL import Image as PIL_Image
except ImportError:
PIL_Image = None


# This is to get around https://github.com/googleapis/proto-plus-python/issues/488
Expand Down

0 comments on commit 7581a75

Please sign in to comment.