'''simple docstring'''





import unittest

from transformers import load_tool

from .test_tools_common import ToolTesterMixin




class        __A      ( unittest.TestCase		,	UpperCamelCase__	):



    def 					_lowercase						(self    :    Any ):
         UpperCAmelCase_           =   load_tool("text-classification" )
         self.tool.setup()
         UpperCAmelCase_           =   load_tool("text-classification"   ,			remote=__a )



    def 					_lowercase						(self    :    Optional[Any] ):
         UpperCAmelCase_           =   self.tool("That's quite cool"   ,			["positive", "negative"] )
         self.assertEqual(__a   ,			"positive" )



    def 					_lowercase						(self    :    List[Any] ):
         UpperCAmelCase_           =   self.remote_tool("That's quite cool"   ,			["positive", "negative"] )
         self.assertEqual(__a   ,			"positive" )



    def 					_lowercase						(self    :    Union[str, Any] ):
         UpperCAmelCase_           =   self.tool(text="That's quite cool"   ,			labels=["positive", "negative"] )
         self.assertEqual(__a   ,			"positive" )






    def 					_lowercase						(self    :    List[Any] ):
         UpperCAmelCase_           =   self.remote_tool(text="That's quite cool"   ,			labels=["positive", "negative"] )
         self.assertEqual(__a   ,			"positive" )







from typing import Optional

import pyspark

from .. import Features, NamedSplit
from ..download import DownloadMode
from ..packaged_modules.spark.spark import Spark
from .abc import AbstractDatasetReader





class 	snake_case_   (		__A					):







			'''simple docstring'''

			def __init__(     self :				int							,   _UpperCamelCase :				pyspark.sql.DataFrame							,   _UpperCamelCase :				Optional[NamedSplit] = None							,   _UpperCamelCase :				Optional[Features] = None							,   _UpperCamelCase :				bool = True							,   _UpperCamelCase :				str = None							,   _UpperCamelCase :				bool = False							,   _UpperCamelCase :				str = None							,   _UpperCamelCase :				bool = True							,   _UpperCamelCase :				str = "arrow"							,   **_UpperCamelCase :				Tuple							,   )      ->str:
									super().__init__(
									    split=_UpperCamelCase							,   features=_UpperCamelCase							,   cache_dir=_UpperCamelCase							,   keep_in_memory=_UpperCamelCase							,   streaming=_UpperCamelCase							,   **_UpperCamelCase							,   )
									snake_case_   =	load_from_cache_file
									snake_case_   =	file_format
									snake_case_   =	Spark(
									    df=_UpperCamelCase							,   features=_UpperCamelCase							,   cache_dir=_UpperCamelCase							,   working_dir=_UpperCamelCase							,   **_UpperCamelCase							,   )







			def 				snake_case__(     self :				int							)      ->Tuple:
									if self.streaming:
															return self.builder.as_streaming_dataset(split=self.split							)
									snake_case_   =	None if self._load_from_cache_file else DownloadMode.FORCE_REDOWNLOAD
									self.builder.download_and_prepare(
									    download_mode=_UpperCamelCase							,   file_format=self._file_format							,   )
									return self.builder.as_dataset(split=self.split							)