Repository: mit-ll-responsible-ai/hydra-zen

Issue:
`validates_with_beartype` considers `Partial` as `NoneType`
Hi @rsokl. I was having a blast using this fascinating library. But It seems when used with `hydra_zen.third_party.validates_with_beartype`, it casts `hydra_zen.typing.Partial` as `NoneType`. 


```python
from hydra_zen.typing import Partial
from hydra_zen.third_party.beartype import validates_with_beartype


def f(x: Partial[list]):
    return x


val_f = validates_with_beartype(f)

val_f(3)
```

It raises the following error. Can you take a look?

```bash
beartype.roar.BeartypeCallHintParamViolation: @beartyped __main__.f() 
parameter x=3 violates type hint None, as int 3 not instance of <class "builtins.NoneType">.
```


Discussion:

Resolving patch:
diff --git a/src/hydra_zen/typing/_implementations.py b/src/hydra_zen/typing/_implementations.py
--- a/src/hydra_zen/typing/_implementations.py
+++ b/src/hydra_zen/typing/_implementations.py
@@ -108,7 +108,7 @@ def __new__(
     ) -> Self:
         ...
 
-    if sys.version_info >= (3, 9):  # pragma: no cover
+    if TYPE_CHECKING and sys.version_info >= (3, 9):  # pragma: no cover
 
         def __class_getitem__(cls, item: Any) -> types.GenericAlias:
             ...


Test patch:
diff --git a/tests/test_protocols.py b/tests/test_protocols.py
--- a/tests/test_protocols.py
+++ b/tests/test_protocols.py
@@ -146,3 +146,8 @@ def test_protocol_checkers(x, yes_builds, yes_just, yes_partial):
 def test_partial_protocol():
     assert isinstance(partial(int), Partial)
     assert not isinstance(print, Partial)
+
+
+def test_parameterized_partial_regression():
+    # https://github.com/mit-ll-responsible-ai/hydra-zen/issues/352
+    assert Partial[int].__origin__ is Partial  # type: ignore
diff --git a/tests/test_py39.py b/tests/test_py39.py
--- a/tests/test_py39.py
+++ b/tests/test_py39.py
@@ -20,7 +20,8 @@
 )
 def test_sanitized_type_expected_behavior(in_type, expected_type):
     # tests collections-as-generics introduced in py39
-    assert sanitized_type(in_type) is expected_type
+    actual = sanitized_type(in_type)
+    assert actual is expected_type or actual == expected_type
 
     @dataclass
     class Tmp:
diff --git a/tests/test_third_party/test_using_beartype.py b/tests/test_third_party/test_using_beartype.py
--- a/tests/test_third_party/test_using_beartype.py
+++ b/tests/test_third_party/test_using_beartype.py
@@ -1,12 +1,21 @@
 # Copyright (c) 2022 Massachusetts Institute of Technology
 # SPDX-License-Identifier: MIT
 
+from functools import partial
+from typing import Type
+
 import pytest
 from beartype.cave import RegexTypes
 from beartype.vale import Is
 from typing_extensions import Annotated
 
+from hydra_zen import builds
 from hydra_zen.third_party.beartype import validates_with_beartype
+from hydra_zen.typing import Builds, Partial
+
+
+def func(x: int) -> float:
+    ...
 
 
 @pytest.mark.parametrize(
@@ -14,6 +23,8 @@
     [
         (RegexTypes, "abc+", 22),
         (Annotated[str, Is[lambda text: 2 == len(text)]], "hi", "bye"),
+        (Partial[float], partial(func), func),
+        (Builds[Type[float]], builds(func), func),
     ],
 )
 def test_beartype_specific_fields(custom_type, good_val, bad_val):