Skip to content

Commit 25fc1fd

Browse files
authored
Disallow type error without code (#1456)
1 parent 5e39d2a commit 25fc1fd

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

pyproj/crs/coordinate_operation.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ def __new__(
604604
f"+k_0={scale_factor_natural_origin}"
605605
)
606606
return cls.from_json(
607-
CRS(proj_string).coordinate_operation.to_json() # type: ignore
607+
CRS(proj_string).coordinate_operation.to_json() # type: ignore[union-attr]
608608
)
609609

610610

pyproj/crs/crs.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ def __init__(self, projparams: Any | None = None, **kwargs) -> None:
334334
elif isinstance(projparams, (list, tuple)) and len(projparams) == 2:
335335
projstring = _prepare_from_authority(*projparams)
336336
elif hasattr(projparams, "to_wkt"):
337-
projstring = projparams.to_wkt() # type: ignore
337+
projstring = projparams.to_wkt()
338338
else:
339339
raise CRSError(f"Invalid CRS input: {projparams!r}")
340340

pyproj/geod.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,7 @@ def geometry_length(self, geometry, radians: bool = False) -> float:
10031003
The total geodesic length of the geometry (meters).
10041004
"""
10051005
try:
1006-
return self.line_length(*geometry.xy, radians=radians) # type: ignore
1006+
return self.line_length(*geometry.xy, radians=radians) # type: ignore[misc]
10071007
except (AttributeError, NotImplementedError):
10081008
pass
10091009
if hasattr(geometry, "exterior"):
@@ -1074,7 +1074,7 @@ def geometry_area_perimeter(
10741074
The geodesic area (meters^2) and perimeter (meters) of the polygon.
10751075
"""
10761076
try:
1077-
return self.polygon_area_perimeter( # type: ignore
1077+
return self.polygon_area_perimeter( # type: ignore[misc]
10781078
*geometry.xy, radians=radians
10791079
)
10801080
except (AttributeError, NotImplementedError):

pyproject.toml

+9-7
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ select = [
110110
"RUF",
111111
# flake8-bandit: exec-builtin
112112
"S102",
113-
# numpy-legacy-random
114-
"NPY002",
113+
# NumPy-specific rules
114+
"NPY",
115115
# Perflint
116116
"PERF",
117117
# flynt
@@ -123,7 +123,7 @@ select = [
123123
# flake8-slots
124124
"SLOT",
125125
# flake8-raise
126-
"RSE"
126+
"RSE",
127127
]
128128

129129
ignore = [
@@ -146,10 +146,6 @@ ignore = [
146146
### TODO: Enable gradually
147147
# Rename unused
148148
"B007",
149-
# Use specific rule codes when ignoring type issues
150-
"PGH003",
151-
# unconventional-import-alias
152-
"ICN001",
153149
# Move standard library import into a type-checking block
154150
"TCH003",
155151
# Consider f-string instead of string join
@@ -158,3 +154,9 @@ ignore = [
158154
"PERF401"
159155

160156
]
157+
158+
[tool.mypy]
159+
files = ["pyproj"]
160+
python_version = "3.10"
161+
ignore_errors = false
162+
enable_error_code = "ignore-without-code"

0 commit comments

Comments
 (0)