MCPcopy Index your code
hub / github.com/plotly/plotly.py / DefaultsWrapper

Class DefaultsWrapper

plotly/io/_kaleido.py:155–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153
154 # Show a deprecation warning if the old method of setting defaults is used
155 class DefaultsWrapper:
156 def __getattr__(self, name):
157 if hasattr(defaults, name):
158 if ENABLE_KALEIDO_V0_DEPRECATION_WARNINGS:
159 warnings.warn(
160 kaleido_scope_default_warning_func(name),
161 DeprecationWarning,
162 stacklevel=2,
163 )
164 return getattr(defaults, name)
165 else:
166 raise AttributeError(bad_attribute_error_msg_func(name))
167
168 def __setattr__(self, name, value):
169 if hasattr(defaults, name):
170 if ENABLE_KALEIDO_V0_DEPRECATION_WARNINGS:
171 warnings.warn(
172 kaleido_scope_default_warning_func(name),
173 DeprecationWarning,
174 stacklevel=2,
175 )
176 setattr(defaults, name, value)
177 else:
178 raise AttributeError(bad_attribute_error_msg_func(name))
179
180 scope = DefaultsWrapper()
181

Callers 1

_kaleido.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected