





import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from .tokenization_lxmert import LxmertTokenizer


UpperCAmelCase_							:      Tuple      =  {"vocab_file": "vocab.txt", "tokenizer_file": "tokenizer.json"}

UpperCAmelCase_							:      List[Any]      =  {
    "vocab_file": {
        "unc-nlp/lxmert-base-uncased": "https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/vocab.txt",
    },
    "tokenizer_file": {
        "unc-nlp/lxmert-base-uncased": (
            "https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/tokenizer.json"
        ),
    },
}

UpperCAmelCase_							:      Optional[int]      =  {
    "unc-nlp/lxmert-base-uncased": 512,
}

UpperCAmelCase_							:      Tuple      =  {
    "unc-nlp/lxmert-base-uncased": {"do_lower_case": True},
}






class      UpperCamelCase    (						_UpperCAmelCase     ):
	lowerCAmelCase	:   str				=	VOCAB_FILES_NAMES
	lowerCAmelCase	:   Union[str, Any]				=	PRETRAINED_VOCAB_FILES_MAP
	lowerCAmelCase	:   Tuple				=	PRETRAINED_INIT_CONFIGURATION
	lowerCAmelCase	:   List[str]				=	PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
	lowerCAmelCase	:   str				=	LxmertTokenizer



	def __init__(       self			,	UpperCAmelCase__=None			,	UpperCAmelCase__=None			,	UpperCAmelCase__=True			,	UpperCAmelCase__="[UNK]"			,	UpperCAmelCase__="[SEP]"			,	UpperCAmelCase__="[PAD]"			,	UpperCAmelCase__="[CLS]"			,	UpperCAmelCase__="[MASK]"			,	UpperCAmelCase__=True			,	UpperCAmelCase__=None			,	**UpperCAmelCase__			,	):
							super().__init__(
							    UpperCAmelCase__			,	tokenizer_file=UpperCAmelCase__			,	do_lower_case=UpperCAmelCase__			,	unk_token=UpperCAmelCase__			,	sep_token=UpperCAmelCase__			,	pad_token=UpperCAmelCase__			,	cls_token=UpperCAmelCase__			,	mask_token=UpperCAmelCase__			,	tokenize_chinese_chars=UpperCAmelCase__			,	strip_accents=UpperCAmelCase__			,	**UpperCAmelCase__			,	)

							A__							=       json.loads(self.backend_tokenizer.normalizer.__getstate__()		)
							if (
							    normalizer_state.get("lowercase"			,	UpperCAmelCase__		) != do_lower_case
							    or normalizer_state.get("strip_accents"			,	UpperCAmelCase__		) != strip_accents
							    or normalizer_state.get("handle_chinese_chars"			,	UpperCAmelCase__		) != tokenize_chinese_chars
							):
													A__							=       getattr(UpperCAmelCase__			,	normalizer_state.pop("type"		)		)
													A__							=       do_lower_case
													A__							=       strip_accents
													A__							=       tokenize_chinese_chars
													A__							=       normalizer_class(**UpperCAmelCase__		)

							A__							=       do_lower_case



	def 			__A							(       self			,	UpperCAmelCase__			,	UpperCAmelCase__=None		):
							A__							=       [self.cls_token_id] + token_ids_a + [self.sep_token_id]

							if token_ids_a:
													output += token_ids_a + [self.sep_token_id]

							return output



	def 			__A							(       self			,	UpperCAmelCase__			,	UpperCAmelCase__ = None		):
							A__							=       [self.sep_token_id]
							A__							=       [self.cls_token_id]
							if token_ids_a is None:
													return len(cls + token_ids_a + sep		) * [0]
							return len(cls + token_ids_a + sep		) * [0] + len(token_ids_a + sep		) * [1]



	def 			__A							(       self			,	UpperCAmelCase__			,	UpperCAmelCase__ = None		):
							A__							=       self._tokenizer.model.save(UpperCAmelCase__			,	name=UpperCAmelCase__		)
							return tuple(UpperCAmelCase__		)










import math
def  UpperCamelCase						(       _A			:				float			,							_A			:				float    )->       float:





						"""simple docstring"""





						if (
						    not isinstance(_A			,							(int, float)    )
						    or power_factor < -1
						    or power_factor > 1
						):
												raise ValueError("power_factor must be a valid float value between -1 and 1."    )
						return apparent_power * power_factor
def  UpperCamelCase						(       _A			:				float			,							_A			:				float    )->       float:





						"""simple docstring"""





						if (
						    not isinstance(_A			,							(int, float)    )
						    or power_factor < -1
						    or power_factor > 1
						):
												raise ValueError("power_factor must be a valid float value between -1 and 1."    )
						return apparent_power * math.sqrt(1 - power_factor**2    )


if __name__ == "__main__":
						import doctest

						doctest.testmod()





