mirror of
https://github.com/ROCm/jax.git
synced 2025-04-16 11:56:07 +00:00
Merge pull request #11613 from jakevdp:deadcode
PiperOrigin-RevId: 463312795
This commit is contained in:
commit
eb0f952ce1
@ -441,18 +441,6 @@ def tuple_delete(t, idx):
|
||||
assert 0 <= idx < len(t), (idx, len(t))
|
||||
return t[:idx] + t[idx + 1:]
|
||||
|
||||
# TODO(mattjj): replace with dataclass when Python 2 support is removed
|
||||
def taggedtuple(name, fields) -> Callable[..., Any]:
|
||||
"""Lightweight version of namedtuple where equality depends on the type."""
|
||||
def __new__(cls, *xs):
|
||||
return tuple.__new__(cls, (cls,) + xs)
|
||||
def __repr__(self):
|
||||
return f'{name}{tuple.__str__(self[1:])}'
|
||||
class_namespace = {'__new__' : __new__, '__repr__': __repr__}
|
||||
for i, f in enumerate(fields):
|
||||
class_namespace[f] = property(operator.itemgetter(i+1)) # type: ignore
|
||||
return type(name, (tuple,), class_namespace)
|
||||
|
||||
class HashableFunction:
|
||||
"""Decouples function equality and hash from its identity.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user