File tree Expand file tree Collapse file tree 3 files changed +29
-1
lines changed Expand file tree Collapse file tree 3 files changed +29
-1
lines changed Original file line number Diff line number Diff line change
1
+ # pylint: disable=too-few-public-methods
2
+ from .exceptions import ObsoleteAttributeException
3
+
4
+
5
+ class ObsoleteAttribute :
6
+ def __init__ (self , message : str , exc = ObsoleteAttributeException ):
7
+ self .message = message
8
+ self .exc = exc
9
+
10
+
11
+ class ObsoleteChecker :
12
+ _obsolete_attributes = {
13
+ "run_server" : ObsoleteAttribute ("app.run_server has been replaced by app.run" ),
14
+ "long_callback" : ObsoleteAttribute (
15
+ "app.long_callback has been removed, use app.callback(..., background=True) instead"
16
+ ),
17
+ }
18
+
19
+ def __getattr__ (self , name : str ):
20
+ if name in self ._obsolete_attributes :
21
+ err = self ._obsolete_attributes [name ]
22
+ raise err .exc (err .message )
23
+ return getattr (self , name )
Original file line number Diff line number Diff line change 66
66
from . import _get_app
67
67
68
68
from ._grouping import map_grouping , grouping_len , update_args_group
69
+ from ._obsolete import ObsoleteChecker
69
70
70
71
from . import _pages
71
72
from ._pages import (
@@ -194,7 +195,7 @@ def _do_skip(error):
194
195
195
196
# pylint: disable=too-many-instance-attributes
196
197
# pylint: disable=too-many-arguments, too-many-locals
197
- class Dash :
198
+ class Dash ( ObsoleteChecker ) :
198
199
"""Dash is a framework for building analytical web applications.
199
200
No JavaScript required.
200
201
Original file line number Diff line number Diff line change @@ -10,6 +10,10 @@ class ObsoleteKwargException(DashException):
10
10
pass
11
11
12
12
13
+ class ObsoleteAttributeException (DashException ):
14
+ pass
15
+
16
+
13
17
class NoLayoutException (DashException ):
14
18
pass
15
19
You can’t perform that action at this time.
0 commit comments