r"""Return the path to the top-level user configuration for black. This looks for ~\.black on Windows and ~/.config/black on Linux and other Unix systems. May raise: - RuntimeError: if the current user has no homedir - PermissionError: if the current process cannot access the u
()
| 219 | |
| 220 | @lru_cache |
| 221 | def find_user_pyproject_toml() -> Path: |
| 222 | r"""Return the path to the top-level user configuration for black. |
| 223 | |
| 224 | This looks for ~\.black on Windows and ~/.config/black on Linux and other |
| 225 | Unix systems. |
| 226 | |
| 227 | May raise: |
| 228 | - RuntimeError: if the current user has no homedir |
| 229 | - PermissionError: if the current process cannot access the user's homedir |
| 230 | """ |
| 231 | if sys.platform == "win32": |
| 232 | # Windows |
| 233 | user_config_path = Path.home() / ".black" |
| 234 | else: |
| 235 | config_root = os.environ.get("XDG_CONFIG_HOME", "~/.config") |
| 236 | user_config_path = Path(config_root).expanduser() / "black" |
| 237 | return _cached_resolve(user_config_path) |
| 238 | |
| 239 | |
| 240 | @lru_cache |
no test coverage detected