Repository: intake/intake

Issue:
Pass pathlib to open_catalog
Was trying to pass a `pathlib.Path` to `intake.open_catalog` and got the following error:

```
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-22-ceeaa41394e2> in <module>
----> 1 cat = intake.open_catalog(cat_file)

/nas/jlord/conda/envs/intake/lib/python3.7/site-packages/intake/__init__.py in open_catalog(uri, **kwargs)
    149     if driver not in registry:
    150         raise ValueError('Unknown catalog driver (%s), supply one of: %s'
--> 151                          % (driver, list(sorted(registry))))
    152     return registry[driver](uri, **kwargs)
    153 

ValueError: Unknown catalog driver (None), supply one of: ['catalog', 'csv', 'intake_remote', 'ndzarr', 'numpy', 'spark_cat', 'spark_dataframe', 'spark_rdd', 'textfiles', 'yaml_file_cat', 'yaml_files_cat']
```

easy fix is passing `str(pathlib.Path)` but might be nice to be able to pass it directly in the future or giving a clearer error message.

Discussion:

Patch:
diff --git a/intake/__init__.py b/intake/__init__.py
index 799ad3e..6857987 100644
--- a/intake/__init__.py
+++ b/intake/__init__.py
@@ -8,6 +8,7 @@
 import importlib
 import re
 import logging
+import os
 import warnings
 
 from ._version import get_versions
@@ -106,11 +107,11 @@ def open_catalog(uri=None, **kwargs):
       files. In the latter case, assume it is a directory.
     - if ``uri`` beings with protocol ``"intake:"``, connect to a remote
       Intake server
-    - otherwise, create a base Catalog object without entries.
+    - if ``uri`` is ``None`` or missing, create a base Catalog object without entries.
 
     Parameters
     ----------
-    uri: str
+    uri: str or pathlib.Path
         Designator for the location of the catalog.
     kwargs:
         passed to subclass instance, see documentation of the individual
@@ -126,6 +127,8 @@ def open_catalog(uri=None, **kwargs):
     intake.open_intake_remote
     """
     driver = kwargs.pop('driver', None)
+    if isinstance(uri, os.PathLike):
+        uri = os.fspath(uri)
     if driver is None:
         if uri:
             if ((isinstance(uri, str) and "*" in uri)
@@ -151,6 +154,8 @@ def open_catalog(uri=None, **kwargs):
                     else:
                         uri = uri.rstrip('/') + '/*.y*ml'
                         driver = 'yaml_files_cat'
+            else:
+                raise ValueError("URI not understood: %s" % uri)
         else:
             # empty cat
             driver = 'catalog'
diff --git a/intake/source/zarr.py b/intake/source/zarr.py
index 686088b..60d9a2c 100644
--- a/intake/source/zarr.py
+++ b/intake/source/zarr.py
@@ -43,7 +43,6 @@ class ZarrArraySource(DataSource):
         self.storage_options = storage_options or {}
         self.component = component
         self.kwargs = kwargs
-        self.chunks = None
         self._arr = None
         super(ZarrArraySource, self).__init__(metadata=metadata)
 
@@ -54,8 +53,6 @@ class ZarrArraySource(DataSource):
                                      storage_options=self.storage_options,
                                      **self.kwargs)
             self.chunks = self._arr.chunks
-            self.shape = self._arr.shape
-            self.dtype = self._arr.dtype
             self.npartitions = self._arr.npartitions
         return Schema(dtype=str(self.dtype), shape=self.shape,
                       extra_metadata=self.metadata,


Test patch:
diff --git a/intake/source/tests/test_npy.py b/intake/source/tests/test_npy.py
index a5528e0..ff87d45 100644
--- a/intake/source/tests/test_npy.py
+++ b/intake/source/tests/test_npy.py
@@ -66,8 +66,6 @@ def test_zarr_minimal():
     cat = intake.open_catalog(posixpath.join(here, 'sources.yaml'))
     s = cat.zarr1()
     assert s.container == 'ndarray'
-    assert s.read().tolist() == [73, 98, 46, 38, 20, 12, 31, 8, 89, 72]
+    assert s.read().tolist() == [73, 98, 46, 38, 20, 12, 31,  8, 89, 72]
     assert s.npartitions == 1
-    assert s.dtype == 'int'
-    assert s.shape == (10,)
     assert (s.read_partition((0, )) == s.read()).all()
diff --git a/intake/tests/test_top_level.py b/intake/tests/test_top_level.py
index 22abc0d..aca5bfc 100644
--- a/intake/tests/test_top_level.py
+++ b/intake/tests/test_top_level.py
@@ -104,7 +104,13 @@ def test_path_catalog(tmp_path_catalog):
 
 def test_bad_open():
     with pytest.raises(ValueError):
-        intake.open_catalog(None, driver='unknown')
+        # unknown driver
+        intake.open_catalog("", driver='unknown')
+    with pytest.raises(ValueError):
+        # bad URI type (NB falsish values become empty catalogs)
+        intake.open_catalog(True)
+    # default empty catalog
+    assert intake.open_catalog() == intake.open_catalog(None)
 
 
 def test_output_notebook():