Loads options from JSON files.
()
| 107 | |
| 108 | @functools.cache |
| 109 | def _load_options(): |
| 110 | """Loads options from JSON files.""" |
| 111 | user_config_file = os.getenv("XDG_CONFIG_HOME", default=Path.home().joinpath(".config")) / Path( |
| 112 | "dolfinx", "dolfinx_jit_options.json" |
| 113 | ) |
| 114 | try: |
| 115 | with open(user_config_file) as f: |
| 116 | user_options = json.load(f) |
| 117 | except FileNotFoundError: |
| 118 | user_options = dict() |
| 119 | |
| 120 | pwd_config_file = Path.cwd().joinpath("dolfinx_jit_options.json") |
| 121 | try: |
| 122 | with open(pwd_config_file) as f: |
| 123 | pwd_options = json.load(f) |
| 124 | except FileNotFoundError: |
| 125 | pwd_options = dict() |
| 126 | |
| 127 | return (user_options, pwd_options) |
| 128 | |
| 129 | |
| 130 | def get_options(priority_options: dict | None = None) -> dict: |