
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   (       __lowerCamelCase	:					Union[str, Any]							,   __lowerCamelCase	:					int       ):
       assert isinstance(__a							,   __a       )
       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   (       __lowerCamelCase	:					Dict							,   __lowerCamelCase	:					Optional[Any]							,   __lowerCamelCase	:					Any       ):
       snake_case			:  Optional[Any]     							= tmp_path / "cache"
       snake_case			:  List[Any]     							= {"text": "string"}
       with assert_arrow_memory_increases() if keep_in_memory else assert_arrow_memory_doesnt_increase():
              snake_case			:  str     							= TextDatasetReader(__a							,   cache_dir=__a							,   keep_in_memory=__a       ).read()
       _check_text_dataset(__a							,   __a       )


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


@pytest.mark.parametrize("split"							,   [None, NamedSplit("train"       ), "train", "test"]       )
def      UpperCamelCase   (       __lowerCamelCase	:					List[str]							,   __lowerCamelCase	:					int							,   __lowerCamelCase	:					Optional[int]       ):
       snake_case			:  Dict     							= tmp_path / "cache"
       snake_case			:  Dict     							= {"text": "string"}
       snake_case			:  Optional[Any]     							= TextDatasetReader(__a							,   cache_dir=__a							,   split=__a       ).read()
       _check_text_dataset(__a							,   __a       )
       assert dataset.split == split if split else "train"


@pytest.mark.parametrize("path_type"							,   [str, list]       )
def      UpperCamelCase   (       __lowerCamelCase	:					Optional[Any]							,   __lowerCamelCase	:					Optional[int]							,   __lowerCamelCase	:					Any       ):
       if issubclass(__a							,   __a       ):
              snake_case			:  List[Any]     							= text_path
       elif issubclass(__a							,   __a       ):
              snake_case			:  Union[str, Any]     							= [text_path]
       snake_case			:  List[Any]     							= tmp_path / "cache"
       snake_case			:  Optional[Any]     							= {"text": "string"}
       snake_case			:  List[str]     							= TextDatasetReader(__a							,   cache_dir=__a       ).read()
       _check_text_dataset(__a							,   __a       )


def      UpperCamelCase   (       __lowerCamelCase	:					Tuple							,   __lowerCamelCase	:					Optional[int]							,   __lowerCamelCase	:					Dict=("train",)       ):
       assert isinstance(__a							,   __a       )
       for split in splits:
              snake_case			:  List[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   (       __lowerCamelCase	:					str							,   __lowerCamelCase	:					Optional[Any]							,   __lowerCamelCase	:					List[Any]       ):
       snake_case			:  List[str]     							= tmp_path / "cache"
       snake_case			:  List[str]     							= {"text": "string"}
       with assert_arrow_memory_increases() if keep_in_memory else assert_arrow_memory_doesnt_increase():
              snake_case			:  Tuple     							= TextDatasetReader({"train": text_path}							,   cache_dir=__a							,   keep_in_memory=__a       ).read()
       _check_text_datasetdict(__a							,   __a       )


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




@pytest.mark.parametrize("split"							,   [None, NamedSplit("train"       ), "train", "test"]       )
def      UpperCamelCase   (       __lowerCamelCase	:					List[str]							,   __lowerCamelCase	:					Union[str, Any]							,   __lowerCamelCase	:					Tuple       ):
       if split:
              snake_case			:  str     							= {split: text_path}
       else:
              snake_case			:  Dict     							= "train"
              snake_case			:  Union[str, Any]     							= {"train": text_path, "test": text_path}
       snake_case			:  Union[str, Any]     							= tmp_path / "cache"
       snake_case			:  Optional[int]     							= {"text": "string"}
       snake_case			:  Optional[int]     							= TextDatasetReader(__a							,   cache_dir=__a       ).read()
       _check_text_datasetdict(__a							,   __a							,   splits=list(path.keys()       )       )
       assert all(dataset[split].split == split for split in path.keys()       )







"""simple docstring"""




from __future__ import annotations

import math



def 							_lowerCamelCase			(			__a     ):

		if num <= 0:
				SCREAMING_SNAKE_CASE_    			=			F'{num}: Invalid input, please enter a positive integer.'
				raise ValueError(__a     )

		SCREAMING_SNAKE_CASE_    			=			[True] * (num + 1)
		SCREAMING_SNAKE_CASE_    			=			[]
		SCREAMING_SNAKE_CASE_    			=			2
		SCREAMING_SNAKE_CASE_    			=			int(math.sqrt(__a     )     )

		while start <= end:
				# If start is a prime
				if sieve[start] is True:
						prime.append(__a     )

						# Set multiples of start be False
						for i in range(start * start,				num + 1,				__a     ):
								if sieve[i] is True:
										SCREAMING_SNAKE_CASE_    			=			False

				start += 1

		for j in range(end + 1,				num + 1     ):
				if sieve[j] is True:
						prime.append(__a     )

		return prime


if __name__ == "__main__":
						print(prime_sieve(int(input('Enter a positive integer: ').strip())))