Procházet zdrojové kódy

feat: make the date parameter optional (default value: today)

tags/v0.10.0
Jérôme Deuchnord před 3 roky
rodič
revize
c59b553c86
4 změnil soubory, kde provedl 6 přidání a 5 odebrání
  1. +2
    -1
      kosmorrolib/__init__.py
  2. +1
    -1
      kosmorrolib/data.py
  3. +2
    -2
      kosmorrolib/ephemerides.py
  4. +1
    -1
      kosmorrolib/events.py

+ 2
- 1
kosmorrolib/__init__.py Zobrazit soubor

@@ -1,4 +1,5 @@
#!/usr/bin/env python3

from .ephemerides import get_ephemerides
from .data import Position
from .ephemerides import get_ephemerides, get_moon_phase
from .events import get_events

+ 1
- 1
kosmorrolib/data.py Zobrazit soubor

@@ -220,7 +220,7 @@ ASTERS = [


class Position:
def __init__(self, latitude: float, longitude: float, aster: Object):
def __init__(self, latitude: float, longitude: float, aster: Object = EARTH):
self.latitude = latitude
self.longitude = longitude
self.aster = aster


+ 2
- 2
kosmorrolib/ephemerides.py Zobrazit soubor

@@ -60,7 +60,7 @@ def _get_skyfield_to_moon_phase(
)


def get_moon_phase(compute_date: datetime.date, timezone: int = 0) -> MoonPhase:
def get_moon_phase(compute_date: datetime.date = datetime.date.today(), timezone: int = 0) -> MoonPhase:
earth = get_skf_objects()["earth"]
moon = get_skf_objects()["moon"]
sun = get_skf_objects()["sun"]
@@ -99,7 +99,7 @@ def get_moon_phase(compute_date: datetime.date, timezone: int = 0) -> MoonPhase:


def get_ephemerides(
date: datetime.date, position: Position, timezone: int = 0
position: Position, date: datetime.date = datetime.date.today(), timezone: int = 0
) -> [AsterEphemerides]:
ephemerides = []



+ 1
- 1
kosmorrolib/events.py Zobrazit soubor

@@ -213,7 +213,7 @@ def _search_moon_perigee(start_time: Time, end_time: Time, timezone: int) -> [Ev
return events


def get_events(date: date_type, timezone: int = 0) -> [Event]:
def get_events(date: date_type = date_type.today(), timezone: int = 0) -> [Event]:
"""Calculate and return a list of events for the given date, adjusted to the given timezone if any.

Find events that happen on April 4th, 2020 (show hours in UTC):


Načítá se…
Zrušit
Uložit