Skip to content

Commit 6edd176

Browse files
committed
lint - and hopefully make black work on CI
1 parent 0ed8144 commit 6edd176

File tree

2 files changed

+16
-22
lines changed

2 files changed

+16
-22
lines changed

dash/dash.py

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ class _NoUpdate(object):
100100
ns["{function_name}"] = {clientside_function};
101101
"""
102102

103+
103104
def extract_callback_args(args, kwargs, name, type_):
104105
"""Extract arguments for callback from a name and type"""
105106
print(args, kwargs)
@@ -109,9 +110,10 @@ def extract_callback_args(args, kwargs, name, type_):
109110
parameters.append(args.pop(0))
110111
return parameters
111112

113+
112114
def _handle_callback_args(*args, **kwargs):
113115
"""Split args into outputs, inputs and states"""
114-
prevent_initial_call = kwargs.get('prevent_initial_call', None)
116+
prevent_initial_call = kwargs.get("prevent_initial_call", None)
115117
# flatten args
116118
args = [
117119
arg
@@ -122,13 +124,14 @@ def _handle_callback_args(*args, **kwargs):
122124
arg_or_list if isinstance(arg_or_list, (list, tuple)) else [arg_or_list]
123125
)
124126
]
125-
outputs = extract_callback_args(args, kwargs, 'output', Output)
126-
inputs = extract_callback_args(args, kwargs, 'inputs', Input)
127-
states = extract_callback_args(args, kwargs, 'state', State)
127+
outputs = extract_callback_args(args, kwargs, "output", Output)
128+
inputs = extract_callback_args(args, kwargs, "inputs", Input)
129+
states = extract_callback_args(args, kwargs, "state", State)
128130

129131
if args:
130132
raise TypeError(
131-
"callback must received first all Outputs, then all Inputs, then all States")
133+
"callback must received first all Outputs, then all Inputs, then all States"
134+
)
132135
return [
133136
outputs,
134137
inputs,
@@ -860,9 +863,7 @@ def interpolate_index(self, **kwargs):
860863
def dependencies(self):
861864
return flask.jsonify(self._callback_list)
862865

863-
def _insert_callback(
864-
self, output, inputs, state, prevent_initial_call
865-
):
866+
def _insert_callback(self, output, inputs, state, prevent_initial_call):
866867
if prevent_initial_call is None:
867868
prevent_initial_call = self.config.prevent_initial_callbacks
868869

@@ -998,22 +999,15 @@ def callback(self, *args, **kwargs):
998999
not to fire when its outputs are first added to the page. Defaults to
9991000
`False` unless `prevent_initial_callbacks=True` at the app level.
10001001
"""
1001-
kwargs['prevent_initial_call'] = kwargs.get(
1002-
'prevent_initial_call', None)
1003-
output = kwargs.get('output', args[0])
1002+
kwargs["prevent_initial_call"] = kwargs.get("prevent_initial_call", None)
1003+
output = kwargs.get("output", args[0])
10041004
# for backward compatibility, store whether first argument is a
10051005
# list of only 1 Output
1006-
specified_output_list = (
1007-
isinstance(output, (list, tuple)) and len(output) == 1)
1008-
(
1009-
output,
1010-
inputs,
1011-
state,
1012-
prevent_initial_call,
1013-
) = _handle_callback_args(*args, **kwargs)
1014-
callback_id = self._insert_callback(
1015-
output, inputs, state, prevent_initial_call
1006+
specified_output_list = isinstance(output, (list, tuple)) and len(output) == 1
1007+
(output, inputs, state, prevent_initial_call,) = _handle_callback_args(
1008+
*args, **kwargs
10161009
)
1010+
callback_id = self._insert_callback(output, inputs, state, prevent_initial_call)
10171011

10181012
def wrap_func(func):
10191013
@wraps(func)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"private::format.black": "black dash tests --exclude metadata_test.py",
66
"private::format.renderer": "cd dash-renderer && npm run format",
77
"private::initialize.renderer": "cd dash-renderer && npm ci",
8-
"private::lint.black": "if [[ $PYLINTRC != '.pylintrc' ]]; then black dash tests --exclude metadata_test.py --check; fi",
8+
"private::lint.black": "if [ ${PYLINTRC:-x} != '.pylintrc' ]; then black dash tests --exclude metadata_test.py --check; fi",
99
"private::lint.flake8": "flake8 --exclude=metadata_test.py dash tests",
1010
"private::lint.pylint-dash": "PYLINTRC=${PYLINTRC:=.pylintrc37} && pylint dash setup.py --rcfile=$PYLINTRC",
1111
"private::lint.pylint-tests": "PYLINTRC=${PYLINTRC:=.pylintrc37} && pylint tests/unit tests/integration -d all --rcfile=$PYLINTRC",

0 commit comments

Comments
 (0)