Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/platformdirs/__init__.py: 1%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""Utilities for determining application-specific dirs.
3Provides convenience functions (e.g. :func:`user_data_dir`, :func:`user_config_path`), a :data:`PlatformDirs` class that
4auto-detects the current platform, and the :class:`~platformdirs.api.PlatformDirsABC` base class.
6See <https://github.com/platformdirs/platformdirs> for details and usage.
8"""
10from __future__ import annotations
12import os
13import sys
14from typing import TYPE_CHECKING
16from .api import PlatformDirsABC
17from .version import __version__
18from .version import __version_tuple__ as __version_info__
20if TYPE_CHECKING:
21 from pathlib import Path
22 from typing import Literal
24if sys.platform == "win32":
25 from platformdirs.windows import Windows as _Result
26elif sys.platform == "darwin":
27 from platformdirs.macos import MacOS as _Result
28else:
29 from platformdirs.unix import Unix as _Result
32def _set_platform_dir_class() -> type[PlatformDirsABC]:
33 if os.getenv("ANDROID_DATA") == "/data" and os.getenv("ANDROID_ROOT") == "/system":
34 if os.getenv("SHELL") or os.getenv("PREFIX"):
35 return _Result
37 from platformdirs.android import _android_folder # ruff:ignore[import-outside-top-level]
39 if _android_folder() is not None:
40 from platformdirs.android import Android # ruff:ignore[import-outside-top-level]
42 return Android # return to avoid redefinition of a result
44 return _Result
47if TYPE_CHECKING:
48 # Work around mypy issue: https://github.com/python/mypy/issues/10962
49 PlatformDirs = _Result
50else:
51 PlatformDirs = _set_platform_dir_class() #: Currently active platform
52AppDirs = PlatformDirs #: Backwards compatibility with appdirs
55def user_data_dir( # ruff:ignore[too-many-arguments, too-many-positional-arguments]
56 appname: str | None = None,
57 appauthor: str | Literal[False] | None = None,
58 version: str | None = None,
59 roaming: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
60 ensure_exists: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
61 use_site_for_root: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
62) -> str:
63 """:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
64 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
65 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
66 :param roaming: See `roaming <platformdirs.api.PlatformDirsABC.roaming>`.
67 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
68 :param use_site_for_root: See `use_site_for_root <platformdirs.api.PlatformDirsABC.use_site_for_root>`.
70 :returns: data directory tied to the user
72 """
73 return PlatformDirs(
74 appname=appname,
75 appauthor=appauthor,
76 version=version,
77 roaming=roaming,
78 ensure_exists=ensure_exists,
79 use_site_for_root=use_site_for_root,
80 ).user_data_dir
83def site_data_dir(
84 appname: str | None = None,
85 appauthor: str | Literal[False] | None = None,
86 version: str | None = None,
87 multipath: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
88 ensure_exists: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
89) -> str:
90 """:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
91 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
92 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
93 :param multipath: See `multipath <platformdirs.api.PlatformDirsABC.multipath>`.
94 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
96 :returns: data directory shared by users
98 """
99 return PlatformDirs(
100 appname=appname,
101 appauthor=appauthor,
102 version=version,
103 multipath=multipath,
104 ensure_exists=ensure_exists,
105 ).site_data_dir
108def user_config_dir( # ruff:ignore[too-many-arguments, too-many-positional-arguments]
109 appname: str | None = None,
110 appauthor: str | Literal[False] | None = None,
111 version: str | None = None,
112 roaming: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
113 ensure_exists: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
114 use_site_for_root: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
115) -> str:
116 """:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
117 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
118 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
119 :param roaming: See `roaming <platformdirs.api.PlatformDirsABC.roaming>`.
120 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
121 :param use_site_for_root: See `use_site_for_root <platformdirs.api.PlatformDirsABC.use_site_for_root>`.
123 :returns: config directory tied to the user
125 """
126 return PlatformDirs(
127 appname=appname,
128 appauthor=appauthor,
129 version=version,
130 roaming=roaming,
131 ensure_exists=ensure_exists,
132 use_site_for_root=use_site_for_root,
133 ).user_config_dir
136def site_config_dir(
137 appname: str | None = None,
138 appauthor: str | Literal[False] | None = None,
139 version: str | None = None,
140 multipath: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
141 ensure_exists: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
142) -> str:
143 """:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
144 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
145 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
146 :param multipath: See `multipath <platformdirs.api.PlatformDirsABC.multipath>`.
147 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
149 :returns: config directory shared by users
151 """
152 return PlatformDirs(
153 appname=appname,
154 appauthor=appauthor,
155 version=version,
156 multipath=multipath,
157 ensure_exists=ensure_exists,
158 ).site_config_dir
161def user_cache_dir( # ruff:ignore[too-many-arguments, too-many-positional-arguments]
162 appname: str | None = None,
163 appauthor: str | Literal[False] | None = None,
164 version: str | None = None,
165 opinion: bool = True, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
166 ensure_exists: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
167 use_site_for_root: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
168) -> str:
169 """:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
170 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
171 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
172 :param opinion: See `opinion <platformdirs.api.PlatformDirsABC.opinion>`.
173 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
174 :param use_site_for_root: See `use_site_for_root <platformdirs.api.PlatformDirsABC.use_site_for_root>`.
176 :returns: cache directory tied to the user
178 """
179 return PlatformDirs(
180 appname=appname,
181 appauthor=appauthor,
182 version=version,
183 opinion=opinion,
184 ensure_exists=ensure_exists,
185 use_site_for_root=use_site_for_root,
186 ).user_cache_dir
189def site_cache_dir(
190 appname: str | None = None,
191 appauthor: str | Literal[False] | None = None,
192 version: str | None = None,
193 opinion: bool = True, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
194 ensure_exists: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
195) -> str:
196 """:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
197 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
198 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
199 :param opinion: See `opinion <platformdirs.api.PlatformDirsABC.opinion>`.
200 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
202 :returns: cache directory shared by users
204 """
205 return PlatformDirs(
206 appname=appname,
207 appauthor=appauthor,
208 version=version,
209 opinion=opinion,
210 ensure_exists=ensure_exists,
211 ).site_cache_dir
214def user_state_dir( # ruff:ignore[too-many-arguments, too-many-positional-arguments]
215 appname: str | None = None,
216 appauthor: str | Literal[False] | None = None,
217 version: str | None = None,
218 roaming: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
219 ensure_exists: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
220 use_site_for_root: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
221) -> str:
222 """:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
223 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
224 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
225 :param roaming: See `roaming <platformdirs.api.PlatformDirsABC.roaming>`.
226 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
227 :param use_site_for_root: See `use_site_for_root <platformdirs.api.PlatformDirsABC.use_site_for_root>`.
229 :returns: state directory tied to the user
231 """
232 return PlatformDirs(
233 appname=appname,
234 appauthor=appauthor,
235 version=version,
236 roaming=roaming,
237 ensure_exists=ensure_exists,
238 use_site_for_root=use_site_for_root,
239 ).user_state_dir
242def site_state_dir(
243 appname: str | None = None,
244 appauthor: str | Literal[False] | None = None,
245 version: str | None = None,
246 ensure_exists: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
247) -> str:
248 """:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
249 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
250 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
251 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
253 :returns: state directory shared by users
255 """
256 return PlatformDirs(
257 appname=appname,
258 appauthor=appauthor,
259 version=version,
260 ensure_exists=ensure_exists,
261 ).site_state_dir
264def user_log_dir( # ruff:ignore[too-many-arguments, too-many-positional-arguments]
265 appname: str | None = None,
266 appauthor: str | Literal[False] | None = None,
267 version: str | None = None,
268 opinion: bool = True, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
269 ensure_exists: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
270 use_site_for_root: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
271) -> str:
272 """:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
273 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
274 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
275 :param opinion: See `opinion <platformdirs.api.PlatformDirsABC.opinion>`.
276 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
277 :param use_site_for_root: See `use_site_for_root <platformdirs.api.PlatformDirsABC.use_site_for_root>`.
279 :returns: log directory tied to the user
281 """
282 return PlatformDirs(
283 appname=appname,
284 appauthor=appauthor,
285 version=version,
286 opinion=opinion,
287 ensure_exists=ensure_exists,
288 use_site_for_root=use_site_for_root,
289 ).user_log_dir
292def site_log_dir(
293 appname: str | None = None,
294 appauthor: str | Literal[False] | None = None,
295 version: str | None = None,
296 opinion: bool = True, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
297 ensure_exists: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
298) -> str:
299 """:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
300 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
301 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
302 :param opinion: See `opinion <platformdirs.api.PlatformDirsABC.opinion>`.
303 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
305 :returns: log directory shared by users
307 """
308 return PlatformDirs(
309 appname=appname,
310 appauthor=appauthor,
311 version=version,
312 opinion=opinion,
313 ensure_exists=ensure_exists,
314 ).site_log_dir
317def user_documents_dir() -> str:
318 """:returns: documents directory tied to the user"""
319 return PlatformDirs().user_documents_dir
322def user_downloads_dir() -> str:
323 """:returns: downloads directory tied to the user"""
324 return PlatformDirs().user_downloads_dir
327def user_pictures_dir() -> str:
328 """:returns: pictures directory tied to the user"""
329 return PlatformDirs().user_pictures_dir
332def user_videos_dir() -> str:
333 """:returns: videos directory tied to the user"""
334 return PlatformDirs().user_videos_dir
337def user_music_dir() -> str:
338 """:returns: music directory tied to the user"""
339 return PlatformDirs().user_music_dir
342def user_desktop_dir() -> str:
343 """:returns: desktop directory tied to the user"""
344 return PlatformDirs().user_desktop_dir
347def user_projects_dir() -> str:
348 """:returns: projects directory tied to the user"""
349 return PlatformDirs().user_projects_dir
352def user_publicshare_dir() -> str:
353 """:returns: public share directory tied to the user"""
354 return PlatformDirs().user_publicshare_dir
357def user_templates_dir() -> str:
358 """:returns: templates directory tied to the user"""
359 return PlatformDirs().user_templates_dir
362def user_fonts_dir() -> str:
363 """:returns: fonts directory tied to the user"""
364 return PlatformDirs().user_fonts_dir
367def user_preference_dir() -> str:
368 """:returns: preference directory tied to the user"""
369 return PlatformDirs().user_preference_dir
372def user_bin_dir() -> str:
373 """:returns: bin directory tied to the user"""
374 return PlatformDirs().user_bin_dir
377def site_bin_dir() -> str:
378 """:returns: bin directory shared by users"""
379 return PlatformDirs().site_bin_dir
382def user_applications_dir() -> str:
383 """:returns: applications directory tied to the user"""
384 return PlatformDirs().user_applications_dir
387def site_applications_dir(
388 multipath: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
389 ensure_exists: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
390) -> str:
391 """:param multipath: See `multipath <platformdirs.api.PlatformDirsABC.multipath>`.
392 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
394 :returns: applications directory shared by users
396 """
397 return PlatformDirs(
398 multipath=multipath,
399 ensure_exists=ensure_exists,
400 ).site_applications_dir
403def user_runtime_dir( # ruff:ignore[too-many-arguments, too-many-positional-arguments]
404 appname: str | None = None,
405 appauthor: str | Literal[False] | None = None,
406 version: str | None = None,
407 opinion: bool = True, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
408 ensure_exists: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
409 use_site_for_root: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
410) -> str:
411 """:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
412 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
413 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
414 :param opinion: See `opinion <platformdirs.api.PlatformDirsABC.opinion>`.
415 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
416 :param use_site_for_root: See `use_site_for_root <platformdirs.api.PlatformDirsABC.use_site_for_root>`.
418 :returns: runtime directory tied to the user
420 """
421 return PlatformDirs(
422 appname=appname,
423 appauthor=appauthor,
424 version=version,
425 opinion=opinion,
426 ensure_exists=ensure_exists,
427 use_site_for_root=use_site_for_root,
428 ).user_runtime_dir
431def site_runtime_dir(
432 appname: str | None = None,
433 appauthor: str | Literal[False] | None = None,
434 version: str | None = None,
435 opinion: bool = True, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
436 ensure_exists: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
437) -> str:
438 """:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
439 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
440 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
441 :param opinion: See `opinion <platformdirs.api.PlatformDirsABC.opinion>`.
442 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
444 :returns: runtime directory shared by users
446 """
447 return PlatformDirs(
448 appname=appname,
449 appauthor=appauthor,
450 version=version,
451 opinion=opinion,
452 ensure_exists=ensure_exists,
453 ).site_runtime_dir
456def user_data_path( # ruff:ignore[too-many-arguments, too-many-positional-arguments]
457 appname: str | None = None,
458 appauthor: str | Literal[False] | None = None,
459 version: str | None = None,
460 roaming: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
461 ensure_exists: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
462 use_site_for_root: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
463) -> Path:
464 """:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
465 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
466 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
467 :param roaming: See `roaming <platformdirs.api.PlatformDirsABC.roaming>`.
468 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
469 :param use_site_for_root: See `use_site_for_root <platformdirs.api.PlatformDirsABC.use_site_for_root>`.
471 :returns: data path tied to the user
473 """
474 return PlatformDirs(
475 appname=appname,
476 appauthor=appauthor,
477 version=version,
478 roaming=roaming,
479 ensure_exists=ensure_exists,
480 use_site_for_root=use_site_for_root,
481 ).user_data_path
484def site_data_path(
485 appname: str | None = None,
486 appauthor: str | Literal[False] | None = None,
487 version: str | None = None,
488 multipath: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
489 ensure_exists: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
490) -> Path:
491 """:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
492 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
493 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
494 :param multipath: See `multipath <platformdirs.api.PlatformDirsABC.multipath>`.
495 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
497 :returns: data path shared by users
499 """
500 return PlatformDirs(
501 appname=appname,
502 appauthor=appauthor,
503 version=version,
504 multipath=multipath,
505 ensure_exists=ensure_exists,
506 ).site_data_path
509def user_config_path( # ruff:ignore[too-many-arguments, too-many-positional-arguments]
510 appname: str | None = None,
511 appauthor: str | Literal[False] | None = None,
512 version: str | None = None,
513 roaming: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
514 ensure_exists: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
515 use_site_for_root: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
516) -> Path:
517 """:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
518 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
519 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
520 :param roaming: See `roaming <platformdirs.api.PlatformDirsABC.roaming>`.
521 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
522 :param use_site_for_root: See `use_site_for_root <platformdirs.api.PlatformDirsABC.use_site_for_root>`.
524 :returns: config path tied to the user
526 """
527 return PlatformDirs(
528 appname=appname,
529 appauthor=appauthor,
530 version=version,
531 roaming=roaming,
532 ensure_exists=ensure_exists,
533 use_site_for_root=use_site_for_root,
534 ).user_config_path
537def site_config_path(
538 appname: str | None = None,
539 appauthor: str | Literal[False] | None = None,
540 version: str | None = None,
541 multipath: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
542 ensure_exists: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
543) -> Path:
544 """:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
545 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
546 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
547 :param multipath: See `multipath <platformdirs.api.PlatformDirsABC.multipath>`.
548 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
550 :returns: config path shared by users
552 """
553 return PlatformDirs(
554 appname=appname,
555 appauthor=appauthor,
556 version=version,
557 multipath=multipath,
558 ensure_exists=ensure_exists,
559 ).site_config_path
562def site_cache_path(
563 appname: str | None = None,
564 appauthor: str | Literal[False] | None = None,
565 version: str | None = None,
566 opinion: bool = True, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
567 ensure_exists: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
568) -> Path:
569 """:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
570 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
571 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
572 :param opinion: See `opinion <platformdirs.api.PlatformDirsABC.opinion>`.
573 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
575 :returns: cache path shared by users
577 """
578 return PlatformDirs(
579 appname=appname,
580 appauthor=appauthor,
581 version=version,
582 opinion=opinion,
583 ensure_exists=ensure_exists,
584 ).site_cache_path
587def user_cache_path( # ruff:ignore[too-many-arguments, too-many-positional-arguments]
588 appname: str | None = None,
589 appauthor: str | Literal[False] | None = None,
590 version: str | None = None,
591 opinion: bool = True, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
592 ensure_exists: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
593 use_site_for_root: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
594) -> Path:
595 """:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
596 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
597 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
598 :param opinion: See `opinion <platformdirs.api.PlatformDirsABC.opinion>`.
599 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
600 :param use_site_for_root: See `use_site_for_root <platformdirs.api.PlatformDirsABC.use_site_for_root>`.
602 :returns: cache path tied to the user
604 """
605 return PlatformDirs(
606 appname=appname,
607 appauthor=appauthor,
608 version=version,
609 opinion=opinion,
610 ensure_exists=ensure_exists,
611 use_site_for_root=use_site_for_root,
612 ).user_cache_path
615def user_state_path( # ruff:ignore[too-many-arguments, too-many-positional-arguments]
616 appname: str | None = None,
617 appauthor: str | Literal[False] | None = None,
618 version: str | None = None,
619 roaming: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
620 ensure_exists: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
621 use_site_for_root: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
622) -> Path:
623 """:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
624 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
625 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
626 :param roaming: See `roaming <platformdirs.api.PlatformDirsABC.roaming>`.
627 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
628 :param use_site_for_root: See `use_site_for_root <platformdirs.api.PlatformDirsABC.use_site_for_root>`.
630 :returns: state path tied to the user
632 """
633 return PlatformDirs(
634 appname=appname,
635 appauthor=appauthor,
636 version=version,
637 roaming=roaming,
638 ensure_exists=ensure_exists,
639 use_site_for_root=use_site_for_root,
640 ).user_state_path
643def site_state_path(
644 appname: str | None = None,
645 appauthor: str | Literal[False] | None = None,
646 version: str | None = None,
647 ensure_exists: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
648) -> Path:
649 """:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
650 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
651 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
652 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
654 :returns: state path shared by users
656 """
657 return PlatformDirs(
658 appname=appname,
659 appauthor=appauthor,
660 version=version,
661 ensure_exists=ensure_exists,
662 ).site_state_path
665def user_log_path( # ruff:ignore[too-many-arguments, too-many-positional-arguments]
666 appname: str | None = None,
667 appauthor: str | Literal[False] | None = None,
668 version: str | None = None,
669 opinion: bool = True, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
670 ensure_exists: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
671 use_site_for_root: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
672) -> Path:
673 """:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
674 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
675 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
676 :param opinion: See `opinion <platformdirs.api.PlatformDirsABC.opinion>`.
677 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
678 :param use_site_for_root: See `use_site_for_root <platformdirs.api.PlatformDirsABC.use_site_for_root>`.
680 :returns: log path tied to the user
682 """
683 return PlatformDirs(
684 appname=appname,
685 appauthor=appauthor,
686 version=version,
687 opinion=opinion,
688 ensure_exists=ensure_exists,
689 use_site_for_root=use_site_for_root,
690 ).user_log_path
693def site_log_path(
694 appname: str | None = None,
695 appauthor: str | Literal[False] | None = None,
696 version: str | None = None,
697 opinion: bool = True, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
698 ensure_exists: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
699) -> Path:
700 """:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
701 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
702 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
703 :param opinion: See `opinion <platformdirs.api.PlatformDirsABC.opinion>`.
704 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
706 :returns: log path shared by users
708 """
709 return PlatformDirs(
710 appname=appname,
711 appauthor=appauthor,
712 version=version,
713 opinion=opinion,
714 ensure_exists=ensure_exists,
715 ).site_log_path
718def user_documents_path() -> Path:
719 """:returns: documents path tied to the user"""
720 return PlatformDirs().user_documents_path
723def user_downloads_path() -> Path:
724 """:returns: downloads path tied to the user"""
725 return PlatformDirs().user_downloads_path
728def user_pictures_path() -> Path:
729 """:returns: pictures path tied to the user"""
730 return PlatformDirs().user_pictures_path
733def user_videos_path() -> Path:
734 """:returns: videos path tied to the user"""
735 return PlatformDirs().user_videos_path
738def user_music_path() -> Path:
739 """:returns: music path tied to the user"""
740 return PlatformDirs().user_music_path
743def user_desktop_path() -> Path:
744 """:returns: desktop path tied to the user"""
745 return PlatformDirs().user_desktop_path
748def user_projects_path() -> Path:
749 """:returns: projects path tied to the user"""
750 return PlatformDirs().user_projects_path
753def user_publicshare_path() -> Path:
754 """:returns: public share path tied to the user"""
755 return PlatformDirs().user_publicshare_path
758def user_templates_path() -> Path:
759 """:returns: templates path tied to the user"""
760 return PlatformDirs().user_templates_path
763def user_fonts_path() -> Path:
764 """:returns: fonts path tied to the user"""
765 return PlatformDirs().user_fonts_path
768def user_preference_path() -> Path:
769 """:returns: preference path tied to the user"""
770 return PlatformDirs().user_preference_path
773def user_bin_path() -> Path:
774 """:returns: bin path tied to the user"""
775 return PlatformDirs().user_bin_path
778def site_bin_path() -> Path:
779 """:returns: bin path shared by users"""
780 return PlatformDirs().site_bin_path
783def user_applications_path() -> Path:
784 """:returns: applications path tied to the user"""
785 return PlatformDirs().user_applications_path
788def site_applications_path(
789 multipath: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
790 ensure_exists: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
791) -> Path:
792 """:param multipath: See `multipath <platformdirs.api.PlatformDirsABC.multipath>`.
793 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
795 :returns: applications path shared by users
797 """
798 return PlatformDirs(
799 multipath=multipath,
800 ensure_exists=ensure_exists,
801 ).site_applications_path
804def user_runtime_path( # ruff:ignore[too-many-arguments, too-many-positional-arguments]
805 appname: str | None = None,
806 appauthor: str | Literal[False] | None = None,
807 version: str | None = None,
808 opinion: bool = True, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
809 ensure_exists: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
810 use_site_for_root: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
811) -> Path:
812 """:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
813 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
814 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
815 :param opinion: See `opinion <platformdirs.api.PlatformDirsABC.opinion>`.
816 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
817 :param use_site_for_root: See `use_site_for_root <platformdirs.api.PlatformDirsABC.use_site_for_root>`.
819 :returns: runtime path tied to the user
821 """
822 return PlatformDirs(
823 appname=appname,
824 appauthor=appauthor,
825 version=version,
826 opinion=opinion,
827 ensure_exists=ensure_exists,
828 use_site_for_root=use_site_for_root,
829 ).user_runtime_path
832def site_runtime_path(
833 appname: str | None = None,
834 appauthor: str | Literal[False] | None = None,
835 version: str | None = None,
836 opinion: bool = True, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
837 ensure_exists: bool = False, # ruff:ignore[boolean-type-hint-positional-argument, boolean-default-value-positional-argument]
838) -> Path:
839 """:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
840 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
841 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
842 :param opinion: See `opinion <platformdirs.api.PlatformDirsABC.opinion>`.
843 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
845 :returns: runtime path shared by users
847 """
848 return PlatformDirs(
849 appname=appname,
850 appauthor=appauthor,
851 version=version,
852 opinion=opinion,
853 ensure_exists=ensure_exists,
854 ).site_runtime_path
857__all__ = [
858 "AppDirs",
859 "PlatformDirs",
860 "PlatformDirsABC",
861 "__version__",
862 "__version_info__",
863 "site_applications_dir",
864 "site_applications_path",
865 "site_bin_dir",
866 "site_bin_path",
867 "site_cache_dir",
868 "site_cache_path",
869 "site_config_dir",
870 "site_config_path",
871 "site_data_dir",
872 "site_data_path",
873 "site_log_dir",
874 "site_log_path",
875 "site_runtime_dir",
876 "site_runtime_path",
877 "site_state_dir",
878 "site_state_path",
879 "user_applications_dir",
880 "user_applications_path",
881 "user_bin_dir",
882 "user_bin_path",
883 "user_cache_dir",
884 "user_cache_path",
885 "user_config_dir",
886 "user_config_path",
887 "user_data_dir",
888 "user_data_path",
889 "user_desktop_dir",
890 "user_desktop_path",
891 "user_documents_dir",
892 "user_documents_path",
893 "user_downloads_dir",
894 "user_downloads_path",
895 "user_fonts_dir",
896 "user_fonts_path",
897 "user_log_dir",
898 "user_log_path",
899 "user_music_dir",
900 "user_music_path",
901 "user_pictures_dir",
902 "user_pictures_path",
903 "user_preference_dir",
904 "user_preference_path",
905 "user_projects_dir",
906 "user_projects_path",
907 "user_publicshare_dir",
908 "user_publicshare_path",
909 "user_runtime_dir",
910 "user_runtime_path",
911 "user_state_dir",
912 "user_state_path",
913 "user_templates_dir",
914 "user_templates_path",
915 "user_videos_dir",
916 "user_videos_path",
917]