|
1 | 1 | """Bootstrap themed components for use in Plotly Dash""" |
2 | 2 | import os |
3 | | -import sys |
4 | 3 |
|
5 | 4 | from dash_bootstrap_components import _components, icons, themes |
6 | 5 | from dash_bootstrap_components._components import * # noqa |
|
38 | 37 | Table.from_dataframe = classmethod(_generate_table_from_df) |
39 | 38 |
|
40 | 39 |
|
41 | | -# TODO: when Python 3.6 support is dropped we can simplify this with PEP 562 |
42 | | -# https://www.python.org/dev/peps/pep-0562/ |
43 | | -class _V1DeprecationWarningWrapper: |
44 | | - def __init__(self, wrapped, deprecated): |
45 | | - self.wrapped = wrapped |
46 | | - self.deprecated = deprecated |
47 | | - |
48 | | - def __getattr__(self, name): |
49 | | - if name in self.deprecated: |
50 | | - raise AttributeError( |
51 | | - f"{name} was deprecated in dash-bootstrap-components version " |
52 | | - f"1.0.0. You are using {__version__}. For more details please " |
53 | | - "see the migration guide: " |
54 | | - "https://dash-bootstrap-components.opensource.faculty.ai/" |
55 | | - "migration-guide/" |
56 | | - ) |
57 | | - return getattr(self.wrapped, name) |
58 | | - |
59 | | - def __setstate__(self, state): |
60 | | - # ensure deprecated & wrapped fields are set to avoid recursive stack |
61 | | - # explosion in __getattr__ |
62 | | - self.deprecated = state.get("deprecated", None) |
63 | | - self.wrapped = state.get("wrapped", None) |
64 | | - |
65 | | - def __dir__(self): |
66 | | - # required for autocomplete. filter out os, and sys imports |
67 | | - return [ |
68 | | - item |
69 | | - for item in self.wrapped.__dir__() |
70 | | - if item not in {"os", "sys"} |
71 | | - ] |
72 | | - |
73 | | - |
74 | | -sys.modules[__name__] = _V1DeprecationWarningWrapper( |
75 | | - sys.modules[__name__], |
76 | | - [ |
| 40 | +def __getattr__(name): |
| 41 | + if name in [ |
77 | 42 | "CardColumns", |
78 | 43 | "CardDeck", |
79 | 44 | "FormGroup", |
80 | 45 | "InputGroupAddon", |
81 | 46 | "Jumbotron", |
82 | 47 | "ListGroupItemHeading", |
83 | 48 | "ListGroupItemText", |
84 | | - ], |
85 | | -) |
| 49 | + ]: |
| 50 | + raise AttributeError( |
| 51 | + f"{name} was deprecated in dash-bootstrap-components version " |
| 52 | + f"1.0.0. You are using {__version__}. For more details please " |
| 53 | + "see the migration guide: " |
| 54 | + "https://dash-bootstrap-components.opensource.faculty.ai/" |
| 55 | + "migration-guide/" |
| 56 | + ) |
| 57 | + raise AttributeError(f"module {__name__!r} has no attribute {name!r}") |
| 58 | + |
| 59 | + |
| 60 | +def __dir__(): |
| 61 | + return __all__ |
0 commit comments