From de9db308c64205ccef0eba08be0aef3cb150d939 Mon Sep 17 00:00:00 2001 From: Dominic Davis-Foster Date: Thu, 18 Jul 2024 16:12:44 +0100 Subject: [PATCH] Use Self as return type for ConsolidatedPeakFilter.from_method --- libgunshotmatch/consolidate/__init__.py | 3 ++- requirements.txt | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libgunshotmatch/consolidate/__init__.py b/libgunshotmatch/consolidate/__init__.py index 6cf0aa8..a683281 100644 --- a/libgunshotmatch/consolidate/__init__.py +++ b/libgunshotmatch/consolidate/__init__.py @@ -41,6 +41,7 @@ from pyms.DPA.Alignment import Alignment from pyms.Spectrum import MassSpectrum from pyms_nist_search import ReferenceData, SearchResult +from typing_extensions import Self # this package from libgunshotmatch.consolidate._fields import ( @@ -715,7 +716,7 @@ class ConsolidatedPeakFilter: verbose: bool = False @classmethod - def from_method(cls: Type["ConsolidatedPeakFilter"], method: ConsolidateMethod) -> "ConsolidatedPeakFilter": + def from_method(cls: Type[Self], method: ConsolidateMethod) -> Self: """ Construct a :class:`~.ConsolidatedPeakFilter` from a :class:`~.ConsolidateMethod`. diff --git a/requirements.txt b/requirements.txt index 409a3c6..2597607 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,3 +11,4 @@ scipy>=1.9.0 sdjson>=0.4.0 tomli>=1.2.3; python_version < "3.11" tomli-w>=1.0.0 +typing-extensions>=4.12.2