MCPcopy
hub / github.com/psf/black / find_user_pyproject_toml

Function find_user_pyproject_toml

src/black/files.py:221–237  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

219
220@lru_cache
221def 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

Callers 2

mainFunction · 0.90
find_pyproject_tomlFunction · 0.85

Calls 1

_cached_resolveFunction · 0.85

Tested by

no test coverage detected