Skip to content

Commit 9cd764c

Browse files
Make stupid linter happy
1 parent 9ea77af commit 9cd764c

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/platformdirs/android.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def site_runtime_dir(self) -> str:
117117

118118

119119
@lru_cache(maxsize=1)
120-
def _android_folder() -> str | None:
120+
def _android_folder() -> str | None: # noqa: C901, PLR0912
121121
""":return: base folder for the Android OS or None if it cannot be found"""
122122
result: str | None = None
123123
# type checker isn't happy with our "import android", just don't do this when type checking
@@ -153,7 +153,7 @@ def _android_folder() -> str | None:
153153
result = None
154154
if result is None:
155155
# one last try: find an android folder looking at path on the sys.path
156-
# taking adopted storage paths into acount
156+
# taking adopted storage paths into account
157157
pattern = re.compile(r"/mnt/expand/[a-fA-F0-9-]{36}/(data|user/\d+)/(.+)/files")
158158
for path in sys.path:
159159
if pattern.match(path):

tests/test_android.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,19 +104,19 @@ def test_android_folder_from_p4a(mocker: MockerFixture, monkeypatch: pytest.Monk
104104

105105
_android_folder.cache_clear()
106106

107-
getAbsolutePath = MagicMock(return_value="/A") # pragma: no cover
108-
getParentFile = MagicMock(getAbsolutePath=getAbsolutePath) # pragma: no cover
109-
getFilesDir = MagicMock(getParentFile=MagicMock(return_value=getParentFile)) # pragma: no cover
110-
getApplicationContext = MagicMock(getFilesDir=MagicMock(return_value=getFilesDir)) # pragma: no cover
111-
mActivity = MagicMock(getApplicationContext=MagicMock(return_value=getApplicationContext)) # pragma: no cover
112-
mocker.patch.dict(sys.modules, {"android": MagicMock(mActivity=mActivity)}) # pragma: no cover
107+
abspath = MagicMock(return_value="/A") # pragma: no cover
108+
pfile = MagicMock(getAbsolutePath=abspath) # pragma: no cover
109+
fdir = MagicMock(getParentFile=MagicMock(return_value=pfile)) # pragma: no cover
110+
appc = MagicMock(getFilesDir=MagicMock(return_value=fdir)) # pragma: no cover
111+
act = MagicMock(getApplicationContext=MagicMock(return_value=appc)) # pragma: no cover
112+
mocker.patch.dict(sys.modules, {"android": MagicMock(mActivity=act)}) # pragma: no cover
113113

114114
result = _android_folder()
115115
assert result == "/A"
116-
assert getAbsolutePath.call_count == 1
116+
assert abspath.call_count == 1
117117

118118
assert _android_folder() is result
119-
assert getAbsolutePath.call_count == 1
119+
assert abspath.call_count == 1
120120

121121

122122
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)