'''simple docstring'''






import pytest

import datasets


# Import fixture modules as plugins
_UpperCAmelCase    :     Union[str, Any]         =       ['''tests.fixtures.files''', '''tests.fixtures.hub''', '''tests.fixtures.fsspec''']





def  _SCREAMING_SNAKE_CASE		(      __snake_case							:			Tuple   ,		__snake_case							:			Union[str, Any]				):
     # 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  _SCREAMING_SNAKE_CASE		(      __snake_case							:			Optional[Any]				):
     config.addinivalue_line('markers'   ,		'torchaudio_latest: mark test to run with torchaudio>=0.12'				)





@pytest.fixture(autouse=__snake_case				)
def  _SCREAMING_SNAKE_CASE		(      __snake_case							:			Any   ,		__snake_case							:			List[Any]				):
     # 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(__snake_case				)				)
     monkeypatch.setattr('datasets.config.HF_METRICS_CACHE'   ,		str(__snake_case				)				)
     monkeypatch.setattr('datasets.config.HF_MODULES_CACHE'   ,		str(__snake_case				)				)
     _A    		=  test_hf_datasets_cache / 'downloads'
     monkeypatch.setattr('datasets.config.DOWNLOADED_DATASETS_PATH'   ,		str(__snake_case				)				)
     _A    		=  test_hf_datasets_cache / 'downloads' / 'extracted'
     monkeypatch.setattr('datasets.config.EXTRACTED_DATASETS_PATH'   ,		str(__snake_case				)				)





@pytest.fixture(autouse=__snake_case   ,		scope='session'				)
def  _SCREAMING_SNAKE_CASE		(      ):
     datasets.disable_progress_bar()





@pytest.fixture(autouse=__snake_case				)
def  _SCREAMING_SNAKE_CASE		(      __snake_case							:			List[Any]				):
     # don't take tests into account when counting downloads
     monkeypatch.setattr('datasets.config.HF_UPDATE_DOWNLOAD_COUNTS'   ,		__snake_case				)





@pytest.fixture
def  _SCREAMING_SNAKE_CASE		(      __snake_case							:			Optional[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'   ,		__snake_case				)




'''simple docstring'''






import os
from pathlib import Path





def  _SCREAMING_SNAKE_CASE		(      ):
     from torch.utils.cpp_extension import load

     _A    		=  Path(__snake_case				).resolve().parent.parent.parent / 'kernels' / 'deformable_detr'
     _A    		=  [
         root / filename
         for filename in [
             'vision.cpp',
             os.path.join('cpu'   ,		'ms_deform_attn_cpu.cpp'				),
             os.path.join('cuda'   ,		'ms_deform_attn_cuda.cu'				),
         ]
     ]

     load(
         'MultiScaleDeformableAttention'   ,		__snake_case   ,		with_cuda=__snake_case   ,		extra_include_paths=[str(__snake_case				)]   ,		extra_cflags=['-DWITH_CUDA=1']   ,		extra_cuda_cflags=[
             '-DCUDA_HAS_FP16=1',
             '-D__CUDA_NO_HALF_OPERATORS__',
             '-D__CUDA_NO_HALF_CONVERSIONS__',
             '-D__CUDA_NO_HALF2_OPERATORS__',
         ]   ,		)

     import MultiScaleDeformableAttention as MSDA

     return MSDA



