Skip to content

Commit 14082f5

Browse files
iosayincclauss
andauthored
refactor(heap): remove redundant TypeVar in Heap (#15504)
* refactor(heap): remove redundant TypeVar in Heap * refactor(heap): revert Comparable.__gt__ signature to self: T, other: T * Clean up imports in heap.py Removed unused TypeVar import from heap.py * Update __gt__ method signature in Comparable class --------- Co-authored-by: Christian Clauss <cclauss@me.com>
1 parent c9953bb commit 14082f5

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

‎data_structures/heap/heap.py‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,15 @@
22

33
from abc import abstractmethod
44
from collections.abc import Iterable
5-
from typing import Protocol, TypeVar
5+
from typing import Protocol
66

77

88
class Comparable(Protocol):
99
@abstractmethod
10-
def __gt__(self: T, other: T, /) -> bool:
10+
def __gt__(self, other: object, /) -> bool:
1111
pass
1212

1313

14-
T = TypeVar("T", bound=Comparable)
15-
16-
1714
class Heap[T: Comparable]:
1815
"""A Max Heap Implementation
1916

0 commit comments

Comments
 (0)