Skip to content

Commit

Permalink
#72 Remove __post_init__ from dataclasses
Browse files Browse the repository at this point in the history
  • Loading branch information
astropenguin committed Jan 20, 2024
1 parent 873d814 commit 470171a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
6 changes: 0 additions & 6 deletions azely/location.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ class Location:
tf: ClassVar = TimezoneFinder()
"""TimezoneFinder instance."""

def __post_init__(self) -> None:
"""Add or update units of location values."""
self.longitude = str(Longitude(self.longitude, "deg"))
self.latitude = str(Latitude(self.latitude, "deg"))
self.altitude = str(Quantity(self.altitude, "m"))

@property
def timezone(self) -> tzinfo:
"""Timezone of the location."""
Expand Down
8 changes: 1 addition & 7 deletions azely/object.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


# dependencies
from astropy.coordinates import Longitude, Latitude, SkyCoord, get_body
from astropy.coordinates import SkyCoord, get_body
from astropy.time import Time as ObsTime
from astropy.utils.data import conf
from .consts import AZELY_CACHE, FRAME, SOLAR_FRAME, SOLAR_OBJECTS, TIMEOUT
Expand All @@ -31,12 +31,6 @@ class Object:
frame: str
"""Equatorial coordinates of the object."""

def __post_init__(self) -> None:
"""Add or update units of object coordinates."""
if not self.is_solar:
self.longitude = str(Longitude(self.longitude, "hr"))
self.latitude = str(Latitude(self.latitude, "deg"))

@property
def is_solar(self) -> bool:
"""Whether it is a solar object."""
Expand Down

0 comments on commit 470171a

Please sign in to comment.