Skip to content

Commit

Permalink
fix some type errors in views
Browse files Browse the repository at this point in the history
  • Loading branch information
cleder committed Jan 14, 2023
1 parent 09f0221 commit e182997
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions fastkml/views.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
from typing import Optional
from typing import SupportsFloat
from typing import Union

import fastkml.config as config
Expand Down Expand Up @@ -89,7 +90,7 @@ def longitude(self) -> Optional[float]:
return self._longitude

@longitude.setter
def longitude(self, value) -> None:
def longitude(self, value: Optional[SupportsFloat]) -> None:
if isinstance(value, (str, int, float)) and (-180 <= float(value) <= 180):
self._longitude = float(value)
elif value is None:
Expand All @@ -102,7 +103,7 @@ def latitude(self) -> Optional[float]:
return self._latitude

@latitude.setter
def latitude(self, value) -> None:
def latitude(self, value: Optional[SupportsFloat]) -> None:
if isinstance(value, (str, int, float)) and (-90 <= float(value) <= 90):
self._latitude = float(value)
elif value is None:
Expand All @@ -115,7 +116,7 @@ def altitude(self) -> Optional[float]:
return self._altitude

@altitude.setter
def altitude(self, value) -> None:
def altitude(self, value: Optional[SupportsFloat]) -> None:
if isinstance(value, (str, int, float)):
self._altitude = float(value)
elif value is None:
Expand All @@ -128,7 +129,7 @@ def heading(self) -> Optional[float]:
return self._heading

@heading.setter
def heading(self, value) -> None:
def heading(self, value: Optional[SupportsFloat]) -> None:
if isinstance(value, (str, int, float)) and (-180 <= float(value) <= 180):
self._heading = float(value)
elif value is None:
Expand All @@ -141,7 +142,7 @@ def tilt(self) -> Optional[float]:
return self._tilt

@tilt.setter
def tilt(self, value) -> None:
def tilt(self, value: Optional[SupportsFloat]) -> None:
if isinstance(value, (str, int, float)) and (0 <= float(value) <= 180):
self._tilt = float(value)
elif value is None:
Expand Down

0 comments on commit e182997

Please sign in to comment.