@@ -433,12 +433,12 @@ def _check_update_figure_dict(
433433 if (
434434 xaxis_filter_short == "x"
435435 and (
436- x_anchor_trace not in [ None , "x" ]
436+ x_anchor_trace not in ( None , "x" )
437437 and xaxis_matches != xaxis_filter_short
438438 )
439439 ) or (
440440 xaxis_filter_short != "x"
441- and (xaxis_filter_short not in [ x_anchor_trace , xaxis_matches ] )
441+ and (xaxis_filter_short not in ( x_anchor_trace , xaxis_matches ) )
442442 ):
443443 continue
444444
@@ -1260,7 +1260,7 @@ def construct_update_data(
12601260 # 1. Base case - there is an x-range specified in the front-end
12611261 start_matches = self ._re_matches (re .compile (r"xaxis\d*.range\[0]" ), cl_k )
12621262 stop_matches = self ._re_matches (re .compile (r"xaxis\d*.range\[1]" ), cl_k )
1263- if len ( start_matches ) and len ( stop_matches ):
1263+ if start_matches and stop_matches : # when both are not empty
12641264 for t_start_key , t_stop_key in zip (start_matches , stop_matches ):
12651265 # Check if the xaxis<NUMB> part of xaxis<NUMB>.[0-1] matches
12661266 xaxis = t_start_key .split ("." )[0 ]
@@ -1280,7 +1280,7 @@ def construct_update_data(
12801280 )
12811281 spike_matches = self ._re_matches (re .compile (r"xaxis\d*.showspikes" ), cl_k )
12821282 # 2.1 Reset-axes -> autorange & reset to the global data view
1283- if len ( autorange_matches ) and len ( spike_matches ):
1283+ if autorange_matches and spike_matches : # when both are not empty
12841284 for autorange_key in autorange_matches :
12851285 if relayout_data [autorange_key ]:
12861286 xaxis = autorange_key .split ("." )[0 ]
@@ -1291,14 +1291,16 @@ def construct_update_data(
12911291 )
12921292 # 2.1. Autorange -> do nothing, the autorange will be applied on the
12931293 # current front-end view
1294- elif len (autorange_matches ) and not len (spike_matches ):
1294+ elif (
1295+ autorange_matches and not spike_matches
1296+ ): # when only autorange is not empty
12951297 # PreventUpdate returns a 204 status code response on the
12961298 # relayout post request
12971299 return dash .no_update
12981300
12991301 # If we do not have any traces to be updated, we will return an empty
13001302 # request response
1301- if len ( updated_trace_indices ) == 0 :
1303+ if not updated_trace_indices : # when updated_trace_indices is empty
13021304 # PreventUpdate returns a 204 status-code response on the relayout post
13031305 # request
13041306 return dash .no_update
@@ -1336,7 +1338,7 @@ def _parse_dtype_orjson(series: np.ndarray) -> np.ndarray:
13361338 # * float16 and float128 aren't supported with latest orjson versions (3.8.1)
13371339 # * this method assumes that the it will not get a float128 series
13381340 # -> this method can be removed if orjson supports float16
1339- if series .dtype in [ np .float16 ] :
1341+ if series .dtype == np .float16 :
13401342 return series .astype (np .float32 )
13411343 return series
13421344
0 commit comments