oskarsh / Yin-Yang

Auto Nightmode for KDE, Gnome, Budgie, VSCode, Atom and more
MIT License
638 stars 52 forks source link

`Sun.get_local_sun{rise,set}_time` is deprecated and requires two parameters since suntime 1.3 #272

Closed flying-sheep closed 8 months ago

flying-sheep commented 8 months ago

See https://github.com/SatAgro/suntime/blob/v1.3.1/suntime/suntime.py#L54-L64

Yin-Yang tries to call it without parameters, and catches only SunTimeException, not the TypeError this raises:

https://github.com/oskarsh/Yin-Yang/blob/572ba65bd68dfe460debeac23943fe3050c63e00/yin_yang/config.py#L107-L108

Please follow the DeprecationWarning and use get_sun{rise,set}_time while passing a timezone instead.

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_man
  File "<frozen runpy>", line 88, in _run_code
  File "/opt/yin-yang/yin_yang/__main__.py", line 134, in <module>
    window = main_window_connector.MainWindow()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/yin-yang/yin_yang/ui/main_window_connector.py", line 55, in __init__
    self.load()
  File "/opt/yin-yang/yin_yang/ui/main_window_connector.py", line 89, in load
    self.load_times()
  File "/opt/yin-yang/yin_yang/ui/main_window_connector.py", line 95, in load_times
    time_light, time_dark = config.times
                            ^^^^^^^^^^^^
  File "/opt/yin-yang/yin_yang/config.py", line 456, in times
    return get_sun_time(latitude, longitude)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/yin-yang/yin_yang/config.py", line 110, in get_sun_time
    today_sr = sun.get_local_sunrise_time()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Sun.get_local_sunrise_time() missing 2 required positional arguments: 'at_date' and 'time_zone'