made minor changes in syntax

1. merged is_url and file_or_url_context in one import statement
2. changed syntax to check if path is a URL. now more compact
This commit is contained in:
Neeraj Gangwar
2014-03-13 18:42:12 +05:30
parent 0bfdda58e5
commit 1d133e5c17
+3 -6
View File
@@ -7,8 +7,7 @@ from skimage import io
from skimage import img_as_ubyte
from skimage.transform import resize
from skimage.color import color_dict
from skimage.io.util import file_or_url_context
from skimage.io.util import is_url
from skimage.io.util import file_or_url_context, is_url
import six
@@ -215,11 +214,9 @@ class Picture(object):
msg = "Must provide a single keyword arg (path, array, xy_array)."
ValueError(msg)
elif path is not None:
if is_url(path):
self._path = path
else:
if not is_url(path):
path = os.path.abspath(path)
self._path = path
self._path = path
with file_or_url_context(path) as context:
self.array = io.imread(context)
self._format = imghdr.what(context)