
import doctest
import logging
import os
import unittest
from pathlib import Path
from typing import List, Union

import transformers
from transformers.testing_utils import require_tf, require_torch, slow


_A     =  logging.getLogger()





@unittest.skip('''Temporarily disable the doc tests.''' )
@require_torch
@require_tf
@slow
class 			_lowerCAmelCase      (			unittest.TestCase ):




				def   __a		(      self       ,       _UpperCamelCase       ,       _UpperCamelCase = None       ,       _UpperCamelCase = None       ,       _UpperCamelCase = None       ,       _UpperCamelCase = True       ,       )       ->   Dict:
							lowerCAmelCase_      			=			[file for file in os.listdir(_UpperCamelCase  ) if os.path.isfile(os.path.join(_UpperCamelCase       ,       _UpperCamelCase  )  )]

							if identifier is not None:
										lowerCAmelCase_      			=			[file for file in files if identifier in file]

							if n_identifier is not None:
										if isinstance(_UpperCamelCase       ,       _UpperCamelCase  ):
													for n_ in n_identifier:
																lowerCAmelCase_      			=			[file for file in files if n_ not in file]
										else:
													lowerCAmelCase_      			=			[file for file in files if n_identifier not in file]

							lowerCAmelCase_      			=			ignore_files or []
							ignore_files.append("__init__.py"  )
							lowerCAmelCase_      			=			[file for file in files if file not in ignore_files]

							for file in files:
										# Open all files
										print("Testing"       ,       _UpperCamelCase  )

										if only_modules:
													lowerCAmelCase_      			=			file.split("."  )[0]
													try:
																lowerCAmelCase_      			=			getattr(_UpperCamelCase       ,       _UpperCamelCase  )
																lowerCAmelCase_      			=			doctest.DocTestSuite(_UpperCamelCase  )
																lowerCAmelCase_      			=			unittest.TextTestRunner().run(_UpperCamelCase  )
																self.assertIs(len(result.failures  )       ,       0  )
													except AttributeError:
																logger.info(f"""{module_identifier} is not a module."""  )
										else:
													lowerCAmelCase_      			=			doctest.testfile(str(".." / directory / file  )       ,       optionflags=doctest.ELLIPSIS  )
													self.assertIs(result.failed       ,       0  )




				def   __a		(      self  )       ->   Union[str, Any]:
							lowerCAmelCase_      			=			Path("src/transformers"  )
							lowerCAmelCase_      			=			"modeling"
							lowerCAmelCase_      			=			[
							    "modeling_ctrl.py",
							    "modeling_tf_ctrl.py",
							]
							self.analyze_directory(_UpperCamelCase       ,       identifier=_UpperCamelCase       ,       ignore_files=_UpperCamelCase  )




				def   __a		(      self  )       ->   Optional[int]:
							lowerCAmelCase_      			=			Path("src/transformers"  )
							lowerCAmelCase_      			=			"tokenization"
							self.analyze_directory(_UpperCamelCase       ,       identifier=_UpperCamelCase  )




				def   __a		(      self  )       ->   Union[str, Any]:
							lowerCAmelCase_      			=			Path("src/transformers"  )
							lowerCAmelCase_      			=			"configuration"
							self.analyze_directory(_UpperCamelCase       ,       identifier=_UpperCamelCase  )




				def   __a		(      self  )       ->   Union[str, Any]:
							lowerCAmelCase_      			=			Path("src/transformers"  )
							lowerCAmelCase_      			=			["configuration", "modeling", "tokenization"]
							self.analyze_directory(_UpperCamelCase       ,       n_identifier=_UpperCamelCase  )




				def   __a		(      self  )       ->   str:
							lowerCAmelCase_      			=			Path("docs/source"  )
							lowerCAmelCase_      			=			["favicon.ico"]
							self.analyze_directory(_UpperCamelCase       ,       ignore_files=_UpperCamelCase       ,       only_modules=_UpperCamelCase  )





from typing import TYPE_CHECKING

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


_A     =  {}

try:
			if not is_sentencepiece_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			_A     =  ["NllbTokenizer"]

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


if TYPE_CHECKING:
			try:
						if not is_sentencepiece_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .tokenization_nllb import NllbTokenizer

			try:
						if not is_tokenizers_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .tokenization_nllb_fast import NllbTokenizerFast

else:
			import sys

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



