File tree Expand file tree Collapse file tree 1 file changed +14
-11
lines changed Expand file tree Collapse file tree 1 file changed +14
-11
lines changed Original file line number Diff line number Diff line change 4
4
"""
5
5
6
6
import re
7
+ from typing import TYPE_CHECKING
7
8
8
9
import packaging
9
10
@@ -155,14 +156,16 @@ def safer_best_effort_version(value: str) -> str:
155
156
canonicalize_license_expression as _canonicalize_license_expression ,
156
157
)
157
158
except ImportError :
158
-
159
- def _canonicalize_license_expression (expression : str ) -> str : # type: ignore[misc] # pyright: ignore[reportAssignmentType]
160
- # Defer import error to affect only users that actually use it
161
- # https://github.com/pypa/setuptools/issues/4894
162
- raise ImportError (
163
- "Cannot import `packaging.licenses`."
164
- """
165
- Setuptools>=77.0.0 requires "packaging>=24.2" to work properly.
166
- Please make sure you have a suitable version installed.
167
- """
168
- )
159
+ if not TYPE_CHECKING :
160
+ # XXX: pyright is still upset even with # pyright: ignore[reportAssignmentType]
161
+
162
+ def _canonicalize_license_expression (expression : str ) -> str :
163
+ # Defer import error to affect only users that actually use it
164
+ # https://github.com/pypa/setuptools/issues/4894
165
+ raise ImportError (
166
+ "Cannot import `packaging.licenses`."
167
+ """
168
+ Setuptools>=77.0.0 requires "packaging>=24.2" to work properly.
169
+ Please make sure you have a suitable version installed.
170
+ """
171
+ )
You can’t perform that action at this time.
0 commit comments