MCPcopy Index your code
hub / github.com/pymupdf/PyMuPDF / get_env_bool

Function get_env_bool

src/__init__.py:285–301  ·  view source on GitHub ↗

Returns `True`, `False` or `default` depending on whether $ is '1', '0' or unset. Otherwise assert-fails.

( name, default)

Source from the content-addressed store, hash-verified

283INVALID_NAME_CHARS = set(string.whitespace + "()<>[]{}/%" + chr(0))
284
285def get_env_bool( name, default):
286 ''&#x27;
287 Returns `True`, `False` or `default` depending on whether $<name> is '1',
288 '0' or unset. Otherwise assert-fails.
289 ''&#x27;
290 v = os.environ.get( name)
291 if v is None:
292 ret = default
293 elif v == '1':
294 ret = True
295 elif v == '0':
296 ret = False
297 else:
298 assert 0, f'Unrecognised value for {name}: {v!r}'
299 if ret != default:
300 log(f'Using non-default setting from {name}: {v!r}')
301 return ret
302
303def get_env_int( name, default):
304 ''&#x27;

Callers 1

__init__.pyFile · 0.70

Calls 2

logFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…