"""simple docstring"""




import math
import unittest

from transformers import BioGptConfig, is_torch_available
from transformers.testing_utils import require_torch, slow, torch_device

from ...generation.test_utils import GenerationTesterMixin
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
			import torch

			from transformers import (
			    BioGptForCausalLM,
			    BioGptForSequenceClassification,
			    BioGptForTokenClassification,
			    BioGptModel,
			    BioGptTokenizer,
			)
			from transformers.models.biogpt.modeling_biogpt import BIOGPT_PRETRAINED_MODEL_ARCHIVE_LIST

class    a_   :




					def __init__(						self    :  Union[str, Any]	,    snake_case__    :  int	,    snake_case__    :  List[Any]=13	,    snake_case__    :  str=7	,    snake_case__    :  List[str]=True	,    snake_case__    :  Tuple=True	,    snake_case__    :  Tuple=False	,    snake_case__    :  int=True	,    snake_case__    :  List[str]=99	,    snake_case__    :  Any=32	,    snake_case__    :  int=5	,    snake_case__    :  Union[str, Any]=4	,    snake_case__    :  Optional[int]=37	,    snake_case__    :  Optional[Any]="gelu"	,    snake_case__    :  Optional[int]=0.1	,    snake_case__    :  Union[str, Any]=0.1	,    snake_case__    :  str=512	,    snake_case__    :  Union[str, Any]=16	,    snake_case__    :  Union[str, Any]=2	,    snake_case__    :  Union[str, Any]=0.02	,    snake_case__    :  str=3	,    snake_case__    :  int=4	,    snake_case__    :  int=None	,    ):
							lowerCAmelCase__   = parent
							lowerCAmelCase__   = batch_size
							lowerCAmelCase__   = seq_length
							lowerCAmelCase__   = is_training
							lowerCAmelCase__   = use_input_mask
							lowerCAmelCase__   = use_token_type_ids
							lowerCAmelCase__   = use_labels
							lowerCAmelCase__   = vocab_size
							lowerCAmelCase__   = hidden_size
							lowerCAmelCase__   = num_hidden_layers
							lowerCAmelCase__   = num_attention_heads
							lowerCAmelCase__   = intermediate_size
							lowerCAmelCase__   = hidden_act
							lowerCAmelCase__   = hidden_dropout_prob
							lowerCAmelCase__   = attention_probs_dropout_prob
							lowerCAmelCase__   = max_position_embeddings
							lowerCAmelCase__   = type_vocab_size
							lowerCAmelCase__   = type_sequence_label_size
							lowerCAmelCase__   = initializer_range
							lowerCAmelCase__   = num_labels
							lowerCAmelCase__   = num_choices
							lowerCAmelCase__   = scope




					def     _SCREAMING_SNAKE_CASE    (						self    :  Union[str, Any]  ):
							lowerCAmelCase__   = ids_tensor([self.batch_size, self.seq_length]	,    self.vocab_size  )

							lowerCAmelCase__   = None
							if self.use_input_mask:
									lowerCAmelCase__   = random_attention_mask([self.batch_size, self.seq_length]  )

							lowerCAmelCase__   = None
							if self.use_token_type_ids:
									lowerCAmelCase__   = ids_tensor([self.batch_size, self.seq_length]	,    self.type_vocab_size  )

							lowerCAmelCase__   = None
							lowerCAmelCase__   = None
							lowerCAmelCase__   = None
							if self.use_labels:
									lowerCAmelCase__   = ids_tensor([self.batch_size]	,    self.type_sequence_label_size  )
									lowerCAmelCase__   = ids_tensor([self.batch_size, self.seq_length]	,    self.num_labels  )
									lowerCAmelCase__   = ids_tensor([self.batch_size]	,    self.num_choices  )

							lowerCAmelCase__   = self.get_config()

							return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels




					def     _SCREAMING_SNAKE_CASE    (						self    :  Dict  ):
							return BioGptConfig(
							    vocab_size=self.vocab_size	,    hidden_size=self.hidden_size	,    num_hidden_layers=self.num_hidden_layers	,    num_attention_heads=self.num_attention_heads	,    intermediate_size=self.intermediate_size	,    hidden_act=self.hidden_act	,    hidden_dropout_prob=self.hidden_dropout_prob	,    attention_probs_dropout_prob=self.attention_probs_dropout_prob	,    max_position_embeddings=self.max_position_embeddings	,    type_vocab_size=self.type_vocab_size	,    is_decoder=snake_case__	,    initializer_range=self.initializer_range	,    )




					def     _SCREAMING_SNAKE_CASE    (						self    :  Dict	,    snake_case__    :  Optional[Any]	,    snake_case__    :  Any	,    snake_case__    :  Optional[Any]	,    snake_case__    :  str	,    snake_case__    :  List[str]	,    snake_case__    :  Optional[int]	,    snake_case__    :  Union[str, Any]  ):
							lowerCAmelCase__   = BioGptModel(config=snake_case__  )
							model.to(snake_case__  )
							model.eval()
							lowerCAmelCase__   = model(snake_case__	,    attention_mask=snake_case__  )
							lowerCAmelCase__   = model(snake_case__  )
							self.parent.assertEqual(result.last_hidden_state.shape	,    (self.batch_size, self.seq_length, self.hidden_size)  )




					def     _SCREAMING_SNAKE_CASE    (						self    :  Tuple	,    snake_case__    :  Union[str, Any]	,    snake_case__    :  int	,    snake_case__    :  Optional[int]	,    snake_case__    :  Any	,    snake_case__    :  Tuple	,    snake_case__    :  List[Any]	,    snake_case__    :  Union[str, Any]	,    snake_case__    :  Union[str, Any]	,    snake_case__    :  Optional[int]	,    ):
							lowerCAmelCase__   = BioGptForCausalLM(config=snake_case__  )
							model.to(snake_case__  )
							model.eval()
							lowerCAmelCase__   = model(snake_case__	,    attention_mask=snake_case__	,    token_type_ids=snake_case__	,    labels=snake_case__  )
							self.parent.assertEqual(result.logits.shape	,    (self.batch_size, self.seq_length, self.vocab_size)  )




					def     _SCREAMING_SNAKE_CASE    (						self    :  Tuple	,    snake_case__    :  Any	,    snake_case__    :  List[str]	,    snake_case__    :  List[str]	,    snake_case__    :  Optional[Any]	,    snake_case__    :  int	,    *snake_case__    :  Optional[Any]  ):
							lowerCAmelCase__   = BioGptModel(config=snake_case__  )
							model.to(snake_case__  )
							model.eval()

							# create attention mask
							lowerCAmelCase__   = torch.ones(input_ids.shape	,    dtype=torch.long	,    device=snake_case__  )
							lowerCAmelCase__   = self.seq_length // 2
							lowerCAmelCase__   = 0

							# first forward pass
							lowerCAmelCase__ ,       lowerCAmelCase__   = model(snake_case__	,    attention_mask=snake_case__  ).to_tuple()

							# create hypothetical next token and extent to next_input_ids
							lowerCAmelCase__   = ids_tensor((self.batch_size, 1)	,    config.vocab_size  )

							# change a random masked slice from input_ids
							lowerCAmelCase__   = ids_tensor((1,)	,    snake_case__  ).item() + 1
							lowerCAmelCase__   = ids_tensor((self.batch_size, 1)	,    config.vocab_size  ).squeeze(-1  )
							lowerCAmelCase__   = random_other_next_tokens

							# append to next input_ids and attn_mask
							lowerCAmelCase__   = torch.cat([input_ids, next_tokens]	,    dim=-1  )
							lowerCAmelCase__   = torch.cat(
							    [attn_mask, torch.ones((attn_mask.shape[0], 1)	,    dtype=torch.long	,    device=snake_case__  )]	,    dim=1	,    )

							# get two different outputs
							lowerCAmelCase__   = model(snake_case__	,    attention_mask=snake_case__  )["""last_hidden_state"""]
							lowerCAmelCase__   = model(snake_case__	,    past_key_values=snake_case__	,    attention_mask=snake_case__  )["""last_hidden_state"""]

							# select random slice
							lowerCAmelCase__   = ids_tensor((1,)	,    output_from_past.shape[-1]  ).item()
							lowerCAmelCase__   = output_from_no_past[:, -1, random_slice_idx].detach()
							lowerCAmelCase__   = output_from_past[:, 0, random_slice_idx].detach()

							# test that outputs are equal for slice
							self.parent.assertTrue(torch.allclose(snake_case__	,    snake_case__	,    atol=1E-3  )  )




					def     _SCREAMING_SNAKE_CASE    (						self    :  str	,    snake_case__    :  Dict	,    snake_case__    :  str	,    snake_case__    :  List[Any]	,    snake_case__    :  List[str]	,    snake_case__    :  List[str]	,    *snake_case__    :  Tuple  ):
							lowerCAmelCase__   = BioGptModel(config=snake_case__  ).to(snake_case__  ).eval()

							lowerCAmelCase__   = torch.ones(input_ids.shape	,    dtype=torch.long	,    device=snake_case__  )

							# first forward pass
							lowerCAmelCase__   = model(snake_case__	,    attention_mask=snake_case__	,    use_cache=snake_case__  )

							lowerCAmelCase__ ,       lowerCAmelCase__   = outputs.to_tuple()

							# create hypothetical multiple next token and extent to next_input_ids
							lowerCAmelCase__   = ids_tensor((self.batch_size, 3)	,    config.vocab_size  )
							lowerCAmelCase__   = ids_tensor((self.batch_size, 3)	,    2  )

							# append to next input_ids and
							lowerCAmelCase__   = torch.cat([input_ids, next_tokens]	,    dim=-1  )
							lowerCAmelCase__   = torch.cat([attention_mask, next_attn_mask]	,    dim=-1  )

							lowerCAmelCase__   = model(snake_case__	,    attention_mask=snake_case__  )["""last_hidden_state"""]
							lowerCAmelCase__   = model(snake_case__	,    attention_mask=snake_case__	,    past_key_values=snake_case__  )[
							    """last_hidden_state"""
							]

							# select random slice
							lowerCAmelCase__   = ids_tensor((1,)	,    output_from_past.shape[-1]  ).item()
							lowerCAmelCase__   = output_from_no_past[:, -3:, random_slice_idx].detach()
							lowerCAmelCase__   = output_from_past[:, :, random_slice_idx].detach()

							self.parent.assertTrue(output_from_past_slice.shape[1] == next_tokens.shape[1]  )

							# test that outputs are equal for slice
							self.parent.assertTrue(torch.allclose(snake_case__	,    snake_case__	,    atol=1E-3  )  )




					def     _SCREAMING_SNAKE_CASE    (						self    :  int	,    snake_case__    :  Tuple	,    snake_case__    :  Optional[int]	,    snake_case__    :  str	,    snake_case__    :  str	,    snake_case__    :  List[Any]	,    *snake_case__    :  Optional[Any]	,    snake_case__    :  Tuple=False  ):
							lowerCAmelCase__   = BioGptForCausalLM(snake_case__  )
							model.to(snake_case__  )
							if gradient_checkpointing:
									model.gradient_checkpointing_enable()

							lowerCAmelCase__   = model(snake_case__	,    labels=snake_case__  )
							self.parent.assertEqual(result.loss.shape	,    ()  )
							self.parent.assertEqual(result.logits.shape	,    (self.batch_size, self.seq_length, self.vocab_size)  )
							result.loss.backward()




					def     _SCREAMING_SNAKE_CASE    (						self    :  List[Any]	,    snake_case__    :  str	,    *snake_case__    :  Optional[Any]  ):
							lowerCAmelCase__   = BioGptModel(snake_case__  )
							lowerCAmelCase__   = model.config.initializer_range / math.sqrt(2 * model.config.num_hidden_layers  )
							for key in model.state_dict().keys():
									if "c_proj" in key and "weight" in key:
											self.parent.assertLessEqual(abs(torch.std(model.state_dict()[key]  ) - model_std  )	,    0.001  )
											self.parent.assertLessEqual(abs(torch.mean(model.state_dict()[key]  ) - 0.0  )	,    0.01  )




					def     _SCREAMING_SNAKE_CASE    (						self    :  Dict	,    snake_case__    :  Any	,    snake_case__    :  List[Any]	,    snake_case__    :  Optional[int]	,    snake_case__    :  Any	,    snake_case__    :  Dict	,    *snake_case__    :  Optional[Any]  ):
							lowerCAmelCase__   = self.num_labels
							lowerCAmelCase__   = BioGptForTokenClassification(snake_case__  )
							model.to(snake_case__  )
							model.eval()
							lowerCAmelCase__   = model(snake_case__	,    attention_mask=snake_case__	,    token_type_ids=snake_case__  )
							self.parent.assertEqual(result.logits.shape	,    (self.batch_size, self.seq_length, self.num_labels)  )




					def     _SCREAMING_SNAKE_CASE    (						self    :  Tuple  ):
							lowerCAmelCase__   = self.prepare_config_and_inputs()
							(
							    (
							    lowerCAmelCase__
							) ,       (
							    lowerCAmelCase__
							) ,       (
							    lowerCAmelCase__
							) ,       (
							    lowerCAmelCase__
							) ,       (
							    lowerCAmelCase__
							) ,       (
							    lowerCAmelCase__
							) ,       (
							    lowerCAmelCase__
							) ,       
							)   = config_and_inputs
							lowerCAmelCase__   = {"""input_ids""": input_ids, """attention_mask""": input_mask}
							return config, inputs_dict

@require_torch
class    a_   (  __UpperCamelCase			,		__UpperCamelCase			,		__UpperCamelCase			,		unittest.TestCase      ):
					UpperCamelCase_			:						Optional[int]      =     (
					    (BioGptModel, BioGptForCausalLM, BioGptForSequenceClassification, BioGptForTokenClassification)
					    if is_torch_available()
					    else ()
					)
					UpperCamelCase_			:						Union[str, Any]      =     (BioGptForCausalLM,) if is_torch_available() else ()
					UpperCamelCase_			:						Dict      =     (
					    {
					        "feature-extraction": BioGptModel,
					        "text-classification": BioGptForSequenceClassification,
					        "text-generation": BioGptForCausalLM,
					        "token-classification": BioGptForTokenClassification,
					        "zero-shot": BioGptForSequenceClassification,
					    }
					    if is_torch_available()
					    else {}
					)
					UpperCamelCase_			:						Any      =     False




					def     _SCREAMING_SNAKE_CASE    (						self    :  Tuple  ):
							lowerCAmelCase__   = BioGptModelTester(self  )
							lowerCAmelCase__   = ConfigTester(self	,    config_class=snake_case__	,    hidden_size=37  )




					def     _SCREAMING_SNAKE_CASE    (						self    :  int  ):
							self.config_tester.run_common_tests()




					def     _SCREAMING_SNAKE_CASE    (						self    :  Optional[Any]  ):
							lowerCAmelCase__   = self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_model(*snake_case__  )




					def     _SCREAMING_SNAKE_CASE    (						self    :  List[str]  ):
							lowerCAmelCase__   = self.model_tester.prepare_config_and_inputs()
							for type in ["absolute", "relative_key", "relative_key_query"]:
									lowerCAmelCase__   = type
									self.model_tester.create_and_check_model(*snake_case__  )




					def     _SCREAMING_SNAKE_CASE    (						self    :  Union[str, Any]  ):
							lowerCAmelCase__   = self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_biogpt_model_attention_mask_past(*snake_case__  )




					def     _SCREAMING_SNAKE_CASE    (						self    :  List[str]  ):
							lowerCAmelCase__   = self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_forward_and_backwards(*snake_case__	,    gradient_checkpointing=snake_case__  )




					def     _SCREAMING_SNAKE_CASE    (						self    :  List[str]  ):
							lowerCAmelCase__   = self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_biogpt_model_past_large_inputs(*snake_case__  )




					def     _SCREAMING_SNAKE_CASE    (						self    :  Union[str, Any]  ):
							lowerCAmelCase__   = self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_biogpt_weight_initialization(*snake_case__  )




					def     _SCREAMING_SNAKE_CASE    (						self    :  Any  ):
							lowerCAmelCase__   = self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_biogpt_for_token_classification(*snake_case__  )




					@slow
					def     _SCREAMING_SNAKE_CASE    (						self    :  str  ):
							lowerCAmelCase__   = BioGptForCausalLM.from_pretrained("""microsoft/biogpt"""  )
							model.to(snake_case__  )
							lowerCAmelCase__   = BioGptTokenizer.from_pretrained("""microsoft/biogpt"""  )

							lowerCAmelCase__   = """left"""

							# Define PAD Token = EOS Token = 50256
							lowerCAmelCase__   = tokenizer.eos_token
							lowerCAmelCase__   = model.config.eos_token_id

							# use different length sentences to test batching
							lowerCAmelCase__   = [
							    """Hello, my dog is a little""",
							    """Today, I""",
							]

							lowerCAmelCase__   = tokenizer(snake_case__	,    return_tensors="""pt"""	,    padding=snake_case__  )
							lowerCAmelCase__   = inputs["""input_ids"""].to(snake_case__  )

							lowerCAmelCase__   = model.generate(
							    input_ids=snake_case__	,    attention_mask=inputs["""attention_mask"""].to(snake_case__  )	,    )

							lowerCAmelCase__   = tokenizer(sentences[0]	,    return_tensors="""pt"""  ).input_ids.to(snake_case__  )
							lowerCAmelCase__   = model.generate(input_ids=snake_case__  )

							lowerCAmelCase__   = inputs_non_padded.shape[-1] - inputs["""attention_mask"""][-1].long().sum().cpu().item()
							lowerCAmelCase__   = tokenizer(sentences[1]	,    return_tensors="""pt"""  ).input_ids.to(snake_case__  )
							lowerCAmelCase__   = model.generate(input_ids=snake_case__	,    max_length=model.config.max_length - num_paddings  )

							lowerCAmelCase__   = tokenizer.batch_decode(snake_case__	,    skip_special_tokens=snake_case__  )
							lowerCAmelCase__   = tokenizer.decode(output_non_padded[0]	,    skip_special_tokens=snake_case__  )
							lowerCAmelCase__   = tokenizer.decode(output_padded[0]	,    skip_special_tokens=snake_case__  )

							lowerCAmelCase__   = [
							    """Hello, my dog is a little bit bigger than a little bit.""",
							    """Today, I have a good idea of how to use the information""",
							]
							self.assertListEqual(snake_case__	,    snake_case__  )
							self.assertListEqual(snake_case__	,    [non_padded_sentence, padded_sentence]  )




					@slow
					def     _SCREAMING_SNAKE_CASE    (						self    :  List[Any]  ):
							for model_name in BIOGPT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
									lowerCAmelCase__   = BioGptModel.from_pretrained(snake_case__  )
									self.assertIsNotNone(snake_case__  )




					def     _SCREAMING_SNAKE_CASE    (						self    :  int  ):
							lowerCAmelCase__ ,       lowerCAmelCase__   = self.model_tester.prepare_config_and_inputs_for_common()
							lowerCAmelCase__   = 3
							lowerCAmelCase__   = input_dict["""input_ids"""]
							lowerCAmelCase__   = input_ids.ne(1  ).to(snake_case__  )
							lowerCAmelCase__   = ids_tensor([self.model_tester.batch_size]	,    self.model_tester.type_sequence_label_size  )
							lowerCAmelCase__   = BioGptForSequenceClassification(snake_case__  )
							model.to(snake_case__  )
							model.eval()
							lowerCAmelCase__   = model(snake_case__	,    attention_mask=snake_case__	,    labels=snake_case__  )
							self.assertEqual(result.logits.shape	,    (self.model_tester.batch_size, self.model_tester.num_labels)  )




					def     _SCREAMING_SNAKE_CASE    (						self    :  Any  ):
							lowerCAmelCase__ ,       lowerCAmelCase__   = self.model_tester.prepare_config_and_inputs_for_common()
							lowerCAmelCase__   = 3
							lowerCAmelCase__   = """multi_label_classification"""
							lowerCAmelCase__   = input_dict["""input_ids"""]
							lowerCAmelCase__   = input_ids.ne(1  ).to(snake_case__  )
							lowerCAmelCase__   = ids_tensor(
							    [self.model_tester.batch_size, config.num_labels]	,    self.model_tester.type_sequence_label_size  ).to(torch.float  )
							lowerCAmelCase__   = BioGptForSequenceClassification(snake_case__  )
							model.to(snake_case__  )
							model.eval()
							lowerCAmelCase__   = model(snake_case__	,    attention_mask=snake_case__	,    labels=snake_case__  )
							self.assertEqual(result.logits.shape	,    (self.model_tester.batch_size, self.model_tester.num_labels)  )

@require_torch
class    a_   (  unittest.TestCase      ):




					@slow
					def     _SCREAMING_SNAKE_CASE    (						self    :  int  ):
							lowerCAmelCase__   = BioGptForCausalLM.from_pretrained("""microsoft/biogpt"""  )
							lowerCAmelCase__   = torch.tensor([[2, 4805, 9, 656, 21]]  )
							lowerCAmelCase__   = model(snake_case__  )[0]

							lowerCAmelCase__   = 42384

							lowerCAmelCase__   = torch.Size((1, 5, vocab_size)  )
							self.assertEqual(output.shape	,    snake_case__  )

							lowerCAmelCase__   = torch.tensor(
							    [[[-9.5236, -9.8918, 10.4557], [-11.0469, -9.6423, 8.1022], [-8.8664, -7.8826, 5.5325]]]  )

							self.assertTrue(torch.allclose(output[:, :3, :3]	,    snake_case__	,    atol=1E-4  )  )




					@slow
					def     _SCREAMING_SNAKE_CASE    (						self    :  List[str]  ):
							lowerCAmelCase__   = BioGptTokenizer.from_pretrained("""microsoft/biogpt"""  )
							lowerCAmelCase__   = BioGptForCausalLM.from_pretrained("""microsoft/biogpt"""  )
							model.to(snake_case__  )

							torch.manual_seed(0  )
							lowerCAmelCase__   = tokenizer("""COVID-19 is"""	,    return_tensors="""pt"""  ).to(snake_case__  )
							lowerCAmelCase__   = model.generate(
							    **snake_case__	,    min_length=100	,    max_length=1024	,    num_beams=5	,    early_stopping=snake_case__	,    )
							lowerCAmelCase__   = tokenizer.decode(output_ids[0]	,    skip_special_tokens=snake_case__  )

							lowerCAmelCase__   = (
							    """COVID-19 is a global pandemic caused by severe acute respiratory syndrome coronavirus 2 (SARS-CoV-2), the"""
							    """ causative agent of coronavirus disease 2019 (COVID-19), which has spread to more than 200 countries and"""
							    """ territories, including the United States (US), Canada, Australia, New Zealand, the United Kingdom (UK),"""
							    """ and the United States of America (USA), as of March 11, 2020, with more than 800,000 confirmed cases and"""
							    """ more than 800,000 deaths."""
							)
							self.assertEqual(snake_case__	,    snake_case__  )





"""simple docstring"""




from __future__ import annotations

from typing import Any

class    a_   :




					def __init__(						self    :  Union[str, Any]	,    snake_case__    :  int = 6  ):
							lowerCAmelCase__   = None
							lowerCAmelCase__   = None
							self.create_linked_list(snake_case__  )




					def     _SCREAMING_SNAKE_CASE    (						self    :  Tuple	,    snake_case__    :  int  ):
							lowerCAmelCase__   = Node()
							lowerCAmelCase__   = current_node
							lowerCAmelCase__   = current_node
							lowerCAmelCase__   = current_node
							for _ in range(1	,    snake_case__  ):
									lowerCAmelCase__   = Node()
									lowerCAmelCase__   = current_node
									lowerCAmelCase__   = previous_node
									lowerCAmelCase__   = current_node
							lowerCAmelCase__   = self.front
							lowerCAmelCase__   = previous_node




					def     _SCREAMING_SNAKE_CASE    (						self    :  Any  ):
							return (
							    self.front == self.rear
							    and self.front is not None
							    and self.front.data is None
							)




					def     _SCREAMING_SNAKE_CASE    (						self    :  Any  ):
							self.check_can_perform_operation()
							return self.front.data if self.front else None




					def     _SCREAMING_SNAKE_CASE    (						self    :  Dict	,    snake_case__    :  Any  ):
							if self.rear is None:
									return

							self.check_is_full()
							if not self.is_empty():
									lowerCAmelCase__   = self.rear.next
							if self.rear:
									lowerCAmelCase__   = data




					def     _SCREAMING_SNAKE_CASE    (						self    :  Any  ):
							self.check_can_perform_operation()
							if self.rear is None or self.front is None:
									return None
							if self.front == self.rear:
									lowerCAmelCase__   = self.front.data
									lowerCAmelCase__   = None
									return data

							lowerCAmelCase__   = self.front
							lowerCAmelCase__   = old_front.next
							lowerCAmelCase__   = old_front.data
							lowerCAmelCase__   = None
							return data




					def     _SCREAMING_SNAKE_CASE    (						self    :  Union[str, Any]  ):
							if self.is_empty():
									raise Exception("""Empty Queue"""  )




					def     _SCREAMING_SNAKE_CASE    (						self    :  Optional[Any]  ):
							if self.rear and self.rear.next == self.front:
									raise Exception("""Full Queue"""  )

class    a_   :




					def __init__(						self    :  Union[str, Any]  ):
							lowerCAmelCase__   = None
							lowerCAmelCase__   = None
							lowerCAmelCase__   = None


if __name__ == "__main__":
			import doctest

			doctest.testmod()




