Skip to content

Commit 7f36190

Browse files
committed
Detail type hints
1 parent c727e56 commit 7f36190

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

supar/utils/vocab.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from collections import Counter, defaultdict
66
from collections.abc import Iterable
7-
from typing import Tuple
7+
from typing import Tuple, Union
88

99

1010
class Vocab(object):
@@ -40,7 +40,7 @@ def __init__(self, counter: Counter, min_freq: int = 1, specials: Tuple = tuple(
4040
def __len__(self):
4141
return len(self.itos)
4242

43-
def __getitem__(self, key):
43+
def __getitem__(self, key: Union[int, str, Iterable]) -> Union[str, int, Iterable]:
4444
if isinstance(key, str):
4545
return self.stoi[key]
4646
elif not isinstance(key, Iterable):

0 commit comments

Comments
 (0)