13
13
14
14
class Android (PlatformDirsABC ):
15
15
"""
16
- Follows the guidance `from here <https://android.stackexchange.com/a/216132>`_. Makes use of the
17
- `appname <platformdirs.api.PlatformDirsABC.appname>`,
18
- `version <platformdirs.api.PlatformDirsABC.version>`,
19
- `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
16
+ Follows the guidance `from here <https://android.stackexchange.com/a/216132>`_.
17
+
18
+ Makes use of the `appname <platformdirs.api.PlatformDirsABC.appname>`, `version
19
+ <platformdirs.api.PlatformDirsABC.version>`, `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
20
+
20
21
"""
21
22
22
23
@property
@@ -44,7 +45,7 @@ def site_config_dir(self) -> str:
44
45
45
46
@property
46
47
def user_cache_dir (self ) -> str :
47
- """:return: cache directory tied to the user, e.g. e.g. ``/data/user/<userid>/<packagename>/cache/<AppName>``"""
48
+ """:return: cache directory tied to the user, e.g., ``/data/user/<userid>/<packagename>/cache/<AppName>``"""
48
49
return self ._append_app_name_and_version (cast (str , _android_folder ()), "cache" )
49
50
50
51
@property
@@ -119,13 +120,13 @@ def site_runtime_dir(self) -> str:
119
120
def _android_folder () -> str | None :
120
121
""":return: base folder for the Android OS or None if it cannot be found"""
121
122
try :
122
- # First try to get path to android app via pyjnius
123
- from jnius import autoclass
123
+ # First try to get a path to android app via pyjnius
124
+ from jnius import autoclass # noqa: PLC0415
124
125
125
126
context = autoclass ("android.content.Context" )
126
127
result : str | None = context .getFilesDir ().getParentFile ().getAbsolutePath ()
127
128
except Exception : # noqa: BLE001
128
- # if fails find an android folder looking path on the sys.path
129
+ # if fails find an android folder looking a path on the sys.path
129
130
pattern = re .compile (r"/data/(data|user/\d+)/(.+)/files" )
130
131
for path in sys .path :
131
132
if pattern .match (path ):
@@ -141,7 +142,7 @@ def _android_documents_folder() -> str:
141
142
""":return: documents folder for the Android OS"""
142
143
# Get directories with pyjnius
143
144
try :
144
- from jnius import autoclass
145
+ from jnius import autoclass # noqa: PLC0415
145
146
146
147
context = autoclass ("android.content.Context" )
147
148
environment = autoclass ("android.os.Environment" )
@@ -157,7 +158,7 @@ def _android_downloads_folder() -> str:
157
158
""":return: downloads folder for the Android OS"""
158
159
# Get directories with pyjnius
159
160
try :
160
- from jnius import autoclass
161
+ from jnius import autoclass # noqa: PLC0415
161
162
162
163
context = autoclass ("android.content.Context" )
163
164
environment = autoclass ("android.os.Environment" )
@@ -173,7 +174,7 @@ def _android_pictures_folder() -> str:
173
174
""":return: pictures folder for the Android OS"""
174
175
# Get directories with pyjnius
175
176
try :
176
- from jnius import autoclass
177
+ from jnius import autoclass # noqa: PLC0415
177
178
178
179
context = autoclass ("android.content.Context" )
179
180
environment = autoclass ("android.os.Environment" )
@@ -189,7 +190,7 @@ def _android_videos_folder() -> str:
189
190
""":return: videos folder for the Android OS"""
190
191
# Get directories with pyjnius
191
192
try :
192
- from jnius import autoclass
193
+ from jnius import autoclass # noqa: PLC0415
193
194
194
195
context = autoclass ("android.content.Context" )
195
196
environment = autoclass ("android.os.Environment" )
@@ -205,7 +206,7 @@ def _android_music_folder() -> str:
205
206
""":return: music folder for the Android OS"""
206
207
# Get directories with pyjnius
207
208
try :
208
- from jnius import autoclass
209
+ from jnius import autoclass # noqa: PLC0415
209
210
210
211
context = autoclass ("android.content.Context" )
211
212
environment = autoclass ("android.os.Environment" )
0 commit comments