

from __future__ import annotations

import inspect
import unittest

from transformers import MobileViTConfig
from transformers.file_utils import is_tf_available, is_vision_available
from transformers.testing_utils import require_tf, slow

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
						import numpy as np
						import tensorflow as tf

						from transformers import TFMobileViTForImageClassification, TFMobileViTForSemanticSegmentation, TFMobileViTModel
						from transformers.models.mobilevit.modeling_tf_mobilevit import TF_MOBILEVIT_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
						from PIL import Image

						from transformers import MobileViTImageProcessor



class       lowercase_		(SCREAMING_SNAKE_CASE__   ):



						def   __a				( self  :      int     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_							=       self.config_class(**self.inputs_dict     )
								self.parent.assertTrue(hasattr(snake_case__				,       'hidden_sizes'     )     )
								self.parent.assertTrue(hasattr(snake_case__				,       'neck_hidden_sizes'     )     )
								self.parent.assertTrue(hasattr(snake_case__				,       'num_attention_heads'     )     )



class       lowercase_		:



						def __init__( self  :      Dict				,       snake_case__  :      Any				,       snake_case__  :      int=13				,       snake_case__  :      List[str]=32				,       snake_case__  :      List[Any]=2				,       snake_case__  :      Union[str, Any]=3				,       snake_case__  :      List[str]=6_40				,       snake_case__  :      Any=4				,       snake_case__  :      Union[str, Any]="silu"				,       snake_case__  :      Optional[Any]=3				,       snake_case__  :      Union[str, Any]=32				,       snake_case__  :      Optional[Any]=0.1				,       snake_case__  :      str=0.1				,       snake_case__  :      Tuple=0.1				,       snake_case__  :      int=0.02				,       snake_case__  :      str=True				,       snake_case__  :      Dict=True				,       snake_case__  :      List[str]=10				,       snake_case__  :      Union[str, Any]=None				,       ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_							=       parent
								SCREAMING_SNAKE_CASE_							=       batch_size
								SCREAMING_SNAKE_CASE_							=       image_size
								SCREAMING_SNAKE_CASE_							=       patch_size
								SCREAMING_SNAKE_CASE_							=       num_channels
								SCREAMING_SNAKE_CASE_							=       last_hidden_size
								SCREAMING_SNAKE_CASE_							=       num_attention_heads
								SCREAMING_SNAKE_CASE_							=       hidden_act
								SCREAMING_SNAKE_CASE_							=       conv_kernel_size
								SCREAMING_SNAKE_CASE_							=       output_stride
								SCREAMING_SNAKE_CASE_							=       hidden_dropout_prob
								SCREAMING_SNAKE_CASE_							=       attention_probs_dropout_prob
								SCREAMING_SNAKE_CASE_							=       classifier_dropout_prob
								SCREAMING_SNAKE_CASE_							=       use_labels
								SCREAMING_SNAKE_CASE_							=       is_training
								SCREAMING_SNAKE_CASE_							=       num_labels
								SCREAMING_SNAKE_CASE_							=       initializer_range
								SCREAMING_SNAKE_CASE_							=       scope



						def   __a				( self  :      int     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_							=       floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]     )

								SCREAMING_SNAKE_CASE_							=       None
								SCREAMING_SNAKE_CASE_							=       None
								if self.use_labels:
										SCREAMING_SNAKE_CASE_							=       ids_tensor([self.batch_size]				,       self.num_labels     )
										SCREAMING_SNAKE_CASE_							=       ids_tensor([self.batch_size, self.image_size, self.image_size]				,       self.num_labels     )

								SCREAMING_SNAKE_CASE_							=       self.get_config()

								return config, pixel_values, labels, pixel_labels



						def   __a				( self  :      List[Any]     ):

								"""simple docstring"""

								return MobileViTConfig(
								    image_size=self.image_size				,       patch_size=self.patch_size				,       num_channels=self.num_channels				,       num_attention_heads=self.num_attention_heads				,       hidden_act=self.hidden_act				,       conv_kernel_size=self.conv_kernel_size				,       output_stride=self.output_stride				,       hidden_dropout_prob=self.hidden_dropout_prob				,       attention_probs_dropout_prob=self.attention_probs_dropout_prob				,       classifier_dropout_prob=self.classifier_dropout_prob				,       initializer_range=self.initializer_range				,       )



						def   __a				( self  :      Tuple				,       snake_case__  :      int				,       snake_case__  :      str				,       snake_case__  :      List[Any]				,       snake_case__  :      str     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_							=       TFMobileViTModel(config=snake_case__     )
								SCREAMING_SNAKE_CASE_							=       model(snake_case__				,       training=snake_case__     )
								SCREAMING_SNAKE_CASE_							=       SCREAMING_SNAKE_CASE_							=       self.image_size // self.output_stride
								self.parent.assertEqual(
								    result.last_hidden_state.shape				,       (self.batch_size, self.last_hidden_size, expected_height, expected_width)     )



						def   __a				( self  :      Any				,       snake_case__  :      Union[str, Any]				,       snake_case__  :      List[str]				,       snake_case__  :      Any				,       snake_case__  :      Tuple     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_							=       self.num_labels
								SCREAMING_SNAKE_CASE_							=       TFMobileViTForImageClassification(snake_case__     )
								SCREAMING_SNAKE_CASE_							=       model(snake_case__				,       labels=snake_case__				,       training=snake_case__     )
								self.parent.assertEqual(result.logits.shape				,       (self.batch_size, self.num_labels)     )



						def   __a				( self  :      Optional[int]				,       snake_case__  :      List[Any]				,       snake_case__  :      Optional[Any]				,       snake_case__  :      Dict				,       snake_case__  :      Any     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_							=       self.num_labels
								SCREAMING_SNAKE_CASE_							=       TFMobileViTForSemanticSegmentation(snake_case__     )
								SCREAMING_SNAKE_CASE_							=       SCREAMING_SNAKE_CASE_							=       self.image_size // self.output_stride

								SCREAMING_SNAKE_CASE_							=       model(snake_case__				,       training=snake_case__     )
								self.parent.assertEqual(
								    result.logits.shape				,       (self.batch_size, self.num_labels, expected_height, expected_width)     )

								SCREAMING_SNAKE_CASE_							=       model(snake_case__				,       labels=snake_case__				,       training=snake_case__     )
								self.parent.assertEqual(
								    result.logits.shape				,       (self.batch_size, self.num_labels, expected_height, expected_width)     )






						def   __a				( self  :      str     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_							=       self.prepare_config_and_inputs()
								SCREAMING_SNAKE_CASE_			,							SCREAMING_SNAKE_CASE_			,							SCREAMING_SNAKE_CASE_			,							SCREAMING_SNAKE_CASE_							=       config_and_inputs
								SCREAMING_SNAKE_CASE_							=       {'pixel_values': pixel_values}
								return config, inputs_dict



@require_tf
class       lowercase_		(SCREAMING_SNAKE_CASE__       ,  SCREAMING_SNAKE_CASE__       ,  unittest.TestCase   ):
						lowerCAmelCase__ 			=(
						    (TFMobileViTModel, TFMobileViTForImageClassification, TFMobileViTForSemanticSegmentation)
						    if is_tf_available()
						    else ()
						)
						lowerCAmelCase__ 			=(
						    {"feature-extraction": TFMobileViTModel, "image-classification": TFMobileViTForImageClassification}
						    if is_tf_available()
						    else {}
						)

						lowerCAmelCase__ 			=False
						lowerCAmelCase__ 			=False
						lowerCAmelCase__ 			=False
						lowerCAmelCase__ 			=False
						lowerCAmelCase__ 			=False



						def   __a				( self  :      int     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_							=       TFMobileViTModelTester(self     )
								SCREAMING_SNAKE_CASE_							=       TFMobileViTConfigTester(self				,       config_class=snake_case__				,       has_text_modality=snake_case__     )



						def   __a				( self  :      Tuple     ):

								"""simple docstring"""

								self.config_tester.run_common_tests()



						@unittest.skip(reason='MobileViT does not use inputs_embeds'     )
						def   __a				( self  :      Optional[int]     ):

								"""simple docstring"""

								pass



						@unittest.skip(reason='MobileViT does not support input and output embeddings'     )
						def   __a				( self  :      List[str]     ):

								"""simple docstring"""

								pass



						@unittest.skip(reason='MobileViT does not output attentions'     )
						def   __a				( self  :      Tuple     ):

								"""simple docstring"""

								pass



						def   __a				( self  :      List[str]     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_			,							SCREAMING_SNAKE_CASE_							=       self.model_tester.prepare_config_and_inputs_for_common()

								for model_class in self.all_model_classes:
										SCREAMING_SNAKE_CASE_							=       model_class(snake_case__     )
										SCREAMING_SNAKE_CASE_							=       inspect.signature(model.call     )
										# signature.parameters is an OrderedDict => so arg_names order is deterministic
										SCREAMING_SNAKE_CASE_							=       [*signature.parameters.keys()]

										SCREAMING_SNAKE_CASE_							=       ['pixel_values']
										self.assertListEqual(arg_names[:1]				,       snake_case__     )



						def   __a				( self  :      str     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_							=       self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_model(*snake_case__     )



						def   __a				( self  :      Optional[int]     ):

								"""simple docstring"""

								def check_hidden_states_output(snake_case__  :      Tuple				,       snake_case__  :      str				,       snake_case__  :      str     ):
										SCREAMING_SNAKE_CASE_							=       model_class(snake_case__     )

										SCREAMING_SNAKE_CASE_							=       model(**self._prepare_for_class(snake_case__				,       snake_case__     )     )

										SCREAMING_SNAKE_CASE_							=       outputs.hidden_states

										SCREAMING_SNAKE_CASE_							=       5
										self.assertEqual(len(snake_case__     )				,       snake_case__     )

										# MobileViT's feature maps are of shape (batch_size, num_channels, height, width)
										# with the width and height being successively divided by 2.
										SCREAMING_SNAKE_CASE_							=       2
										for i in range(len(snake_case__     )     ):
												self.assertListEqual(
												    list(hidden_states[i].shape[-2:]     )				,       [self.model_tester.image_size // divisor, self.model_tester.image_size // divisor]				,       )
												divisor *= 2

										self.assertEqual(self.model_tester.output_stride				,       divisor // 2     )

								SCREAMING_SNAKE_CASE_			,							SCREAMING_SNAKE_CASE_							=       self.model_tester.prepare_config_and_inputs_for_common()

								for model_class in self.all_model_classes:
										SCREAMING_SNAKE_CASE_							=       True
										check_hidden_states_output(snake_case__				,       snake_case__				,       snake_case__     )

										# check that output_hidden_states also work using config
										del inputs_dict["output_hidden_states"]
										SCREAMING_SNAKE_CASE_							=       True

										check_hidden_states_output(snake_case__				,       snake_case__				,       snake_case__     )



						def   __a				( self  :      Union[str, Any]     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_							=       self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_image_classification(*snake_case__     )



						def   __a				( self  :      int     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_							=       self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_semantic_segmentation(*snake_case__     )



						@unittest.skipIf(
						    not is_tf_available() or len(tf.config.list_physical_devices('GPU'     )     ) == 0				,       reason='TF does not support backprop for grouped convolutions on CPU.'				,       )
						def   __a				( self  :      List[Any]     ):

								"""simple docstring"""

								super().test_dataset_conversion()



						def   __a				( self  :      Tuple				,       snake_case__  :      Optional[Any]				,       snake_case__  :      int				,       snake_case__  :      Tuple=2e-1				,       snake_case__  :      str=2e-1     ):

								"""simple docstring"""

								self.assertTrue(np.allclose(snake_case__				,       snake_case__				,       atol=snake_case__				,       rtol=snake_case__     )     )



						@unittest.skipIf(
						    not is_tf_available() or len(tf.config.list_physical_devices('GPU'     )     ) == 0				,       reason='TF does not support backprop for grouped convolutions on CPU.'				,       )
						@slow
						def   __a				( self  :      Optional[int]     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_			,							SCREAMING_SNAKE_CASE_							=       self.model_tester.prepare_config_and_inputs_for_common()

								for model_class in self.all_model_classes:
										# Since `TFMobileViTModel` cannot operate with the default `fit()` method.
										if model_class.__name__ != "TFMobileViTModel":
												SCREAMING_SNAKE_CASE_							=       model_class(snake_case__     )
												if getattr(snake_case__				,       'hf_compute_loss'				,       snake_case__     ):
														super().test_keras_fit()



						def   __a				( self  :      List[str]     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_			,							SCREAMING_SNAKE_CASE_							=       self.model_tester.prepare_config_and_inputs_for_common()
								for model_class in self.all_model_classes:
										# set an ignore index to correctly test the masked loss used in
										# `TFMobileViTForSemanticSegmentation`.
										if model_class.__name__ != "TFMobileViTForSemanticSegmentation":
												SCREAMING_SNAKE_CASE_							=       5

										SCREAMING_SNAKE_CASE_							=       model_class(snake_case__     )
										if getattr(snake_case__				,       'hf_compute_loss'				,       snake_case__     ):
												# The number of elements in the loss should be the same as the number of elements in the label
												SCREAMING_SNAKE_CASE_							=       self._prepare_for_class(inputs_dict.copy()				,       snake_case__				,       return_labels=snake_case__     )
												SCREAMING_SNAKE_CASE_							=       prepared_for_class[
												    sorted(prepared_for_class.keys() - inputs_dict.keys()				,       reverse=snake_case__     )[0]
												]
												SCREAMING_SNAKE_CASE_							=       added_label.shape.as_list()[:1]

												# Test that model correctly compute the loss with kwargs
												SCREAMING_SNAKE_CASE_							=       self._prepare_for_class(inputs_dict.copy()				,       snake_case__				,       return_labels=snake_case__     )
												SCREAMING_SNAKE_CASE_							=       {'input_ids', 'pixel_values', 'input_features'}
												SCREAMING_SNAKE_CASE_							=       possible_input_names.intersection(set(snake_case__     )     ).pop()
												SCREAMING_SNAKE_CASE_							=       prepared_for_class.pop(snake_case__     )

												SCREAMING_SNAKE_CASE_							=       model(snake_case__				,       **snake_case__     )[0]
												self.assertTrue(loss.shape.as_list() == expected_loss_size or loss.shape.as_list() == [1]     )

												# Test that model correctly compute the loss when we mask some positions
												SCREAMING_SNAKE_CASE_							=       self._prepare_for_class(inputs_dict.copy()				,       snake_case__				,       return_labels=snake_case__     )
												SCREAMING_SNAKE_CASE_							=       {'input_ids', 'pixel_values', 'input_features'}
												SCREAMING_SNAKE_CASE_							=       possible_input_names.intersection(set(snake_case__     )     ).pop()
												SCREAMING_SNAKE_CASE_							=       prepared_for_class.pop(snake_case__     )
												if "labels" in prepared_for_class:
														SCREAMING_SNAKE_CASE_							=       prepared_for_class['labels'].numpy()
														if len(labels.shape     ) > 1 and labels.shape[1] != 1:
																# labels[0] = -100
																SCREAMING_SNAKE_CASE_							=       tf.convert_to_tensor(snake_case__     )
																SCREAMING_SNAKE_CASE_							=       model(snake_case__				,       **snake_case__     )[0]
																self.assertTrue(loss.shape.as_list() == expected_loss_size or loss.shape.as_list() == [1]     )
																self.assertTrue(not np.any(np.isnan(loss.numpy()     )     )     )

                # Test that model correctly compute the loss with a dict
												SCREAMING_SNAKE_CASE_							=       self._prepare_for_class(inputs_dict.copy()				,       snake_case__				,       return_labels=snake_case__     )
												SCREAMING_SNAKE_CASE_							=       model(snake_case__     )[0]
												self.assertTrue(loss.shape.as_list() == expected_loss_size or loss.shape.as_list() == [1]     )

												# Test that model correctly compute the loss with a tuple
												SCREAMING_SNAKE_CASE_							=       self._prepare_for_class(inputs_dict.copy()				,       snake_case__				,       return_labels=snake_case__     )

												# Get keys that were added with the _prepare_for_class function
												SCREAMING_SNAKE_CASE_							=       prepared_for_class.keys() - inputs_dict.keys()
												SCREAMING_SNAKE_CASE_							=       inspect.signature(model.call     ).parameters
												SCREAMING_SNAKE_CASE_							=       list(signature.keys()     )

												# Create a dictionary holding the location of the tensors in the tuple
												SCREAMING_SNAKE_CASE_							=       {0: input_name}
												for label_key in label_keys:
														SCREAMING_SNAKE_CASE_							=       signature_names.index(snake_case__     )
														SCREAMING_SNAKE_CASE_							=       label_key
												SCREAMING_SNAKE_CASE_							=       sorted(tuple_index_mapping.items()     )
												# Initialize a list with their default values, update the values and convert to a tuple
												SCREAMING_SNAKE_CASE_							=       []

												for name in signature_names:
														if name != "kwargs":
																list_input.append(signature[name].default     )

												for index, value in sorted_tuple_index_mapping:
														SCREAMING_SNAKE_CASE_							=       prepared_for_class[value]

												SCREAMING_SNAKE_CASE_							=       tuple(snake_case__     )

												# Send to model
												SCREAMING_SNAKE_CASE_							=       model(tuple_input[:-1]     )[0]

												self.assertTrue(loss.shape.as_list() == expected_loss_size or loss.shape.as_list() == [1]     )






						@slow
						def   __a				( self  :      List[str]     ):

								"""simple docstring"""

								for model_name in TF_MOBILEVIT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
										SCREAMING_SNAKE_CASE_							=       TFMobileViTModel.from_pretrained(snake_case__     )
										self.assertIsNotNone(snake_case__     )


def 				_a       (				)->  int:
		SCREAMING_SNAKE_CASE_							=       Image.open('./tests/fixtures/tests_samples/COCO/000000039769.png'   )
		return image




@require_tf
class       lowercase_		(unittest.TestCase   ):



						@slow
						def   __a				( self  :      Union[str, Any]     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_							=       TFMobileViTForImageClassification.from_pretrained('apple/mobilevit-xx-small'     )

								SCREAMING_SNAKE_CASE_							=       MobileViTImageProcessor.from_pretrained('apple/mobilevit-xx-small'     )
								SCREAMING_SNAKE_CASE_							=       prepare_img()
								SCREAMING_SNAKE_CASE_							=       image_processor(images=snake_case__				,       return_tensors='tf'     )

								# forward pass
								SCREAMING_SNAKE_CASE_							=       model(**snake_case__				,       training=snake_case__     )

								# verify the logits
								SCREAMING_SNAKE_CASE_							=       tf.TensorShape((1, 10_00)     )
								self.assertEqual(outputs.logits.shape				,       snake_case__     )

								SCREAMING_SNAKE_CASE_							=       tf.constant([-1.93_64, -1.23_27, -0.46_53]     )

								tf.debugging.assert_near(outputs.logits[0, :3]				,       snake_case__				,       atol=1e-4				,       rtol=1e-04     )






						@slow
						def   __a				( self  :      Optional[Any]     ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_							=       TFMobileViTForSemanticSegmentation.from_pretrained('apple/deeplabv3-mobilevit-xx-small'     )

								SCREAMING_SNAKE_CASE_							=       MobileViTImageProcessor.from_pretrained('apple/deeplabv3-mobilevit-xx-small'     )

								SCREAMING_SNAKE_CASE_							=       prepare_img()
								SCREAMING_SNAKE_CASE_							=       image_processor(images=snake_case__				,       return_tensors='tf'     )

								# forward pass
								SCREAMING_SNAKE_CASE_							=       model(inputs.pixel_values				,       training=snake_case__     )
								SCREAMING_SNAKE_CASE_							=       outputs.logits

								# verify the logits
								SCREAMING_SNAKE_CASE_							=       tf.TensorShape((1, 21, 32, 32)     )
								self.assertEqual(logits.shape				,       snake_case__     )

								SCREAMING_SNAKE_CASE_							=       tf.constant(
								    [
								        [[6.97_13, 6.97_86, 7.24_22], [7.28_93, 7.28_25, 7.44_46], [7.65_80, 7.87_97, 7.94_20]],
								        [[-10.68_69, -10.32_50, -10.34_71], [-10.42_28, -9.98_68, -9.71_32], [-11.04_05, -11.02_21, -10.73_18]],
								        [[-3.30_89, -2.85_39, -2.67_40], [-3.27_06, -2.56_21, -2.51_08], [-3.25_34, -2.66_15, -2.66_51]],
								    ]     )

								tf.debugging.assert_near(logits[0, :3, :3, :3]				,       snake_case__				,       rtol=1e-4				,       atol=1e-4     )





SCREAMING_SNAKE_CASE:    Optional[Any]											=   [0.33, 0.44, 0.55, 0.44, 0.33]
SCREAMING_SNAKE_CASE:    int											=   3
SCREAMING_SNAKE_CASE:    str											=   5

# Buffer Space (with Parameters Space)
SCREAMING_SNAKE_CASE:    list[float]											=   []
SCREAMING_SNAKE_CASE:    list[float]											=   []

# Machine Time
SCREAMING_SNAKE_CASE:    str											=   0


def 				_a       (				lowerCAmelCase   )->  int:
		global buffer_space, params_space, machine_time, K, m, t

		# Choosing Dynamical Systems (All)
		for key, value in enumerate(lowerCAmelCase   ):
				# Evolution Parameter
				SCREAMING_SNAKE_CASE_							=       float(seed / value   )

				# Control Theory: Orbit Change
				SCREAMING_SNAKE_CASE_							=       (buffer_space[(key + 1) % m] + e) % 1

				# Control Theory: Trajectory Change
				SCREAMING_SNAKE_CASE_							=       (params_space[key] + e) % 1 + 3

				# Modification (Transition Function) - Jumps
				SCREAMING_SNAKE_CASE_							=       round(float(r * value * (1 - value)   )						,	10   )
				SCREAMING_SNAKE_CASE_							=       r  # Saving to Parameters Space

		# Logistic Map
		assert max(lowerCAmelCase   ) < 1
		assert max(lowerCAmelCase   ) < 4

		# Machine Time
		machine_time += 1


def 				_a       (				)->  int:
		global buffer_space, params_space, machine_time, K, m, t

		# PRNG (Xorshift by George Marsaglia)
		def xorshift(lowerCAmelCase						,	lowerCAmelCase   ):
				x ^= y >> 13
				y ^= x << 17
				x ^= y >> 5
				return x

		# Choosing Dynamical Systems (Increment)
		SCREAMING_SNAKE_CASE_							=       machine_time % m

		# Evolution (Time Length)
		for _ in range(0						,	lowerCAmelCase   ):
				# Variables (Position + Parameters)
				SCREAMING_SNAKE_CASE_							=       params_space[key]
				SCREAMING_SNAKE_CASE_							=       buffer_space[key]

				# Modification (Transition Function) - Flow
				SCREAMING_SNAKE_CASE_							=       round(float(r * value * (1 - value)   )						,	10   )
				SCREAMING_SNAKE_CASE_							=       (machine_time * 0.0_1 + r * 1.0_1) % 1 + 3

		# Choosing Chaotic Data
		SCREAMING_SNAKE_CASE_							=       int(buffer_space[(key + 2) % m] * (10**10)   )
		SCREAMING_SNAKE_CASE_							=       int(buffer_space[(key - 2) % m] * (10**10)   )

		# Machine Time
		machine_time += 1

		return xorshift(lowerCAmelCase						,	lowerCAmelCase   ) % 0xFFFF_FFFF


def 				_a       (				)->  Optional[Any]:
		global buffer_space, params_space, machine_time, K, m, t

		SCREAMING_SNAKE_CASE_							=       K
		SCREAMING_SNAKE_CASE_							=       [0] * m
		SCREAMING_SNAKE_CASE_							=       0


if __name__ == "__main__":
						# Initialization
						reset()

						# Pushing Data (Input)
						import random

						SCREAMING_SNAKE_CASE:    List[Any]											=   random.sample(range(0xff_ff_ff_ff), 1_0_0)
						for chunk in message:
												push(chunk)

						# for controlling
						SCREAMING_SNAKE_CASE:    List[str]											=   ''''''

						# Pulling Data (Output)
						while inp in ("e", "E"):
												print(f"""{format(pull(), '#04x')}""")
												print(buffer_space)
												print(params_space)
												SCREAMING_SNAKE_CASE:    List[Any]											=   input('''(e)exit? ''').strip()