Skip to content

Commit 27c9382

Browse files
authored
Correct TypeVar usage for Validators (#1042)
The TypeVar usage was indicating that ALL validators available in _VALIDATORS would have the same type. This update only indicates that these validators are an instance of the ValidatorBase.
1 parent 3e0b2a3 commit 27c9382

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

openhtf/util/validators.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ def __call__(self, value) -> bool:
7070
"""Should validate value, returning a boolean result."""
7171

7272

73-
_ValidatorT = TypeVar("_ValidatorT", bound=ValidatorBase)
74-
_ValidatorFactoryT = Union[Type[_ValidatorT], Callable[..., _ValidatorT]]
73+
_ValidatorFactoryT = Union[Callable[..., ValidatorBase]]
7574
_VALIDATORS: Dict[str, _ValidatorFactoryT] = {}
7675

7776

@@ -88,7 +87,7 @@ def has_validator(name: str) -> bool:
8887
return name in _VALIDATORS
8988

9089

91-
def create_validator(name: str, *args, **kwargs) -> _ValidatorT:
90+
def create_validator(name: str, *args, **kwargs) -> ValidatorBase:
9291
return _VALIDATORS[name](*args, **kwargs)
9392

9493

0 commit comments

Comments
 (0)