From 9210edfd7090734134c7a44e97ecfcd15a870b0b Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sat, 26 Jul 2025 14:08:13 -0500 Subject: [PATCH] WWVBMinute: correct typing of __new__ method --- requirements-dev.txt | 1 + src/wwvb/__init__.py | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 8106670..29fc5d6 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -22,5 +22,6 @@ twine; implementation_name=="cpython" types-beautifulsoup4; implementation_name=="cpython" types-python-dateutil; implementation_name=="cpython" types-requests; implementation_name=="cpython" +typing-extensions; implementation_name=="cpython" tzdata wheel diff --git a/src/wwvb/__init__.py b/src/wwvb/__init__.py index 497d364..46467dd 100644 --- a/src/wwvb/__init__.py +++ b/src/wwvb/__init__.py @@ -21,6 +21,8 @@ import json import warnings from typing import TYPE_CHECKING, Any, NamedTuple, TextIO, TypeVar +from typing_extensions import Self + from . import iersdata from .tz import Mountain @@ -376,7 +378,7 @@ class WWVBMinute(_WWVBMinute): epoch: int = 1970 - def __new__( # noqa: PYI034 + def __new__( cls, year: int, days: int, @@ -387,7 +389,7 @@ class WWVBMinute(_WWVBMinute): *, ls: bool | None = None, ly: bool | None = None, - ) -> WWVBMinute: + ) -> Self: """Construct a WWVBMinute :param year: The 2- or 4-digit year. This parameter is converted by the `full_year` method.