8000 [BE][Ez]: Remove unnecessary type ignores from orderedset (#146902) · pytorch/pytorch@b61032f · GitHub
[go: up one dir, main page]

Skip to content

Commit b61032f

Browse files
Skylion007pytorchmergebot
authored andcommitted
[BE][Ez]: Remove unnecessary type ignores from orderedset (#146902)
After #145783, we can remove some type ignores from the ordered set class Pull Request resolved: #146902 Approved by: https://github.com/eellison
1 parent ce80865 commit b61032f

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

torch/utils/_ordered_set.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,22 +79,22 @@ def difference(self, *others: Iterable[T]) -> OrderedSet[T]:
7979

8080
def difference_update(self, *others: Iterable[T]) -> None:
8181
for other in others:
82-
self -= other # type: ignore[operator, arg-type]
82+
self -= other # type: ignore[arg-type]
8383

8484
def update(self, *others: Iterable[T]) -> None:
8585
for other in others:
86-
self |= other # type: ignore[operator, arg-type]
86+
self |= other
8787

8888
def intersection(self, *others: Iterable[T]) -> OrderedSet[T]:
8989
res = self.copy()
9090
for other in others:
9191
if other is not self:
92-
res &= other # type: ignore[operator, arg-type]
92+
res &= other # type: ignore[arg-type]
9393
return res
9494

9595
def intersection_update(self, *others: Iterable[T]) -> None:
9696
for other in others:
97-
self &= other # type: ignore[operator, arg-type]
97+
self &= other # type: ignore[arg-type]
9898

9999
def issubset(self, other: Iterable[T]) -> bool:
100100
return self <= self._wrap_iter_in_set(other)
@@ -103,17 +103,17 @@ def issuperset(self, other: Iterable[T]) -> bool:
103103
return self >= self._wrap_iter_in_set(other)
104104

105105
def symmetric_difference(self, other: Iterable[T]) -> OrderedSet[T]:
106-
return self ^ other # type: ignore[operator, arg-type]
106+
return self ^ other # type: ignore[operator]
107107

108108
def symmetric_difference_update(self, other: Iterable[T]) -> None:
109-
self ^= other # type: ignore[operator, arg-type]
109+
self ^= other # type: ignore[arg-type]
110110

111111
def union(self, *others: Iterable[T]) -> OrderedSet[T]:
112112
res = self.copy()
113113
for other in others:
114114
if other is self:
115115
continue
116-
res |= other # type: ignore[operator, arg-type]
116+
res |= other
117117
return res
118118

119119
# Specify here for correct type inference, otherwise would
@@ -132,15 +132,15 @@ def __ior__(self, other: Iterable[T]) -> OrderedSet[T]: # type: ignore[misc, ov
132132
return self
133133
return super().__ior__(other) # type: ignore[arg-type]
134134

135-
def __eq__(self, other: AbstractSet[T]) -> bool: # type: ignore[misc, override]
135+
def __eq__(self, other: object) -> bool:
136136
if isinstance(other, OrderedSet):
137137
return self._dict == other._dict
138-
return super().__eq__(other) # type: ignore[arg-type]
138+
return super().__eq__(other)
139139

140-
def __ne__(self, other: AbstractSet[T]) -> bool: # type: ignore[misc, override]
140+
def __ne__(self, other: object) -> bool:
141141
if isinstance(other, OrderedSet):
142142
return self._dict != other._dict
143-
return super().__ne__(other) # type: ignore[arg-type]
143+
return super().__ne__(other)
144144

145145
def __or__(self, other: AbstractSet[T_co]) -> OrderedSet[T]:
146146
return cast(OrderedSet[T], super().__or__(other))

0 commit comments

Comments
 (0)
0