



'''simple docstring'''

from typing import Optional, Union

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



class 		lowerCamelCase__   (    A  ):




					'''simple docstring'''



					A_         =    """MarkupLMFeatureExtractor"""
					A_         =    ("""MarkupLMTokenizer""", """MarkupLMTokenizerFast""")
					A_         =    True




					def __call__(	self					:						List[Any]  ,	UpperCamelCase_					:						List[str]=None  ,	UpperCamelCase_					:						Any=None  ,	UpperCamelCase_					:						List[Any]=None  ,	UpperCamelCase_					:						int=None  ,	UpperCamelCase_					:						Optional[int]=None  ,	UpperCamelCase_					:						bool = True  ,	UpperCamelCase_					:						Union[bool, str, PaddingStrategy] = False  ,	UpperCamelCase_					:						Union[bool, str, TruncationStrategy] = None  ,	UpperCamelCase_					:						Optional[int] = None  ,	UpperCamelCase_					:						int = 0  ,	UpperCamelCase_					:						Optional[int] = None  ,	UpperCamelCase_					:						Optional[bool] = None  ,	UpperCamelCase_					:						Optional[bool] = None  ,	UpperCamelCase_					:						bool = False  ,	UpperCamelCase_					:						bool = False  ,	UpperCamelCase_					:						bool = False  ,	UpperCamelCase_					:						bool = False  ,	UpperCamelCase_					:						bool = True  ,	UpperCamelCase_					:						Optional[Union[str, TensorType]] = None  ,	**UpperCamelCase_					:						List[Any]  ,	)	->							BatchEncoding:



						'''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`'       )

							_lowercase       :							str  	=		self.feature_extractor(UpperCamelCase_       )
							_lowercase       :							int  	=		features['nodes']
							_lowercase       :							List[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(UpperCamelCase_  ,	UpperCamelCase_       ):
								_lowercase       :							Optional[int]  	=		[questions]  # add batch dimension (as the feature extractor always adds a batch dimension)

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

						return encoded_inputs




					def     __UpperCAmelCase  (	self					:						str  ,	*UpperCamelCase_					:						List[Any]  ,	**UpperCamelCase_					:						Tuple       )	->							Optional[Any]:



						'''simple docstring'''





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




					def     __UpperCAmelCase  (	self					:						List[Any]  ,	*UpperCamelCase_					:						Optional[int]  ,	**UpperCamelCase_					:						Dict       )	->							Optional[Any]:



						'''simple docstring'''





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




					@property
					def     __UpperCAmelCase  (	self					:						Optional[int]       )	->							Any:



						'''simple docstring'''





						_lowercase       :							str  	=		self.tokenizer.model_input_names
						return tokenizer_input_names





'''simple docstring'''

import torch

from transformers import PreTrainedModel

from .custom_configuration import CustomConfig, NoSuperInitConfig



class 		lowerCamelCase__   (    A  ):




					'''simple docstring'''



					A_         =    CustomConfig




					def __init__(	self					:						int  ,	UpperCamelCase_					:						List[str]       )	->							int:



						'''simple docstring'''





						super().__init__(UpperCamelCase_       )
						_lowercase       :							List[Any]  	=		torch.nn.Linear(config.hidden_size  ,	config.hidden_size       )




					def     __UpperCAmelCase  (	self					:						Optional[int]  ,	UpperCamelCase_					:						Any       )	->							Union[str, Any]:



						'''simple docstring'''





						return self.linear(UpperCamelCase_       )




					def     __UpperCAmelCase  (	self					:						Optional[int]  ,	UpperCamelCase_					:						Optional[Any]       )	->							str:



						'''simple docstring'''





						pass






class 		lowerCamelCase__   (    A  ):




					'''simple docstring'''



					A_         =    NoSuperInitConfig




					def __init__(	self					:						Optional[int]  ,	UpperCamelCase_					:						Dict       )	->							Optional[Any]:



						'''simple docstring'''





						super().__init__(UpperCamelCase_       )
						_lowercase       :							List[str]  	=		torch.nn.Linear(config.attribute  ,	config.attribute       )




					def     __UpperCAmelCase  (	self					:						Optional[Any]  ,	UpperCamelCase_					:						Optional[int]       )	->							List[Any]:



						'''simple docstring'''





						return self.linear(UpperCamelCase_       )




					def     __UpperCAmelCase  (	self					:						Optional[Any]  ,	UpperCamelCase_					:						int       )	->							List[str]:



						'''simple docstring'''





						pass
