
'''simple docstring'''






import pytest

from datasets import Dataset, DatasetDict, Features, NamedSplit, Value
from datasets.io.text import TextDatasetReader

from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases





def    UpperCAmelCase							(  UpperCAmelCase__							:							List[Any]       ,							UpperCAmelCase__							:							Optional[Any]):
				assert isinstance(UpperCAmelCase__       ,							UpperCAmelCase__)
				assert dataset.num_rows == 4
				assert dataset.num_columns == 1
				assert dataset.column_names == ["text"]
				for feature, expected_dtype in expected_features.items():
								assert dataset.features[feature].dtype == expected_dtype





@pytest.mark.parametrize('keep_in_memory'       ,							[False, True])
def    UpperCAmelCase							(  UpperCAmelCase__							:							List[Any]       ,							UpperCAmelCase__							:							str       ,							UpperCAmelCase__							:							List[Any]):
				lowerCamelCase					:			Optional[Any]									= tmp_path / 'cache'
				lowerCamelCase					:			Any									= {'text': 'string'}
				with assert_arrow_memory_increases() if keep_in_memory else assert_arrow_memory_doesnt_increase():
								lowerCamelCase					:			Optional[int]									= TextDatasetReader(UpperCAmelCase__       ,							cache_dir=UpperCAmelCase__       ,							keep_in_memory=UpperCAmelCase__).read()
				_check_text_dataset(UpperCAmelCase__       ,							UpperCAmelCase__)





@pytest.mark.parametrize(
    'features'       ,							[
        None,
        {'text': 'string'},
        {'text': 'int32'},
        {'text': 'float32'},
    ]       ,							)
def    UpperCAmelCase							(  UpperCAmelCase__							:							str       ,							UpperCAmelCase__							:							List[str]       ,							UpperCAmelCase__							:							Dict):
				lowerCamelCase					:			Optional[int]									= tmp_path / 'cache'
				lowerCamelCase					:			int									= {'text': 'string'}
				lowerCamelCase					:			Tuple									= features.copy() if features else default_expected_features
				lowerCamelCase					:			List[str]									= (
				    Features({feature: Value(UpperCAmelCase__) for feature, dtype in features.items()}) if features is not None else None
				)
				lowerCamelCase					:			Any									= TextDatasetReader(UpperCAmelCase__       ,							features=UpperCAmelCase__       ,							cache_dir=UpperCAmelCase__).read()
				_check_text_dataset(UpperCAmelCase__       ,							UpperCAmelCase__)





@pytest.mark.parametrize('split'       ,							[None, NamedSplit('train'), 'train', 'test'])
def    UpperCAmelCase							(  UpperCAmelCase__							:							str       ,							UpperCAmelCase__							:							List[str]       ,							UpperCAmelCase__							:							Union[str, Any]):
				lowerCamelCase					:			Dict									= tmp_path / 'cache'
				lowerCamelCase					:			Optional[Any]									= {'text': 'string'}
				lowerCamelCase					:			str									= TextDatasetReader(UpperCAmelCase__       ,							cache_dir=UpperCAmelCase__       ,							split=UpperCAmelCase__).read()
				_check_text_dataset(UpperCAmelCase__       ,							UpperCAmelCase__)
				assert dataset.split == split if split else "train"





@pytest.mark.parametrize('path_type'       ,							[str, list])
def    UpperCAmelCase							(  UpperCAmelCase__							:							Dict       ,							UpperCAmelCase__							:							List[str]       ,							UpperCAmelCase__							:							int):
				if issubclass(UpperCAmelCase__       ,							UpperCAmelCase__):
								lowerCamelCase					:			List[Any]									= text_path
				elif issubclass(UpperCAmelCase__       ,							UpperCAmelCase__):
								lowerCamelCase					:			int									= [text_path]
				lowerCamelCase					:			Union[str, Any]									= tmp_path / 'cache'
				lowerCamelCase					:			Any									= {'text': 'string'}
				lowerCamelCase					:			List[str]									= TextDatasetReader(UpperCAmelCase__       ,							cache_dir=UpperCAmelCase__).read()
				_check_text_dataset(UpperCAmelCase__       ,							UpperCAmelCase__)





def    UpperCAmelCase							(  UpperCAmelCase__							:							Union[str, Any]       ,							UpperCAmelCase__							:							List[str]       ,							UpperCAmelCase__							:							Optional[int]=("train",)):
				assert isinstance(UpperCAmelCase__       ,							UpperCAmelCase__)
				for split in splits:
								lowerCamelCase					:			Any									= dataset_dict[split]
								assert dataset.num_rows == 4
								assert dataset.num_columns == 1
								assert dataset.column_names == ["text"]
								for feature, expected_dtype in expected_features.items():
												assert dataset.features[feature].dtype == expected_dtype





@pytest.mark.parametrize('keep_in_memory'       ,							[False, True])
def    UpperCAmelCase							(  UpperCAmelCase__							:							Tuple       ,							UpperCAmelCase__							:							Dict       ,							UpperCAmelCase__							:							List[Any]):
				lowerCamelCase					:			List[str]									= tmp_path / 'cache'
				lowerCamelCase					:			Optional[int]									= {'text': 'string'}
				with assert_arrow_memory_increases() if keep_in_memory else assert_arrow_memory_doesnt_increase():
								lowerCamelCase					:			str									= TextDatasetReader({'train': text_path}       ,							cache_dir=UpperCAmelCase__       ,							keep_in_memory=UpperCAmelCase__).read()
				_check_text_datasetdict(UpperCAmelCase__       ,							UpperCAmelCase__)





@pytest.mark.parametrize(
    'features'       ,							[
        None,
        {'text': 'string'},
        {'text': 'int32'},
        {'text': 'float32'},
    ]       ,							)
def    UpperCAmelCase							(  UpperCAmelCase__							:							Tuple       ,							UpperCAmelCase__							:							Optional[int]       ,							UpperCAmelCase__							:							Optional[int]):
				lowerCamelCase					:			Union[str, Any]									= tmp_path / 'cache'
				# CSV file loses col_1 string dtype information: default now is "int64" instead of "string"
				lowerCamelCase					:			Dict									= {'text': 'string'}
				lowerCamelCase					:			Optional[Any]									= features.copy() if features else default_expected_features
				lowerCamelCase					:			Optional[int]									= (
				    Features({feature: Value(UpperCAmelCase__) for feature, dtype in features.items()}) if features is not None else None
				)
				lowerCamelCase					:			Optional[Any]									= TextDatasetReader({'train': text_path}       ,							features=UpperCAmelCase__       ,							cache_dir=UpperCAmelCase__).read()
				_check_text_datasetdict(UpperCAmelCase__       ,							UpperCAmelCase__)





@pytest.mark.parametrize('split'       ,							[None, NamedSplit('train'), 'train', 'test'])
def    UpperCAmelCase							(  UpperCAmelCase__							:							int       ,							UpperCAmelCase__							:							str       ,							UpperCAmelCase__							:							str):
				if split:
								lowerCamelCase					:			List[str]									= {split: text_path}
				else:
								lowerCamelCase					:			List[str]									= 'train'
								lowerCamelCase					:			List[Any]									= {'train': text_path, 'test': text_path}
				lowerCamelCase					:			Any									= tmp_path / 'cache'
				lowerCamelCase					:			List[str]									= {'text': 'string'}
				lowerCamelCase					:			Optional[Any]									= TextDatasetReader(UpperCAmelCase__       ,							cache_dir=UpperCAmelCase__).read()
				_check_text_datasetdict(UpperCAmelCase__       ,							UpperCAmelCase__       ,							splits=list(path.keys()))
				assert all(dataset[split].split == split for split in path.keys())


'''simple docstring'''






def    UpperCAmelCase							(  UpperCAmelCase__							:							int = 10_00):
				lowerCamelCase					:			Optional[Any]									= 2**power
				lowerCamelCase					:			str									= str(UpperCAmelCase__)
				lowerCamelCase					:			Union[str, Any]									= list(UpperCAmelCase__)
				lowerCamelCase					:			Optional[Any]									= 0

				for i in list_num:
								sum_of_num += int(UpperCAmelCase__)

				return sum_of_num


if __name__ == "__main__":
					A			      =      int(input('Enter the power of 2: ').strip())
					print('2 ^ ', power, ' = ', 2**power)
					A			      =      solution(power)
					print('Sum of the digits is: ', result)
