From 9f6cd423269311995f4e76ad19b51215107fff3f Mon Sep 17 00:00:00 2001 From: JamJomJim Date: Thu, 10 Apr 2025 14:59:21 -0500 Subject: [PATCH 1/4] add .venv to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 2ffdc7be..0d6c4611 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *.pyc *.swp .tox/ +.venv htmlcov/ .coverage /build/ From ddfbd7f6a814f6bab740b5b1f8f24cfe8e44b085 Mon Sep 17 00:00:00 2001 From: JamJomJim Date: Thu, 10 Apr 2025 15:00:57 -0500 Subject: [PATCH 2/4] add repo name egg-info to .gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 0d6c4611..15b35152 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,10 @@ *.pyc *.swp .tox/ -.venv htmlcov/ .coverage +/.venv/ /build/ /dist/ +/python_metar.egg-info/ /metar.egg-info/ \ No newline at end of file From 4e67b25e7960d680895ba273eda7be6df4f4ec15 Mon Sep 17 00:00:00 2001 From: JamJomJim Date: Thu, 10 Apr 2025 17:36:32 -0500 Subject: [PATCH 3/4] fix missing math import, and remove unused sqrt import --- metar/Datatypes.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/metar/Datatypes.py b/metar/Datatypes.py index adb36737..fd698f9e 100644 --- a/metar/Datatypes.py +++ b/metar/Datatypes.py @@ -1,10 +1,9 @@ # Copyright (c) 2004,2018 Python-Metar Developers. # Distributed under the terms of the BSD 2-Clause License. # SPDX-License-Identifier: BSD-2-Clause -"""Python classes to represent dimensioned quantities used in weather reports. -""" +"""Python classes to represent dimensioned quantities used in weather reports.""" import re -from math import sin, cos, atan2, sqrt +from math import pi, sin, cos, atan2 # exceptions @@ -481,7 +480,7 @@ def getdirection(self, position2): long2 = position2.longitude s = -sin(long1 - long2) * cos(lat2) c = cos(lat1) * sin(lat2) - sin(lat1) * cos(lat2) * cos(long1 - long2) - d = atan2(s, c) * 180.0 / math.pi + d = atan2(s, c) * 180.0 / pi if d < 0.0: d += 360.0 return direction(d) From 458e15957490caa3848447ad317b641e1e373255 Mon Sep 17 00:00:00 2001 From: JamJomJim Date: Thu, 10 Apr 2025 15:13:00 -0500 Subject: [PATCH 4/4] removed unused (misleading) utcdelta --- metar/Metar.py | 8 +------- metar/Metar.pyi | 1 - 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/metar/Metar.py b/metar/Metar.py index 3859417b..9c8e8eb5 100644 --- a/metar/Metar.py +++ b/metar/Metar.py @@ -352,7 +352,7 @@ def _unparsedGroup(self, d): class Metar(object): """METAR (aviation meteorology report)""" - def __init__(self, metarcode, month=None, year=None, utcdelta=None, strict=True): + def __init__(self, metarcode, month=None, year=None, strict=True): """ Parse raw METAR code. @@ -362,8 +362,6 @@ def __init__(self, metarcode, month=None, year=None, utcdelta=None, strict=True) month, year : int, optional Date values to be used when parsing a non-current METAR code. If not provided, then the month and year are guessed from the current date. - utcdelta : int or datetime.timedelta, optional - An int of hours or a timedelta object used to specify the timezone. strict : bool (default is True) This option determines if a ``ParserError`` is raised when unparsable groups are found or an unexpected exception is encountered. @@ -419,10 +417,6 @@ def __init__(self, metarcode, month=None, year=None, utcdelta=None, strict=True) self._unparsed_remarks = [] self._now = datetime.datetime.now(datetime.timezone.utc).replace(tzinfo=None) - if utcdelta: - self._utcdelta = utcdelta - else: - self._utcdelta = datetime.datetime.now() - self._now self._month = month self._year = year diff --git a/metar/Metar.pyi b/metar/Metar.pyi index 24e763bb..cf1ba1de 100644 --- a/metar/Metar.pyi +++ b/metar/Metar.pyi @@ -74,7 +74,6 @@ class Metar: metarcode: str, month: Optional[int] = ..., year: Optional[int] = ..., - utcdelta: Union[int, timedelta, None] = ..., strict: bool = ..., ): ... @property