code: 
  
  
  
  
  """simple docstring"""
  
  
  
  import sys
  from collections.abc import Mapping
  
  import numpy as np
  import pyarrow as pa
  
  from .. import config
  from ..utils.py_utils import map_nested
  from .formatting import TensorFormatter
  
  
  
  
  class 			UpperCAmelCase_						(		TensorFormatter[Mapping, np.ndarray, Mapping]							):
  
      '''simple docstring'''
  
  
  
  
  
      def __init__(					self		: Any			,				snake_case_		: Dict=None			,				**snake_case_		: Tuple   )   ->							Any:
  
  
  
  
       '''simple docstring'''
  
       super().__init__(features=snake_case_   )
       A__ =       np_array_kwargs
  
  
  
  
      def 							__magic_name__							(					self		: Any			,				snake_case_		: List[Any]   )   ->							str:
  
  
  
  
       '''simple docstring'''
  
       if isinstance(snake_case_			,				snake_case_   ):
        if column and all(
            isinstance(snake_case_			,				np.ndarray   ) and x.shape == column[0].shape and x.dtype == column[0].dtype for x in column   ):
         return np.stack(snake_case_   )
        else:
         # don't use np.array(column, dtype=object)
         # since it fails in certain cases
         # see https://stackoverflow.com/q/51005699
         A__ =       np.empty(len(snake_case_   )			,				dtype=snake_case_   )
         A__ =       column
         return out
       return column
  
  
  
  
      def 							__magic_name__							(					self		: Any			,				snake_case_		: Tuple   )   ->							Tuple:
  
  
  
  
       '''simple docstring'''
  
       if isinstance(snake_case_			,				(str, bytes, type(snake_case_   ))   ):
        return value
       elif isinstance(snake_case_			,				(np.character, np.ndarray)   ) and np.issubdtype(value.dtype			,				np.character   ):
        return value
       elif isinstance(snake_case_			,				np.number   ):
        return value
  
       A__ =       {}
  
       if isinstance(snake_case_			,				np.ndarray   ) and np.issubdtype(value.dtype			,				np.integer   ):
        A__ =       {"dtype": np.intaa}
       elif isinstance(snake_case_			,				np.ndarray   ) and np.issubdtype(value.dtype			,				np.floating   ):
        A__ =       {"dtype": np.floataa}
       elif config.PIL_AVAILABLE and "PIL" in sys.modules:
        import PIL.Image
  
        if isinstance(snake_case_			,				PIL.Image.Image   ):
         return np.asarray(snake_case_			,				**self.np_array_kwargs   )
  
       return np.asarray(snake_case_			,				**{**default_dtype, **self.np_array_kwargs}   )
  
  
  
  
      def 							__magic_name__							(					self		: Optional[int]			,				snake_case_		: int   )   ->							Tuple:
  
  
  
  
       '''simple docstring'''
  
       if config.TORCH_AVAILABLE and "torch" in sys.modules:
        import torch
  
        if isinstance(snake_case_			,				torch.Tensor   ):
         return self._tensorize(data_struct.detach().cpu().numpy()[()]   )
       if hasattr(snake_case_			,				"__array__"   ) and not isinstance(snake_case_			,				(np.ndarray, np.character, np.number)   ):
        A__ =       data_struct.__array__()
       # support for nested types like struct of list of struct
       if isinstance(snake_case_			,				np.ndarray   ):
        if data_struct.dtype == object:
         return self._consolidate([self.recursive_tensorize(snake_case_   ) for substruct in data_struct]   )
       if isinstance(snake_case_			,				(list, tuple)   ):
        return self._consolidate([self.recursive_tensorize(snake_case_   ) for substruct in data_struct]   )
       return self._tensorize(snake_case_   )
  
  
  
  
      def 							__magic_name__							(					self		: Any			,				snake_case_		: dict   )   ->							Dict:
  
  
  
  
       '''simple docstring'''
  
       return map_nested(self._recursive_tensorize			,				snake_case_			,				map_list=snake_case_   )
  
  
  
  
      def 							__magic_name__							(					self		: Tuple			,				snake_case_		: pa.Table   )   ->							Mapping:
  
  
  
  
       '''simple docstring'''
  
       A__ =       self.numpy_arrow_extractor().extract_row(snake_case_   )
       A__ =       self.python_features_decoder.decode_row(snake_case_   )
       return self.recursive_tensorize(snake_case_   )
  
  
  
  
      def 							__magic_name__							(					self		: Tuple			,				snake_case_		: pa.Table   )   ->							np.ndarray:
  
  
  
  
       '''simple docstring'''
  
       A__ =       self.numpy_arrow_extractor().extract_column(snake_case_   )
       A__ =       self.python_features_decoder.decode_column(snake_case_			,				pa_table.column_names[0]   )
       A__ =       self.recursive_tensorize(snake_case_   )
       A__ =       self._consolidate(snake_case_   )
       return column
  
  
  
  
      def 							__magic_name__							(					self		: str			,				snake_case_		: pa.Table   )   ->							Mapping:
  
  
  
  
       '''simple docstring'''
  
       A__ =       self.numpy_arrow_extractor().extract_batch(snake_case_   )
       A__ =       self.python_features_decoder.decode_batch(snake_case_   )
       A__ =       self.recursive_tensorize(snake_case_   )
       for column_name in batch:
        A__ =       self._consolidate(batch[column_name]   )
       return batch
  
  
  
  
  
  
style_context: 
  
  
  
  
  """simple docstring"""
  
  
  
  from typing import TYPE_CHECKING
  
  from ...utils import _LazyModule
  
  
  SCREAMING_SNAKE_CASE       = {"tokenization_bert_japanese": ["BertJapaneseTokenizer", "CharacterTokenizer", "MecabTokenizer"]}
  
  
  if TYPE_CHECKING:
        from .tokenization_bert_japanese import BertJapaneseTokenizer, CharacterTokenizer, MecabTokenizer
  
  else:
        import sys
  
        SCREAMING_SNAKE_CASE       = _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
  
  
  
  
  
  