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"""
2Utilities for determining application-specific dirs.
4Provides convenience functions (e.g. :func:`user_data_dir`, :func:`user_config_path`), a :data:`PlatformDirs` class
5that auto-detects the current platform, and the :class:`~platformdirs.api.PlatformDirsABC` base class.
7See <https://github.com/platformdirs/platformdirs> for details and usage.
9"""
11from __future__ import annotations
13import os
14import sys
15from typing import TYPE_CHECKING
17from .api import PlatformDirsABC
18from .version import __version__
19from .version import __version_tuple__ as __version_info__
21if TYPE_CHECKING:
22 from pathlib import Path
23 from typing import Literal
25if sys.platform == "win32":
26 from platformdirs.windows import Windows as _Result
27elif sys.platform == "darwin":
28 from platformdirs.macos import MacOS as _Result
29else:
30 from platformdirs.unix import Unix as _Result
33def _set_platform_dir_class() -> type[PlatformDirsABC]:
34 if os.getenv("ANDROID_DATA") == "/data" and os.getenv("ANDROID_ROOT") == "/system":
35 if os.getenv("SHELL") or os.getenv("PREFIX"):
36 return _Result
38 from platformdirs.android import _android_folder # noqa: PLC0415
40 if _android_folder() is not None:
41 from platformdirs.android import Android # noqa: PLC0415
43 return Android # return to avoid redefinition of a result
45 return _Result
48if TYPE_CHECKING:
49 # Work around mypy issue: https://github.com/python/mypy/issues/10962
50 PlatformDirs = _Result
51else:
52 PlatformDirs = _set_platform_dir_class() #: Currently active platform
53AppDirs = PlatformDirs #: Backwards compatibility with appdirs
56def user_data_dir( # noqa: PLR0913, PLR0917
57 appname: str | None = None,
58 appauthor: str | Literal[False] | None = None,
59 version: str | None = None,
60 roaming: bool = False, # noqa: FBT001, FBT002
61 ensure_exists: bool = False, # noqa: FBT001, FBT002
62 use_site_for_root: bool = False, # noqa: FBT001, FBT002
63) -> str:
64 """
65 :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
66 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
67 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
68 :param roaming: See `roaming <platformdirs.api.PlatformDirsABC.roaming>`.
69 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
70 :param use_site_for_root: See `use_site_for_root <platformdirs.api.PlatformDirsABC.use_site_for_root>`.
71 :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, # noqa: FBT001, FBT002
88 ensure_exists: bool = False, # noqa: FBT001, FBT002
89) -> str:
90 """
91 :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
92 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
93 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
94 :param multipath: See `multipath <platformdirs.api.PlatformDirsABC.multipath>`.
95 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
96 :returns: data directory shared by users
97 """
98 return PlatformDirs(
99 appname=appname,
100 appauthor=appauthor,
101 version=version,
102 multipath=multipath,
103 ensure_exists=ensure_exists,
104 ).site_data_dir
107def user_config_dir( # noqa: PLR0913, PLR0917
108 appname: str | None = None,
109 appauthor: str | Literal[False] | None = None,
110 version: str | None = None,
111 roaming: bool = False, # noqa: FBT001, FBT002
112 ensure_exists: bool = False, # noqa: FBT001, FBT002
113 use_site_for_root: bool = False, # noqa: FBT001, FBT002
114) -> str:
115 """
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>`.
122 :returns: config directory tied to the user
123 """
124 return PlatformDirs(
125 appname=appname,
126 appauthor=appauthor,
127 version=version,
128 roaming=roaming,
129 ensure_exists=ensure_exists,
130 use_site_for_root=use_site_for_root,
131 ).user_config_dir
134def site_config_dir(
135 appname: str | None = None,
136 appauthor: str | Literal[False] | None = None,
137 version: str | None = None,
138 multipath: bool = False, # noqa: FBT001, FBT002
139 ensure_exists: bool = False, # noqa: FBT001, FBT002
140) -> str:
141 """
142 :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
143 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
144 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
145 :param multipath: See `multipath <platformdirs.api.PlatformDirsABC.multipath>`.
146 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
147 :returns: config directory shared by users
148 """
149 return PlatformDirs(
150 appname=appname,
151 appauthor=appauthor,
152 version=version,
153 multipath=multipath,
154 ensure_exists=ensure_exists,
155 ).site_config_dir
158def user_cache_dir( # noqa: PLR0913, PLR0917
159 appname: str | None = None,
160 appauthor: str | Literal[False] | None = None,
161 version: str | None = None,
162 opinion: bool = True, # noqa: FBT001, FBT002
163 ensure_exists: bool = False, # noqa: FBT001, FBT002
164 use_site_for_root: bool = False, # noqa: FBT001, FBT002
165) -> str:
166 """
167 :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
168 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
169 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
170 :param opinion: See `opinion <platformdirs.api.PlatformDirsABC.opinion>`.
171 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
172 :param use_site_for_root: See `use_site_for_root <platformdirs.api.PlatformDirsABC.use_site_for_root>`.
173 :returns: cache directory tied to the user
174 """
175 return PlatformDirs(
176 appname=appname,
177 appauthor=appauthor,
178 version=version,
179 opinion=opinion,
180 ensure_exists=ensure_exists,
181 use_site_for_root=use_site_for_root,
182 ).user_cache_dir
185def site_cache_dir(
186 appname: str | None = None,
187 appauthor: str | Literal[False] | None = None,
188 version: str | None = None,
189 opinion: bool = True, # noqa: FBT001, FBT002
190 ensure_exists: bool = False, # noqa: FBT001, FBT002
191) -> str:
192 """
193 :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
194 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
195 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
196 :param opinion: See `opinion <platformdirs.api.PlatformDirsABC.opinion>`.
197 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
198 :returns: cache directory shared by users
199 """
200 return PlatformDirs(
201 appname=appname,
202 appauthor=appauthor,
203 version=version,
204 opinion=opinion,
205 ensure_exists=ensure_exists,
206 ).site_cache_dir
209def user_state_dir( # noqa: PLR0913, PLR0917
210 appname: str | None = None,
211 appauthor: str | Literal[False] | None = None,
212 version: str | None = None,
213 roaming: bool = False, # noqa: FBT001, FBT002
214 ensure_exists: bool = False, # noqa: FBT001, FBT002
215 use_site_for_root: bool = False, # noqa: FBT001, FBT002
216) -> str:
217 """
218 :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
219 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
220 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
221 :param roaming: See `roaming <platformdirs.api.PlatformDirsABC.roaming>`.
222 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
223 :param use_site_for_root: See `use_site_for_root <platformdirs.api.PlatformDirsABC.use_site_for_root>`.
224 :returns: state directory tied to the user
225 """
226 return PlatformDirs(
227 appname=appname,
228 appauthor=appauthor,
229 version=version,
230 roaming=roaming,
231 ensure_exists=ensure_exists,
232 use_site_for_root=use_site_for_root,
233 ).user_state_dir
236def site_state_dir(
237 appname: str | None = None,
238 appauthor: str | Literal[False] | None = None,
239 version: str | None = None,
240 ensure_exists: bool = False, # noqa: FBT001, FBT002
241) -> str:
242 """
243 :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
244 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
245 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
246 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
247 :returns: state directory shared by users
248 """
249 return PlatformDirs(
250 appname=appname,
251 appauthor=appauthor,
252 version=version,
253 ensure_exists=ensure_exists,
254 ).site_state_dir
257def user_log_dir( # noqa: PLR0913, PLR0917
258 appname: str | None = None,
259 appauthor: str | Literal[False] | None = None,
260 version: str | None = None,
261 opinion: bool = True, # noqa: FBT001, FBT002
262 ensure_exists: bool = False, # noqa: FBT001, FBT002
263 use_site_for_root: bool = False, # noqa: FBT001, FBT002
264) -> str:
265 """
266 :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
267 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
268 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
269 :param opinion: See `opinion <platformdirs.api.PlatformDirsABC.opinion>`.
270 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
271 :param use_site_for_root: See `use_site_for_root <platformdirs.api.PlatformDirsABC.use_site_for_root>`.
272 :returns: log directory tied to the user
273 """
274 return PlatformDirs(
275 appname=appname,
276 appauthor=appauthor,
277 version=version,
278 opinion=opinion,
279 ensure_exists=ensure_exists,
280 use_site_for_root=use_site_for_root,
281 ).user_log_dir
284def site_log_dir(
285 appname: str | None = None,
286 appauthor: str | Literal[False] | None = None,
287 version: str | None = None,
288 opinion: bool = True, # noqa: FBT001, FBT002
289 ensure_exists: bool = False, # noqa: FBT001, FBT002
290) -> str:
291 """
292 :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
293 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
294 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
295 :param opinion: See `opinion <platformdirs.api.PlatformDirsABC.opinion>`.
296 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
297 :returns: log directory shared by users
298 """
299 return PlatformDirs(
300 appname=appname,
301 appauthor=appauthor,
302 version=version,
303 opinion=opinion,
304 ensure_exists=ensure_exists,
305 ).site_log_dir
308def user_documents_dir() -> str:
309 """:returns: documents directory tied to the user"""
310 return PlatformDirs().user_documents_dir
313def user_downloads_dir() -> str:
314 """:returns: downloads directory tied to the user"""
315 return PlatformDirs().user_downloads_dir
318def user_pictures_dir() -> str:
319 """:returns: pictures directory tied to the user"""
320 return PlatformDirs().user_pictures_dir
323def user_videos_dir() -> str:
324 """:returns: videos directory tied to the user"""
325 return PlatformDirs().user_videos_dir
328def user_music_dir() -> str:
329 """:returns: music directory tied to the user"""
330 return PlatformDirs().user_music_dir
333def user_desktop_dir() -> str:
334 """:returns: desktop directory tied to the user"""
335 return PlatformDirs().user_desktop_dir
338def user_bin_dir() -> str:
339 """:returns: bin directory tied to the user"""
340 return PlatformDirs().user_bin_dir
343def user_applications_dir() -> str:
344 """:returns: applications directory tied to the user"""
345 return PlatformDirs().user_applications_dir
348def user_runtime_dir( # noqa: PLR0913, PLR0917
349 appname: str | None = None,
350 appauthor: str | Literal[False] | None = None,
351 version: str | None = None,
352 opinion: bool = True, # noqa: FBT001, FBT002
353 ensure_exists: bool = False, # noqa: FBT001, FBT002
354 use_site_for_root: bool = False, # noqa: FBT001, FBT002
355) -> str:
356 """
357 :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
358 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
359 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
360 :param opinion: See `opinion <platformdirs.api.PlatformDirsABC.opinion>`.
361 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
362 :param use_site_for_root: See `use_site_for_root <platformdirs.api.PlatformDirsABC.use_site_for_root>`.
363 :returns: runtime directory tied to the user
364 """
365 return PlatformDirs(
366 appname=appname,
367 appauthor=appauthor,
368 version=version,
369 opinion=opinion,
370 ensure_exists=ensure_exists,
371 use_site_for_root=use_site_for_root,
372 ).user_runtime_dir
375def site_runtime_dir(
376 appname: str | None = None,
377 appauthor: str | Literal[False] | None = None,
378 version: str | None = None,
379 opinion: bool = True, # noqa: FBT001, FBT002
380 ensure_exists: bool = False, # noqa: FBT001, FBT002
381) -> str:
382 """
383 :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
384 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
385 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
386 :param opinion: See `opinion <platformdirs.api.PlatformDirsABC.opinion>`.
387 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
388 :returns: runtime directory shared by users
389 """
390 return PlatformDirs(
391 appname=appname,
392 appauthor=appauthor,
393 version=version,
394 opinion=opinion,
395 ensure_exists=ensure_exists,
396 ).site_runtime_dir
399def user_data_path( # noqa: PLR0913, PLR0917
400 appname: str | None = None,
401 appauthor: str | Literal[False] | None = None,
402 version: str | None = None,
403 roaming: bool = False, # noqa: FBT001, FBT002
404 ensure_exists: bool = False, # noqa: FBT001, FBT002
405 use_site_for_root: bool = False, # noqa: FBT001, FBT002
406) -> Path:
407 """
408 :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
409 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
410 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
411 :param roaming: See `roaming <platformdirs.api.PlatformDirsABC.roaming>`.
412 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
413 :param use_site_for_root: See `use_site_for_root <platformdirs.api.PlatformDirsABC.use_site_for_root>`.
414 :returns: data path tied to the user
415 """
416 return PlatformDirs(
417 appname=appname,
418 appauthor=appauthor,
419 version=version,
420 roaming=roaming,
421 ensure_exists=ensure_exists,
422 use_site_for_root=use_site_for_root,
423 ).user_data_path
426def site_data_path(
427 appname: str | None = None,
428 appauthor: str | Literal[False] | None = None,
429 version: str | None = None,
430 multipath: bool = False, # noqa: FBT001, FBT002
431 ensure_exists: bool = False, # noqa: FBT001, FBT002
432) -> Path:
433 """
434 :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
435 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
436 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
437 :param multipath: See `multipath <platformdirs.api.PlatformDirsABC.multipath>`.
438 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
439 :returns: data path shared by users
440 """
441 return PlatformDirs(
442 appname=appname,
443 appauthor=appauthor,
444 version=version,
445 multipath=multipath,
446 ensure_exists=ensure_exists,
447 ).site_data_path
450def user_config_path( # noqa: PLR0913, PLR0917
451 appname: str | None = None,
452 appauthor: str | Literal[False] | None = None,
453 version: str | None = None,
454 roaming: bool = False, # noqa: FBT001, FBT002
455 ensure_exists: bool = False, # noqa: FBT001, FBT002
456 use_site_for_root: bool = False, # noqa: FBT001, FBT002
457) -> Path:
458 """
459 :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
460 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
461 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
462 :param roaming: See `roaming <platformdirs.api.PlatformDirsABC.roaming>`.
463 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
464 :param use_site_for_root: See `use_site_for_root <platformdirs.api.PlatformDirsABC.use_site_for_root>`.
465 :returns: config path tied to the user
466 """
467 return PlatformDirs(
468 appname=appname,
469 appauthor=appauthor,
470 version=version,
471 roaming=roaming,
472 ensure_exists=ensure_exists,
473 use_site_for_root=use_site_for_root,
474 ).user_config_path
477def site_config_path(
478 appname: str | None = None,
479 appauthor: str | Literal[False] | None = None,
480 version: str | None = None,
481 multipath: bool = False, # noqa: FBT001, FBT002
482 ensure_exists: bool = False, # noqa: FBT001, FBT002
483) -> Path:
484 """
485 :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
486 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
487 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
488 :param multipath: See `multipath <platformdirs.api.PlatformDirsABC.multipath>`.
489 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
490 :returns: config path shared by users
491 """
492 return PlatformDirs(
493 appname=appname,
494 appauthor=appauthor,
495 version=version,
496 multipath=multipath,
497 ensure_exists=ensure_exists,
498 ).site_config_path
501def site_cache_path(
502 appname: str | None = None,
503 appauthor: str | Literal[False] | None = None,
504 version: str | None = None,
505 opinion: bool = True, # noqa: FBT001, FBT002
506 ensure_exists: bool = False, # noqa: FBT001, FBT002
507) -> Path:
508 """
509 :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
510 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
511 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
512 :param opinion: See `opinion <platformdirs.api.PlatformDirsABC.opinion>`.
513 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
514 :returns: cache path shared by users
515 """
516 return PlatformDirs(
517 appname=appname,
518 appauthor=appauthor,
519 version=version,
520 opinion=opinion,
521 ensure_exists=ensure_exists,
522 ).site_cache_path
525def user_cache_path( # noqa: PLR0913, PLR0917
526 appname: str | None = None,
527 appauthor: str | Literal[False] | None = None,
528 version: str | None = None,
529 opinion: bool = True, # noqa: FBT001, FBT002
530 ensure_exists: bool = False, # noqa: FBT001, FBT002
531 use_site_for_root: bool = False, # noqa: FBT001, FBT002
532) -> Path:
533 """
534 :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
535 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
536 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
537 :param opinion: See `opinion <platformdirs.api.PlatformDirsABC.opinion>`.
538 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
539 :param use_site_for_root: See `use_site_for_root <platformdirs.api.PlatformDirsABC.use_site_for_root>`.
540 :returns: cache path tied to the user
541 """
542 return PlatformDirs(
543 appname=appname,
544 appauthor=appauthor,
545 version=version,
546 opinion=opinion,
547 ensure_exists=ensure_exists,
548 use_site_for_root=use_site_for_root,
549 ).user_cache_path
552def user_state_path( # noqa: PLR0913, PLR0917
553 appname: str | None = None,
554 appauthor: str | Literal[False] | None = None,
555 version: str | None = None,
556 roaming: bool = False, # noqa: FBT001, FBT002
557 ensure_exists: bool = False, # noqa: FBT001, FBT002
558 use_site_for_root: bool = False, # noqa: FBT001, FBT002
559) -> Path:
560 """
561 :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
562 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
563 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
564 :param roaming: See `roaming <platformdirs.api.PlatformDirsABC.roaming>`.
565 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
566 :param use_site_for_root: See `use_site_for_root <platformdirs.api.PlatformDirsABC.use_site_for_root>`.
567 :returns: state path tied to the user
568 """
569 return PlatformDirs(
570 appname=appname,
571 appauthor=appauthor,
572 version=version,
573 roaming=roaming,
574 ensure_exists=ensure_exists,
575 use_site_for_root=use_site_for_root,
576 ).user_state_path
579def site_state_path(
580 appname: str | None = None,
581 appauthor: str | Literal[False] | None = None,
582 version: str | None = None,
583 ensure_exists: bool = False, # noqa: FBT001, FBT002
584) -> Path:
585 """
586 :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
587 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
588 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
589 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
590 :returns: state path shared by users
591 """
592 return PlatformDirs(
593 appname=appname,
594 appauthor=appauthor,
595 version=version,
596 ensure_exists=ensure_exists,
597 ).site_state_path
600def user_log_path( # noqa: PLR0913, PLR0917
601 appname: str | None = None,
602 appauthor: str | Literal[False] | None = None,
603 version: str | None = None,
604 opinion: bool = True, # noqa: FBT001, FBT002
605 ensure_exists: bool = False, # noqa: FBT001, FBT002
606 use_site_for_root: bool = False, # noqa: FBT001, FBT002
607) -> Path:
608 """
609 :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
610 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
611 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
612 :param opinion: See `opinion <platformdirs.api.PlatformDirsABC.opinion>`.
613 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
614 :param use_site_for_root: See `use_site_for_root <platformdirs.api.PlatformDirsABC.use_site_for_root>`.
615 :returns: log path tied to the user
616 """
617 return PlatformDirs(
618 appname=appname,
619 appauthor=appauthor,
620 version=version,
621 opinion=opinion,
622 ensure_exists=ensure_exists,
623 use_site_for_root=use_site_for_root,
624 ).user_log_path
627def site_log_path(
628 appname: str | None = None,
629 appauthor: str | Literal[False] | None = None,
630 version: str | None = None,
631 opinion: bool = True, # noqa: FBT001, FBT002
632 ensure_exists: bool = False, # noqa: FBT001, FBT002
633) -> Path:
634 """
635 :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
636 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
637 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
638 :param opinion: See `opinion <platformdirs.api.PlatformDirsABC.opinion>`.
639 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
640 :returns: log path shared by users
641 """
642 return PlatformDirs(
643 appname=appname,
644 appauthor=appauthor,
645 version=version,
646 opinion=opinion,
647 ensure_exists=ensure_exists,
648 ).site_log_path
651def user_documents_path() -> Path:
652 """:returns: documents path tied to the user"""
653 return PlatformDirs().user_documents_path
656def user_downloads_path() -> Path:
657 """:returns: downloads path tied to the user"""
658 return PlatformDirs().user_downloads_path
661def user_pictures_path() -> Path:
662 """:returns: pictures path tied to the user"""
663 return PlatformDirs().user_pictures_path
666def user_videos_path() -> Path:
667 """:returns: videos path tied to the user"""
668 return PlatformDirs().user_videos_path
671def user_music_path() -> Path:
672 """:returns: music path tied to the user"""
673 return PlatformDirs().user_music_path
676def user_desktop_path() -> Path:
677 """:returns: desktop path tied to the user"""
678 return PlatformDirs().user_desktop_path
681def user_bin_path() -> Path:
682 """:returns: bin path tied to the user"""
683 return PlatformDirs().user_bin_path
686def user_applications_path() -> Path:
687 """:returns: applications path tied to the user"""
688 return PlatformDirs().user_applications_path
691def user_runtime_path( # noqa: PLR0913, PLR0917
692 appname: str | None = None,
693 appauthor: str | Literal[False] | None = None,
694 version: str | None = None,
695 opinion: bool = True, # noqa: FBT001, FBT002
696 ensure_exists: bool = False, # noqa: FBT001, FBT002
697 use_site_for_root: bool = False, # noqa: FBT001, FBT002
698) -> Path:
699 """
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>`.
705 :param use_site_for_root: See `use_site_for_root <platformdirs.api.PlatformDirsABC.use_site_for_root>`.
706 :returns: runtime path tied to the user
707 """
708 return PlatformDirs(
709 appname=appname,
710 appauthor=appauthor,
711 version=version,
712 opinion=opinion,
713 ensure_exists=ensure_exists,
714 use_site_for_root=use_site_for_root,
715 ).user_runtime_path
718def site_runtime_path(
719 appname: str | None = None,
720 appauthor: str | Literal[False] | None = None,
721 version: str | None = None,
722 opinion: bool = True, # noqa: FBT001, FBT002
723 ensure_exists: bool = False, # noqa: FBT001, FBT002
724) -> Path:
725 """
726 :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
727 :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
728 :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
729 :param opinion: See `opinion <platformdirs.api.PlatformDirsABC.opinion>`.
730 :param ensure_exists: See `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
731 :returns: runtime path shared by users
732 """
733 return PlatformDirs(
734 appname=appname,
735 appauthor=appauthor,
736 version=version,
737 opinion=opinion,
738 ensure_exists=ensure_exists,
739 ).site_runtime_path
742__all__ = [
743 "AppDirs",
744 "PlatformDirs",
745 "PlatformDirsABC",
746 "__version__",
747 "__version_info__",
748 "site_cache_dir",
749 "site_cache_path",
750 "site_config_dir",
751 "site_config_path",
752 "site_data_dir",
753 "site_data_path",
754 "site_log_dir",
755 "site_log_path",
756 "site_runtime_dir",
757 "site_runtime_path",
758 "site_state_dir",
759 "site_state_path",
760 "user_applications_dir",
761 "user_applications_path",
762 "user_bin_dir",
763 "user_bin_path",
764 "user_cache_dir",
765 "user_cache_path",
766 "user_config_dir",
767 "user_config_path",
768 "user_data_dir",
769 "user_data_path",
770 "user_desktop_dir",
771 "user_desktop_path",
772 "user_documents_dir",
773 "user_documents_path",
774 "user_downloads_dir",
775 "user_downloads_path",
776 "user_log_dir",
777 "user_log_path",
778 "user_music_dir",
779 "user_music_path",
780 "user_pictures_dir",
781 "user_pictures_path",
782 "user_runtime_dir",
783 "user_runtime_path",
784 "user_state_dir",
785 "user_state_path",
786 "user_videos_dir",
787 "user_videos_path",
788]