


import logging
import os
from logging import (
    CRITICAL,  # NOQA
    DEBUG,  # NOQA
    ERROR,  # NOQA
    FATAL,  # NOQA
    INFO,  # NOQA
    NOTSET,  # NOQA
    WARN,  # NOQA
    WARNING,  # NOQA
)
from typing import Optional

from tqdm import auto as tqdm_lib


SCREAMING_SNAKE_CASE       :      Dict												= {
    "debug": logging.DEBUG,
    "info": logging.INFO,
    "warning": logging.WARNING,
    "error": logging.ERROR,
    "critical": logging.CRITICAL,
}

SCREAMING_SNAKE_CASE       :      str												= logging.WARNING



def 				UpperCamelCase_(      )    ->						Optional[int]:
    _lowercase       :							Union[str, Any]      		=		os.getenv('DATASETS_VERBOSITY'							, lowerCamelCase_ )
    if env_level_str:
        if env_level_str in log_levels:
            return log_levels[env_level_str]
        else:
            logging.getLogger().warning(
                F'''Unknown option DATASETS_VERBOSITY={env_level_str}, '''
                F'''has to be one of: { ", ".join(log_levels.keys() ) }''' )
    return _default_log_level



def 				UpperCamelCase_(      )    ->						Optional[int]:
    return __name__.split('.' )[0]



def 				UpperCamelCase_(      )    ->						Dict:
    return logging.getLogger(_get_library_name() )



def 				UpperCamelCase_(      )    ->						List[Any]:
    # Apply our default configuration to the library root logger.
    _lowercase       :							List[Any]      		=		_get_library_root_logger()
    library_root_logger.setLevel(_get_default_logging_level() )



def 				UpperCamelCase_(      )    ->						Optional[Any]:
    _lowercase       :							Optional[Any]      		=		_get_library_root_logger()
    library_root_logger.setLevel(logging.NOTSET )



def 				UpperCamelCase_(      lowerCamelCase_ = None )    ->						Tuple:
    if name is None:
        _lowercase       :							int      		=		_get_library_name()
    return logging.getLogger(lowerCamelCase_ )



def 				UpperCamelCase_(      )    ->						int:
    return _get_library_root_logger().getEffectiveLevel()



def 				UpperCamelCase_(      lowerCamelCase_ )    ->						int:
    _get_library_root_logger().setLevel(lowerCamelCase_ )



def 				UpperCamelCase_(      )    ->						Tuple:
    return set_verbosity(lowerCamelCase_ )



def 				UpperCamelCase_(      )    ->						str:
    return set_verbosity(lowerCamelCase_ )



def 				UpperCamelCase_(      )    ->						Union[str, Any]:
    return set_verbosity(lowerCamelCase_ )



def 				UpperCamelCase_(      )    ->						Tuple:
    return set_verbosity(lowerCamelCase_ )



def 				UpperCamelCase_(      )    ->						List[str]:
    _lowercase       :							Optional[Any]      		=		False



def 				UpperCamelCase_(      )    ->						Any:
    _lowercase       :							List[Any]      		=		True


# Configure the library root logger at the module level (singleton-like)
_configure_library_root_logger()






class _lowerCamelCase:
       def __init__(					self,      *lowerCamelCase,      **lowerCamelCase)       ->   int:  # pylint: disable=unused-argument




           """simple docstring"""

           _lowercase       :							str      		=		args[0] if args else None
       def __iter__(					self)       ->   List[Any]:




           """simple docstring"""

           return iter(self._iterator)
       def __getattr__(					self,      lowerCamelCase)       ->   Tuple:




           """simple docstring"""

           def empty_fn(*lowerCamelCase,      **lowerCamelCase):  # pylint: disable=unused-argument
               return

           return empty_fn
       def __enter__(					self)       ->   int:




           """simple docstring"""

           return self




       def __exit__(					self,      lowerCamelCase,      lowerCamelCase,      lowerCamelCase)       ->   str:




           """simple docstring"""

           return


SCREAMING_SNAKE_CASE       :      List[Any]												= True






class _lowerCamelCase:
       def __call__(					self,      *lowerCamelCase,      lowerCamelCase=False,      **lowerCamelCase)       ->   Optional[int]:




           """simple docstring"""

           if _tqdm_active and not disable:
               return tqdm_lib.tqdm(*_SCREAMING_SNAKE_CASE,      **_SCREAMING_SNAKE_CASE)
           else:
               return EmptyTqdm(*_SCREAMING_SNAKE_CASE,      **_SCREAMING_SNAKE_CASE)
       def 			UpperCamelCase     (					self,      *lowerCamelCase,      **lowerCamelCase)       ->   Tuple:




           """simple docstring"""

           _lowercase       :							str      		=		None
           if _tqdm_active:
               return tqdm_lib.tqdm.set_lock(*_SCREAMING_SNAKE_CASE,      **_SCREAMING_SNAKE_CASE)




       def 			UpperCamelCase     (					self)       ->   Dict:




           """simple docstring"""

           if _tqdm_active:
               return tqdm_lib.tqdm.get_lock()


SCREAMING_SNAKE_CASE       :      List[Any]												= _tqdm_cls()



def 				UpperCamelCase_(      )    ->						Optional[Any]:
    global _tqdm_active
    return bool(_tqdm_active )



def 				UpperCamelCase_(      )    ->						Tuple:
    global _tqdm_active
    _lowercase       :							Optional[Any]      		=		True



def 				UpperCamelCase_(      )    ->						Tuple:
    global _tqdm_active
    _lowercase       :							Tuple      		=		False







"""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()
