



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     :    List[Any]      						=					logging.getLogger()

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





	def 				_lowercase(						self	,	A	,	A = None	,	A = None	,	A = None	,	A = True	,	)    ->    Tuple:
								UpperCAmelCase  :	Dict							  =	[file for file in os.listdir(A					) if os.path.isfile(os.path.join(A	,	A					)					)]

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

								if n_identifier is not None:
															if isinstance(A	,	A					):
																						for n_ in n_identifier:
																													UpperCAmelCase  :	Optional[int]							  =	[file for file in files if n_ not in file]
															else:
																						UpperCAmelCase  :	int							  =	[file for file in files if n_identifier not in file]

								UpperCAmelCase  :	Dict							  =	ignore_files or []
								ignore_files.append("""__init__.py"""					)
								UpperCAmelCase  :	List[Any]							  =	[file for file in files if file not in ignore_files]

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

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





	def 				_lowercase(						self					)    ->    str:
								UpperCAmelCase  :	Optional[int]							  =	Path("""src/transformers"""					)
								UpperCAmelCase  :	Tuple							  =	"""modeling"""
								UpperCAmelCase  :	Dict							  =	[
								    """modeling_ctrl.py""",
								    """modeling_tf_ctrl.py""",
								]
								self.analyze_directory(A	,	identifier=A	,	ignore_files=A					)





	def 				_lowercase(						self					)    ->    str:
								UpperCAmelCase  :	Tuple							  =	Path("""src/transformers"""					)
								UpperCAmelCase  :	Dict							  =	"""tokenization"""
								self.analyze_directory(A	,	identifier=A					)





	def 				_lowercase(						self					)    ->    Union[str, Any]:
								UpperCAmelCase  :	Any							  =	Path("""src/transformers"""					)
								UpperCAmelCase  :	Optional[Any]							  =	"""configuration"""
								self.analyze_directory(A	,	identifier=A					)





	def 				_lowercase(						self					)    ->    str:
								UpperCAmelCase  :	List[str]							  =	Path("""src/transformers"""					)
								UpperCAmelCase  :	Optional[Any]							  =	["""configuration""", """modeling""", """tokenization"""]
								self.analyze_directory(A	,	n_identifier=A					)






	def 				_lowercase(						self					)    ->    Tuple:
								UpperCAmelCase  :	List[str]							  =	Path("""docs/source"""					)
								UpperCAmelCase  :	Union[str, Any]							  =	["""favicon.ico"""]
								self.analyze_directory(A	,	ignore_files=A	,	only_modules=A					)






'''simple docstring'''




from typing import TYPE_CHECKING

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


a     :    Optional[Any]      						=					{
    """configuration_bert""": ["""BERT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """BertConfig""", """BertOnnxConfig"""],
    """tokenization_bert""": ["""BasicTokenizer""", """BertTokenizer""", """WordpieceTokenizer"""],
}

try:
							if not is_tokenizers_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							a     :    Dict      						=					["""BertTokenizerFast"""]

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							a     :    List[Any]      						=					[
							    """BERT_PRETRAINED_MODEL_ARCHIVE_LIST""",
							    """BertForMaskedLM""",
							    """BertForMultipleChoice""",
							    """BertForNextSentencePrediction""",
							    """BertForPreTraining""",
							    """BertForQuestionAnswering""",
							    """BertForSequenceClassification""",
							    """BertForTokenClassification""",
							    """BertLayer""",
							    """BertLMHeadModel""",
							    """BertModel""",
							    """BertPreTrainedModel""",
							    """load_tf_weights_in_bert""",
							]

try:
							if not is_tf_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							a     :    List[str]      						=					[
							    """TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST""",
							    """TFBertEmbeddings""",
							    """TFBertForMaskedLM""",
							    """TFBertForMultipleChoice""",
							    """TFBertForNextSentencePrediction""",
							    """TFBertForPreTraining""",
							    """TFBertForQuestionAnswering""",
							    """TFBertForSequenceClassification""",
							    """TFBertForTokenClassification""",
							    """TFBertLMHeadModel""",
							    """TFBertMainLayer""",
							    """TFBertModel""",
							    """TFBertPreTrainedModel""",
							]
try:
							if not is_tensorflow_text_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							a     :    int      						=					["""TFBertTokenizer"""]

try:
							if not is_flax_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							a     :    Optional[Any]      						=					[
							    """FlaxBertForCausalLM""",
							    """FlaxBertForMaskedLM""",
							    """FlaxBertForMultipleChoice""",
							    """FlaxBertForNextSentencePrediction""",
							    """FlaxBertForPreTraining""",
							    """FlaxBertForQuestionAnswering""",
							    """FlaxBertForSequenceClassification""",
							    """FlaxBertForTokenClassification""",
							    """FlaxBertModel""",
							    """FlaxBertPreTrainedModel""",
							]

if TYPE_CHECKING:
							from .configuration_bert import BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, BertConfig, BertOnnxConfig
							from .tokenization_bert import BasicTokenizer, BertTokenizer, WordpieceTokenizer

							try:
														if not is_tokenizers_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .tokenization_bert_fast import BertTokenizerFast

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_bert import (
														    BERT_PRETRAINED_MODEL_ARCHIVE_LIST,
														    BertForMaskedLM,
														    BertForMultipleChoice,
														    BertForNextSentencePrediction,
														    BertForPreTraining,
														    BertForQuestionAnswering,
														    BertForSequenceClassification,
														    BertForTokenClassification,
														    BertLayer,
														    BertLMHeadModel,
														    BertModel,
														    BertPreTrainedModel,
														    load_tf_weights_in_bert,
														)

							try:
														if not is_tf_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_tf_bert import (
														    TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST,
														    TFBertEmbeddings,
														    TFBertForMaskedLM,
														    TFBertForMultipleChoice,
														    TFBertForNextSentencePrediction,
														    TFBertForPreTraining,
														    TFBertForQuestionAnswering,
														    TFBertForSequenceClassification,
														    TFBertForTokenClassification,
														    TFBertLMHeadModel,
														    TFBertMainLayer,
														    TFBertModel,
														    TFBertPreTrainedModel,
														)

							try:
														if not is_tensorflow_text_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .tokenization_bert_tf import TFBertTokenizer

							try:
														if not is_flax_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_flax_bert import (
														    FlaxBertForCausalLM,
														    FlaxBertForMaskedLM,
														    FlaxBertForMultipleChoice,
														    FlaxBertForNextSentencePrediction,
														    FlaxBertForPreTraining,
														    FlaxBertForQuestionAnswering,
														    FlaxBertForSequenceClassification,
														    FlaxBertForTokenClassification,
														    FlaxBertModel,
														    FlaxBertPreTrainedModel,
														)

else:
							import sys

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

