




from typing import Optional, Union

from ...file_utils import TensorType
from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, TruncationStrategy


class 							__SCREAMING_SNAKE_CASE				(						lowerCamelCase    ):
					_lowerCamelCase						    =					"""MarkupLMFeatureExtractor"""
					_lowerCamelCase						    =					("""MarkupLMTokenizer""", """MarkupLMTokenizerFast""")
					_lowerCamelCase						    =					True

					def __call__(							self					,			__lowercase=None					,			__lowercase=None					,			__lowercase=None					,			__lowercase=None					,			__lowercase=None					,			__lowercase = True					,			__lowercase = False					,			__lowercase = None					,			__lowercase = None					,			__lowercase = 0					,			__lowercase = None					,			__lowercase = None					,			__lowercase = None					,			__lowercase = False					,			__lowercase = False					,			__lowercase = False					,			__lowercase = False					,			__lowercase = True					,			__lowercase = None					,			**__lowercase					,			):







						'''simple docstring'''




						if self.parse_html:
							if html_strings is None:
								raise ValueError('Make sure to pass HTML strings in case `parse_html` is set to `True`'   )

							if nodes is not None or xpaths is not None or node_labels is not None:
								raise ValueError(
								    'Please don\'t pass nodes, xpaths nor node labels in case `parse_html` is set to `True`'   )

							lowerCamelCase_				:						Dict				  =				self.feature_extractor(__lowercase   )
							lowerCamelCase_				:						Any				  =				features['nodes']
							lowerCamelCase_				:						Union[str, Any]				  =				features['xpaths']
						else:
							if html_strings is not None:
								raise ValueError('You have passed HTML strings but `parse_html` is set to `False`.'   )
							if nodes is None or xpaths is None:
								raise ValueError('Make sure to pass nodes and xpaths in case `parse_html` is set to `False`'   )

        # # second, apply the tokenizer
						if questions is not None and self.parse_html:
							if isinstance(__lowercase					,			__lowercase   ):
								lowerCamelCase_				:						Optional[Any]				  =				[questions]  # add batch dimension (as the feature extractor always adds a batch dimension)

						lowerCamelCase_				:						Optional[int]				  =				self.tokenizer(
						    text=questions if questions is not None else nodes					,			text_pair=nodes if questions is not None else None					,			xpaths=__lowercase					,			node_labels=__lowercase					,			add_special_tokens=__lowercase					,			padding=__lowercase					,			truncation=__lowercase					,			max_length=__lowercase					,			stride=__lowercase					,			pad_to_multiple_of=__lowercase					,			return_token_type_ids=__lowercase					,			return_attention_mask=__lowercase					,			return_overflowing_tokens=__lowercase					,			return_special_tokens_mask=__lowercase					,			return_offsets_mapping=__lowercase					,			return_length=__lowercase					,			verbose=__lowercase					,			return_tensors=__lowercase					,			**__lowercase					,			)

						return encoded_inputs

					def       lowercase_				(							self					,			*__lowercase					,			**__lowercase   ):







						'''simple docstring'''




						return self.tokenizer.batch_decode(*__lowercase					,			**__lowercase   )

					def       lowercase_				(							self					,			*__lowercase					,			**__lowercase   ):







						'''simple docstring'''




						return self.tokenizer.decode(*__lowercase					,			**__lowercase   )





					@property
					def       lowercase_				(							self   ):







						'''simple docstring'''




						lowerCamelCase_				:						Optional[Any]				  =				self.tokenizer.model_input_names
						return tokenizer_input_names






from typing import TYPE_CHECKING

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


UpperCamelCase__						=		{
    'configuration_sam': [
        'SAM_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'SamConfig',
        'SamMaskDecoderConfig',
        'SamPromptEncoderConfig',
        'SamVisionConfig',
    ],
    'processing_sam': ['SamProcessor'],
}


try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							UpperCamelCase__						=		[
							    'SAM_PRETRAINED_MODEL_ARCHIVE_LIST',
							    'SamModel',
							    'SamPreTrainedModel',
							]
try:
							if not is_tf_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							UpperCamelCase__						=		[
							    'TF_SAM_PRETRAINED_MODEL_ARCHIVE_LIST',
							    'TFSamModel',
							    'TFSamPreTrainedModel',
							]
try:
							if not is_vision_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							UpperCamelCase__						=		['SamImageProcessor']


if TYPE_CHECKING:
							from .configuration_sam import (
							    SAM_PRETRAINED_CONFIG_ARCHIVE_MAP,
							    SamConfig,
							    SamMaskDecoderConfig,
							    SamPromptEncoderConfig,
							    SamVisionConfig,
							)
							from .processing_sam import SamProcessor

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_sam import SAM_PRETRAINED_MODEL_ARCHIVE_LIST, SamModel, SamPreTrainedModel

							try:
														if not is_tf_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_tf_sam import TF_SAM_PRETRAINED_MODEL_ARCHIVE_LIST, TFSamModel, TFSamPreTrainedModel

							try:
														if not is_vision_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .image_processing_sam import SamImageProcessor

else:
							import sys

							UpperCamelCase__						=		_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)
