from typing import TYPE_CHECKING

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


_lowerCAmelCase       =		{
    "configuration_ctrl": ["CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP", "CTRLConfig"],
    "tokenization_ctrl": ["CTRLTokenizer"],
}

try:
					if not is_torch_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					_lowerCAmelCase       =		[
					    "CTRL_PRETRAINED_MODEL_ARCHIVE_LIST",
					    "CTRLForSequenceClassification",
					    "CTRLLMHeadModel",
					    "CTRLModel",
					    "CTRLPreTrainedModel",
					]

try:
					if not is_tf_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					_lowerCAmelCase       =		[
					    "TF_CTRL_PRETRAINED_MODEL_ARCHIVE_LIST",
					    "TFCTRLForSequenceClassification",
					    "TFCTRLLMHeadModel",
					    "TFCTRLModel",
					    "TFCTRLPreTrainedModel",
					]


if TYPE_CHECKING:
					from .configuration_ctrl import CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP, CTRLConfig
					from .tokenization_ctrl import CTRLTokenizer

					try:
										if not is_torch_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_ctrl import (
										    CTRL_PRETRAINED_MODEL_ARCHIVE_LIST,
										    CTRLForSequenceClassification,
										    CTRLLMHeadModel,
										    CTRLModel,
										    CTRLPreTrainedModel,
										)

					try:
										if not is_tf_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_tf_ctrl import (
										    TF_CTRL_PRETRAINED_MODEL_ARCHIVE_LIST,
										    TFCTRLForSequenceClassification,
										    TFCTRLLMHeadModel,
										    TFCTRLModel,
										    TFCTRLPreTrainedModel,
										)

else:
					import sys

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



'''simple docstring'''







import pytest

import datasets


# Import fixture modules as plugins
__lowerCamelCase									=     ['''tests.fixtures.files''', '''tests.fixtures.hub''', '''tests.fixtures.fsspec''']
def    UpperCAmelCase__     (   UpperCAmelCase__,							UpperCAmelCase__					)      ->      Optional[int]:
       # Mark tests as "unit" by default if not marked as "integration" (or already marked as "unit")
       for item in items:
              if any(marker in item.keywords for marker in ["""integration""", """unit"""]					):
                     continue
              item.add_marker(pytest.mark.unit					)
def    UpperCAmelCase__     (   UpperCAmelCase__					)      ->      Tuple:
       config.addinivalue_line("""markers""",							"""torchaudio_latest: mark test to run with torchaudio>=0.12"""					)
@pytest.fixture(autouse=UpperCAmelCase__					)
def    UpperCAmelCase__     (   UpperCAmelCase__,							UpperCAmelCase__					)      ->      int:
       # test_hf_cache_home = tmp_path_factory.mktemp("cache")  # TODO: why a cache dir per test function does not work?
       A_						       =   tmp_path_factory.getbasetemp() / """cache"""
       A_						       =   test_hf_cache_home / """datasets"""
       A_						       =   test_hf_cache_home / """metrics"""
       A_						       =   test_hf_cache_home / """modules"""
       monkeypatch.setattr("""datasets.config.HF_DATASETS_CACHE""",							str(UpperCAmelCase__					)					)
       monkeypatch.setattr("""datasets.config.HF_METRICS_CACHE""",							str(UpperCAmelCase__					)					)
       monkeypatch.setattr("""datasets.config.HF_MODULES_CACHE""",							str(UpperCAmelCase__					)					)
       A_						       =   test_hf_datasets_cache / """downloads"""
       monkeypatch.setattr("""datasets.config.DOWNLOADED_DATASETS_PATH""",							str(UpperCAmelCase__					)					)
       A_						       =   test_hf_datasets_cache / """downloads""" / """extracted"""
       monkeypatch.setattr("""datasets.config.EXTRACTED_DATASETS_PATH""",							str(UpperCAmelCase__					)					)
@pytest.fixture(autouse=UpperCAmelCase__,							scope="""session"""					)
def    UpperCAmelCase__     (   )      ->      str:
       datasets.disable_progress_bar()
@pytest.fixture(autouse=UpperCAmelCase__					)
def    UpperCAmelCase__     (   UpperCAmelCase__					)      ->      Tuple:
       # don't take tests into account when counting downloads
       monkeypatch.setattr("""datasets.config.HF_UPDATE_DOWNLOAD_COUNTS""",							UpperCAmelCase__					)







@pytest.fixture
def    UpperCAmelCase__     (   UpperCAmelCase__					)      ->      Any:
       # Required to suppress RemovedIn20Warning when feature(s) are not compatible with SQLAlchemy 2.0
       # To be removed once SQLAlchemy 2.0 supported
       monkeypatch.setattr("""sqlalchemy.util.deprecations.SILENCE_UBER_WARNING""",							UpperCAmelCase__					)
