cli: typing

This commit is contained in:
James R. Barlow
2020-12-11 14:14:21 -08:00
parent 0b7e52fb5e
commit 156d5d9a9c
+4 -1
View File
@@ -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