Skip to content

Commit 07ad3a9

Browse files
committed
move the src/data validation into the main conditional
1 parent 01b2fb5 commit 07ad3a9

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

plotdevice/gfx/image.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,6 @@ def __init__(self, *args, **kwargs):
6363
elif args and args[0] is None:
6464
args.pop(0) # make image(None, 10,20, image=...) work properly for compat
6565

66-
# Validate that we have either a source or data
67-
if not (src or data):
68-
raise DeviceError("Image requires either a source (path/url/Image) or image data")
69-
7066
# get an NSImage reference (once way or another)
7167
if data:
7268
self._nsImage = self._lazyload(data=data)
@@ -81,6 +77,9 @@ def __init__(self, *args, **kwargs):
8177
else:
8278
invalid = "Not a valid image source: %r" % type(src)
8379
raise DeviceError(invalid)
80+
else:
81+
undefined = "Image requires either a source (path/url/Image) or image data"
82+
raise DeviceError(undefined)
8483

8584
# set the bounds (in phases)
8685
if isinstance(src, Image):

0 commit comments

Comments
 (0)