MCPcopy Index your code
hub / github.com/ipython/ipython / get_xdg_dir

Function get_xdg_dir

IPython/utils/path.py:199–215  ·  view source on GitHub ↗

Return the XDG_CONFIG_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

197 'set $HOME environment variable to override' % homedir)
198
199def get_xdg_dir() -> str | None:
200 """Return the XDG_CONFIG_HOME, if it is defined and exists, else None.
201
202 This is only for non-OS X posix (Linux,Unix,etc.) systems.
203 """
204
205 env = os.environ
206
207 if os.name == "posix":
208 # Linux, Unix, AIX, etc.
209 # use ~/.config if empty OR not set
210 xdg = env.get("XDG_CONFIG_HOME", None) or os.path.join(get_home_dir(), '.config')
211 if xdg and _writable_dir(xdg):
212 assert isinstance(xdg, str)
213 return xdg
214
215 return None
216
217
218def get_xdg_cache_dir():

Callers 1

get_ipython_dirFunction · 0.90

Calls 3

get_home_dirFunction · 0.85
_writable_dirFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…