MCPcopy Create free account
hub / github.com/ipython/ipython / get_xdg_cache_dir

Function get_xdg_cache_dir

IPython/utils/path.py:233–249  ·  view source on GitHub ↗

Return the XDG_CACHE_HOME, if it is defined and exists, else None. This is only for non-OS X posix (Linux,Unix,etc.) systems.

()

Source from the content-addressed store, hash-verified

231
232
233def get_xdg_cache_dir():
234 """Return the XDG_CACHE_HOME, if it is defined and exists, else None.
235
236 This is only for non-OS X posix (Linux,Unix,etc.) systems.
237 """
238
239 env = os.environ
240
241 if os.name == 'posix' and sys.platform != 'darwin':
242 # Linux, Unix, AIX, etc.
243 # use ~/.cache if empty OR not set
244 xdg = env.get("XDG_CACHE_HOME", None) or os.path.join(get_home_dir(), '.cache')
245 if xdg and _writable_dir(xdg):
246 assert isinstance(xdg, str)
247 return xdg
248
249 return None
250
251
252@undoc

Callers 1

get_ipython_cache_dirFunction · 0.90

Calls 2

get_home_dirFunction · 0.85
_writable_dirFunction · 0.85

Tested by

no test coverage detected