





'''simple docstring'''

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 						UpperCamelCase    (							_lowerCamelCase : Union[str, Any]						,	_lowerCamelCase : Tuple						,	_lowerCamelCase : Dict						,	_lowerCamelCase : Union[str, Any]	):
    if isinstance(_lowerCamelCase						,	_lowerCamelCase	):
        A__    =      np.full((len(_lowerCamelCase	), sequence_length, 2)						,	_lowerCamelCase	)
    else:
        A__    =      np.full((len(_lowerCamelCase	), sequence_length)						,	_lowerCamelCase	)

    for i, tensor in enumerate(_lowerCamelCase	):
        if padding_side == "right":
            if isinstance(_lowerCamelCase						,	_lowerCamelCase	):
                A__    =      tensor[:sequence_length]
            else:
                A__    =      tensor[:sequence_length]
        else:
            if isinstance(_lowerCamelCase						,	_lowerCamelCase	):
                A__    =      tensor[:sequence_length]
            else:
                A__    =      tensor[:sequence_length]

    return out_tensor.tolist()





def 						UpperCamelCase    (							_lowerCamelCase : int	):
    A__    =      ord(_lowerCamelCase	)
    if (cp >= 33 and cp <= 47) or (cp >= 58 and cp <= 64) or (cp >= 91 and cp <= 96) or (cp >= 1_23 and cp <= 1_26):
        return True
    A__    =      unicodedata.category(_lowerCamelCase	)
    if cat.startswith("P"	):
        return True
    return False






@dataclass
class        UpperCAmelCase     (	UpperCamelCase__    ):
 __lowercase       		=    42
 __lowercase       		=    True
 __lowercase       		=    None
 __lowercase       		=    None
 __lowercase       		=    -100
 __lowercase       		=    "pt"
 def 					UpperCAmelCase_							(    self				:Optional[int]						,	lowercase_				:Tuple							)->							Tuple:
     import torch

     A__    =      "label" if "label" in features[0].keys() else "labels"
     A__    =      [feature[label_name] for feature in features] if label_name in features[0].keys() else None
     A__    =      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

     A__    =      torch.tensor(batch["entity_ids"]							).shape[1]
     A__    =      self.tokenizer.padding_side
     if padding_side == "right":
         A__    =      [
             list(lowercase_							) + [self.label_pad_token_id] * (sequence_length - len(lowercase_							)) for label in labels
         ]
     else:
         A__    =      [
             [self.label_pad_token_id] * (sequence_length - len(lowercase_							)) + list(lowercase_							) for label in labels
         ]

     A__    =      [feature["ner_tags"] for feature in features]
     A__    =      padding_tensor(lowercase_						,	-1						,	lowercase_						,	lowercase_							)
     A__    =      [feature["original_entity_spans"] for feature in features]
     A__    =      padding_tensor(lowercase_						,	(-1, -1)						,	lowercase_						,	lowercase_							)
     A__    =      {k: torch.tensor(lowercase_						,	dtype=torch.intaa							) for k, v in batch.items()}

     return batch










'''simple docstring'''

import qiskit





def 						UpperCamelCase    (							_lowerCamelCase : int						,	_lowerCamelCase : int	):
    A__    =      qiskit.Aer.get_backend("aer_simulator"	)

    # Create a Quantum Circuit acting on the q register
    A__    =      qiskit.QuantumCircuit(_lowerCamelCase						,	_lowerCamelCase	)

    # Map the quantum measurement to the classical bits
    circuit.measure([0]						,	[0]	)

    # Execute the circuit on the simulator
    A__    =      qiskit.execute(_lowerCamelCase						,	_lowerCamelCase						,	shots=10_00	)

    # Return the histogram data of the results of the experiment.
    return job.result().get_counts(_lowerCamelCase	)


if __name__ == "__main__":
  print(f"""Total count for various states are: {single_qubit_measure(1, 1)}""")



