




"""simple docstring"""


def        lowerCAmelCase_       (		snake_case_		:      int							,   snake_case_		:      int							,   snake_case_		:      int							,   snake_case_		:      int      )       ->int:
			return len_board * len_board_column * row + column






def        lowerCAmelCase_       (		snake_case_		:      list[list[str]]							,   snake_case_		:      str							,   snake_case_		:      int							,   snake_case_		:      int							,   snake_case_		:      int							,   snake_case_		:      set[int]							,   )       ->bool:

			if board[row][column] != word[word_index]:
						return False

			if word_index == len(_lowerCAmelCase      ) - 1:
						return True

			lowerCamelCase__     :					str		=[(0, 1), (0, -1), (-1, 0), (1, 0)]
			lowerCamelCase__     :					Optional[Any]		=len(_lowerCAmelCase      )
			lowerCamelCase__     :					Optional[Any]		=len(board[0]      )
			for direction in traverts_directions:
						lowerCamelCase__     :					List[str]		=row + direction[0]
						lowerCamelCase__     :					Tuple		=column + direction[1]
						if not (0 <= next_i < len_board and 0 <= next_j < len_board_column):
									continue

						lowerCamelCase__     :					Tuple		=get_point_key(_lowerCAmelCase							,   _lowerCAmelCase							,   _lowerCAmelCase							,   _lowerCAmelCase      )
						if key in visited_points_set:
									continue

						visited_points_set.add(_lowerCAmelCase      )
						if exits_word(_lowerCAmelCase							,   _lowerCAmelCase							,   _lowerCAmelCase							,   _lowerCAmelCase							,   word_index + 1							,   _lowerCAmelCase      ):
									return True

						visited_points_set.remove(_lowerCAmelCase      )

			return False






def        lowerCAmelCase_       (		snake_case_		:      list[list[str]]							,   snake_case_		:      str      )       ->bool:
			lowerCamelCase__     :					Union[str, Any]		=(
			    '''The board should be a non empty matrix of single chars strings.'''
			)

			lowerCamelCase__     :					List[str]		=len(_lowerCAmelCase      )
			if not isinstance(_lowerCAmelCase							,   _lowerCAmelCase      ) or len(_lowerCAmelCase      ) == 0:
						raise ValueError(_lowerCAmelCase      )

			for row in board:
						if not isinstance(_lowerCAmelCase							,   _lowerCAmelCase      ) or len(_lowerCAmelCase      ) == 0:
									raise ValueError(_lowerCAmelCase      )

						for item in row:
									if not isinstance(_lowerCAmelCase							,   _lowerCAmelCase      ) or len(_lowerCAmelCase      ) != 1:
												raise ValueError(_lowerCAmelCase      )

    # Validate word
			if not isinstance(_lowerCAmelCase							,   _lowerCAmelCase      ) or len(_lowerCAmelCase      ) == 0:
						raise ValueError(
						    'The word parameter should be a string of length greater than 0.'      )

			lowerCamelCase__     :					Any		=len(board[0]      )
			for i in range(_lowerCAmelCase      ):
						for j in range(_lowerCAmelCase      ):
									if exits_word(
									    _lowerCAmelCase							,   _lowerCAmelCase							,   _lowerCAmelCase							,   _lowerCAmelCase							,   0							,   {get_point_key(_lowerCAmelCase							,   _lowerCAmelCase							,   _lowerCAmelCase							,   _lowerCAmelCase      )}      ):
												return True

			return False


if __name__ == "__main__":
							import doctest

							doctest.testmod()

"""simple docstring"""


from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


lowerCAmelCase								=						{
    """configuration_deberta_v2""": ["""DEBERTA_V2_PRETRAINED_CONFIG_ARCHIVE_MAP""", """DebertaV2Config""", """DebertaV2OnnxConfig"""],
    """tokenization_deberta_v2""": ["""DebertaV2Tokenizer"""],
}

try:
							if not is_tokenizers_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							lowerCAmelCase								=						["""DebertaV2TokenizerFast"""]

try:
							if not is_tf_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							lowerCAmelCase								=						[
							    """TF_DEBERTA_V2_PRETRAINED_MODEL_ARCHIVE_LIST""",
							    """TFDebertaV2ForMaskedLM""",
							    """TFDebertaV2ForQuestionAnswering""",
							    """TFDebertaV2ForSequenceClassification""",
							    """TFDebertaV2ForTokenClassification""",
							    """TFDebertaV2Model""",
							    """TFDebertaV2PreTrainedModel""",
							]

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							lowerCAmelCase								=						[
							    """DEBERTA_V2_PRETRAINED_MODEL_ARCHIVE_LIST""",
							    """DebertaV2ForMaskedLM""",
							    """DebertaV2ForMultipleChoice""",
							    """DebertaV2ForQuestionAnswering""",
							    """DebertaV2ForSequenceClassification""",
							    """DebertaV2ForTokenClassification""",
							    """DebertaV2Model""",
							    """DebertaV2PreTrainedModel""",
							]


if TYPE_CHECKING:
							from .configuration_deberta_va import (
							    DEBERTA_V2_PRETRAINED_CONFIG_ARCHIVE_MAP,
							    DebertaVaConfig,
							    DebertaVaOnnxConfig,
							)
							from .tokenization_deberta_va import DebertaVaTokenizer

							try:
														if not is_tokenizers_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .tokenization_deberta_va_fast import DebertaVaTokenizerFast

							try:
														if not is_tf_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_tf_deberta_va import (
														    TF_DEBERTA_V2_PRETRAINED_MODEL_ARCHIVE_LIST,
														    TFDebertaVaForMaskedLM,
														    TFDebertaVaForQuestionAnswering,
														    TFDebertaVaForSequenceClassification,
														    TFDebertaVaForTokenClassification,
														    TFDebertaVaModel,
														    TFDebertaVaPreTrainedModel,
														)

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_deberta_va import (
														    DEBERTA_V2_PRETRAINED_MODEL_ARCHIVE_LIST,
														    DebertaVaForMaskedLM,
														    DebertaVaForMultipleChoice,
														    DebertaVaForQuestionAnswering,
														    DebertaVaForSequenceClassification,
														    DebertaVaForTokenClassification,
														    DebertaVaModel,
														    DebertaVaPreTrainedModel,
														)

else:
							import sys

							lowerCAmelCase								=						_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)