Skip to content

Commit

Permalink
Implement suggestion from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr committed Jan 25, 2021
1 parent 1accbb3 commit d8ea1cb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 0 additions & 2 deletions openeo/internal/jupyter.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,13 @@ def _repr_html_(self):

class VisualDict(dict, JupyterIntegration):

# The first entry of the dict is expected to always be the actual dict with the data
def __init__(self, component: str, data : dict, parameters: dict = {}):
JupyterIntegration.__init__(self, component, data, parameters)
dict.__init__(self, data)


class VisualList(list, JupyterIntegration):

# The first entry of the dict is expected to always be the actual list with the data
def __init__(self, component: str, data : list, parameters: dict = {}):
JupyterIntegration.__init__(self, component, data, parameters)
list.__init__(self, data)
4 changes: 2 additions & 2 deletions openeo/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import List, Union, Tuple, Callable

from openeo.util import deep_get
from openeo.internal.jupyter import VisualDict
from openeo.internal.jupyter import JupyterIntegration


class MetadataException(Exception):
Expand Down Expand Up @@ -395,4 +395,4 @@ def add_dimension(self, name: str, label: Union[str, float], type: str = None) -
return self._clone_and_update(dimensions=self._dimensions + [dim])

def _repr_html_(self):
return VisualDict('collection', data = self._orig_metadata)._repr_html_()
return JupyterIntegration('collection', data = self._orig_metadata)._repr_html_()
4 changes: 2 additions & 2 deletions openeo/rest/rest_capabilities.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from openeo.capabilities import Capabilities
from openeo.internal.jupyter import VisualDict
from openeo.internal.jupyter import JupyterIntegration


class RESTCapabilities(Capabilities):
Expand Down Expand Up @@ -36,4 +36,4 @@ def list_plans(self):
return self.capabilities.get('billing', {}).get('plans')

def _repr_html_(self):
return VisualDict("capabilities", data = self.capabilities, parameters = {"url": self.url})._repr_html_()
return JupyterIntegration("capabilities", data = self.capabilities, parameters = {"url": self.url})._repr_html_()

0 comments on commit d8ea1cb

Please sign in to comment.