|
17 | 17 |
|
18 | 18 | from IPython.utils.py3compat import cast_unicode |
19 | 19 | from IPython.testing.skipdoctest import skip_doctest |
20 | | -from .display_functions import display, clear_output, publish_display_data, update_display, DisplayHandle |
| 20 | +from . import display_functions |
21 | 21 |
|
22 | | -__all__ = ['display', 'display_pretty', 'display_html', 'display_markdown', |
| 22 | + |
| 23 | +__all__ = ['display_pretty', 'display_html', 'display_markdown', |
23 | 24 | 'display_svg', 'display_png', 'display_jpeg', 'display_latex', 'display_json', |
24 | 25 | 'display_javascript', 'display_pdf', 'DisplayObject', 'TextDisplayObject', |
25 | 26 | 'Pretty', 'HTML', 'Markdown', 'Math', 'Latex', 'SVG', 'ProgressBar', 'JSON', |
26 | | - 'GeoJSON', 'Javascript', 'Image', 'clear_output', 'set_matplotlib_formats', |
27 | | - 'set_matplotlib_close', 'publish_display_data', 'update_display', 'DisplayHandle', |
| 27 | + 'GeoJSON', 'Javascript', 'Image', 'set_matplotlib_formats', |
| 28 | + 'set_matplotlib_close', |
28 | 29 | 'Video'] |
29 | 30 |
|
| 31 | +_deprecated_names = ["display", "clear_output", "publish_display_data", "update_display", "DisplayHandle"] |
| 32 | + |
| 33 | +__all__ = __all__ + _deprecated_names |
| 34 | + |
| 35 | + |
| 36 | +# ----- warn to import from IPython.display ----- |
| 37 | + |
| 38 | +from warnings import warn |
| 39 | + |
| 40 | + |
| 41 | +def __getattr__(name): |
| 42 | + if name in _deprecated_names: |
| 43 | + warn(f"Importing {name} from IPython.core.display is deprecated since IPython 7.14, please import from IPython display", DeprecationWarning, stacklevel=2) |
| 44 | + return getattr(display_functions, name) |
| 45 | + |
| 46 | + if name in globals().keys(): |
| 47 | + return globals()[name] |
| 48 | + else: |
| 49 | + raise AttributeError(f"module {__name__} has no attribute {name}") |
| 50 | + |
| 51 | + |
30 | 52 | #----------------------------------------------------------------------------- |
31 | 53 | # utility functions |
32 | 54 | #----------------------------------------------------------------------------- |
|
0 commit comments