-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathenv_var_util.py
33 lines (26 loc) · 909 Bytes
/
env_var_util.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""Implementations for environment variable related utilities.
"""
import os
def apply_material_icons_import_skipping_setting() -> None:
"""
Apply the environment variable setting to skip importing Material icons.
Notes
-----
This function needs to call before importing apysc package
(i.e., `import apysc as ap`).
"""
os.environ["APYSC_SKIP_MATERIAL_ICONS"] = "1"
def skip_material_icons_importing() -> bool:
"""
Get a boolean value whether to skip importing Material icons or not.
Returns
-------
result : bool
If the environment variable is set to skip importing Material icons,
then this function returns True.
"""
skip_material_icons: str = os.environ.get("APYSC_SKIP_MATERIAL_ICONS", "")
try:
return bool(int(skip_material_icons))
except ValueError:
return False