Skip to content

Commit fe6ceab

Browse files
committed
Linting and test fixes
1 parent d461404 commit fe6ceab

File tree

9 files changed

+21
-38
lines changed

9 files changed

+21
-38
lines changed

dash/dash.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,7 @@ def add_context(*args, **kwargs):
11551155

11561156
return wrap_func
11571157

1158-
def long_callback(self, *_args, **_kwargs):
1158+
def long_callback(self, *_args, **_kwargs): # pylint: disable=too-many-statements
11591159
"""
11601160
Normally used as a decorator, `@app.long_callback` is an alternative to
11611161
`@app.callback` designed for callbacks that take a long time to run,
@@ -1349,7 +1349,7 @@ def callback(_triggers, user_store_data, user_callback_args):
13491349
progress=clear_progress,
13501350
user_store_data=user_store_data,
13511351
)
1352-
elif progress_value:
1352+
if progress_value:
13531353
return dict(
13541354
user_callback_output=map_grouping(lambda x: no_update, output),
13551355
interval_disabled=False,

dash/long_callback/managers/diskcache_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __init__(self, cache, cache_by=None, expire=None):
2525
import diskcache # pylint: disable=import-outside-toplevel
2626
import psutil # noqa: F401,E402 pylint: disable=import-outside-toplevel,unused-import,unused-variable,import-error
2727
import multiprocess # noqa: F401,E402 pylint: disable=import-outside-toplevel,unused-import,unused-variable
28-
except ImportError:
28+
except ImportError as missing_imports:
2929
raise ImportError(
3030
"""\
3131
DiskcacheLongCallbackManager requires the multiprocess, diskcache, and psutil packages
@@ -36,7 +36,7 @@ def __init__(self, cache, cache_by=None, expire=None):
3636
or conda.
3737
3838
$ conda install -c conda-forge multiprocess diskcache psutil\n"""
39-
)
39+
) from missing_imports
4040

4141
if not isinstance(cache, (diskcache.Cache, diskcache.FanoutCache)):
4242
raise ValueError("First argument must be a diskcache.Cache object")

tests/integration/long_callback/app1.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
import dash
2-
from dash.dependencies import Input, Output
3-
import dash_html_components as html
4-
import dash_core_components as dcc
1+
from dash import Dash, Input, Output, dcc, html
52
import time
63

74
from tests.integration.long_callback.utils import get_long_callback_manager
85

96
long_callback_manager = get_long_callback_manager()
107
handle = long_callback_manager.handle
118

12-
app = dash.Dash(__name__)
9+
app = Dash(__name__)
1310
app.layout = html.Div(
1411
[
1512
dcc.Input(id="input", value="initial value"),

tests/integration/long_callback/app2.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
import dash
2-
from dash.dependencies import Input, Output
3-
import dash_html_components as html
1+
from dash import Dash, Input, Output, html
2+
43
import time
54

65
from tests.integration.long_callback.utils import get_long_callback_manager
76

87
long_callback_manager = get_long_callback_manager()
98
handle = long_callback_manager.handle
109

11-
app = dash.Dash(__name__, long_callback_manager=long_callback_manager)
10+
app = Dash(__name__, long_callback_manager=long_callback_manager)
1211
app.layout = html.Div(
1312
[
1413
html.Button(id="button-1", children="Click Here", n_clicks=0),

tests/integration/long_callback/app3.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
import dash
2-
from dash.dependencies import Input, State, Output
3-
import dash_html_components as html
4-
import dash_core_components as dcc
1+
from dash import Dash, Input, Output, State, dcc, html
52
import time
63

74
from tests.integration.long_callback.utils import get_long_callback_manager
85

96
long_callback_manager = get_long_callback_manager()
107
handle = long_callback_manager.handle
118

12-
app = dash.Dash(__name__)
9+
app = Dash(__name__)
1310
app.layout = html.Div(
1411
[
1512
dcc.Input(id="input", value="initial value"),

tests/integration/long_callback/app4.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import dash
2-
from dash.dependencies import Input, State, Output
3-
import dash_html_components as html
4-
import dash_core_components as dcc
1+
from dash import Dash, Input, Output, State, dcc, html
52
import time
63

74
from tests.integration.long_callback.utils import get_long_callback_manager
@@ -10,7 +7,7 @@
107
handle = long_callback_manager.handle
118

129

13-
app = dash.Dash(__name__, long_callback_manager=long_callback_manager)
10+
app = Dash(__name__, long_callback_manager=long_callback_manager)
1411
app.layout = html.Div(
1512
[
1613
dcc.Input(id="input", value="hello, world"),

tests/integration/long_callback/app5.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import dash
2-
from dash.dependencies import Input, State, Output
3-
import dash_html_components as html
4-
import dash_core_components as dcc
1+
from dash import Dash, Input, State, Output, dcc, html
52
import time
63
from multiprocessing import Value
74

@@ -11,7 +8,7 @@
118
handle = long_callback_manager.handle
129

1310

14-
app = dash.Dash(__name__, long_callback_manager=long_callback_manager)
11+
app = Dash(__name__, long_callback_manager=long_callback_manager)
1512
app._cache_key = Value("i", 0)
1613

1714

tests/integration/long_callback/app6.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
import dash
2-
from dash.dependencies import Input, State, Output
3-
import dash_html_components as html
4-
import dash_core_components as dcc
1+
from dash import Dash, Input, Output, State, dcc, html
2+
53
import time
64
from multiprocessing import Value
75

@@ -10,7 +8,7 @@
108
long_callback_manager = get_long_callback_manager()
119
handle = long_callback_manager.handle
1210

13-
app = dash.Dash(__name__, long_callback_manager=long_callback_manager)
11+
app = Dash(__name__, long_callback_manager=long_callback_manager)
1412
app._cache_key = Value("i", 0)
1513

1614

tests/integration/long_callback/app7.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
import dash
2-
from dash.dependencies import Input, State, Output
3-
import dash_html_components as html
4-
import dash_core_components as dcc
1+
from dash import Dash, Input, Output, State, dcc, html
2+
53
import time
64

75
from tests.integration.long_callback.utils import get_long_callback_manager
@@ -10,7 +8,7 @@
108
handle = long_callback_manager.handle
119

1210

13-
app = dash.Dash(__name__, long_callback_manager=long_callback_manager)
11+
app = Dash(__name__, long_callback_manager=long_callback_manager)
1412
app.layout = html.Div(
1513
[
1614
html.Button(id="show-layout-button", children="Show"),

0 commit comments

Comments
 (0)