MCPcopy Index your code
hub / github.com/plotly/plotly.py / key

Function key

_plotly_utils/utils.py:371–379  ·  view source on GitHub ↗
(v)

Source from the content-addressed store, hash-verified

369
370def _natural_sort_strings(vals, reverse=False):
371 def key(v):
372 v_parts = re.split(r"(\d+)", v)
373 for i in range(len(v_parts)):
374 try:
375 v_parts[i] = int(v_parts[i])
376 except ValueError:
377 # not an int
378 pass
379 return tuple(v_parts)
380
381 return sorted(vals, key=key, reverse=reverse)
382

Callers

nothing calls this directly

Calls 2

intFunction · 0.85
splitMethod · 0.45

Tested by

no test coverage detected