Skip to content

Commit

Permalink
Fix Self on Py<3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
devdupont committed May 27, 2024
1 parent d16e269 commit d95b64a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
7 changes: 6 additions & 1 deletion avwx/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from abc import ABCMeta, abstractmethod
from contextlib import suppress
from datetime import date, datetime, timezone
from typing import TYPE_CHECKING, Self
from typing import TYPE_CHECKING

# module
from avwx.exceptions import BadStation
Expand All @@ -17,6 +17,11 @@
from avwx.service import Service
from avwx.structs import ReportData, Units

try:
from typing import Self
except ImportError:
from typing_extensions import Self


def find_station(report: str) -> Station | None:
"""Returns the first Station found in a report string"""
Expand Down
7 changes: 6 additions & 1 deletion avwx/station/station.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from copy import copy
from dataclasses import dataclass
from functools import lru_cache
from typing import Any, Self
from typing import Any

# library
import httpx
Expand All @@ -19,6 +19,11 @@
from avwx.station.meta import STATIONS
from avwx.structs import Coord

try:
from typing import Self
except ImportError:
from typing_extensions import Self


def _get_ip_location() -> Coord:
"""Return the current location according to ipinfo.io."""
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ dependencies = [
"geopy>=2.4",
"httpx>=0.26",
"python-dateutil>=2.8",
"typing-extensions~=4.12; python_version < '3.11'",
"xmltodict>=0.13",
]

Expand Down

0 comments on commit d95b64a

Please sign in to comment.