Quellcode durchsuchen

Fix Python files header

tags/v0.1.0
Jérôme Deuchnord vor 4 Jahren
Ursprung
Commit
f545dfd0cd
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden GPG-Schlüssel-ID: BC6F3C345B7D33B0
4 geänderte Dateien mit 21 neuen und 15 gelöschten Zeilen
  1. +1
    -1
      .pylintrc
  2. +2
    -0
      dumper.py
  3. +16
    -14
      ephemeris.py
  4. +2
    -0
      kosmorro.py

+ 1
- 1
.pylintrc Datei anzeigen

@@ -30,7 +30,7 @@ limit-inference-results=100
# usually to register additional checkers. # usually to register additional checkers.
load-plugins=pylintfileheader load-plugins=pylintfileheader


file-header=# Kosmorro - Compute The Next Ephemeris\n# Copyright \(C\) 2019 Jérôme Deuchnord <jerome@deuchnord.fr>\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Affero General Public License as\n# published by the Free Software Foundation, either version 3 of the\n# License, or \(at your option\) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU Affero General Public License for more details.\n#\n# You should have received a copy of the GNU Affero General Public License\n# along with this program. If not, see <https://www.gnu.org/licenses/>.
file-header=#!/usr/bin/env python3\n\n# Kosmorro - Compute The Next Ephemeris\n# Copyright \(C\) 2019 Jérôme Deuchnord <jerome@deuchnord.fr>\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU Affero General Public License as\n# published by the Free Software Foundation, either version 3 of the\n# License, or \(at your option\) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU Affero General Public License for more details.\n#\n# You should have received a copy of the GNU Affero General Public License\n# along with this program. If not, see <https://www.gnu.org/licenses/>.\n\n


# Pickle collected data for later comparisons. # Pickle collected data for later comparisons.
persistent=yes persistent=yes


+ 2
- 0
dumper.py Datei anzeigen

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

# Kosmorro - Compute The Next Ephemeris # Kosmorro - Compute The Next Ephemeris
# Copyright (C) 2019 Jérôme Deuchnord <jerome@deuchnord.fr> # Copyright (C) 2019 Jérôme Deuchnord <jerome@deuchnord.fr>
# #


+ 16
- 14
ephemeris.py Datei anzeigen

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

# Kosmorro - Compute The Next Ephemeris # Kosmorro - Compute The Next Ephemeris
# Copyright (C) 2019 Jérôme Deuchnord <jerome@deuchnord.fr> # Copyright (C) 2019 Jérôme Deuchnord <jerome@deuchnord.fr>
# #
@@ -37,18 +39,6 @@ class Ephemeris:
self.longitude = position['lon'] self.longitude = position['lon']
self.position = Topos(latitude_degrees=position['lat'], longitude_degrees=position['lon']) self.position = Topos(latitude_degrees=position['lat'], longitude_degrees=position['lon'])


def compute_ephemeris_for_day(self, year: int, month: int, day: int) -> dict:
ephemeris = {}
time1 = self.timescale.utc(year, month, day, 2)
time2 = self.timescale.utc(year, month, day + 1, 2)

# Compute sunrise and sunset
ephemeris['sun'] = self.get_sun(time1, time2)
ephemeris['moon'] = self.get_moon(year, month, day)
ephemeris['planets'] = self.get_planets(year, month, day)

return ephemeris

def get_sun(self, start_time, end_time) -> dict: def get_sun(self, start_time, end_time) -> dict:
times, is_risen = almanac.find_discrete(start_time, times, is_risen = almanac.find_discrete(start_time,
end_time, end_time,
@@ -167,6 +157,18 @@ class Ephemeris:
'set': set_time if set_time is not None else None 'set': set_time if set_time is not None else None
} }


def compute_ephemerides_for_day(self, year: int, month: int, day: int) -> dict:
ephemeris = {}
time1 = self.timescale.utc(year, month, day, 2)
time2 = self.timescale.utc(year, month, day + 1, 2)

# Compute sunrise and sunset
ephemeris['sun'] = self.get_sun(time1, time2)
ephemeris['moon'] = self.get_moon(year, month, day)
ephemeris['planets'] = self.get_planets(year, month, day)

return ephemeris

def compute_ephemerides_for_month(self, year: int, month: int) -> list: def compute_ephemerides_for_month(self, year: int, month: int) -> list:
if month == 2: if month == 2:
is_leap_year = (year % 4 == 0 and year % 100 > 0) or (year % 400 == 0) is_leap_year = (year % 4 == 0 and year % 100 > 0) or (year % 400 == 0)
@@ -179,7 +181,7 @@ class Ephemeris:
ephemerides = [] ephemerides = []


for day in range(1, max_day + 1): for day in range(1, max_day + 1):
ephemerides.append(self.compute_ephemeris_for_day(year, month, day))
ephemerides.append(self.compute_ephemerides_for_day(year, month, day))


return ephemerides return ephemerides


@@ -216,7 +218,7 @@ class Ephemeris:


def compute_ephemeris(self, year: int, month: int, day: int): def compute_ephemeris(self, year: int, month: int, day: int):
if day is not None: if day is not None:
return self.compute_ephemeris_for_day(year, month, day)
return self.compute_ephemerides_for_day(year, month, day)


if month is not None: if month is not None:
return self.compute_ephemerides_for_month(year, month) return self.compute_ephemerides_for_month(year, month)


+ 2
- 0
kosmorro.py Datei anzeigen

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

# Kosmorro - Compute The Next Ephemeris # Kosmorro - Compute The Next Ephemeris
# Copyright (C) 2019 Jérôme Deuchnord <jerome@deuchnord.fr> # Copyright (C) 2019 Jérôme Deuchnord <jerome@deuchnord.fr>
# #


Laden…
Abbrechen
Speichern