






'''simple docstring'''




import importlib.metadata
from typing import Union

from packaging.version import Version, parse

from .constants import STR_OPERATION_TO_FUNC


lowerCamelCase_												=					parse(importlib.metadata.version('''torch'''))

def 					__lowercase						(			__lowercase   ,  __lowercase   ,  __lowercase       )       ->						List[Any]:

      '''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			     =	STR_OPERATION_TO_FUNC[operation]
      if isinstance(__lowercase   ,  __lowercase       ):
            _A			     =	parse(importlib.metadata.version(__lowercase       )       )
      return operation(__lowercase   ,  parse(__lowercase       )       )


def 					__lowercase						(			__lowercase   ,  __lowercase       )       ->						Optional[Any]:

      '''simple docstring'''


      return compare_versions(__lowercase   ,  __lowercase   ,  __lowercase       )












import functools



def 		A_				(     _lowerCAmelCase							,   _lowerCAmelCase     )						-> int:
 UpperCamelCase	:					Optional[int]       	=   len(_lowerCAmelCase     )
 UpperCamelCase	:					List[str]       	=   len(_lowerCAmelCase     )

 @functools.cache
 def min_distance(_lowerCAmelCase							,   _lowerCAmelCase     ) -> int:
  # if first word index is overflow - delete all from the second word
  if indexa >= len_worda:
   return len_worda - indexa
  # if second word index is overflow - delete all from the first word
  if indexa >= len_worda:
   return len_worda - indexa
  UpperCamelCase	:					Union[str, Any]       	=   int(worda[indexa] != worda[indexa]     )  # current letters not identical
  return min(
      1 + min_distance(indexa + 1							,   _lowerCAmelCase     )							,   1 + min_distance(_lowerCAmelCase							,   indexa + 1     )							,   diff + min_distance(indexa + 1							,   indexa + 1     )							,   )

 return min_distance(0							,   0     )


if __name__ == "__main__":
    import doctest

    doctest.testmod()
