From d08e21c374a520a16546ec844c9197d49de326d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Deuchnord?= Date: Sun, 20 Jun 2021 14:30:23 +0200 Subject: [PATCH] Fix some minor issues with Black and Event.details field --- kosmorrolib/events.py | 4 ++-- kosmorrolib/model.py | 2 +- tests/events.py | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/kosmorrolib/events.py b/kosmorrolib/events.py index a68f1d7..a0bcee8 100644 --- a/kosmorrolib/events.py +++ b/kosmorrolib/events.py @@ -195,13 +195,13 @@ def _search_maximal_elongations( ) for i, time in enumerate(times): - elongation = round(elongations[i],1) + elongation = round(elongations[i], 1) events.append( Event( EventType.MAXIMAL_ELONGATION, [aster], translate_to_timezone(time.utc_datetime(), timezone), - details={"deg": f"{elongation}°"}, + details={"deg": elongation}, ) ) diff --git a/kosmorrolib/model.py b/kosmorrolib/model.py index 0fc79bc..4a69147 100644 --- a/kosmorrolib/model.py +++ b/kosmorrolib/model.py @@ -154,7 +154,7 @@ class Event(Serializable): objects: [Object], start_time: datetime, end_time: Union[datetime, None] = None, - details: dict = None, + details: {str: any} = None, ): self.event_type = event_type self.objects = objects diff --git a/tests/events.py b/tests/events.py index b022a4b..0132692 100644 --- a/tests/events.py +++ b/tests/events.py @@ -74,7 +74,7 @@ EXPECTED_EVENTS = [ EventType.MAXIMAL_ELONGATION, [ASTERS[2]], datetime(2020, 2, 10, 13, 46), - details={'deg':"18.2°"}, + details={"deg": 18.2}, ), Event(EventType.MOON_PERIGEE, [ASTERS[1]], datetime(2020, 2, 10, 20, 34)), ], @@ -86,14 +86,14 @@ EXPECTED_EVENTS = [ EventType.MAXIMAL_ELONGATION, [ASTERS[2]], datetime(2020, 3, 24, 1, 56), - details={'deg':"27.8°"}, + details={"deg": 27.8}, ), Event(EventType.MOON_APOGEE, [ASTERS[1]], datetime(2020, 3, 24, 15, 39)), Event( EventType.MAXIMAL_ELONGATION, [ASTERS[3]], datetime(2020, 3, 24, 21, 58), - details={'deg':"46.1°"}, + details={"deg": 46.1}, ), ], ),