Skip to content

Commit 473895e

Browse files
committed
lint & simplify _validate
1 parent d301e3b commit 473895e

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

dash/_validate.py

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -35,43 +35,43 @@ def validate_callback(output, inputs, state, extra_args, types):
3535

3636
outputs = output if is_multi else [output]
3737

38-
for args, cls in [(outputs, Output), (inputs, Input), (state, State)]:
39-
validate_callback_args(args, cls)
38+
for args in [outputs, inputs, state]:
39+
for arg in args:
40+
validate_callback_arg(arg)
4041

4142

42-
def validate_callback_args(args, cls):
43-
for arg in args:
44-
if not isinstance(getattr(arg, "component_property", None), _strings):
45-
raise exceptions.IncorrectTypeException(
46-
"""
47-
component_property must be a string, found {!r}
48-
""".format(
49-
arg.component_property
50-
)
43+
def validate_callback_arg(arg):
44+
if not isinstance(getattr(arg, "component_property", None), _strings):
45+
raise exceptions.IncorrectTypeException(
46+
"""
47+
component_property must be a string, found {!r}
48+
""".format(
49+
arg.component_property
5150
)
51+
)
5252

53-
if hasattr(arg, "component_event"):
54-
raise exceptions.NonExistentEventException(
55-
"""
56-
Events have been removed.
57-
Use the associated property instead.
58-
"""
59-
)
53+
if hasattr(arg, "component_event"):
54+
raise exceptions.NonExistentEventException(
55+
"""
56+
Events have been removed.
57+
Use the associated property instead.
58+
"""
59+
)
6060

61-
if isinstance(arg.component_id, dict):
62-
validate_id_dict(arg)
61+
if isinstance(arg.component_id, dict):
62+
validate_id_dict(arg)
6363

64-
elif isinstance(arg.component_id, _strings):
65-
validate_id_string(arg)
64+
elif isinstance(arg.component_id, _strings):
65+
validate_id_string(arg)
6666

67-
else:
68-
raise exceptions.IncorrectTypeException(
69-
"""
70-
component_id must be a string or dict, found {!r}
71-
""".format(
72-
arg.component_id
73-
)
67+
else:
68+
raise exceptions.IncorrectTypeException(
69+
"""
70+
component_id must be a string or dict, found {!r}
71+
""".format(
72+
arg.component_id
7473
)
74+
)
7575

7676

7777
def validate_id_dict(arg):

0 commit comments

Comments
 (0)