6
6
7
7
import os
8
8
import sys
9
- from pathlib import Path
10
-
11
- if sys .version_info >= (3 , 8 ): # pragma: no cover (py38+)
12
- from typing import Literal
13
- else : # pragma: no cover (py38+)
14
- from pip ._vendor .typing_extensions import Literal
9
+ from typing import TYPE_CHECKING
15
10
16
11
from .api import PlatformDirsABC
17
12
from .version import __version__
18
13
from .version import __version_tuple__ as __version_info__
19
14
15
+ if TYPE_CHECKING :
16
+ from pathlib import Path
17
+
18
+ if sys .version_info >= (3 , 8 ): # pragma: no cover (py38+)
19
+ from typing import Literal
20
+ else : # pragma: no cover (py38+)
21
+ from pip ._vendor .typing_extensions import Literal
22
+
20
23
21
24
def _set_platform_dir_class () -> type [PlatformDirsABC ]:
22
25
if sys .platform == "win32" :
@@ -48,8 +51,8 @@ def user_data_dir(
48
51
appname : str | None = None ,
49
52
appauthor : str | None | Literal [False ] = None ,
50
53
version : str | None = None ,
51
- roaming : bool = False ,
52
- ensure_exists : bool = False ,
54
+ roaming : bool = False , # noqa: FBT001, FBT002
55
+ ensure_exists : bool = False , # noqa: FBT001, FBT002
53
56
) -> str :
54
57
"""
55
58
:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
@@ -72,8 +75,8 @@ def site_data_dir(
72
75
appname : str | None = None ,
73
76
appauthor : str | None | Literal [False ] = None ,
74
77
version : str | None = None ,
75
- multipath : bool = False ,
76
- ensure_exists : bool = False ,
78
+ multipath : bool = False , # noqa: FBT001, FBT002
79
+ ensure_exists : bool = False , # noqa: FBT001, FBT002
77
80
) -> str :
78
81
"""
79
82
:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
@@ -96,8 +99,8 @@ def user_config_dir(
96
99
appname : str | None = None ,
97
100
appauthor : str | None | Literal [False ] = None ,
98
101
version : str | None = None ,
99
- roaming : bool = False ,
100
- ensure_exists : bool = False ,
102
+ roaming : bool = False , # noqa: FBT001, FBT002
103
+ ensure_exists : bool = False , # noqa: FBT001, FBT002
101
104
) -> str :
102
105
"""
103
106
:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
@@ -120,8 +123,8 @@ def site_config_dir(
120
123
appname : str | None = None ,
121
124
appauthor : str | None | Literal [False ] = None ,
122
125
version : str | None = None ,
123
- multipath : bool = False ,
124
- ensure_exists : bool = False ,
126
+ multipath : bool = False , # noqa: FBT001, FBT002
127
+ ensure_exists : bool = False , # noqa: FBT001, FBT002
125
128
) -> str :
126
129
"""
127
130
:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
@@ -144,8 +147,8 @@ def user_cache_dir(
144
147
appname : str | None = None ,
145
148
appauthor : str | None | Literal [False ] = None ,
146
149
version : str | None = None ,
147
- opinion : bool = True ,
148
- ensure_exists : bool = False ,
150
+ opinion : bool = True , # noqa: FBT001, FBT002
151
+ ensure_exists : bool = False , # noqa: FBT001, FBT002
149
152
) -> str :
150
153
"""
151
154
:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
@@ -168,8 +171,8 @@ def site_cache_dir(
168
171
appname : str | None = None ,
169
172
appauthor : str | None | Literal [False ] = None ,
170
173
version : str | None = None ,
171
- opinion : bool = True ,
172
- ensure_exists : bool = False ,
174
+ opinion : bool = True , # noqa: FBT001, FBT002
175
+ ensure_exists : bool = False , # noqa: FBT001, FBT002
173
176
) -> str :
174
177
"""
175
178
:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
@@ -192,8 +195,8 @@ def user_state_dir(
192
195
appname : str | None = None ,
193
196
appauthor : str | None | Literal [False ] = None ,
194
197
version : str | None = None ,
195
- roaming : bool = False ,
196
- ensure_exists : bool = False ,
198
+ roaming : bool = False , # noqa: FBT001, FBT002
199
+ ensure_exists : bool = False , # noqa: FBT001, FBT002
197
200
) -> str :
198
201
"""
199
202
:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
@@ -216,8 +219,8 @@ def user_log_dir(
216
219
appname : str | None = None ,
217
220
appauthor : str | None | Literal [False ] = None ,
218
221
version : str | None = None ,
219
- opinion : bool = True ,
220
- ensure_exists : bool = False ,
222
+ opinion : bool = True , # noqa: FBT001, FBT002
223
+ ensure_exists : bool = False , # noqa: FBT001, FBT002
221
224
) -> str :
222
225
"""
223
226
:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
@@ -237,18 +240,36 @@ def user_log_dir(
237
240
238
241
239
242
def user_documents_dir () -> str :
240
- """
241
- :returns: documents directory tied to the user
242
- """
243
+ """:returns: documents directory tied to the user"""
243
244
return PlatformDirs ().user_documents_dir
244
245
245
246
247
+ def user_downloads_dir () -> str :
248
+ """:returns: downloads directory tied to the user"""
249
+ return PlatformDirs ().user_downloads_dir
250
+
251
+
252
+ def user_pictures_dir () -> str :
253
+ """:returns: pictures directory tied to the user"""
254
+ return PlatformDirs ().user_pictures_dir
255
+
256
+
257
+ def user_videos_dir () -> str :
258
+ """:returns: videos directory tied to the user"""
259
+ return PlatformDirs ().user_videos_dir
260
+
261
+
262
+ def user_music_dir () -> str :
263
+ """:returns: music directory tied to the user"""
264
+ return PlatformDirs ().user_music_dir
265
+
266
+
246
267
def user_runtime_dir (
247
268
appname : str | None = None ,
248
269
appauthor : str | None | Literal [False ] = None ,
249
270
version : str | None = None ,
250
- opinion : bool = True ,
251
- ensure_exists : bool = False ,
271
+ opinion : bool = True , # noqa: FBT001, FBT002
272
+ ensure_exists : bool = False , # noqa: FBT001, FBT002
252
273
) -> str :
253
274
"""
254
275
:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
@@ -271,8 +292,8 @@ def user_data_path(
271
292
appname : str | None = None ,
272
293
appauthor : str | None | Literal [False ] = None ,
273
294
version : str | None = None ,
274
- roaming : bool = False ,
275
- ensure_exists : bool = False ,
295
+ roaming : bool = False , # noqa: FBT001, FBT002
296
+ ensure_exists : bool = False , # noqa: FBT001, FBT002
276
297
) -> Path :
277
298
"""
278
299
:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
@@ -295,8 +316,8 @@ def site_data_path(
295
316
appname : str | None = None ,
296
317
appauthor : str | None | Literal [False ] = None ,
297
318
version : str | None = None ,
298
- multipath : bool = False ,
299
- ensure_exists : bool = False ,
319
+ multipath : bool = False , # noqa: FBT001, FBT002
320
+ ensure_exists : bool = False , # noqa: FBT001, FBT002
300
321
) -> Path :
301
322
"""
302
323
:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
@@ -319,8 +340,8 @@ def user_config_path(
319
340
appname : str | None = None ,
320
341
appauthor : str | None | Literal [False ] = None ,
321
342
version : str | None = None ,
322
- roaming : bool = False ,
323
- ensure_exists : bool = False ,
343
+ roaming : bool = False , # noqa: FBT001, FBT002
344
+ ensure_exists : bool = False , # noqa: FBT001, FBT002
324
345
) -> Path :
325
346
"""
326
347
:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
@@ -343,8 +364,8 @@ def site_config_path(
343
364
appname : str | None = None ,
344
365
appauthor : str | None | Literal [False ] = None ,
345
366
version : str | None = None ,
346
- multipath : bool = False ,
347
- ensure_exists : bool = False ,
367
+ multipath : bool = False , # noqa: FBT001, FBT002
368
+ ensure_exists : bool = False , # noqa: FBT001, FBT002
348
369
) -> Path :
349
370
"""
350
371
:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
@@ -367,8 +388,8 @@ def site_cache_path(
367
388
appname : str | None = None ,
368
389
appauthor : str | None | Literal [False ] = None ,
369
390
version : str | None = None ,
370
- opinion : bool = True ,
371
- ensure_exists : bool = False ,
391
+ opinion : bool = True , # noqa: FBT001, FBT002
392
+ ensure_exists : bool = False , # noqa: FBT001, FBT002
372
393
) -> Path :
373
394
"""
374
395
:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
@@ -391,8 +412,8 @@ def user_cache_path(
391
412
appname : str | None = None ,
392
413
appauthor : str | None | Literal [False ] = None ,
393
414
version : str | None = None ,
394
- opinion : bool = True ,
395
- ensure_exists : bool = False ,
415
+ opinion : bool = True , # noqa: FBT001, FBT002
416
+ ensure_exists : bool = False , # noqa: FBT001, FBT002
396
417
) -> Path :
397
418
"""
398
419
:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
@@ -415,8 +436,8 @@ def user_state_path(
415
436
appname : str | None = None ,
416
437
appauthor : str | None | Literal [False ] = None ,
417
438
version : str | None = None ,
418
- roaming : bool = False ,
419
- ensure_exists : bool = False ,
439
+ roaming : bool = False , # noqa: FBT001, FBT002
440
+ ensure_exists : bool = False , # noqa: FBT001, FBT002
420
441
) -> Path :
421
442
"""
422
443
:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
@@ -439,8 +460,8 @@ def user_log_path(
439
460
appname : str | None = None ,
440
461
appauthor : str | None | Literal [False ] = None ,
441
462
version : str | None = None ,
442
- opinion : bool = True ,
443
- ensure_exists : bool = False ,
463
+ opinion : bool = True , # noqa: FBT001, FBT002
464
+ ensure_exists : bool = False , # noqa: FBT001, FBT002
444
465
) -> Path :
445
466
"""
446
467
:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
@@ -460,18 +481,36 @@ def user_log_path(
460
481
461
482
462
483
def user_documents_path () -> Path :
463
- """
464
- :returns: documents path tied to the user
465
- """
484
+ """:returns: documents path tied to the user"""
466
485
return PlatformDirs ().user_documents_path
467
486
468
487
488
+ def user_downloads_path () -> Path :
489
+ """:returns: downloads path tied to the user"""
490
+ return PlatformDirs ().user_downloads_path
491
+
492
+
493
+ def user_pictures_path () -> Path :
494
+ """:returns: pictures path tied to the user"""
495
+ return PlatformDirs ().user_pictures_path
496
+
497
+
498
+ def user_videos_path () -> Path :
499
+ """:returns: videos path tied to the user"""
500
+ return PlatformDirs ().user_videos_path
501
+
502
+
503
+ def user_music_path () -> Path :
504
+ """:returns: music path tied to the user"""
505
+ return PlatformDirs ().user_music_path
506
+
507
+
469
508
def user_runtime_path (
470
509
appname : str | None = None ,
471
510
appauthor : str | None | Literal [False ] = None ,
472
511
version : str | None = None ,
473
- opinion : bool = True ,
474
- ensure_exists : bool = False ,
512
+ opinion : bool = True , # noqa: FBT001, FBT002
513
+ ensure_exists : bool = False , # noqa: FBT001, FBT002
475
514
) -> Path :
476
515
"""
477
516
:param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
@@ -502,6 +541,10 @@ def user_runtime_path(
502
541
"user_state_dir" ,
503
542
"user_log_dir" ,
504
543
"user_documents_dir" ,
544
+ "user_downloads_dir" ,
545
+ "user_pictures_dir" ,
546
+ "user_videos_dir" ,
547
+ "user_music_dir" ,
505
548
"user_runtime_dir" ,
506
549
"site_data_dir" ,
507
550
"site_config_dir" ,
@@ -512,6 +555,10 @@ def user_runtime_path(
512
555
"user_state_path" ,
513
556
"user_log_path" ,
514
557
"user_documents_path" ,
558
+ "user_downloads_path" ,
559
+ "user_pictures_path" ,
560
+ "user_videos_path" ,
561
+ "user_music_path" ,
515
562
"user_runtime_path" ,
516
563
"site_data_path" ,
517
564
"site_config_path" ,
0 commit comments