


'''simple docstring'''



import unittest

from transformers import DonutProcessor


__UpperCAmelCase      :Tuple			    =       '''naver-clova-ix/donut-base'''



class      a    (		unittest.TestCase	):


     """simple docstring"""






     def 			lowerCamelCase__			(    self					:		Any      )						->							Dict:
          __UpperCAmelCase     :			Optional[int]  							=      DonutProcessor.from_pretrained(snake_case      )






     def 			lowerCamelCase__			(    self					:		str      )						->							str:
          __UpperCAmelCase     :			Optional[int]  							=      {
              "name": "John Doe",
              "age": "99",
              "city": "Atlanta",
              "state": "GA",
              "zip": "30301",
              "phone": "123-4567",
              "nicknames": [{"nickname": "Johnny"}, {"nickname": "JD"}],
          }

          __UpperCAmelCase     :			List[str]  							=      (
              "<s_name>John Doe</s_name><s_age>99</s_age><s_city>Atlanta</s_city>"
              "<s_state>GA</s_state><s_zip>30301</s_zip><s_phone>123-4567</s_phone>"
              "<s_nicknames><s_nickname>Johnny</s_nickname>"
              "<sep/><s_nickname>JD</s_nickname></s_nicknames>"
          )
          __UpperCAmelCase     :			Dict  							=      self.processor.tokenajson(snake_case      )

          self.assertDictEqual(snake_case							,			snake_case      )



'''simple docstring'''



from typing import TYPE_CHECKING

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


__UpperCAmelCase      :List[Any]			    =       {
    "configuration_lxmert": ["LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "LxmertConfig"],
    "tokenization_lxmert": ["LxmertTokenizer"],
}

try:
      if not is_tokenizers_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      __UpperCAmelCase      :List[Any]			    =       ["LxmertTokenizerFast"]

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      __UpperCAmelCase      :List[Any]			    =       [
          "LxmertEncoder",
          "LxmertForPreTraining",
          "LxmertForQuestionAnswering",
          "LxmertModel",
          "LxmertPreTrainedModel",
          "LxmertVisualFeatureEncoder",
          "LxmertXLayer",
      ]

try:
      if not is_tf_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      __UpperCAmelCase      :List[str]			    =       [
          "TF_LXMERT_PRETRAINED_MODEL_ARCHIVE_LIST",
          "TFLxmertForPreTraining",
          "TFLxmertMainLayer",
          "TFLxmertModel",
          "TFLxmertPreTrainedModel",
          "TFLxmertVisualFeatureEncoder",
      ]


if TYPE_CHECKING:
      from .configuration_lxmert import LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP, LxmertConfig
      from .tokenization_lxmert import LxmertTokenizer

      try:
            if not is_tokenizers_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .tokenization_lxmert_fast import LxmertTokenizerFast

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_lxmert import (
                LxmertEncoder,
                LxmertForPreTraining,
                LxmertForQuestionAnswering,
                LxmertModel,
                LxmertPreTrainedModel,
                LxmertVisualFeatureEncoder,
                LxmertXLayer,
            )

      try:
            if not is_tf_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_tf_lxmert import (
                TF_LXMERT_PRETRAINED_MODEL_ARCHIVE_LIST,
                TFLxmertForPreTraining,
                TFLxmertMainLayer,
                TFLxmertModel,
                TFLxmertPreTrainedModel,
                TFLxmertVisualFeatureEncoder,
            )

else:
      import sys

      __UpperCAmelCase      :int			    =       _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)