






"""simple docstring"""
from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_torch_available


A_     :					List[str]							=     {"configuration_bert_generation": ["BertGenerationConfig"]}

try:
      if not is_sentencepiece_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      A_     :					Union[str, Any]							=     ["BertGenerationTokenizer"]

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      A_     :					Tuple							=     [
          "BertGenerationDecoder",
          "BertGenerationEncoder",
          "BertGenerationPreTrainedModel",
          "load_tf_weights_in_bert_generation",
      ]


if TYPE_CHECKING:
      from .configuration_bert_generation import BertGenerationConfig

      try:
            if not is_sentencepiece_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .tokenization_bert_generation import BertGenerationTokenizer

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_bert_generation import (
                BertGenerationDecoder,
                BertGenerationEncoder,
                BertGenerationPreTrainedModel,
                load_tf_weights_in_bert_generation,
            )

else:
      import sys

      A_     :					List[Any]							=     _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)









"""simple docstring"""
from __future__ import annotations






def 			lowerCamelCase_    (		_lowerCamelCase							):
 lowerCamelCase__	:     int
 lowerCamelCase__	:     list[str]								=		list(_lowerCamelCase							)
 lowerCamelCase__							,	lowerCamelCase__	:     Union[str, Any]								=		_vector[:-1], int(_vector[-1]							)
 lowerCamelCase__	:     list[int]								=		[int(_lowerCamelCase							) for digit in __vector]

 vector.reverse()
 for i, digit in enumerate(_lowerCamelCase							):
  if i & 1 == 0:
   lowerCamelCase__	:     int								=		digit * 2
   if doubled > 9:
    doubled -= 9
   check_digit += doubled
  else:
   check_digit += digit

 return check_digit % 10 == 0


if __name__ == "__main__":
      import doctest

      doctest.testmod()
      assert is_luhn("79927398713")
      assert not is_luhn("79927398714")

