Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/pip/_vendor/platformdirs/macos.py: 0%
35 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 06:48 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 06:48 +0000
1from __future__ import annotations
3import os
5from .api import PlatformDirsABC
8class MacOS(PlatformDirsABC):
9 """
10 Platform directories for the macOS operating system. Follows the guidance from `Apple documentation
11 <https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/MacOSXDirectories/MacOSXDirectories.html>`_.
12 Makes use of the `appname <platformdirs.api.PlatformDirsABC.appname>`,
13 `version <platformdirs.api.PlatformDirsABC.version>`,
14 `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
15 """
17 @property
18 def user_data_dir(self) -> str:
19 """:return: data directory tied to the user, e.g. ``~/Library/Application Support/$appname/$version``"""
20 return self._append_app_name_and_version(os.path.expanduser("~/Library/Application Support"))
22 @property
23 def site_data_dir(self) -> str:
24 """:return: data directory shared by users, e.g. ``/Library/Application Support/$appname/$version``"""
25 return self._append_app_name_and_version("/Library/Application Support")
27 @property
28 def user_config_dir(self) -> str:
29 """:return: config directory tied to the user, same as `user_data_dir`"""
30 return self.user_data_dir
32 @property
33 def site_config_dir(self) -> str:
34 """:return: config directory shared by the users, same as `site_data_dir`"""
35 return self.site_data_dir
37 @property
38 def user_cache_dir(self) -> str:
39 """:return: cache directory tied to the user, e.g. ``~/Library/Caches/$appname/$version``"""
40 return self._append_app_name_and_version(os.path.expanduser("~/Library/Caches"))
42 @property
43 def site_cache_dir(self) -> str:
44 """:return: cache directory shared by users, e.g. ``/Library/Caches/$appname/$version``"""
45 return self._append_app_name_and_version("/Library/Caches")
47 @property
48 def user_state_dir(self) -> str:
49 """:return: state directory tied to the user, same as `user_data_dir`"""
50 return self.user_data_dir
52 @property
53 def user_log_dir(self) -> str:
54 """:return: log directory tied to the user, e.g. ``~/Library/Logs/$appname/$version``"""
55 return self._append_app_name_and_version(os.path.expanduser("~/Library/Logs"))
57 @property
58 def user_documents_dir(self) -> str:
59 """:return: documents directory tied to the user, e.g. ``~/Documents``"""
60 return os.path.expanduser("~/Documents")
62 @property
63 def user_runtime_dir(self) -> str:
64 """:return: runtime directory tied to the user, e.g. ``~/Library/Caches/TemporaryItems/$appname/$version``"""
65 return self._append_app_name_and_version(os.path.expanduser("~/Library/Caches/TemporaryItems"))
68__all__ = [
69 "MacOS",
70]