Returns the default directory for the Store. This is intentionally underscored to indicate that `Store.get_default_directory` is the intended way to get this information. This is also done so `Store.get_default_directory` can be mocked in tests and `_get_default_directory` can be t
()
| 23 | |
| 24 | |
| 25 | def _get_default_directory() -> str: |
| 26 | """Returns the default directory for the Store. This is intentionally |
| 27 | underscored to indicate that `Store.get_default_directory` is the intended |
| 28 | way to get this information. This is also done so |
| 29 | `Store.get_default_directory` can be mocked in tests and |
| 30 | `_get_default_directory` can be tested. |
| 31 | """ |
| 32 | ret = os.environ.get('PRE_COMMIT_HOME') or os.path.join( |
| 33 | os.environ.get('XDG_CACHE_HOME') or os.path.expanduser('~/.cache'), |
| 34 | 'pre-commit', |
| 35 | ) |
| 36 | return os.path.realpath(ret) |
| 37 | |
| 38 | |
| 39 | _LOCAL_RESOURCES = ( |