From 62291ddf82acd13b1872f6894df27c1c2d7f8e0c Mon Sep 17 00:00:00 2001 From: Cunliang Geng Date: Tue, 31 Oct 2023 15:38:44 +0100 Subject: [PATCH] update type hints for class itself When using `from __future__ import annotations`, the class name can be directly used as type hint; Otherwise, use string like "ClassName" as type hint. --- src/nplinker/strain_collection.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/nplinker/strain_collection.py b/src/nplinker/strain_collection.py index 1f430d4d..86993f6d 100644 --- a/src/nplinker/strain_collection.py +++ b/src/nplinker/strain_collection.py @@ -1,3 +1,4 @@ +from __future__ import annotations import json from os import PathLike from typing import Iterator @@ -37,7 +38,7 @@ def __eq__(self, other) -> bool: and self._strain_dict_name == other._strain_dict_name) return NotImplemented - def __add__(self, other) -> 'StrainCollection': + def __add__(self, other) -> StrainCollection: if isinstance(other, StrainCollection): sc = StrainCollection() for strain in self._strains: