MCPcopy Create free account
hub / github.com/psf/black / get_cache_dir

Function get_cache_dir

src/black/cache.py:21–34  ·  view source on GitHub ↗

Get the cache directory used by black. Users can customize this directory on all systems using `BLACK_CACHE_DIR` environment variable. By default, the cache directory is the user cache directory under the black application. This result is immediately set to a constant `black.cache.

()

Source from the content-addressed store, hash-verified

19
20
21def get_cache_dir() -> Path:
22 """Get the cache directory used by black.
23
24 Users can customize this directory on all systems using `BLACK_CACHE_DIR`
25 environment variable. By default, the cache directory is the user cache directory
26 under the black application.
27
28 This result is immediately set to a constant `black.cache.CACHE_DIR` as to avoid
29 repeated calls.
30 """
31 # NOTE: Function mostly exists as a clean way to test getting the cache directory.
32 default_cache_dir = user_cache_dir("black", version=__version__)
33 cache_dir = Path(os.environ.get("BLACK_CACHE_DIR", default_cache_dir))
34 return cache_dir
35
36
37CACHE_DIR = get_cache_dir()

Callers 2

test_get_cache_dirMethod · 0.90
cache.pyFile · 0.85

Calls

no outgoing calls

Tested by 1

test_get_cache_dirMethod · 0.72