


import importlib.metadata
from typing import Union

from packaging.version import Version, parse

from .constants import STR_OPERATION_TO_FUNC


SCREAMING_SNAKE_CASE       :      List[Any]												= parse(importlib.metadata.version("torch"))



def 				UpperCamelCase_(      lowerCamelCase_							, lowerCamelCase_							, lowerCamelCase_ )    ->						List[Any]:
    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}''' )
    _lowercase       :							Optional[Any]      		=		STR_OPERATION_TO_FUNC[operation]
    if isinstance(lowerCamelCase_							, lowerCamelCase_ ):
        _lowercase       :							Union[str, Any]      		=		parse(importlib.metadata.version(lowerCamelCase_ ) )
    return operation(lowerCamelCase_							, parse(lowerCamelCase_ ) )



def 				UpperCamelCase_(      lowerCamelCase_							, lowerCamelCase_ )    ->						List[Any]:
    return compare_versions(lowerCamelCase_							, lowerCamelCase_							, lowerCamelCase_ )







"""simple docstring"""
def       _snake_case						(						UpperCamelCase						:		list						):
 if not isinstance(UpperCamelCase			,		UpperCamelCase						):
  raise ValueError("""Input series is not valid, valid series - [2, 4, 6]"""						)
 if len(UpperCamelCase						) == 0:
  raise ValueError("""Input list must be a non empty list"""						)
 if len(UpperCamelCase						) == 1:
  return True
 UpperCAmelCase	:					Union[str, Any]	=	series[1] - series[0]
 for index in range(len(UpperCamelCase						) - 1						):
  if series[index + 1] - series[index] != common_diff:
   return False
 return True

def       _snake_case						(						UpperCamelCase						:		list						):
 if not isinstance(UpperCamelCase			,		UpperCamelCase						):
  raise ValueError("""Input series is not valid, valid series - [2, 4, 6]"""						)
 if len(UpperCamelCase						) == 0:
  raise ValueError("""Input list must be a non empty list"""						)
 UpperCAmelCase	:					Any	=	0
 for val in series:
  answer += val
 return answer / len(UpperCamelCase						)


if __name__ == "__main__":
      import doctest

      doctest.testmod()
