lets-plot 4.8.1rc1__cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lets_plot/__init__.py +382 -0
- lets_plot/_global_settings.py +192 -0
- lets_plot/_kbridge.py +197 -0
- lets_plot/_type_utils.py +133 -0
- lets_plot/_version.py +6 -0
- lets_plot/bistro/__init__.py +16 -0
- lets_plot/bistro/_plot2d_common.py +106 -0
- lets_plot/bistro/corr.py +448 -0
- lets_plot/bistro/im.py +196 -0
- lets_plot/bistro/joint.py +192 -0
- lets_plot/bistro/qq.py +207 -0
- lets_plot/bistro/residual.py +341 -0
- lets_plot/bistro/waterfall.py +332 -0
- lets_plot/export/__init__.py +6 -0
- lets_plot/export/ggsave_.py +172 -0
- lets_plot/frontend_context/__init__.py +8 -0
- lets_plot/frontend_context/_configuration.py +140 -0
- lets_plot/frontend_context/_dynamic_configure_html.py +115 -0
- lets_plot/frontend_context/_frontend_ctx.py +16 -0
- lets_plot/frontend_context/_html_contexts.py +223 -0
- lets_plot/frontend_context/_intellij_python_json_ctx.py +38 -0
- lets_plot/frontend_context/_isolated_webview_panel_ctx.py +81 -0
- lets_plot/frontend_context/_json_contexts.py +39 -0
- lets_plot/frontend_context/_jupyter_notebook_ctx.py +82 -0
- lets_plot/frontend_context/_mime_types.py +7 -0
- lets_plot/frontend_context/_static_html_page_ctx.py +76 -0
- lets_plot/frontend_context/_static_svg_ctx.py +26 -0
- lets_plot/frontend_context/_webbr_html_page_ctx.py +29 -0
- lets_plot/frontend_context/sandbox.py +5 -0
- lets_plot/geo_data/__init__.py +19 -0
- lets_plot/geo_data/core.py +335 -0
- lets_plot/geo_data/geocoder.py +988 -0
- lets_plot/geo_data/geocodes.py +512 -0
- lets_plot/geo_data/gis/__init__.py +0 -0
- lets_plot/geo_data/gis/fluent_dict.py +201 -0
- lets_plot/geo_data/gis/geocoding_service.py +42 -0
- lets_plot/geo_data/gis/geometry.py +91 -0
- lets_plot/geo_data/gis/json_request.py +232 -0
- lets_plot/geo_data/gis/json_response.py +308 -0
- lets_plot/geo_data/gis/request.py +492 -0
- lets_plot/geo_data/gis/response.py +247 -0
- lets_plot/geo_data/livemap_helper.py +65 -0
- lets_plot/geo_data/to_geo_data_frame.py +141 -0
- lets_plot/geo_data/type_assertion.py +34 -0
- lets_plot/geo_data_internals/__init__.py +4 -0
- lets_plot/geo_data_internals/constants.py +13 -0
- lets_plot/geo_data_internals/utils.py +33 -0
- lets_plot/mapping.py +115 -0
- lets_plot/package_data/lets-plot.min.js +3 -0
- lets_plot/plot/__init__.py +64 -0
- lets_plot/plot/_global_theme.py +14 -0
- lets_plot/plot/annotation.py +290 -0
- lets_plot/plot/coord.py +242 -0
- lets_plot/plot/core.py +1071 -0
- lets_plot/plot/expand_limits_.py +78 -0
- lets_plot/plot/facet.py +210 -0
- lets_plot/plot/font_features.py +71 -0
- lets_plot/plot/geom.py +9146 -0
- lets_plot/plot/geom_extras.py +53 -0
- lets_plot/plot/geom_function_.py +219 -0
- lets_plot/plot/geom_imshow_.py +393 -0
- lets_plot/plot/geom_livemap_.py +343 -0
- lets_plot/plot/ggbunch_.py +96 -0
- lets_plot/plot/gggrid_.py +139 -0
- lets_plot/plot/ggtb_.py +81 -0
- lets_plot/plot/guide.py +231 -0
- lets_plot/plot/label.py +187 -0
- lets_plot/plot/marginal_layer.py +181 -0
- lets_plot/plot/plot.py +245 -0
- lets_plot/plot/pos.py +344 -0
- lets_plot/plot/sampling.py +338 -0
- lets_plot/plot/sandbox_.py +26 -0
- lets_plot/plot/scale.py +3580 -0
- lets_plot/plot/scale_colormap_mpl.py +300 -0
- lets_plot/plot/scale_convenience.py +155 -0
- lets_plot/plot/scale_identity_.py +653 -0
- lets_plot/plot/scale_position.py +1342 -0
- lets_plot/plot/series_meta.py +209 -0
- lets_plot/plot/stat.py +585 -0
- lets_plot/plot/subplots.py +331 -0
- lets_plot/plot/subplots_util.py +24 -0
- lets_plot/plot/theme_.py +790 -0
- lets_plot/plot/theme_set.py +418 -0
- lets_plot/plot/tooltip.py +486 -0
- lets_plot/plot/util.py +267 -0
- lets_plot/settings_utils.py +244 -0
- lets_plot/tilesets.py +429 -0
- lets_plot-4.8.1rc1.dist-info/METADATA +221 -0
- lets_plot-4.8.1rc1.dist-info/RECORD +97 -0
- lets_plot-4.8.1rc1.dist-info/WHEEL +6 -0
- lets_plot-4.8.1rc1.dist-info/licenses/LICENSE +21 -0
- lets_plot-4.8.1rc1.dist-info/licenses/licenses/LICENSE.FreeType +166 -0
- lets_plot-4.8.1rc1.dist-info/licenses/licenses/LICENSE.ImageMagick +106 -0
- lets_plot-4.8.1rc1.dist-info/licenses/licenses/LICENSE.expat +21 -0
- lets_plot-4.8.1rc1.dist-info/licenses/licenses/LICENSE.fontconfig +200 -0
- lets_plot-4.8.1rc1.dist-info/top_level.txt +2 -0
- lets_plot_kotlin_bridge.cpython-311-x86_64-linux-gnu.so +0 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright (c) 2019. JetBrains s.r.o.
|
|
3
|
+
# Use of this source code is governed by the MIT license that can be found in the LICENSE file.
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
from typing import Dict, Tuple
|
|
7
|
+
|
|
8
|
+
from ._frontend_ctx import FrontendContext
|
|
9
|
+
from ._mime_types import LETS_PLOT_JSON
|
|
10
|
+
from .._type_utils import standardize_dict
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class IntellijPythonJsonContext(FrontendContext):
|
|
14
|
+
|
|
15
|
+
def configure(self, verbose: bool):
|
|
16
|
+
pass
|
|
17
|
+
|
|
18
|
+
def show(self, plot_spec: Dict) -> str:
|
|
19
|
+
plot_spec_std = standardize_dict(plot_spec)
|
|
20
|
+
data_object = DisplayDataObject(plot_spec_std)
|
|
21
|
+
|
|
22
|
+
# See intellij.python.helpers module in IDEA
|
|
23
|
+
from datalore.display import display
|
|
24
|
+
display(data_object)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class DisplayDataObject():
|
|
28
|
+
|
|
29
|
+
def __init__(self, plot_spec: Dict) -> None:
|
|
30
|
+
super().__init__()
|
|
31
|
+
self.data_object = (LETS_PLOT_JSON, plot_spec)
|
|
32
|
+
|
|
33
|
+
def _repr_display_(self) -> Tuple[str, Dict]:
|
|
34
|
+
"""
|
|
35
|
+
Special method discovered and invoked by datalore.display.display()
|
|
36
|
+
See: IDEA/community/python/helpers/pycharm_display/datalore/display/display_.py
|
|
37
|
+
"""
|
|
38
|
+
return self.data_object
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright (c) 2025. JetBrains s.r.o.
|
|
3
|
+
# Use of this source code is governed by the MIT license that can be found in the LICENSE file.
|
|
4
|
+
#
|
|
5
|
+
from typing import Dict
|
|
6
|
+
|
|
7
|
+
from ._dynamic_configure_html import generate_dynamic_configure_html
|
|
8
|
+
from ._frontend_ctx import FrontendContext
|
|
9
|
+
from .. import _kbridge as kbr
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
# noinspection PyPackageRequirements
|
|
13
|
+
|
|
14
|
+
class IsolatedWebviewPanelContext(FrontendContext):
|
|
15
|
+
|
|
16
|
+
def __init__(self, offline: bool, *,
|
|
17
|
+
width_mode: str = 'fit',
|
|
18
|
+
height_mode: str = 'fit',
|
|
19
|
+
width: float = None,
|
|
20
|
+
height: float = None,
|
|
21
|
+
responsive: bool = True,
|
|
22
|
+
force_immediate_render: bool = False,
|
|
23
|
+
height100pct: bool = True # Set height to 100% the panel height
|
|
24
|
+
) -> None:
|
|
25
|
+
super().__init__()
|
|
26
|
+
self.connected = not offline
|
|
27
|
+
self.width_mode = width_mode
|
|
28
|
+
self.height_mode = height_mode
|
|
29
|
+
self.width = width
|
|
30
|
+
self.height = height
|
|
31
|
+
self.responsive = responsive
|
|
32
|
+
self.force_immediate_render = force_immediate_render
|
|
33
|
+
self.height100pct = height100pct
|
|
34
|
+
|
|
35
|
+
def configure(self, verbose: bool):
|
|
36
|
+
# Nothing here because everything is inside the WebView panel.
|
|
37
|
+
pass
|
|
38
|
+
|
|
39
|
+
def as_str(self, plot_spec: Dict) -> str:
|
|
40
|
+
# Build sizing_options
|
|
41
|
+
# Default to notebookCell sizing (MIN width, SCALED height) if not specified
|
|
42
|
+
if self.width_mode is not None and self.height_mode is not None:
|
|
43
|
+
# Use dev options
|
|
44
|
+
sizing_options = {
|
|
45
|
+
'width_mode': self.width_mode,
|
|
46
|
+
'height_mode': self.height_mode
|
|
47
|
+
}
|
|
48
|
+
else:
|
|
49
|
+
# Default to notebookCell sizing
|
|
50
|
+
sizing_options = {
|
|
51
|
+
'width_mode': 'min',
|
|
52
|
+
'height_mode': 'scaled'
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
# Add width and height if specified
|
|
56
|
+
if self.width is not None:
|
|
57
|
+
sizing_options['width'] = self.width
|
|
58
|
+
if self.height is not None:
|
|
59
|
+
sizing_options['height'] = self.height
|
|
60
|
+
|
|
61
|
+
# Generate dynamic configure HTML (verbose=False)
|
|
62
|
+
dynamic_configure_html = generate_dynamic_configure_html(
|
|
63
|
+
offline=not self.connected,
|
|
64
|
+
verbose=False
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
# Generate dynamic display HTML
|
|
68
|
+
dynamic_display_html = kbr._generate_display_html_for_raw_spec(
|
|
69
|
+
plot_spec,
|
|
70
|
+
sizing_options,
|
|
71
|
+
dynamic_script_loading=True, # True for WebView panel
|
|
72
|
+
force_immediate_render=self.force_immediate_render,
|
|
73
|
+
responsive=self.responsive,
|
|
74
|
+
height100pct=self.height100pct
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
# Wrap both in a fixed position container
|
|
78
|
+
return f"""<div style="position: fixed; width: 100%; height: 100%;">
|
|
79
|
+
{dynamic_configure_html}
|
|
80
|
+
{dynamic_display_html}
|
|
81
|
+
</div>"""
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Copyright (c) 2020. JetBrains s.r.o.
|
|
2
|
+
# Use of this source code is governed by the MIT license that can be found in the LICENSE file.
|
|
3
|
+
|
|
4
|
+
import os
|
|
5
|
+
|
|
6
|
+
from ._frontend_ctx import FrontendContext
|
|
7
|
+
from ._intellij_python_json_ctx import IntellijPythonJsonContext
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _create_json_frontend_context() -> FrontendContext:
|
|
11
|
+
"""
|
|
12
|
+
Configures Lets-Plot JSON output.
|
|
13
|
+
|
|
14
|
+
Such context requires a Lets-Plot JSON interpreter plugged in to the frontend env (like PyCharm)
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
if _is_Intellij_Python_Lets_Plot_Plugin():
|
|
18
|
+
return IntellijPythonJsonContext()
|
|
19
|
+
|
|
20
|
+
# ToDo: GenericJsonFrontendContext
|
|
21
|
+
raise RuntimeError("Couldn't detect Intellij Python environment")
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def _is_Intellij_Python_Lets_Plot_Plugin() -> bool:
|
|
25
|
+
try:
|
|
26
|
+
# An empty marker module defined by Intellij Lets-Plot plugin
|
|
27
|
+
# import lets_plot_intellij_python_plugin <---- the old way.
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# The check above is not working with PyCharm remote interpreter: https://github.com/JetBrains/lets-plot/issues/348
|
|
31
|
+
|
|
32
|
+
# 1) The "datalore.display" is present in both PyCharm and Datalore env.
|
|
33
|
+
# See `intellij.python.helpers` module in IDEA.
|
|
34
|
+
from datalore.display import display
|
|
35
|
+
|
|
36
|
+
# 2) The "DATALORE_HOME" is only present in Datalore env but not in PyCharm env.
|
|
37
|
+
return "DATALORE_HOME" not in os.environ
|
|
38
|
+
except ImportError:
|
|
39
|
+
return False
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright (c) 2019. JetBrains s.r.o.
|
|
3
|
+
# Use of this source code is governed by the MIT license that can be found in the LICENSE file.
|
|
4
|
+
#
|
|
5
|
+
from typing import Dict
|
|
6
|
+
|
|
7
|
+
try:
|
|
8
|
+
from IPython.display import display_html
|
|
9
|
+
except ImportError:
|
|
10
|
+
display_html = None
|
|
11
|
+
|
|
12
|
+
from ._frontend_ctx import FrontendContext
|
|
13
|
+
from ._dynamic_configure_html import generate_dynamic_configure_html
|
|
14
|
+
from .. import _kbridge as kbr
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class JupyterNotebookContext(FrontendContext):
|
|
18
|
+
|
|
19
|
+
requires_configure = True
|
|
20
|
+
|
|
21
|
+
def __init__(self, offline: bool, *,
|
|
22
|
+
width_mode: str = 'min',
|
|
23
|
+
height_mode: str = 'scaled',
|
|
24
|
+
width: float = None,
|
|
25
|
+
height: float = None,
|
|
26
|
+
responsive: bool = False,
|
|
27
|
+
force_immediate_render: bool = False,
|
|
28
|
+
height100pct: bool = False
|
|
29
|
+
) -> None:
|
|
30
|
+
super().__init__()
|
|
31
|
+
self.connected = not offline
|
|
32
|
+
self.width_mode = width_mode
|
|
33
|
+
self.height_mode = height_mode
|
|
34
|
+
self.width = width
|
|
35
|
+
self.height = height
|
|
36
|
+
self.responsive = responsive
|
|
37
|
+
self.force_immediate_render = force_immediate_render
|
|
38
|
+
self.height100pct = height100pct
|
|
39
|
+
|
|
40
|
+
def configure(self, verbose: bool):
|
|
41
|
+
html = generate_dynamic_configure_html(offline=not self.connected, verbose=verbose)
|
|
42
|
+
# noinspection PyTypeChecker
|
|
43
|
+
display_html(html, raw=True)
|
|
44
|
+
|
|
45
|
+
def as_str(self, plot_spec: Dict) -> str:
|
|
46
|
+
# Old implementation (deprecated):
|
|
47
|
+
# return kbr._generate_dynamic_display_html(plot_spec)
|
|
48
|
+
|
|
49
|
+
# Build sizing_options
|
|
50
|
+
# Default to notebookCell sizing (MIN width, SCALED height) if not specified
|
|
51
|
+
# if self.width_mode is not None and self.height_mode is not None:
|
|
52
|
+
# # Use dev options
|
|
53
|
+
# sizing_options = {
|
|
54
|
+
# 'width_mode': self.width_mode,
|
|
55
|
+
# 'height_mode': self.height_mode
|
|
56
|
+
# }
|
|
57
|
+
# else:
|
|
58
|
+
# # Default to notebookCell sizing
|
|
59
|
+
# sizing_options = {
|
|
60
|
+
# 'width_mode': 'min',
|
|
61
|
+
# 'height_mode': 'scaled'
|
|
62
|
+
# }
|
|
63
|
+
|
|
64
|
+
sizing_options = {
|
|
65
|
+
'width_mode': self.width_mode,
|
|
66
|
+
'height_mode': self.height_mode
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
# Add width and height if specified
|
|
70
|
+
if self.width is not None:
|
|
71
|
+
sizing_options['width'] = self.width
|
|
72
|
+
if self.height is not None:
|
|
73
|
+
sizing_options['height'] = self.height
|
|
74
|
+
|
|
75
|
+
return kbr._generate_display_html_for_raw_spec(
|
|
76
|
+
plot_spec,
|
|
77
|
+
sizing_options,
|
|
78
|
+
dynamic_script_loading=True, # True for Jupyter Notebook, JupyterLab
|
|
79
|
+
force_immediate_render=self.force_immediate_render,
|
|
80
|
+
responsive=self.responsive,
|
|
81
|
+
height100pct=self.height100pct
|
|
82
|
+
)
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright (c) 2019. JetBrains s.r.o.
|
|
3
|
+
# Use of this source code is governed by the MIT license that can be found in the LICENSE file.
|
|
4
|
+
#
|
|
5
|
+
from typing import Dict
|
|
6
|
+
|
|
7
|
+
from ._frontend_ctx import FrontendContext
|
|
8
|
+
from .. import _kbridge as kbr
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
# noinspection PyPackageRequirements
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class StaticHtmlPageContext(FrontendContext):
|
|
15
|
+
|
|
16
|
+
def __init__(self, offline: bool, *,
|
|
17
|
+
width_mode: str = 'min',
|
|
18
|
+
height_mode: str = 'scaled',
|
|
19
|
+
width: float = None,
|
|
20
|
+
height: float = None,
|
|
21
|
+
responsive: bool = False,
|
|
22
|
+
force_immediate_render: bool = False,
|
|
23
|
+
height100pct: bool = False,
|
|
24
|
+
) -> None:
|
|
25
|
+
super().__init__()
|
|
26
|
+
self.connected = not offline
|
|
27
|
+
self.width_mode = width_mode
|
|
28
|
+
self.height_mode = height_mode
|
|
29
|
+
self.width = width
|
|
30
|
+
self.height = height
|
|
31
|
+
self.responsive = responsive
|
|
32
|
+
self.force_immediate_render = force_immediate_render
|
|
33
|
+
self.height100pct = height100pct
|
|
34
|
+
|
|
35
|
+
def configure(self, verbose: bool):
|
|
36
|
+
# Nothing here because the complete HTML page is created per each cell output.
|
|
37
|
+
if not self.connected:
|
|
38
|
+
print("WARN: Embedding Lets-Plot JS library for offline usage is not supported.")
|
|
39
|
+
|
|
40
|
+
def as_str(self, plot_spec: Dict) -> str:
|
|
41
|
+
# Old implementation (uses static HTML page generator):
|
|
42
|
+
# return kbr._generate_static_html_page(plot_spec, iframe=False)
|
|
43
|
+
|
|
44
|
+
# Build sizing_options
|
|
45
|
+
# Default to notebookCell sizing (MIN width, SCALED height) if not specified
|
|
46
|
+
# if self.width_mode is not None and self.height_mode is not None:
|
|
47
|
+
# # Use dev options
|
|
48
|
+
# sizing_options = {
|
|
49
|
+
# 'width_mode': self.width_mode,
|
|
50
|
+
# 'height_mode': self.height_mode
|
|
51
|
+
# }
|
|
52
|
+
# else:
|
|
53
|
+
# # Default to notebookCell sizing
|
|
54
|
+
# sizing_options = {
|
|
55
|
+
# 'width_mode': 'min',
|
|
56
|
+
# 'height_mode': 'scaled'
|
|
57
|
+
# }
|
|
58
|
+
sizing_options = {
|
|
59
|
+
'width_mode': self.width_mode,
|
|
60
|
+
'height_mode': self.height_mode
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
# Add width and height if specified
|
|
64
|
+
if self.width is not None:
|
|
65
|
+
sizing_options['width'] = self.width
|
|
66
|
+
if self.height is not None:
|
|
67
|
+
sizing_options['height'] = self.height
|
|
68
|
+
|
|
69
|
+
return kbr._generate_static_html_page_for_raw_spec(
|
|
70
|
+
plot_spec,
|
|
71
|
+
sizing_options,
|
|
72
|
+
dynamic_script_loading=False, # False for static HTML pages
|
|
73
|
+
force_immediate_render=self.force_immediate_render,
|
|
74
|
+
responsive=self.responsive,
|
|
75
|
+
height100pct=self.height100pct
|
|
76
|
+
)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright (c) 2020. JetBrains s.r.o.
|
|
3
|
+
# Use of this source code is governed by the MIT license that can be found in the LICENSE file.
|
|
4
|
+
#
|
|
5
|
+
from typing import Dict
|
|
6
|
+
|
|
7
|
+
from ._frontend_ctx import FrontendContext
|
|
8
|
+
from .. import _kbridge as kbr
|
|
9
|
+
from .._version import __version__
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class StaticSvgImageContext(FrontendContext):
|
|
13
|
+
|
|
14
|
+
def configure(self, verbose: bool):
|
|
15
|
+
if verbose:
|
|
16
|
+
message = '<div style="color:darkblue;">Lets-Plot v{}: static SVG output configured.</div>'.format(
|
|
17
|
+
__version__)
|
|
18
|
+
try:
|
|
19
|
+
from IPython.display import display_html
|
|
20
|
+
display_html(message, raw=True)
|
|
21
|
+
except ImportError:
|
|
22
|
+
pass
|
|
23
|
+
print(message)
|
|
24
|
+
|
|
25
|
+
def as_str(self, plot_spec: Dict) -> str:
|
|
26
|
+
return kbr._generate_svg(plot_spec)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright (c) 2019. JetBrains s.r.o.
|
|
3
|
+
# Use of this source code is governed by the MIT license that can be found in the LICENSE file.
|
|
4
|
+
#
|
|
5
|
+
import io
|
|
6
|
+
import webbrowser
|
|
7
|
+
import tempfile
|
|
8
|
+
from typing import Dict
|
|
9
|
+
|
|
10
|
+
from ._frontend_ctx import FrontendContext
|
|
11
|
+
from .. import _kbridge as kbr
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class WebBrHtmlPageContext(FrontendContext):
|
|
15
|
+
|
|
16
|
+
def __init__(self, exec: str, new: bool) -> None:
|
|
17
|
+
super().__init__()
|
|
18
|
+
self.exec = exec
|
|
19
|
+
self.new = new
|
|
20
|
+
|
|
21
|
+
def show(self, plot_spec: Dict) -> str:
|
|
22
|
+
html_page = kbr._generate_static_html_page(plot_spec, iframe=False)
|
|
23
|
+
|
|
24
|
+
path = tempfile.NamedTemporaryFile(mode='w+t', suffix=".html", delete=False)
|
|
25
|
+
try:
|
|
26
|
+
io.open(path.name, 'w+t').write(html_page)
|
|
27
|
+
webbrowser.get(self.exec).open('file://' + path.name, new=1 if self.new else 2)
|
|
28
|
+
finally:
|
|
29
|
+
path.close()
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
try:
|
|
2
|
+
import geopandas
|
|
3
|
+
except ImportError:
|
|
4
|
+
print("geopandas is required for using the geo_data package")
|
|
5
|
+
raise
|
|
6
|
+
|
|
7
|
+
from .core import *
|
|
8
|
+
from .geocoder import *
|
|
9
|
+
from .geocodes import *
|
|
10
|
+
|
|
11
|
+
__all__ = core.__all__
|
|
12
|
+
|
|
13
|
+
# Use geo_data package only for executing geocoding requests.
|
|
14
|
+
# For accessing variuous checks, contants, types etc use package geo_data_internals
|
|
15
|
+
# as it won't cause the OSM attribution to appear.
|
|
16
|
+
|
|
17
|
+
# print on the package import
|
|
18
|
+
print("The geodata is provided by © OpenStreetMap contributors"
|
|
19
|
+
" and is made available here under the Open Database License (ODbL).")
|