Skip to content

Commit f0f5ae2

Browse files
dimblebyabn
authored andcommitted
handle importlib typing at python 3.7
1 parent f33c9db commit f0f5ae2

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

Diff for: pyproject.toml

+12
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,18 @@ module = [
127127
]
128128
ignore_errors = true
129129

130+
# use of importlib-metadata backport at python3.7 makes it impossible to
131+
# satisfy mypy without some ignores: but we get a different set of ignores at
132+
# different python versions.
133+
#
134+
# <https://github.com/python/mypy/issues/8823>, meanwhile suppress that
135+
# warning.
136+
[[tool.mypy.overrides]]
137+
module = [
138+
'poetry.repositories.installed_repository',
139+
]
140+
warn_unused_ignores = false
141+
130142
[[tool.mypy.overrides]]
131143
module = [
132144
'cachecontrol.*',

Diff for: src/poetry/repositories/installed_repository.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,11 @@ def create_package_from_distribution(
163163
source_reference=source_reference,
164164
source_resolved_reference=source_resolved_reference,
165165
)
166-
package.description = distribution.metadata.get("summary", "")
166+
167+
package.description = distribution.metadata.get( # type: ignore[attr-defined]
168+
"summary",
169+
"",
170+
)
167171

168172
return package
169173

@@ -213,7 +217,10 @@ def create_package_from_pep610(cls, distribution: metadata.Distribution) -> Pack
213217
develop=develop,
214218
)
215219

216-
package.description = distribution.metadata.get("summary", "")
220+
package.description = distribution.metadata.get( # type: ignore[attr-defined]
221+
"summary",
222+
"",
223+
)
217224

218225
return package
219226

@@ -229,7 +236,9 @@ def load(cls, env: Env, with_dependencies: bool = False) -> InstalledRepository:
229236

230237
for entry in reversed(env.sys_path):
231238
for distribution in sorted(
232-
metadata.distributions(path=[entry]),
239+
metadata.distributions( # type: ignore[no-untyped-call]
240+
path=[entry],
241+
),
233242
key=lambda d: str(d._path), # type: ignore[attr-defined]
234243
):
235244
name = canonicalize_name(distribution.metadata["name"])

0 commit comments

Comments
 (0)