Skip to content

Commit 1cc48db

Browse files
author
rhliang
committed
Changes to attempt to fix the Python 3.10 pipeline.
1 parent 89ee0c4 commit 1cc48db

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

src/easyhla/models.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import re
22
from collections.abc import Iterable
33
from operator import itemgetter
4-
from typing import Final, Optional, Self
4+
from typing import Final, Optional
55

66
import numpy as np
77
from pydantic import BaseModel, ConfigDict
@@ -61,7 +61,7 @@ def sequence_np(self) -> np.ndarray:
6161
return np.array(self.sequence)
6262

6363
@classmethod
64-
def from_raw_standard(cls, raw_standard: HLARawStandard) -> Self:
64+
def from_raw_standard(cls, raw_standard: HLARawStandard) -> "HLAStandard":
6565
return cls(
6666
allele=raw_standard.allele,
6767
two=nuc2bin(raw_standard.exon2),
@@ -155,7 +155,7 @@ def __init__(
155155
@classmethod
156156
def from_frequency_entry(
157157
cls, raw_first_allele: str, raw_second_allele: str
158-
) -> Optional[Self]:
158+
) -> Optional["HLAProteinPair.NonAlleleException"]:
159159
first_unmapped: bool = False
160160
first_deprecated: bool = False
161161
second_unmapped: bool = False
@@ -184,7 +184,7 @@ def from_frequency_entry(
184184
cls,
185185
raw_first_allele: str,
186186
raw_second_allele: str,
187-
) -> Self:
187+
) -> "HLAProteinPair":
188188
any_problems: Optional[HLAProteinPair.NonAlleleException] = (
189189
HLAProteinPair.NonAlleleException.from_frequency_entry(
190190
raw_first_allele, raw_second_allele

src/easyhla/update_frequency_file_lib.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from collections import Counter
44
from dataclasses import dataclass
55
from io import TextIOBase
6-
from typing import Final, Optional, Self, TypedDict, cast
6+
from typing import Final, Optional, TypedDict, cast
77

88
from .easyhla import EasyHLA
99
from .models import HLAProteinPair
@@ -25,7 +25,7 @@ class OldName:
2525
field_2: str
2626

2727
@classmethod
28-
def from_string(cls, old_name_str: str) -> Self:
28+
def from_string(cls, old_name_str: str) -> "OldName":
2929
"""
3030
Build an instance directly from an entry in the nomenclature mapping.
3131
@@ -46,7 +46,9 @@ def from_string(cls, old_name_str: str) -> Self:
4646
return cls(locus, field_1, field_2)
4747

4848
@classmethod
49-
def from_old_frequency_format(cls, locus: HLA_LOCUS, four_digit_code: str) -> Self:
49+
def from_old_frequency_format(
50+
cls, locus: HLA_LOCUS, four_digit_code: str
51+
) -> "OldName":
5052
"""
5153
Build an instance from an entry in the old frequency file format.
5254
@@ -71,7 +73,7 @@ class NewName:
7173
field_2: str
7274

7375
@classmethod
74-
def from_string(cls, new_name_str: str) -> Self:
76+
def from_string(cls, new_name_str: str) -> "NewName":
7577
"""
7678
Build an instance directly from an entry in the nomenclature mapping.
7779

src/easyhla/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from collections import defaultdict
55
from collections.abc import Iterable, Sequence
66
from datetime import datetime
7-
from typing import Final, Literal, Optional, Self, cast
7+
from typing import Final, Literal, Optional, cast
88

99
import numpy as np
1010
from Bio.SeqIO import SeqRecord
@@ -549,7 +549,7 @@ class StoredHLAStandards(BaseModel):
549549
checksum: Optional[str] = None
550550

551551
@model_validator(mode="after")
552-
def compute_compare_checksum(self) -> Self:
552+
def compute_compare_checksum(self) -> "StoredHLAStandards":
553553
checksum: str = compute_stored_standard_checksum(
554554
self.tag,
555555
self.commit_hash,

0 commit comments

Comments
 (0)