"""simple docstring"""
from collections import OrderedDict
from dataclasses import fields
from typing import Any, Tuple

import numpy as np

from .import_utils import is_torch_available





def  lowerCAmelCase__     (      _UpperCamelCase							:					List[str]       )       ->					str:





						"""simple docstring"""






						if is_torch_available():
												import torch

												if isinstance(_UpperCamelCase			,      torch.Tensor       ):
																		return True

						return isinstance(_UpperCamelCase			,      np.ndarray       )



class 	lowerCAmelCase_     (      lowerCAmelCase       ):



				"""simple docstring"""

				def 		snake_case			(					self     ):






										"""simple docstring"""

										snake_case             =      fields(self     )

										# Safety and consistency checks
										if not len(lowerCAmelCase     ):
																raise ValueError(F"""{self.__class__.__name__} has no fields."""     )

										snake_case             =      getattr(self		,     class_fields[0].name     )
										snake_case             =      all(getattr(self		,     field.name     ) is None for field in class_fields[1:]     )

										if other_fields_are_none and isinstance(lowerCAmelCase		,     lowerCAmelCase     ):
																for key, value in first_field.items():
																						snake_case             =      value
										else:
																for field in class_fields:
																						snake_case             =      getattr(self		,     field.name     )
																						if v is not None:
																												snake_case             =      v

				def __delitem__(					self		,     *lowerCAmelCase		,     **lowerCAmelCase     ):






										"""simple docstring"""

										raise Exception(F"""You cannot use ``__delitem__`` on a {self.__class__.__name__} instance."""     )

				def 		snake_case			(					self		,     *lowerCAmelCase		,     **lowerCAmelCase     ):






										"""simple docstring"""

										raise Exception(F"""You cannot use ``setdefault`` on a {self.__class__.__name__} instance."""     )

				def 		snake_case			(					self		,     *lowerCAmelCase		,     **lowerCAmelCase     ):






										"""simple docstring"""

										raise Exception(F"""You cannot use ``pop`` on a {self.__class__.__name__} instance."""     )

				def 		snake_case			(					self		,     *lowerCAmelCase		,     **lowerCAmelCase     ):






										"""simple docstring"""

										raise Exception(F"""You cannot use ``update`` on a {self.__class__.__name__} instance."""     )

				def __getitem__(					self		,     lowerCAmelCase     ):






										"""simple docstring"""

										if isinstance(lowerCAmelCase		,     lowerCAmelCase     ):
																snake_case             =      dict(self.items()     )
																return inner_dict[k]
										else:
																return self.to_tuple()[k]

				def __setattr__(					self		,     lowerCAmelCase		,     lowerCAmelCase     ):






										"""simple docstring"""

										if name in self.keys() and value is not None:
																# Don't call self.__setitem__ to avoid recursion errors
																super().__setitem__(lowerCAmelCase		,     lowerCAmelCase     )
										super().__setattr__(lowerCAmelCase		,     lowerCAmelCase     )

				def __setitem__(					self		,     lowerCAmelCase		,     lowerCAmelCase     ):






										"""simple docstring"""

										super().__setitem__(lowerCAmelCase		,     lowerCAmelCase     )
										# Don't call self.__setattr__ to avoid recursion errors
										super().__setattr__(lowerCAmelCase		,     lowerCAmelCase     )

				def 		snake_case			(					self     ):






										"""simple docstring"""

										return tuple(self[k] for k in self.keys()     )



"""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__)


