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

Method coerce

_plotly_utils/basevalidators.py:1788–1801  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

1786
1787 def validate_coerce(self, v):
1788 def coerce(value):
1789 if not isinstance(value, str):
1790 return value, False
1791 match = fullmatch(self.regex, value)
1792 if not match:
1793 return value, False
1794 else:
1795 digit_str = match.group(1)
1796 if len(digit_str) > 0 and int(digit_str) == 0:
1797 return value, False
1798 elif len(digit_str) > 0 and int(digit_str) == 1:
1799 return self.base, True
1800 else:
1801 return value, True
1802
1803 if v is None:
1804 pass

Callers

nothing calls this directly

Calls 3

fullmatchFunction · 0.85
intFunction · 0.85
groupMethod · 0.80

Tested by

no test coverage detected