| 120 | # DefaultsBackwardsCompatible sets the attributes on `scope` object at the same time |
| 121 | # as they are set on the `defaults` object |
| 122 | class DefaultsBackwardsCompatible(defaults.__class__): |
| 123 | def __init__(self, scope): |
| 124 | self._scope = scope |
| 125 | super().__init__() |
| 126 | |
| 127 | def __setattr__(self, name, value): |
| 128 | if not name == "_scope": |
| 129 | if ( |
| 130 | hasattr(self._scope, name) |
| 131 | and getattr(self._scope, name) != value |
| 132 | ): |
| 133 | setattr(self._scope, name, value) |
| 134 | super().__setattr__(name, value) |
| 135 | |
| 136 | scope = PlotlyScopeWrapper() |
| 137 | defaults = DefaultsBackwardsCompatible(scope) |