From f07374d41f3e725b3adbf375e6d4dbeec1715ce1 Mon Sep 17 00:00:00 2001 From: brentyi Date: Wed, 18 Dec 2024 15:38:20 -0800 Subject: [PATCH] Comments --- src/tyro/_unsafe_cache.py | 3 +++ tests/test_dcargs.py | 5 +++-- tests/test_py311_generated/test_dcargs_generated.py | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/tyro/_unsafe_cache.py b/src/tyro/_unsafe_cache.py index d78ef1af..c1681410 100644 --- a/src/tyro/_unsafe_cache.py +++ b/src/tyro/_unsafe_cache.py @@ -50,6 +50,9 @@ def wrapped_f(*args, **kwargs): def unsafe_hash(obj: Any) -> Any: + """We include the types to match functools. + + Some context: https://github.com/brentyi/tyro/issues/214""" try: return type(obj), hash(obj) except TypeError: diff --git a/tests/test_dcargs.py b/tests/test_dcargs.py index f45286db..1db78393 100644 --- a/tests/test_dcargs.py +++ b/tests/test_dcargs.py @@ -21,9 +21,8 @@ ) import pytest -from typing_extensions import Annotated, Final, Literal, TypeAlias, runtime_checkable - import tyro +from typing_extensions import Annotated, Final, Literal, TypeAlias, runtime_checkable def test_no_args() -> None: @@ -957,6 +956,8 @@ class NumericTower: def test_runtime_checkable_edge_case() -> None: + """From Kevin Black: https://github.com/brentyi/tyro/issues/214""" + @runtime_checkable class DummyProtocol(Protocol): pass diff --git a/tests/test_py311_generated/test_dcargs_generated.py b/tests/test_py311_generated/test_dcargs_generated.py index 3cce1b13..fdcbcfab 100644 --- a/tests/test_py311_generated/test_dcargs_generated.py +++ b/tests/test_py311_generated/test_dcargs_generated.py @@ -960,6 +960,8 @@ class NumericTower: def test_runtime_checkable_edge_case() -> None: + """From Kevin Black: https://github.com/brentyi/tyro/issues/214""" + @runtime_checkable class DummyProtocol(Protocol): pass