



'''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   __lowerCAmelCase					(							lowerCamelCase   :						Optional[int]				,		lowerCamelCase   :						Optional[int]					):






	'''simple docstring'''




	assert isinstance(lowerCamelCase				,		lowerCamelCase					)
	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   __lowerCAmelCase					(							lowerCamelCase   :						Any				,		lowerCamelCase   :						List[str]				,		lowerCamelCase   :						Optional[Any]					):






	'''simple docstring'''




	__lowerCAmelCase												=  tmp_path / "cache"
	__lowerCAmelCase												=  {"text": "string"}
	with assert_arrow_memory_increases() if keep_in_memory else assert_arrow_memory_doesnt_increase():
		__lowerCAmelCase												=  TextDatasetReader(lowerCamelCase				,		cache_dir=lowerCamelCase				,		keep_in_memory=lowerCamelCase					).read()
	_check_text_dataset(lowerCamelCase				,		lowerCamelCase					)



@pytest.mark.parametrize(
    "features"				,		[
        None,
        {"text": "string"},
        {"text": "int32"},
        {"text": "float32"},
    ]				,		)
def   __lowerCAmelCase					(							lowerCamelCase   :						List[str]				,		lowerCamelCase   :						Optional[Any]				,		lowerCamelCase   :						List[Any]					):






	'''simple docstring'''




	__lowerCAmelCase												=  tmp_path / "cache"
	__lowerCAmelCase												=  {"text": "string"}
	__lowerCAmelCase												=  features.copy() if features else default_expected_features
	__lowerCAmelCase												=  (
	    Features({feature: Value(lowerCamelCase					) for feature, dtype in features.items()}					) if features is not None else None
	)
	__lowerCAmelCase												=  TextDatasetReader(lowerCamelCase				,		features=lowerCamelCase				,		cache_dir=lowerCamelCase					).read()
	_check_text_dataset(lowerCamelCase				,		lowerCamelCase					)



@pytest.mark.parametrize("split"				,		[None, NamedSplit("train"					), "train", "test"]					)
def   __lowerCAmelCase					(							lowerCamelCase   :						str				,		lowerCamelCase   :						Union[str, Any]				,		lowerCamelCase   :						Tuple					):






	'''simple docstring'''




	__lowerCAmelCase												=  tmp_path / "cache"
	__lowerCAmelCase												=  {"text": "string"}
	__lowerCAmelCase												=  TextDatasetReader(lowerCamelCase				,		cache_dir=lowerCamelCase				,		split=lowerCamelCase					).read()
	_check_text_dataset(lowerCamelCase				,		lowerCamelCase					)
	assert dataset.split == split if split else "train"



@pytest.mark.parametrize("path_type"				,		[str, list]					)
def   __lowerCAmelCase					(							lowerCamelCase   :						Optional[int]				,		lowerCamelCase   :						List[Any]				,		lowerCamelCase   :						Dict					):






	'''simple docstring'''




	if issubclass(lowerCamelCase				,		lowerCamelCase					):
		__lowerCAmelCase												=  text_path
	elif issubclass(lowerCamelCase				,		lowerCamelCase					):
		__lowerCAmelCase												=  [text_path]
	__lowerCAmelCase												=  tmp_path / "cache"
	__lowerCAmelCase												=  {"text": "string"}
	__lowerCAmelCase												=  TextDatasetReader(lowerCamelCase				,		cache_dir=lowerCamelCase					).read()
	_check_text_dataset(lowerCamelCase				,		lowerCamelCase					)



def   __lowerCAmelCase					(							lowerCamelCase   :						Tuple				,		lowerCamelCase   :						int				,		lowerCamelCase   :						Optional[Any]=("train",)					):






	'''simple docstring'''




	assert isinstance(lowerCamelCase				,		lowerCamelCase					)
	for split in splits:
		__lowerCAmelCase												=  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   __lowerCAmelCase					(							lowerCamelCase   :						Optional[int]				,		lowerCamelCase   :						List[Any]				,		lowerCamelCase   :						Dict					):






	'''simple docstring'''




	__lowerCAmelCase												=  tmp_path / "cache"
	__lowerCAmelCase												=  {"text": "string"}
	with assert_arrow_memory_increases() if keep_in_memory else assert_arrow_memory_doesnt_increase():
		__lowerCAmelCase												=  TextDatasetReader({"train": text_path}				,		cache_dir=lowerCamelCase				,		keep_in_memory=lowerCamelCase					).read()
	_check_text_datasetdict(lowerCamelCase				,		lowerCamelCase					)



@pytest.mark.parametrize(
    "features"				,		[
        None,
        {"text": "string"},
        {"text": "int32"},
        {"text": "float32"},
    ]				,		)
def   __lowerCAmelCase					(							lowerCamelCase   :						Dict				,		lowerCamelCase   :						Optional[int]				,		lowerCamelCase   :						Tuple					):






	'''simple docstring'''




	__lowerCAmelCase												=  tmp_path / "cache"
	# CSV file loses col_1 string dtype information: default now is "int64" instead of "string"
	__lowerCAmelCase												=  {"text": "string"}
	__lowerCAmelCase												=  features.copy() if features else default_expected_features
	__lowerCAmelCase												=  (
	    Features({feature: Value(lowerCamelCase					) for feature, dtype in features.items()}					) if features is not None else None
	)
	__lowerCAmelCase												=  TextDatasetReader({"train": text_path}				,		features=lowerCamelCase				,		cache_dir=lowerCamelCase					).read()
	_check_text_datasetdict(lowerCamelCase				,		lowerCamelCase					)




@pytest.mark.parametrize("split"				,		[None, NamedSplit("train"					), "train", "test"]					)
def   __lowerCAmelCase					(							lowerCamelCase   :						str				,		lowerCamelCase   :						Union[str, Any]				,		lowerCamelCase   :						Tuple					):






	'''simple docstring'''




	if split:
		__lowerCAmelCase												=  {split: text_path}
	else:
		__lowerCAmelCase												=  "train"
		__lowerCAmelCase												=  {"train": text_path, "test": text_path}
	__lowerCAmelCase												=  tmp_path / "cache"
	__lowerCAmelCase												=  {"text": "string"}
	__lowerCAmelCase												=  TextDatasetReader(lowerCamelCase				,		cache_dir=lowerCamelCase					).read()
	_check_text_datasetdict(lowerCamelCase				,		lowerCamelCase				,		splits=list(path.keys()					)					)
	assert all(dataset[split].split == split for split in path.keys()					)




'''simple docstring'''



def   __lowerCAmelCase					(							lowerCamelCase   :						Union[str, Any]					):






	'''simple docstring'''




	__lowerCAmelCase												=  1
	__lowerCAmelCase												=  2
	while i * i <= n:
		__lowerCAmelCase												=  0
		while n % i == 0:
			n //= i
			multiplicity += 1
		n_divisors *= multiplicity + 1
		i += 1
	if n > 1:
		n_divisors *= 2
	return n_divisors



def   __lowerCAmelCase					(							):






	'''simple docstring'''




	__lowerCAmelCase												=  1
	__lowerCAmelCase												=  1

	while True:
		i += 1
		t_num += i

		if count_divisors(lowerCamelCase					) > 5_00:
			break

	return t_num


if __name__ == "__main__":
	print(solution())