





'''simple docstring'''







def    _lowerCAmelCase						(						lowercase					,	lowercase					,	lowercase					,	lowercase	)					->					int:
			return len_board * len_board_column * row + column





def    _lowerCAmelCase						(						lowercase					,	lowercase					,	lowercase					,	lowercase					,	lowercase					,	lowercase					,	)					->					bool:

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

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

			__lowerCAmelCase											=				[(0, 1), (0, -1), (-1, 0), (1, 0)]
			__lowerCAmelCase											=				len(lowercase	)
			__lowerCAmelCase											=				len(board[0]	)
			for direction in traverts_directions:
						__lowerCAmelCase											=				row + direction[0]
						__lowerCAmelCase											=				column + direction[1]
						if not (0 <= next_i < len_board and 0 <= next_j < len_board_column):
									continue

						__lowerCAmelCase											=				get_point_key(lowercase					,	lowercase					,	lowercase					,	lowercase	)
						if key in visited_points_set:
									continue

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

						visited_points_set.remove(lowercase	)

			return False





def    _lowerCAmelCase						(						lowercase					,	lowercase	)					->					bool:
			__lowerCAmelCase											=				(
			    """The board should be a non empty matrix of single chars strings."""
			)

			__lowerCAmelCase											=				len(lowercase	)
			if not isinstance(lowercase					,	lowercase	) or len(lowercase	) == 0:
						raise ValueError(lowercase	)

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

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

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

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

			return False


if __name__ == "__main__":
	import doctest

	doctest.testmod()








'''simple docstring'''







from collections import namedtuple

_a					: Any      =    namedtuple("""from_to""", """from_ to""")

_a					: Dict      =    {
    """millimeter""": """mm""",
    """centimeter""": """cm""",
    """meter""": """m""",
    """kilometer""": """km""",
    """inch""": """in""",
    """inche""": """in""",  # Trailing 's' has been stripped off
    """feet""": """ft""",
    """foot""": """ft""",
    """yard""": """yd""",
    """mile""": """mi""",
}

_a					: Optional[Any]      =    {
    """mm""": from_to(0.001, 1_0_0_0),
    """cm""": from_to(0.01, 1_0_0),
    """m""": from_to(1, 1),
    """km""": from_to(1_0_0_0, 0.001),
    """in""": from_to(0.0254, 39.3701),
    """ft""": from_to(0.3048, 3.28084),
    """yd""": from_to(0.9144, 1.09361),
    """mi""": from_to(1609.34, 0.000621371),
}





def    _lowerCAmelCase						(						lowercase					,	lowercase					,	lowercase	)					->					float:
			__lowerCAmelCase											=				from_type.lower().rstrip("""s"""	)
			__lowerCAmelCase											=				TYPE_CONVERSION.get(lowercase					,	lowercase	)
			__lowerCAmelCase											=				to_type.lower().rstrip("""s"""	)
			__lowerCAmelCase											=				TYPE_CONVERSION.get(lowercase					,	lowercase	)
			if new_from not in METRIC_CONVERSION:
						__lowerCAmelCase											=				(
						    f'Invalid \'from_type\' value: {from_type!r}.\n'
						    f'Conversion abbreviations are: {", ".join(lowercase	)}'
						)
						raise ValueError(lowercase	)
			if new_to not in METRIC_CONVERSION:
						__lowerCAmelCase											=				(
						    f'Invalid \'to_type\' value: {to_type!r}.\n'
						    f'Conversion abbreviations are: {", ".join(lowercase	)}'
						)
						raise ValueError(lowercase	)
			return value * METRIC_CONVERSION[new_from].from_ * METRIC_CONVERSION[new_to].to


if __name__ == "__main__":
	import doctest

	doctest.testmod()

