]> crepu.dev Git - config.git/blame_incremental - djavu-asus/elpy/rpc-venv/lib/python3.11/site-packages/platformdirs/macos.py
Archivo de configuraciĆ³n de la terminal
[config.git] / djavu-asus / elpy / rpc-venv / lib / python3.11 / site-packages / platformdirs / macos.py
... / ...
CommitLineData
1"""macOS."""
2from __future__ import annotations
3
4import os.path
5import sys
6
7from .api import PlatformDirsABC
8
9
10class MacOS(PlatformDirsABC):
11 """
12 Platform directories for the macOS operating system. Follows the guidance from `Apple documentation
13 <https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/MacOSXDirectories/MacOSXDirectories.html>`_.
14 Makes use of the `appname <platformdirs.api.PlatformDirsABC.appname>`,
15 `version <platformdirs.api.PlatformDirsABC.version>`,
16 `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
17 """
18
19 @property
20 def user_data_dir(self) -> str:
21 """:return: data directory tied to the user, e.g. ``~/Library/Application Support/$appname/$version``"""
22 return self._append_app_name_and_version(os.path.expanduser("~/Library/Application Support")) # noqa: PTH111
23
24 @property
25 def site_data_dir(self) -> str:
26 """
27 :return: data directory shared by users, e.g. ``/Library/Application Support/$appname/$version``.
28 If we're using a Python binary managed by `Homebrew <https://brew.sh>`_, the directory
29 will be under the Homebrew prefix, e.g. ``/opt/homebrew/share/$appname/$version``.
30 If `multipath <platformdirs.api.PlatformDirsABC.multipath>` is enabled and we're in Homebrew,
31 the response is a multi-path string separated by ":", e.g.
32 ``/opt/homebrew/share/$appname/$version:/Library/Application Support/$appname/$version``
33 """
34 is_homebrew = sys.prefix.startswith("/opt/homebrew")
35 path_list = [self._append_app_name_and_version("/opt/homebrew/share")] if is_homebrew else []
36 path_list.append(self._append_app_name_and_version("/Library/Application Support"))
37 if self.multipath:
38 return os.pathsep.join(path_list)
39 return path_list[0]
40
41 @property
42 def user_config_dir(self) -> str:
43 """:return: config directory tied to the user, same as `user_data_dir`"""
44 return self.user_data_dir
45
46 @property
47 def site_config_dir(self) -> str:
48 """:return: config directory shared by the users, same as `site_data_dir`"""
49 return self.site_data_dir
50
51 @property
52 def user_cache_dir(self) -> str:
53 """:return: cache directory tied to the user, e.g. ``~/Library/Caches/$appname/$version``"""
54 return self._append_app_name_and_version(os.path.expanduser("~/Library/Caches")) # noqa: PTH111
55
56 @property
57 def site_cache_dir(self) -> str:
58 """
59 :return: cache directory shared by users, e.g. ``/Library/Caches/$appname/$version``.
60 If we're using a Python binary managed by `Homebrew <https://brew.sh>`_, the directory
61 will be under the Homebrew prefix, e.g. ``/opt/homebrew/var/cache/$appname/$version``.
62 If `multipath <platformdirs.api.PlatformDirsABC.multipath>` is enabled and we're in Homebrew,
63 the response is a multi-path string separated by ":", e.g.
64 ``/opt/homebrew/var/cache/$appname/$version:/Library/Caches/$appname/$version``
65 """
66 is_homebrew = sys.prefix.startswith("/opt/homebrew")
67 path_list = [self._append_app_name_and_version("/opt/homebrew/var/cache")] if is_homebrew else []
68 path_list.append(self._append_app_name_and_version("/Library/Caches"))
69 if self.multipath:
70 return os.pathsep.join(path_list)
71 return path_list[0]
72
73 @property
74 def user_state_dir(self) -> str:
75 """:return: state directory tied to the user, same as `user_data_dir`"""
76 return self.user_data_dir
77
78 @property
79 def user_log_dir(self) -> str:
80 """:return: log directory tied to the user, e.g. ``~/Library/Logs/$appname/$version``"""
81 return self._append_app_name_and_version(os.path.expanduser("~/Library/Logs")) # noqa: PTH111
82
83 @property
84 def user_documents_dir(self) -> str:
85 """:return: documents directory tied to the user, e.g. ``~/Documents``"""
86 return os.path.expanduser("~/Documents") # noqa: PTH111
87
88 @property
89 def user_downloads_dir(self) -> str:
90 """:return: downloads directory tied to the user, e.g. ``~/Downloads``"""
91 return os.path.expanduser("~/Downloads") # noqa: PTH111
92
93 @property
94 def user_pictures_dir(self) -> str:
95 """:return: pictures directory tied to the user, e.g. ``~/Pictures``"""
96 return os.path.expanduser("~/Pictures") # noqa: PTH111
97
98 @property
99 def user_videos_dir(self) -> str:
100 """:return: videos directory tied to the user, e.g. ``~/Movies``"""
101 return os.path.expanduser("~/Movies") # noqa: PTH111
102
103 @property
104 def user_music_dir(self) -> str:
105 """:return: music directory tied to the user, e.g. ``~/Music``"""
106 return os.path.expanduser("~/Music") # noqa: PTH111
107
108 @property
109 def user_desktop_dir(self) -> str:
110 """:return: desktop directory tied to the user, e.g. ``~/Desktop``"""
111 return os.path.expanduser("~/Desktop") # noqa: PTH111
112
113 @property
114 def user_runtime_dir(self) -> str:
115 """:return: runtime directory tied to the user, e.g. ``~/Library/Caches/TemporaryItems/$appname/$version``"""
116 return self._append_app_name_and_version(os.path.expanduser("~/Library/Caches/TemporaryItems")) # noqa: PTH111
117
118 @property
119 def site_runtime_dir(self) -> str:
120 """:return: runtime directory shared by users, same as `user_runtime_dir`"""
121 return self.user_runtime_dir
122
123
124__all__ = [
125 "MacOS",
126]