Skip to content

Commit cae6ffa

Browse files
committed
Improvement: overloads for OSW.load_entity
1 parent cf8e701 commit cae6ffa

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

‎src/osw/core.py‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import sys
1010
from copy import deepcopy
1111
from enum import Enum
12-
from typing import Any, Dict, List, Optional, Type, Union
12+
from typing import Any, Dict, List, Optional, Type, Union, overload
1313
from uuid import UUID, uuid4
1414
from warnings import warn
1515

@@ -729,6 +729,21 @@ class LoadEntityResult(BaseModel):
729729
entities: Union[model.Entity, List[model.Entity]]
730730
"""The dataclass instance(s)"""
731731

732+
# fmt: off
733+
@overload
734+
def load_entity(self, entity_title: str) -> model.Entity:
735+
...
736+
737+
@overload
738+
def load_entity(self, entity_title: List[str]) -> List[model.Entity]:
739+
...
740+
741+
@overload
742+
def load_entity(self, entity_title: LoadEntityParam) -> LoadEntityResult:
743+
...
744+
745+
# fmt: on
746+
732747
def load_entity(
733748
self, entity_title: Union[str, List[str], LoadEntityParam]
734749
) -> Union[model.Entity, List[model.Entity], LoadEntityResult]:

0 commit comments

Comments
 (0)