import importlib.metadata
from typing import Union

from packaging.version import Version, parse

from .constants import STR_OPERATION_TO_FUNC


_UpperCAmelCase          =						parse(importlib.metadata.version("""torch"""))




def 							UpperCamelCase		(			__lowercase		:					Union[str, Version]		,__lowercase		:					str		,__lowercase		:					str      ):
		'''simple docstring'''




		if operation not in STR_OPERATION_TO_FUNC.keys():
				raise ValueError(f'''`operation` must be one of {list(STR_OPERATION_TO_FUNC.keys()      )}, received {operation}'''      )
		A_						:							Optional[int]      = STR_OPERATION_TO_FUNC[operation]
		if isinstance(__lowercase		,__lowercase      ):
				A_						:							str      = parse(importlib.metadata.version(__lowercase      )      )
		return operation(__lowercase		,parse(__lowercase      )      )




def 							UpperCamelCase		(			__lowercase		:					str		,__lowercase		:					str      ):
		'''simple docstring'''




		return compare_versions(__lowercase		,__lowercase		,__lowercase      )







# flake8: noqa
# Lint as: python3
_UpperCAmelCase          =						[
    """VerificationMode""",
    """Version""",
    """disable_progress_bar""",
    """enable_progress_bar""",
    """is_progress_bar_enabled""",
    """experimental""",
]

from .info_utils import VerificationMode
from .logging import disable_progress_bar, enable_progress_bar, is_progress_bar_enabled
from .version import Version
from .experimental import experimental






