MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / validate_bool

Function validate_bool

lib/matplotlib/rcsetup.py:179–188  ·  view source on GitHub ↗

Convert b to ``bool`` or raise.

(b)

Source from the content-addressed store, hash-verified

177
178
179def validate_bool(b):
180 """Convert b to ``bool`` or raise."""
181 if isinstance(b, str):
182 b = b.lower()
183 if b in ('t', 'y', 'yes', 'on', 'true', '1', 1, True):
184 return True
185 elif b in ('f', 'n', 'no', 'off', 'false', '0', 0, False):
186 return False
187 else:
188 raise ValueError(f'Cannot convert {b!r} to bool')
189
190
191def validate_axisbelow(s):

Callers 2

test_Bug_2543Function · 0.90
validate_axisbelowFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_Bug_2543Function · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…