


'''simple docstring'''





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 							_UpperCamelCase (						__lowerCamelCase						):

   '''simple docstring'''







   def __init__(  self  : Optional[int]       ,  _lowerCamelCase  : pyspark.sql.DataFrame       ,  _lowerCamelCase  : Optional[NamedSplit] = None       ,  _lowerCamelCase  : Optional[Features] = None       ,  _lowerCamelCase  : bool = True       ,  _lowerCamelCase  : str = None       ,  _lowerCamelCase  : bool = False       ,  _lowerCamelCase  : str = None       ,  _lowerCamelCase  : bool = True       ,  _lowerCamelCase  : str = "arrow"       ,  **_lowerCamelCase  : str       ,  ):






         '''simple docstring'''



         super().__init__(
             split=UpperCamelCase_       ,  features=UpperCamelCase_       ,  cache_dir=UpperCamelCase_       ,  keep_in_memory=UpperCamelCase_       ,  streaming=UpperCamelCase_       ,  **UpperCamelCase_       ,  )
         __lowerCamelCase     :      str       						=						load_from_cache_file
         __lowerCamelCase     :      Optional[Any]       						=						file_format
         __lowerCamelCase     :      Optional[int]       						=						Spark(
             df=UpperCamelCase_       ,  features=UpperCamelCase_       ,  cache_dir=UpperCamelCase_       ,  working_dir=UpperCamelCase_       ,  **UpperCamelCase_       ,  )


   def   _snake_case    (  self  : Tuple							):






         '''simple docstring'''



         if self.streaming:
               return self.builder.as_streaming_dataset(split=self.split							)
         __lowerCamelCase     :      Optional[Any]       						=						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							)







def   _UpperCAmelCase       (     UpperCAmelCase      :			str      ):
      """simple docstring"""




      __lowerCamelCase     :      List[Any]       						=						hex_num.strip()
      if not hex_num:
            raise ValueError("""No value was passed to the function"""      )

      __lowerCamelCase     :      Dict       						=						hex_num[0] == """-"""
      if is_negative:
            __lowerCamelCase     :      Optional[Any]       						=						hex_num[1:]

      try:
            __lowerCamelCase     :      Any       						=						int(UpperCAmelCase						,	16      )
      except ValueError:
            raise ValueError("""Invalid value was passed to the function"""      )

      __lowerCamelCase     :      List[str]       						=						""""""
      while int_num > 0:
            __lowerCamelCase     :      Dict       						=						str(int_num % 2      ) + bin_str
            int_num >>= 1

      return int(("""-""" + bin_str) if is_negative else bin_str      )


if __name__ == "__main__":
    import doctest

    doctest.testmod()



