





'''simple docstring'''




from typing import TYPE_CHECKING

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


lowercase__       : str         =       {
    '''configuration_convbert''': ['''CONVBERT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ConvBertConfig''', '''ConvBertOnnxConfig'''],
    '''tokenization_convbert''': ['''ConvBertTokenizer'''],
}

try:
  if not is_tokenizers_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  lowercase__       : Tuple         =       ['''ConvBertTokenizerFast''']

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  lowercase__       : int         =       [
      '''CONVBERT_PRETRAINED_MODEL_ARCHIVE_LIST''',
      '''ConvBertForMaskedLM''',
      '''ConvBertForMultipleChoice''',
      '''ConvBertForQuestionAnswering''',
      '''ConvBertForSequenceClassification''',
      '''ConvBertForTokenClassification''',
      '''ConvBertLayer''',
      '''ConvBertModel''',
      '''ConvBertPreTrainedModel''',
      '''load_tf_weights_in_convbert''',
  ]


try:
  if not is_tf_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  lowercase__       : List[Any]         =       [
      '''TF_CONVBERT_PRETRAINED_MODEL_ARCHIVE_LIST''',
      '''TFConvBertForMaskedLM''',
      '''TFConvBertForMultipleChoice''',
      '''TFConvBertForQuestionAnswering''',
      '''TFConvBertForSequenceClassification''',
      '''TFConvBertForTokenClassification''',
      '''TFConvBertLayer''',
      '''TFConvBertModel''',
      '''TFConvBertPreTrainedModel''',
  ]


if TYPE_CHECKING:
  from .configuration_convbert import CONVBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, ConvBertConfig, ConvBertOnnxConfig
  from .tokenization_convbert import ConvBertTokenizer

  try:
    if not is_tokenizers_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .tokenization_convbert_fast import ConvBertTokenizerFast

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_convbert import (
        CONVBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
        ConvBertForMaskedLM,
        ConvBertForMultipleChoice,
        ConvBertForQuestionAnswering,
        ConvBertForSequenceClassification,
        ConvBertForTokenClassification,
        ConvBertLayer,
        ConvBertModel,
        ConvBertPreTrainedModel,
        load_tf_weights_in_convbert,
    )

  try:
    if not is_tf_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_tf_convbert import (
        TF_CONVBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
        TFConvBertForMaskedLM,
        TFConvBertForMultipleChoice,
        TFConvBertForQuestionAnswering,
        TFConvBertForSequenceClassification,
        TFConvBertForTokenClassification,
        TFConvBertLayer,
        TFConvBertModel,
        TFConvBertPreTrainedModel,
    )


else:
  import sys

  lowercase__       : Union[str, Any]         =       _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)







import re
from pathlib import Path
from unittest import TestCase

import pytest


@pytest.mark.integration
class     _a							(	UpperCAmelCase__     ):






  """simple docstring"""





  def  _UpperCAmelCase  (  self		,		_UpperCAmelCase			)      ->			Dict:

     with open(_UpperCAmelCase		,		encoding='utf-8'			) as input_file:
        UpperCamelCase_						=  re.compile(R'(?!.*\b(?:encoding|rb|w|wb|w+|wb+|ab|ab+)\b)(?<=\s)(open)\((.*)\)'			)
        UpperCamelCase_						=  input_file.read()
        UpperCamelCase_						=  regexp.search(_UpperCAmelCase			)

     return match




  def  _UpperCAmelCase  (  self		,		_UpperCAmelCase			)      ->			Dict:

     with open(_UpperCAmelCase		,		encoding='utf-8'			) as input_file:
        UpperCamelCase_						=  re.compile(R'#[^\r\n]*print\(|\"[^\r\n]*print\(|\"\"\".*?print\(.*?\"\"\"|(print\()'		,		re.DOTALL			)
        UpperCamelCase_						=  input_file.read()
        # use `re.finditer` to handle the case where the ignored groups would be matched first by `re.search`
        UpperCamelCase_						=  regexp.finditer(_UpperCAmelCase			)

     UpperCamelCase_						=  [match for match in matches if match is not None and match.group(1			) is not None]
     return matches[0] if matches else None




  def  _UpperCAmelCase  (  self			)      ->			List[str]:
     UpperCamelCase_						=  Path('./datasets'			)
     UpperCamelCase_						=  list(dataset_paths.absolute().glob('**/*.py'			)			)

     for dataset in dataset_files:
        if self._no_encoding_on_file_open(str(_UpperCAmelCase			)			):
           raise AssertionError(f"""open(...) must use utf-8 encoding in {dataset}"""			)




  def  _UpperCAmelCase  (  self			)      ->			Optional[int]:
     UpperCamelCase_						=  Path('./datasets'			)
     UpperCamelCase_						=  list(dataset_paths.absolute().glob('**/*.py'			)			)

     for dataset in dataset_files:
        if self._no_print_statements(str(_UpperCAmelCase			)			):
           raise AssertionError(f"""print statement found in {dataset}. Use datasets.logger/logging instead."""			)





