






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      __lowercase					( snake_case,  snake_case ):







				"""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      __lowercase					( snake_case,  snake_case,  snake_case ):







				"""simple docstring"""






				__magic_name__		:Optional[Any]        =      tmp_path / '''cache'''
				__magic_name__		:Optional[Any]        =      {'''text''': '''string'''}
				with assert_arrow_memory_increases() if keep_in_memory else assert_arrow_memory_doesnt_increase():
								__magic_name__		:List[Any]        =      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      __lowercase					( snake_case,  snake_case,  snake_case ):







				"""simple docstring"""






				__magic_name__		:List[str]        =      tmp_path / '''cache'''
				__magic_name__		:List[Any]        =      {'''text''': '''string'''}
				__magic_name__		:Tuple        =      features.copy() if features else default_expected_features
				__magic_name__		:List[Any]        =      (
				    Features({feature: Value(lowerCAmelCase__ ) for feature, dtype in features.items()} ) if features is not None else None
				)
				__magic_name__		:Optional[int]        =      TextDatasetReader(lowerCAmelCase__,  features=lowerCAmelCase__,  cache_dir=lowerCAmelCase__ ).read()
				_check_text_dataset(lowerCAmelCase__,  lowerCAmelCase__ )

@pytest.mark.parametrize('''split''',  [None, NamedSplit('''train''' ), '''train''', '''test'''] )
def      __lowercase					( snake_case,  snake_case,  snake_case ):







				"""simple docstring"""






				__magic_name__		:int        =      tmp_path / '''cache'''
				__magic_name__		:Optional[int]        =      {'''text''': '''string'''}
				__magic_name__		:Optional[int]        =      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      __lowercase					( snake_case,  snake_case,  snake_case ):







				"""simple docstring"""






				if issubclass(lowerCAmelCase__,  lowerCAmelCase__ ):
								__magic_name__		:Any        =      text_path
				elif issubclass(lowerCAmelCase__,  lowerCAmelCase__ ):
								__magic_name__		:str        =      [text_path]
				__magic_name__		:Optional[Any]        =      tmp_path / '''cache'''
				__magic_name__		:Optional[int]        =      {'''text''': '''string'''}
				__magic_name__		:Union[str, Any]        =      TextDatasetReader(lowerCAmelCase__,  cache_dir=lowerCAmelCase__ ).read()
				_check_text_dataset(lowerCAmelCase__,  lowerCAmelCase__ )

def      __lowercase					( snake_case,  snake_case,  snake_case=("train",) ):







				"""simple docstring"""






				assert isinstance(lowerCAmelCase__,  lowerCAmelCase__ )
				for split in splits:
								__magic_name__		: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      __lowercase					( snake_case,  snake_case,  snake_case ):







				"""simple docstring"""






				__magic_name__		:Optional[int]        =      tmp_path / '''cache'''
				__magic_name__		:List[Any]        =      {'''text''': '''string'''}
				with assert_arrow_memory_increases() if keep_in_memory else assert_arrow_memory_doesnt_increase():
								__magic_name__		:List[Any]        =      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      __lowercase					( snake_case,  snake_case,  snake_case ):







				"""simple docstring"""






				__magic_name__		:str        =      tmp_path / '''cache'''
				# CSV file loses col_1 string dtype information: default now is "int64" instead of "string"
				__magic_name__		:str        =      {'''text''': '''string'''}
				__magic_name__		:Dict        =      features.copy() if features else default_expected_features
				__magic_name__		:Union[str, Any]        =      (
				    Features({feature: Value(lowerCAmelCase__ ) for feature, dtype in features.items()} ) if features is not None else None
				)
				__magic_name__		:Optional[int]        =      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      __lowercase					( snake_case,  snake_case,  snake_case ):







				"""simple docstring"""






				if split:
								__magic_name__		:Optional[Any]        =      {split: text_path}
				else:
								__magic_name__		:int        =      '''train'''
								__magic_name__		:List[Any]        =      {'''train''': text_path, '''test''': text_path}
				__magic_name__		:List[str]        =      tmp_path / '''cache'''
				__magic_name__		:Any        =      {'''text''': '''string'''}
				__magic_name__		:Tuple        =      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() )














from __future__ import annotations

def      __lowercase					( snake_case,  snake_case ):







				"""simple docstring"""






				__magic_name__		:Tuple        =      0
				__magic_name__		:Tuple        =      len(snake_case ) - 1

				while i < j:
								if nums[i] + nums[j] == target:
												return [i, j]
								elif nums[i] + nums[j] < target:
												__magic_name__		:str        =      i + 1
								else:
												__magic_name__		:List[Any]        =      j - 1

				return []


if __name__ == "__main__":
					import doctest

					doctest.testmod()
					print(f"{two_pointer([2, 7, 11, 15], 9) = }")






