Skip to content

Commit

Permalink
remove unneeded mypy ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Feb 26, 2023
1 parent 907c675 commit 54fea73
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Examples/compare/compare_ecef2eci.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_ecef_eci():
ecef = eci2ecef(*eci_matlab, utc)

if has_aero:
ecef_matlab = eng.eci2ecef(utc_matlab, *eci_matlab, nargout=3) # type: ignore
ecef_matlab = eng.eci2ecef(utc_matlab, *eci_matlab, nargout=3)
else:
ecef_matlab = eng.matmap3d.eci2ecef(utc_matlab, *eci_matlab, nargout=3)

Expand Down
2 changes: 1 addition & 1 deletion src/pymap3d/ecef.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def ecef2geodetic(
)

try:
if inside.any(): # type: ignore
if inside.any():
# avoid all false assignment bug
alt[inside] = -alt[inside]
except (TypeError, AttributeError):
Expand Down
6 changes: 3 additions & 3 deletions src/pymap3d/enu.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ def enu2aer(e, n, u, deg: bool = True) -> tuple:
u[abs(u) < 1e-3] = 0.0
except TypeError:
if abs(e) < 1e-3:
e = 0.0 # type: ignore
e = 0.0
if abs(n) < 1e-3:
n = 0.0 # type: ignore
n = 0.0
if abs(u) < 1e-3:
u = 0.0 # type: ignore
u = 0.0

r = hypot(e, n)
slantRange = hypot(r, u)
Expand Down
2 changes: 1 addition & 1 deletion src/pymap3d/latitude.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def geodetic2isometric(geodetic_lat, ell: Ellipsoid = None, deg: bool = True):
i = abs(coslat) <= COS_EPS

try:
isometric_lat[i] = sign(geodetic_lat[i]) * inf # type: ignore
isometric_lat[i] = sign(geodetic_lat[i]) * inf
except TypeError:
if i:
isometric_lat = sign(geodetic_lat) * inf
Expand Down
4 changes: 2 additions & 2 deletions src/pymap3d/lox.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def loxodrome_direct(
dlon = tan(a12) * (newiso - iso)

try:
dlon[i] = sign(pi - a12[i]) * rng[i] / rcurve.parallel(lat1[i], ell=ell, deg=False) # type: ignore
dlon[i] = sign(pi - a12[i]) * rng[i] / rcurve.parallel(lat1[i], ell=ell, deg=False)
except (AttributeError, TypeError):
if i: # straight east or west
dlon = sign(pi - a12) * rng / rcurve.parallel(lat1, ell=ell, deg=False)
Expand All @@ -256,7 +256,7 @@ def loxodrome_direct(
lat2, lon2 = degrees(lat2), degrees(lon2)

try:
return lat2.squeeze()[()], lon2.squeeze()[()] # type: ignore
return lat2.squeeze()[()], lon2.squeeze()[()]
except AttributeError:
return lat2, lon2

Expand Down
4 changes: 2 additions & 2 deletions src/pymap3d/timeconv.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def str2dt(time: str | datetime) -> datetime:
try:
return dateutil.parser.parse(time)
except NameError:
raise ImportError("pip install dateutil")
raise ImportError("pip install python-dateutil")

# some sort of iterable
try:
Expand All @@ -45,7 +45,7 @@ def str2dt(time: str | datetime) -> datetime:
except IndexError:
pass
except NameError:
raise ImportError("pip install dateutil")
raise ImportError("pip install python-dateutil")

# pandas/xarray
try:
Expand Down
4 changes: 2 additions & 2 deletions src/pymap3d/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ def sanitize(lat, ell: Ellipsoid | None, deg: bool) -> tuple:
lat = radians(lat)

try:
if (abs(lat) > pi / 2).any(): # type: ignore
if (abs(lat) > pi / 2).any():
raise ValueError("-pi/2 <= latitude <= pi/2")
except AttributeError:
if abs(lat) > pi / 2: # type: ignore
if abs(lat) > pi / 2:
raise ValueError("-pi/2 <= latitude <= pi/2")

return lat, ell
16 changes: 8 additions & 8 deletions src/pymap3d/vincenty.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def vdist(
if (abs(Lat1) > 90).any() | (abs(Lat2) > 90).any():
raise ValueError("Input latitudes must be in [-90, 90] degrees.")
except NameError:
if (abs(Lat1) > 90) | (abs(Lat2) > 90): # type: ignore
if (abs(Lat1) > 90) | (abs(Lat2) > 90):
raise ValueError("Input latitudes must be in [-90, 90] degrees.")
# %% Supply WGS84 earth ellipsoid axis lengths in meters:
a = ell.semimajor_axis
Expand Down Expand Up @@ -155,7 +155,7 @@ def vdist(
L[L > pi] = 2 * pi - L[L > pi]
except TypeError:
if L > pi:
L = 2 * pi - L # type: ignore
L = 2 * pi - L

lamb = copy(L) # NOTE: program will fail without copy!
itercount = 0
Expand All @@ -167,7 +167,7 @@ def vdist(
if not warninggiven:
logging.warning("Essentially antipodal points--precision may be reduced slightly.")

lamb = pi # type: ignore
lamb = pi
break

lambdaold = copy(lamb)
Expand Down Expand Up @@ -213,7 +213,7 @@ def vdist(
# print(f'then, lambda(21752) = {lamb[21752],20})
# correct for convergence failure for essentially antipodal points
try:
i = (lamb > pi).any() # type: ignore
i = (lamb > pi).any()
except AttributeError:
i = lamb > pi

Expand All @@ -222,11 +222,11 @@ def vdist(
"Essentially antipodal points encountered. Precision may be reduced slightly."
)
warninggiven = True
lambdaold = pi # type: ignore
lamb = pi # type: ignore
lambdaold = pi
lamb = pi

try:
notdone = (abs(lamb - lambdaold) > 1e-12).any() # type: ignore
notdone = (abs(lamb - lambdaold) > 1e-12).any()
except AttributeError:
notdone = abs(lamb - lambdaold) > 1e-12

Expand Down Expand Up @@ -347,7 +347,7 @@ def vreckon(
if (Rng < 0.0).any():
raise ValueError("Ground distance must be positive")
except NameError:
if abs(Lat1) > 90.0: # type: ignore
if abs(Lat1) > 90.0:
raise ValueError("Input lat. must be between -90 and 90 deg., inclusive.")
if Rng < 0.0:
raise ValueError("Ground distance must be positive")
Expand Down

0 comments on commit 54fea73

Please sign in to comment.