





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


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

UpperCAmelCase_ 							=       logging.WARNING





def   lowerCamelCase__       (       )     ->	Optional[int]:



					'''simple docstring'''




					_snake_case													=			os.getenv('DATASETS_VERBOSITY'    ,      UpperCamelCase__  )
					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   lowerCamelCase__       (       )     ->	str:



					'''simple docstring'''




					return __name__.split('.'  )[0]





def   lowerCamelCase__       (       )     ->	logging.Logger:



					'''simple docstring'''




					return logging.getLogger(_get_library_name()  )





def   lowerCamelCase__       (       )     ->	None:



					'''simple docstring'''




					_snake_case													=			_get_library_root_logger()
					library_root_logger.setLevel(_get_default_logging_level()  )





def   lowerCamelCase__       (       )     ->	None:



					'''simple docstring'''




					_snake_case													=			_get_library_root_logger()
					library_root_logger.setLevel(logging.NOTSET  )





def   lowerCamelCase__       (       UpperCamelCase__     :    Optional[str] = None  )     ->	logging.Logger:



					'''simple docstring'''




					if name is None:
										_snake_case													=			_get_library_name()
					return logging.getLogger(UpperCamelCase__  )





def   lowerCamelCase__       (       )     ->	int:



					'''simple docstring'''




					return _get_library_root_logger().getEffectiveLevel()





def   lowerCamelCase__       (       UpperCamelCase__     :    int  )     ->	None:



					'''simple docstring'''




					_get_library_root_logger().setLevel(UpperCamelCase__  )





def   lowerCamelCase__       (       )     ->	int:



					'''simple docstring'''




					return set_verbosity(UpperCamelCase__  )





def   lowerCamelCase__       (       )     ->	Union[str, Any]:



					'''simple docstring'''




					return set_verbosity(UpperCamelCase__  )





def   lowerCamelCase__       (       )     ->	Union[str, Any]:



					'''simple docstring'''




					return set_verbosity(UpperCamelCase__  )





def   lowerCamelCase__       (       )     ->	int:



					'''simple docstring'''




					return set_verbosity(UpperCamelCase__  )





def   lowerCamelCase__       (       )     ->	None:



					'''simple docstring'''




					_snake_case													=			False





def   lowerCamelCase__       (       )     ->	None:



					'''simple docstring'''




					_snake_case													=			True


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




					def __init__(						self			,  *lowerCAmelCase_			,  **lowerCAmelCase_					)						->							Optional[Any]:  # pylint: disable=unused-argument
										_snake_case													=			args[0] if args else None




					def __iter__(						self					)						->							str:
										return iter(self._iterator					)




					def __getattr__(						self			,  lowerCAmelCase_					)						->							List[str]:

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

										return empty_fn




					def __enter__(						self					)						->							str:
										return self






					def __exit__(						self			,  lowerCAmelCase_			,  lowerCAmelCase_			,  lowerCAmelCase_					)						->							List[Any]:
										return





UpperCAmelCase_ 							=       True
class      UpperCamelCase_						:




					def __call__(						self			,  *lowerCAmelCase_			,  lowerCAmelCase_=False			,  **lowerCAmelCase_					)						->							Union[str, Any]:
										if _tqdm_active and not disable:
															return tqdm_lib.tqdm(*lowerCAmelCase_			,  **lowerCAmelCase_					)
										else:
															return EmptyTqdm(*lowerCAmelCase_			,  **lowerCAmelCase_					)




					def 		lowerCAmelCase     (						self			,  *lowerCAmelCase_			,  **lowerCAmelCase_					)						->							Optional[Any]:
										_snake_case													=			None
										if _tqdm_active:
															return tqdm_lib.tqdm.set_lock(*lowerCAmelCase_			,  **lowerCAmelCase_					)






					def 		lowerCAmelCase     (						self					)						->							str:
										if _tqdm_active:
															return tqdm_lib.tqdm.get_lock()





UpperCAmelCase_ 							=       _tqdm_cls()





def   lowerCamelCase__       (       )     ->	bool:



					'''simple docstring'''




					global _tqdm_active
					return bool(_tqdm_active  )





def   lowerCamelCase__       (       )     ->	List[str]:



					'''simple docstring'''




					global _tqdm_active
					_snake_case													=			True





def   lowerCamelCase__       (       )     ->	int:



					'''simple docstring'''




					global _tqdm_active
					_snake_case													=			False










from collections.abc import Sequence





def   lowerCamelCase__       (       UpperCamelCase__     :    Sequence[float]    ,      UpperCamelCase__     :    bool = False  )     ->	float:



					'''simple docstring'''




					if not arr:
										return 0

					_snake_case													=			0 if allow_empty_subarrays else float('-inf'  )
					_snake_case													=			0.0
					for num in arr:
										_snake_case													=			max(0 if allow_empty_subarrays else num    ,      curr_sum + num  )
										_snake_case													=			max(UpperCamelCase__    ,      UpperCamelCase__  )

					return max_sum


if __name__ == "__main__":
					from doctest import testmod

					testmod()

					UpperCAmelCase_ 							=       [-2, 1, -3, 4, -1, 2, 1, -5, 4]
					print(F"{max_subarray_sum(nums) = }")



