Skip to content

Commit bf50db1

Browse files
fix mypy err
1 parent a804b70 commit bf50db1

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

mypy/nodes.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2210,8 +2210,8 @@ def is_star(self) -> bool:
22102210
@mypyc_attr(native_class=False)
22112211
class ArgKinds(list[ArgKind]):
22122212
def __init__(self, values: Iterable[ArgKind] = None) -> None:
2213-
self._count_cache: dict[ArgKind, int] = {}
2214-
self._index_cache: dict[ArgKind, int] = {}
2213+
self.__count_cache: dict[ArgKind, int] = {}
2214+
self.__index_cache: dict[ArgKind, int] = {}
22152215

22162216
@property
22172217
def positional_only(self) -> bool:
@@ -2229,16 +2229,19 @@ def has_star2(self) -> bool:
22292229
def has_any_star(self) -> bool:
22302230
return any(kind.is_star() for kind in self)
22312231

2232+
def copy(self) -> ArgKinds:
2233+
return ArgKinds(kind for kind in self)
2234+
22322235
def count(self, kind: ArgKind) -> int:
2233-
count = self._count_cache.get(kind)
2236+
count = self.__count_cache.get(kind)
22342237
if count is None:
2235-
count = self._count_cache[kind] = super().count(kind)
2238+
count = self.__count_cache[kind] = super().count(kind)
22362239
return count
22372240

22382241
def index(self, kind: ArgKind) -> int:
2239-
index = self._index_cache.get(kind)
2242+
index = self.__index_cache.get(kind)
22402243
if index is None:
2241-
index = self._index_cache[kind] = super().index(kind)
2244+
index = self.__index_cache[kind] = super().index(kind)
22422245
return index
22432246

22442247

0 commit comments

Comments
 (0)