From f303eb1b8ee39c361afc6c7155964de381dd741c Mon Sep 17 00:00:00 2001 From: "Stephen C. Pope" Date: Wed, 7 Feb 2024 18:46:03 -0700 Subject: [PATCH] Vector: Fix vector visualize (#12443) GitOrigin-RevId: 9c0a311e6fdbcef16cb723389db3acfcfc5eb01e --- descarteslabs/core/vector/layers.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/descarteslabs/core/vector/layers.py b/descarteslabs/core/vector/layers.py index cf29676c..49d72676 100644 --- a/descarteslabs/core/vector/layers.py +++ b/descarteslabs/core/vector/layers.py @@ -2,7 +2,12 @@ from ipyleaflet import VectorTileLayer from traitlets import Dict except ImportError: - VectorTileLayer = object + raise ImportError( + "The visualization support in the `descarteslabs.vector` Python package" + " requires the `viz` extra to be installed." + " Please run `pip install descarteslabs[viz]` and try again." + " Alternatively you can install the `ipyleaflet` package directly." + ) class DLVectorTileLayer(VectorTileLayer): @@ -10,12 +15,4 @@ class DLVectorTileLayer(VectorTileLayer): A minimal wrapper around VectorTileLayer to add fetch_options """ - def __init__(self, *args, **kwargs): - if VectorTileLayer is object: - raise ImportError( - "The visualization support in the `descarteslabs.vector` Python package" - " requires the `viz` extra to be installed." - " Please run `pip install descarteslabs[viz]` and try again." - ) - super(DLVectorTileLayer, self).__init__(*args, **kwargs) - self.fetch_options = Dict({"credentials": "include"}).tag(sync=True, o=True) + fetch_options = Dict({"credentials": "include"}).tag(sync=True, o=True)