


"""simple docstring"""



import pytest

from datasets.parallel import ParallelBackendConfig, parallel_backend
from datasets.utils.py_utils import map_nested

from .utils import require_dill_gt_0_3_2, require_joblibspark, require_not_windows







def 		__lowercase					(       snake_case_  :  List[Any]						)       ->Optional[Any]:  # picklable for multiprocessing



    '''simple docstring'''







    return i + 1







@require_dill_gt_0_3_2
@require_joblibspark
@require_not_windows
def 		__lowercase					(       )       ->Optional[int]:



    '''simple docstring'''







    with parallel_backend('''spark'''						):
        assert ParallelBackendConfig.backend_name == "spark"

    __A   :						List[str]									=					[1, 2, 3]
    with pytest.raises(snake_case_						):
        with parallel_backend('''unsupported backend'''						):
            map_nested(snake_case_    ,snake_case_    ,num_proc=2						)

    with pytest.raises(snake_case_						):
        with parallel_backend('''unsupported backend'''						):
            map_nested(snake_case_    ,snake_case_    ,num_proc=-1						)







@require_dill_gt_0_3_2
@require_joblibspark
@require_not_windows
@pytest.mark.parametrize('''num_proc'''    ,[2, -1]						)
def 		__lowercase					(       snake_case_  :  Tuple						)       ->str:



    '''simple docstring'''







    __A   :						List[str]									=					[1, 2]
    __A   :						Optional[int]									=					{'''a''': 1, '''b''': 2}
    __A   :						Union[str, Any]									=					{'''a''': [1, 2], '''b''': [3, 4]}
    __A   :						str									=					{'''a''': {'''1''': 1}, '''b''': 2}
    __A   :						Any									=					{'''a''': 1, '''b''': 2, '''c''': 3, '''d''': 4}
    __A   :						Tuple									=					[2, 3]
    __A   :						List[str]									=					{'''a''': 2, '''b''': 3}
    __A   :						Dict									=					{'''a''': [2, 3], '''b''': [4, 5]}
    __A   :						List[Any]									=					{'''a''': {'''1''': 2}, '''b''': 3}
    __A   :						List[Any]									=					{'''a''': 2, '''b''': 3, '''c''': 4, '''d''': 5}

    with parallel_backend('''spark'''						):
        assert map_nested(snake_case_    ,snake_case_    ,num_proc=snake_case_						) == expected_map_nested_sa
        assert map_nested(snake_case_    ,snake_case_    ,num_proc=snake_case_						) == expected_map_nested_sa
        assert map_nested(snake_case_    ,snake_case_    ,num_proc=snake_case_						) == expected_map_nested_sa
        assert map_nested(snake_case_    ,snake_case_    ,num_proc=snake_case_						) == expected_map_nested_sa
        assert map_nested(snake_case_    ,snake_case_    ,num_proc=snake_case_						) == expected_map_nested_sa











"""simple docstring"""



from typing import TYPE_CHECKING

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


a_			=      {
    """configuration_tapas""": ["""TAPAS_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TapasConfig"""],
    """tokenization_tapas""": ["""TapasTokenizer"""],
}

try:
       if not is_torch_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       a_			=      [
           """TAPAS_PRETRAINED_MODEL_ARCHIVE_LIST""",
           """TapasForMaskedLM""",
           """TapasForQuestionAnswering""",
           """TapasForSequenceClassification""",
           """TapasModel""",
           """TapasPreTrainedModel""",
           """load_tf_weights_in_tapas""",
       ]
try:
       if not is_tf_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       a_			=      [
           """TF_TAPAS_PRETRAINED_MODEL_ARCHIVE_LIST""",
           """TFTapasForMaskedLM""",
           """TFTapasForQuestionAnswering""",
           """TFTapasForSequenceClassification""",
           """TFTapasModel""",
           """TFTapasPreTrainedModel""",
       ]


if TYPE_CHECKING:
       from .configuration_tapas import TAPAS_PRETRAINED_CONFIG_ARCHIVE_MAP, TapasConfig
       from .tokenization_tapas import TapasTokenizer

       try:
              if not is_torch_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_tapas import (
                  TAPAS_PRETRAINED_MODEL_ARCHIVE_LIST,
                  TapasForMaskedLM,
                  TapasForQuestionAnswering,
                  TapasForSequenceClassification,
                  TapasModel,
                  TapasPreTrainedModel,
                  load_tf_weights_in_tapas,
              )

       try:
              if not is_tf_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_tf_tapas import (
                  TF_TAPAS_PRETRAINED_MODEL_ARCHIVE_LIST,
                  TFTapasForMaskedLM,
                  TFTapasForQuestionAnswering,
                  TFTapasForSequenceClassification,
                  TFTapasModel,
                  TFTapasPreTrainedModel,
              )


else:
       import sys

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




