from collections.abc import Sequence




def 	UpperCAmelCase   (						_lowerCamelCase ,    _lowerCamelCase = False    ):
			if not arr:
						return 0

			A							:					Dict              =						0 if allow_empty_subarrays else float("-inf"    )
			A							:					str              =						0.0
			for num in arr:
						A							:					int              =						max(0 if allow_empty_subarrays else num ,    curr_sum + num    )
						A							:					Tuple              =						max(_lowerCamelCase ,    _lowerCamelCase    )

			return max_sum


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

							testmod()

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




import os


# All paths are set with the intent you should run this script from the root of the repo with the command
# python utils/check_doctest_list.py
__SCREAMING_SNAKE_CASE           =  """."""


if __name__ == "__main__":
							__SCREAMING_SNAKE_CASE           =  os.path.join(REPO_PATH, """utils/documentation_tests.txt""")
							__SCREAMING_SNAKE_CASE           =  []
							__SCREAMING_SNAKE_CASE           =  []
							with open(doctest_file_path) as fp:
														for line in fp:
																					__SCREAMING_SNAKE_CASE           =  line.strip()
																					__SCREAMING_SNAKE_CASE           =  os.path.join(REPO_PATH, line)
																					if not (os.path.isfile(path) or os.path.isdir(path)):
																												non_existent_paths.append(line)
																					all_paths.append(path)
							if len(non_existent_paths) > 0:
														__SCREAMING_SNAKE_CASE           =  """\n""".join(non_existent_paths)
														raise ValueError(F"""`utils/documentation_tests.txt` contains non-existent paths:\n{non_existent_paths}""")
							if all_paths != sorted(all_paths):
														raise ValueError("""Files in `utils/documentation_tests.txt` are not in alphabetical order.""")