


def 	_lowerCAmelCase					( UpperCamelCase__:  List[str]    )			-> Optional[Any]:





	"""simple docstring"""







	A             =					generate_pascal_triangle(lowerCAmelCase__    )
	for row_idx in range(lowerCAmelCase__    ):
		# 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					( UpperCamelCase__:  Dict    )			-> str:





	"""simple docstring"""







	if not isinstance(lowerCAmelCase__				,       lowerCAmelCase__    ):
		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"""    )

	A             =					[]
	for current_row_idx in range(lowerCAmelCase__    ):
		A             =					populate_current_row(lowerCAmelCase__				,       lowerCAmelCase__    )
		triangle.append(lowerCAmelCase__    )
	return triangle





def 	_lowerCAmelCase					( UpperCamelCase__:  List[Any]				,       UpperCamelCase__:  int    )			-> List[str]:





	"""simple docstring"""







	A             =					[-1] * (current_row_idx + 1)
	# first and last elements of current row are equal to 1
	A       ,      A             =					1, 1
	for current_col_idx in range(1				,       lowerCAmelCase__    ):
		calculate_current_element(
		    lowerCAmelCase__				,       lowerCAmelCase__				,       lowerCAmelCase__				,       lowerCAmelCase__    )
	return current_row





def 	_lowerCAmelCase					( UpperCamelCase__:  Tuple				,       UpperCamelCase__:  List[Any]				,       UpperCamelCase__:  List[str]				,       UpperCamelCase__:  Dict				,       )			-> Optional[int]:





	"""simple docstring"""







	A             =					triangle[current_row_idx - 1][current_col_idx - 1]
	A             =					triangle[current_row_idx - 1][current_col_idx]
	A             =					above_to_left_elt + above_to_right_elt





def 	_lowerCAmelCase					( UpperCamelCase__:  List[Any]    )			-> str:





	"""simple docstring"""







	if not isinstance(lowerCAmelCase__				,       lowerCAmelCase__    ):
		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"""    )

	A             =					[[1]]

	for row_index in range(1				,       lowerCAmelCase__    ):
		A             =					[0] + result[-1] + [0]
		A             =					row_index + 1
		# Calculate the number of distinct elements in a row
		A             =					sum(divmod(lowerCAmelCase__				,       2    )    )
		A             =					[
		    temp_row[i - 1] + temp_row[i] for i in range(1				,       distinct_elements + 1    )
		]
		A             =					row_first_half[: (row_index + 1) // 2]
		row_second_half.reverse()
		A             =					row_first_half + row_second_half
		result.append(lowerCAmelCase__    )

	return result





def 	_lowerCAmelCase					( )			-> List[Any]:





	"""simple docstring"""







	from collections.abc import Callable
	from timeit import timeit

	def benchmark_a_function(UpperCamelCase__:  Any				,       UpperCamelCase__:  int    ) -> None:
		A             =					f'{func.__name__}({value})'
		A             =					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(lowerCAmelCase__				,       lowerCAmelCase__    )
		print()


if __name__ == "__main__":
				import doctest

				doctest.testmod()
				benchmark()





"""simple docstring"""


import os
from collections import namedtuple

import pytest

from datasets import ClassLabel, Features, Sequence, Value
from datasets.commands.test import TestCommand
from datasets.info import DatasetInfo, DatasetInfosDict


A_    							=					namedtuple(
    """_TestCommandArgs""",
    [
        """dataset""",
        """name""",
        """cache_dir""",
        """data_dir""",
        """all_configs""",
        """save_infos""",
        """ignore_verifications""",
        """force_redownload""",
        """clear_cache""",
    ],
    defaults=[None, None, None, False, False, False, False, False],
)






def  lowercase						(	lowerCAmelCase__	,lowerCAmelCase__						):
			return (abs(source - target						) / target) < 0.01






@pytest.mark.integration
def  lowercase						(	lowerCAmelCase__						):
			lowerCamelCase_					=  _TestCommandArgs(dataset=lowerCAmelCase__	,all_configs=lowerCAmelCase__	,save_infos=lowerCAmelCase__						)
			lowerCamelCase_					=  TestCommand(*lowerCAmelCase__						)
			test_command.run()
			lowerCamelCase_					=  os.path.join(lowerCAmelCase__	,'''README.md'''						)
			assert os.path.exists(lowerCAmelCase__						)
			lowerCamelCase_					=  DatasetInfosDict.from_directory(lowerCAmelCase__						)
			lowerCamelCase_					=  DatasetInfosDict(
			    {
			        '''default''': DatasetInfo(
			            features=Features(
			                {
			                    '''tokens''': Sequence(Value('''string'''						)						),
			                    '''ner_tags''': Sequence(
			                        ClassLabel(names=['''O''', '''B-PER''', '''I-PER''', '''B-ORG''', '''I-ORG''', '''B-LOC''', '''I-LOC''']						)						),
			                    '''langs''': Sequence(Value('''string'''						)						),
			                    '''spans''': Sequence(Value('''string'''						)						),
			                }						)	,splits=[
			                {
			                    '''name''': '''train''',
			                    '''num_bytes''': 2_351_563,
			                    '''num_examples''': 10_000,
			                },
			                {
			                    '''name''': '''validation''',
			                    '''num_bytes''': 238_418,
			                    '''num_examples''': 1_000,
			                },
			            ]	,download_size=3_940_680	,dataset_size=2_589_981	,)
			    }						)
			assert dataset_infos.keys() == expected_dataset_infos.keys()
			for key in DatasetInfo._INCLUDED_INFO_IN_YAML:
						lowerCamelCase_		, lowerCamelCase_					=  getattr(dataset_infos['''default''']	,lowerCAmelCase__						), getattr(expected_dataset_infos['''default''']	,lowerCAmelCase__						)
						if key == "num_bytes":
									assert is_apercent_close(lowerCAmelCase__	,lowerCAmelCase__						)
						elif key == "splits":
									assert list(lowerCAmelCase__						) == list(lowerCAmelCase__						)
									for split in result:
												assert result[split].name == expected[split].name
												assert result[split].num_examples == expected[split].num_examples
												assert is_apercent_close(result[split].num_bytes	,expected[split].num_bytes						)
						else:
									result == expected



