diff --git a/src/ocrmypdf/cli.py b/src/ocrmypdf/cli.py index 6d8d4296..24d5e036 100644 --- a/src/ocrmypdf/cli.py +++ b/src/ocrmypdf/cli.py @@ -6,12 +6,15 @@ import argparse +from typing import Optional, Type, TypeVar from ocrmypdf._version import PROGRAM_NAME as _PROGRAM_NAME from ocrmypdf._version import __version__ as _VERSION +T = TypeVar('T') -def numeric(basetype, min_=None, max_=None): + +def numeric(basetype: Type[T], min_: Optional[T] = None, max_: Optional[T] = None): """Validator for numeric params""" min_ = basetype(min_) if min_ is not None else None max_ = basetype(max_) if max_ is not None else None