Skip to content

Commit 0d7604a

Browse files
authored
Small #TODO cleanups (#9284)
1 parent 925424a commit 0d7604a

File tree

3 files changed

+3
-10
lines changed

3 files changed

+3
-10
lines changed

src/poetry/masonry/builders/editable.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,7 @@ def _add_pth(self) -> list[Path]:
132132
f" {self._poetry.file.path.parent}"
133133
)
134134
return [pth_file]
135-
except OSError:
136-
# TODO: Replace with PermissionError
135+
except PermissionError:
137136
self._io.write_error_line(
138137
f" - Failed to create <c2>{pth_file.name}</c2> for"
139138
f" {self._poetry.file.path.parent}"

src/poetry/utils/_compat.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,11 @@
1010
from pathlib import Path
1111

1212

13-
# TODO: use try/except ImportError when
14-
# https://github.com/python/mypy/issues/1393 is fixed
15-
1613
if sys.version_info < (3, 11):
1714
# compatibility for python <3.11
1815
import tomli as tomllib
1916
else:
20-
import tomllib # nopycln: import
17+
import tomllib
2118

2219

2320
if sys.version_info < (3, 10):

src/poetry/utils/env/site_packages.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,11 @@ def _path_method_wrapper(
169169
results = []
170170

171171
for candidate in candidates:
172-
try:
172+
with contextlib.suppress(OSError):
173173
result = candidate, getattr(candidate, method)(*args, **kwargs)
174174
if return_first:
175175
return result
176176
results.append(result)
177-
except OSError:
178-
# TODO: Replace with PermissionError
179-
pass
180177

181178
if results:
182179
return results

0 commit comments

Comments
 (0)