import unicodedata
from dataclasses import dataclass
from typing import Optional, Union

import numpy as np

from transformers.data.data_collator import DataCollatorMixin
from transformers.file_utils import PaddingStrategy
from transformers.tokenization_utils_base import PreTrainedTokenizerBase



def lowerCamelCase						(     SCREAMING_SNAKE_CASE						,    SCREAMING_SNAKE_CASE						,    SCREAMING_SNAKE_CASE						,    SCREAMING_SNAKE_CASE			):
    '''simple docstring'''







    if isinstance(SCREAMING_SNAKE_CASE						,    SCREAMING_SNAKE_CASE			):
        __UpperCamelCase  :List[Any]    						=	np.full((len(SCREAMING_SNAKE_CASE			), sequence_length, 2)						,    SCREAMING_SNAKE_CASE			)
    else:
        __UpperCamelCase  :List[Any]    						=	np.full((len(SCREAMING_SNAKE_CASE			), sequence_length)						,    SCREAMING_SNAKE_CASE			)

    for i, tensor in enumerate(SCREAMING_SNAKE_CASE			):
        if padding_side == "right":
            if isinstance(SCREAMING_SNAKE_CASE						,    SCREAMING_SNAKE_CASE			):
                __UpperCamelCase  :List[Any]    						=	tensor[:sequence_length]
            else:
                __UpperCamelCase  :Any    						=	tensor[:sequence_length]
        else:
            if isinstance(SCREAMING_SNAKE_CASE						,    SCREAMING_SNAKE_CASE			):
                __UpperCamelCase  :Dict    						=	tensor[:sequence_length]
            else:
                __UpperCamelCase  :Union[str, Any]    						=	tensor[:sequence_length]

    return out_tensor.tolist()



def lowerCamelCase						(     SCREAMING_SNAKE_CASE			):
    '''simple docstring'''







    __UpperCamelCase  :List[str]    						=	ord(SCREAMING_SNAKE_CASE			)
    if (cp >= 33 and cp <= 47) or (cp >= 58 and cp <= 64) or (cp >= 91 and cp <= 96) or (cp >= 123 and cp <= 126):
        return True
    __UpperCamelCase  :Dict    						=	unicodedata.category(SCREAMING_SNAKE_CASE			)
    if cat.startswith('''P'''			):
        return True
    return False


@dataclass
class 			lowerCamelCase_  (     UpperCAmelCase_				):






    '''simple docstring'''






    a__			:		PreTrainedTokenizerBase
    a__			:		Union[bool, str, PaddingStrategy]      			=   True
    a__			:		Optional[int]      			=   None
    a__			:		Optional[int]      			=   None
    a__			:		int      			=   -1_0_0
    a__			:		str      			=   "pt"







    def     UpperCamelCase__     (			self				,				__lowercase) ->			Optional[Any]:
        import torch

        __UpperCamelCase  :List[str]    						=	'''label''' if '''label''' in features[0].keys() else '''labels'''
        __UpperCamelCase  :int    						=	[feature[label_name] for feature in features] if label_name in features[0].keys() else None
        __UpperCamelCase  :Optional[int]    						=	self.tokenizer.pad(
            __lowercase				,				padding=self.padding				,				max_length=self.max_length				,				pad_to_multiple_of=self.pad_to_multiple_of				,				return_tensors='''pt''' if labels is None else None				,				)

        if labels is None:
            return batch

        __UpperCamelCase  :Optional[Any]    						=	torch.tensor(batch['''entity_ids''']).shape[1]
        __UpperCamelCase  :int    						=	self.tokenizer.padding_side
        if padding_side == "right":
            __UpperCamelCase  :Optional[Any]    						=	[
                list(__lowercase) + [self.label_pad_token_id] * (sequence_length - len(__lowercase)) for label in labels
            ]
        else:
            __UpperCamelCase  :Dict    						=	[
                [self.label_pad_token_id] * (sequence_length - len(__lowercase)) + list(__lowercase) for label in labels
            ]

        __UpperCamelCase  :int    						=	[feature['''ner_tags'''] for feature in features]
        __UpperCamelCase  :Optional[Any]    						=	padding_tensor(__lowercase				,				-1				,				__lowercase				,				__lowercase)
        __UpperCamelCase  :Tuple    						=	[feature['''original_entity_spans'''] for feature in features]
        __UpperCamelCase  :Optional[Any]    						=	padding_tensor(__lowercase				,				(-1, -1)				,				__lowercase				,				__lowercase)
        __UpperCamelCase  :Any    						=	{k: torch.tensor(__lowercase				,				dtype=torch.intaa) for k, v in batch.items()}

        return batch






def lowerCamelCase						(     SCREAMING_SNAKE_CASE						,    SCREAMING_SNAKE_CASE			):
    '''simple docstring'''







    return 1 if input_a == input_a else 0



def lowerCamelCase						(     ):
    '''simple docstring'''







    assert xnor_gate(0						,    0			) == 1
    assert xnor_gate(0						,    1			) == 0
    assert xnor_gate(1						,    0			) == 0
    assert xnor_gate(1						,    1			) == 1


if __name__ == "__main__":
    print(xnor_gate(0, 0))
    print(xnor_gate(0, 1))
    print(xnor_gate(1, 0))
    print(xnor_gate(1, 1))





