Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/platformdirs/macos.py: 0%
47 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-07-01 06:54 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2023-07-01 06:54 +0000
1"""macOS."""
2from __future__ import annotations
4import os.path
6from .api import PlatformDirsABC
9class MacOS(PlatformDirsABC):
10 """
11 Platform directories for the macOS operating system. Follows the guidance from `Apple documentation
12 <https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/MacOSXDirectories/MacOSXDirectories.html>`_.
13 Makes use of the `appname <platformdirs.api.PlatformDirsABC.appname>`,
14 `version <platformdirs.api.PlatformDirsABC.version>`,
15 `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
16 """
18 @property
19 def user_data_dir(self) -> str:
20 """:return: data directory tied to the user, e.g. ``~/Library/Application Support/$appname/$version``"""
21 return self._append_app_name_and_version(os.path.expanduser("~/Library/Application Support")) # noqa: PTH111
23 @property
24 def site_data_dir(self) -> str:
25 """:return: data directory shared by users, e.g. ``/Library/Application Support/$appname/$version``"""
26 return self._append_app_name_and_version("/Library/Application Support")
28 @property
29 def user_config_dir(self) -> str:
30 """:return: config directory tied to the user, same as `user_data_dir`"""
31 return self.user_data_dir
33 @property
34 def site_config_dir(self) -> str:
35 """:return: config directory shared by the users, same as `site_data_dir`"""
36 return self.site_data_dir
38 @property
39 def user_cache_dir(self) -> str:
40 """:return: cache directory tied to the user, e.g. ``~/Library/Caches/$appname/$version``"""
41 return self._append_app_name_and_version(os.path.expanduser("~/Library/Caches")) # noqa: PTH111
43 @property
44 def site_cache_dir(self) -> str:
45 """:return: cache directory shared by users, e.g. ``/Library/Caches/$appname/$version``"""
46 return self._append_app_name_and_version("/Library/Caches")
48 @property
49 def user_state_dir(self) -> str:
50 """:return: state directory tied to the user, same as `user_data_dir`"""
51 return self.user_data_dir
53 @property
54 def user_log_dir(self) -> str:
55 """:return: log directory tied to the user, e.g. ``~/Library/Logs/$appname/$version``"""
56 return self._append_app_name_and_version(os.path.expanduser("~/Library/Logs")) # noqa: PTH111
58 @property
59 def user_documents_dir(self) -> str:
60 """:return: documents directory tied to the user, e.g. ``~/Documents``"""
61 return os.path.expanduser("~/Documents") # noqa: PTH111
63 @property
64 def user_downloads_dir(self) -> str:
65 """:return: downloads directory tied to the user, e.g. ``~/Downloads``"""
66 return os.path.expanduser("~/Downloads") # noqa: PTH111
68 @property
69 def user_pictures_dir(self) -> str:
70 """:return: pictures directory tied to the user, e.g. ``~/Pictures``"""
71 return os.path.expanduser("~/Pictures") # noqa: PTH111
73 @property
74 def user_videos_dir(self) -> str:
75 """:return: videos directory tied to the user, e.g. ``~/Movies``"""
76 return os.path.expanduser("~/Movies") # noqa: PTH111
78 @property
79 def user_music_dir(self) -> str:
80 """:return: music directory tied to the user, e.g. ``~/Music``"""
81 return os.path.expanduser("~/Music") # noqa: PTH111
83 @property
84 def user_runtime_dir(self) -> str:
85 """:return: runtime directory tied to the user, e.g. ``~/Library/Caches/TemporaryItems/$appname/$version``"""
86 return self._append_app_name_and_version(os.path.expanduser("~/Library/Caches/TemporaryItems")) # noqa: PTH111
89__all__ = [
90 "MacOS",
91]