

'''simple docstring'''





def 				_lowerCAmelCase			(   __magic_name__						:     int						)				->  None:
						lowercase :							int    		=generate_pascal_triangle(__magic_name__						)
						for row_idx in range(__magic_name__						):
												# Print left spaces
												for _ in range(num_rows - row_idx - 1						):
																		print(end=''' '''						)
												# Print row values
												for col_idx in range(row_idx + 1						):
																		if col_idx != row_idx:
																								print(triangle[row_idx][col_idx]   , end=''' '''						)
																		else:
																								print(triangle[row_idx][col_idx]   , end=''''''						)
												print()






def 				_lowerCAmelCase			(   __magic_name__						:     int						)				->  list[list[int]]:

						if not isinstance(__magic_name__   , __magic_name__						):
												raise TypeError('''The input value of \'num_rows\' should be \'int\''''						)

						if num_rows == 0:
												return []
						elif num_rows < 0:
												raise ValueError(
												    '''The input value of \'num_rows\' should be greater than or equal to 0'''						)

						lowercase :							list[list[int]]    		=[]
						for current_row_idx in range(__magic_name__						):
												lowercase :							List[str]    		=populate_current_row(__magic_name__   , __magic_name__						)
												triangle.append(__magic_name__						)
						return triangle






def 				_lowerCAmelCase			(   __magic_name__						:     list[list[int]]   , __magic_name__						:     int						)				->  list[int]:
						lowercase :							int    		=[-1] * (current_row_idx + 1)
						# first and last elements of current row are equal to 1
						lowercase		,	lowercase :							Any    		=1, 1
						for current_col_idx in range(1   , __magic_name__						):
												calculate_current_element(
												    __magic_name__   , __magic_name__   , __magic_name__   , __magic_name__						)
						return current_row






def 				_lowerCAmelCase			(   __magic_name__						:     list[list[int]]   , __magic_name__						:     list[int]   , __magic_name__						:     int   , __magic_name__						:     int   , )				->  None:
						lowercase :							Any    		=triangle[current_row_idx - 1][current_col_idx - 1]
						lowercase :							Union[str, Any]    		=triangle[current_row_idx - 1][current_col_idx]
						lowercase :							int    		=above_to_left_elt + above_to_right_elt






def 				_lowerCAmelCase			(   __magic_name__						:     int						)				->  list[list[int]]:

						if not isinstance(__magic_name__   , __magic_name__						):
												raise TypeError('''The input value of \'num_rows\' should be \'int\''''						)

						if num_rows == 0:
												return []
						elif num_rows < 0:
												raise ValueError(
												    '''The input value of \'num_rows\' should be greater than or equal to 0'''						)

						lowercase :							list[list[int]]    		=[[1]]

						for row_index in range(1   , __magic_name__						):
												lowercase :							List[str]    		=[0] + result[-1] + [0]
												lowercase :							Tuple    		=row_index + 1
												# Calculate the number of distinct elements in a row
												lowercase :							List[Any]    		=sum(divmod(__magic_name__   , 2						)						)
												lowercase :							int    		=[
												    temp_row[i - 1] + temp_row[i] for i in range(1   , distinct_elements + 1						)
												]
												lowercase :							Union[str, Any]    		=row_first_half[: (row_index + 1) // 2]
												row_second_half.reverse()
												lowercase :							str    		=row_first_half + row_second_half
												result.append(__magic_name__						)

						return result






def 				_lowerCAmelCase			(   )				->  None:
						from collections.abc import Callable
						from timeit import timeit

						def benchmark_a_function(__magic_name__						:     Callable   , __magic_name__						:     int						) -> None:
												lowercase :							str    		=f'''{func.__name__}({value})'''
												lowercase :							Optional[Any]    		=timeit(f'''__main__.{call}'''   , setup='''import __main__'''						)
												# print(f"{call:38} = {func(value)} -- {timing:.4f} seconds")
												print(f'''{call:38} -- {timing:.4f} seconds'''						)

						for value in range(15						):  # (1, 7, 14):
												for func in (generate_pascal_triangle, generate_pascal_triangle_optimized):
																		benchmark_a_function(__magic_name__   , __magic_name__						)
												print()


if __name__ == "__main__":
							import doctest

							doctest.testmod()
							benchmark()








'''simple docstring'''





# tests directory-specific settings - this file is run automatically
# by pytest before any tests are run

import doctest
import sys
import warnings
from os.path import abspath, dirname, join

import _pytest

from transformers.testing_utils import HfDoctestModule, HfDocTestParser


# allow having multiple repository checkouts and not needing to remember to rerun
# 'pip install -e .[dev]' when switching between checkouts and running tests.
UpperCamelCase_    						=       abspath(join(dirname(__file__), """src"""))
sys.path.insert(1, git_repo_path)

# silence FutureWarning warnings in tests since often we can't act on them until
# they become normal warnings - i.e. the tests still need to test the current functionality
warnings.simplefilter(action="""ignore""", category=FutureWarning)






def 				_lowerCAmelCase			(   __magic_name__						:     int						)				->  Tuple:
						config.addinivalue_line(
						    '''markers'''   , '''is_pt_tf_cross_test: mark test to run only when PT and TF interactions are tested'''						)
						config.addinivalue_line(
						    '''markers'''   , '''is_pt_flax_cross_test: mark test to run only when PT and FLAX interactions are tested'''						)
						config.addinivalue_line('''markers'''   , '''is_pipeline_test: mark test to run only when pipelines are tested'''						)
						config.addinivalue_line('''markers'''   , '''is_staging_test: mark test to run only in the staging environment'''						)
						config.addinivalue_line('''markers'''   , '''accelerate_tests: mark test that require accelerate'''						)
						config.addinivalue_line('''markers'''   , '''tool_tests: mark the tool tests that are run on their specific schedule'''						)






def 				_lowerCAmelCase			(   __magic_name__						:     int						)				->  Any:
						from transformers.testing_utils import pytest_addoption_shared

						pytest_addoption_shared(__magic_name__						)






def 				_lowerCAmelCase			(   __magic_name__						:     Any						)				->  Any:
						from transformers.testing_utils import pytest_terminal_summary_main

						lowercase :							Optional[Any]    		=terminalreporter.config.getoption('''--make-reports'''						)
						if make_reports:
												pytest_terminal_summary_main(__magic_name__   , id=__magic_name__						)






def 				_lowerCAmelCase			(   __magic_name__						:     Tuple   , __magic_name__						:     Union[str, Any]						)				->  List[str]:
						# If no tests are collected, pytest exists with code 5, which makes the CI fail.
						if exitstatus == 5:
												lowercase :							Optional[int]    		=0


# Doctest custom flag to ignore output.
UpperCamelCase_    						=       doctest.register_optionflag("""IGNORE_RESULT""")

UpperCamelCase_    						=       doctest.OutputChecker





class 		__SCREAMING_SNAKE_CASE							(			lowercase__      ):







				def  lowerCamelCase_	(       self     :		Optional[Any]		,					UpperCAmelCase__     :		Union[str, Any]		,					UpperCAmelCase__     :		List[Any]		,					UpperCAmelCase__     :		List[Any]   ):
										'''simple docstring'''
										if IGNORE_RESULT & optionflags:
																return True
										return OutputChecker.check_output(self		,					UpperCAmelCase__		,					UpperCAmelCase__		,					UpperCAmelCase__   )



UpperCamelCase_    						=       CustomOutputChecker
UpperCamelCase_    						=       HfDoctestModule







UpperCamelCase_    						=       HfDocTestParser





