


'''simple docstring'''







import collections
import inspect
import unittest

from transformers import SwinvaConfig
from transformers.testing_utils import require_torch, require_vision, slow, torch_device
from transformers.utils import cached_property, is_torch_available, is_vision_available

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, _config_zero_init, floats_tensor, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
   import torch
   from torch import nn

   from transformers import SwinvaForImageClassification, SwinvaForMaskedImageModeling, SwinvaModel
   from transformers.models.swinva.modeling_swinva import SWINV2_PRETRAINED_MODEL_ARCHIVE_LIST

if is_vision_available():
   from PIL import Image

   from transformers import AutoImageProcessor


class 			__lowerCamelCase			:
    """simple docstring"""


    def __init__(  self      :							Any				,							SCREAMING_SNAKE_CASE      :							List[str]				,							SCREAMING_SNAKE_CASE      :							List[Any]=13				,							SCREAMING_SNAKE_CASE      :							str=32				,							SCREAMING_SNAKE_CASE      :							Any=2				,							SCREAMING_SNAKE_CASE      :							Any=3				,							SCREAMING_SNAKE_CASE      :							int=16				,							SCREAMING_SNAKE_CASE      :							Dict=[1, 2, 1]				,							SCREAMING_SNAKE_CASE      :							List[Any]=[2, 2, 4]				,							SCREAMING_SNAKE_CASE      :							Optional[Any]=2				,							SCREAMING_SNAKE_CASE      :							List[Any]=2.0				,							SCREAMING_SNAKE_CASE      :							List[Any]=True				,							SCREAMING_SNAKE_CASE      :							List[Any]=0.0				,							SCREAMING_SNAKE_CASE      :							Union[str, Any]=0.0				,							SCREAMING_SNAKE_CASE      :							List[str]=0.1				,							SCREAMING_SNAKE_CASE      :							Optional[Any]="gelu"				,							SCREAMING_SNAKE_CASE      :							Any=False				,							SCREAMING_SNAKE_CASE      :							str=True				,							SCREAMING_SNAKE_CASE      :							Any=0.02				,							SCREAMING_SNAKE_CASE      :							List[str]=1e-5				,							SCREAMING_SNAKE_CASE      :							Union[str, Any]=True				,							SCREAMING_SNAKE_CASE      :							Dict=None				,							SCREAMING_SNAKE_CASE      :							Any=True				,							SCREAMING_SNAKE_CASE      :							List[str]=10				,							SCREAMING_SNAKE_CASE      :							Dict=8				,							):
           _A					:     List[Any]     = parent
           _A					:     List[Any]     = batch_size
           _A					:     Union[str, Any]     = image_size
           _A					:     Tuple     = patch_size
           _A					:     List[str]     = num_channels
           _A					:     List[Any]     = embed_dim
           _A					:     List[str]     = depths
           _A					:     Optional[int]     = num_heads
           _A					:     List[Any]     = window_size
           _A					:     Union[str, Any]     = mlp_ratio
           _A					:     Optional[Any]     = qkv_bias
           _A					:     int     = hidden_dropout_prob
           _A					:     Any     = attention_probs_dropout_prob
           _A					:     List[Any]     = drop_path_rate
           _A					:     Any     = hidden_act
           _A					:     List[Any]     = use_absolute_embeddings
           _A					:     List[Any]     = patch_norm
           _A					:     Union[str, Any]     = layer_norm_eps
           _A					:     Union[str, Any]     = initializer_range
           _A					:     Dict     = is_training
           _A					:     Any     = scope
           _A					:     Any     = use_labels
           _A					:     List[str]     = type_sequence_label_size
           _A					:     Optional[int]     = encoder_stride


    def        A   (  self      :							Any):
           _A					:     List[Any]     = floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size])

           _A					:     Dict     = None
           if self.use_labels:
                  _A					:     Any     = ids_tensor([self.batch_size]				,							self.type_sequence_label_size)

           _A					:     Tuple     = self.get_config()

           return config, pixel_values, labels


    def        A   (  self      :							str):
           return SwinvaConfig(
               image_size=self.image_size				,							patch_size=self.patch_size				,							num_channels=self.num_channels				,							embed_dim=self.embed_dim				,							depths=self.depths				,							num_heads=self.num_heads				,							window_size=self.window_size				,							mlp_ratio=self.mlp_ratio				,							qkv_bias=self.qkv_bias				,							hidden_dropout_prob=self.hidden_dropout_prob				,							attention_probs_dropout_prob=self.attention_probs_dropout_prob				,							drop_path_rate=self.drop_path_rate				,							hidden_act=self.hidden_act				,							use_absolute_embeddings=self.use_absolute_embeddings				,							path_norm=self.patch_norm				,							layer_norm_eps=self.layer_norm_eps				,							initializer_range=self.initializer_range				,							encoder_stride=self.encoder_stride				,							)


    def        A   (  self      :							Tuple				,							SCREAMING_SNAKE_CASE      :							Union[str, Any]				,							SCREAMING_SNAKE_CASE      :							List[str]				,							SCREAMING_SNAKE_CASE      :							List[Any]):
           _A					:     Any     = SwinvaModel(config=SCREAMING_SNAKE_CASE)
           model.to(SCREAMING_SNAKE_CASE)
           model.eval()
           _A					:     Optional[Any]     = model(SCREAMING_SNAKE_CASE)

           _A					:     List[str]     = ((config.image_size // config.patch_size) ** 2) // (4 ** (len(config.depths) - 1))
           _A					:     List[str]     = int(config.embed_dim * 2 ** (len(config.depths) - 1))

           self.parent.assertEqual(result.last_hidden_state.shape				,							(self.batch_size, expected_seq_len, expected_dim))


    def        A   (  self      :							str				,							SCREAMING_SNAKE_CASE      :							str				,							SCREAMING_SNAKE_CASE      :							Optional[Any]				,							SCREAMING_SNAKE_CASE      :							Dict):
           _A					:     Optional[Any]     = SwinvaForMaskedImageModeling(config=SCREAMING_SNAKE_CASE)
           model.to(SCREAMING_SNAKE_CASE)
           model.eval()
           _A					:     Any     = model(SCREAMING_SNAKE_CASE)
           self.parent.assertEqual(
               result.logits.shape				,							(self.batch_size, self.num_channels, self.image_size, self.image_size))

           # test greyscale images
           _A					:     Tuple     = 1
           _A					:     Optional[Any]     = SwinvaForMaskedImageModeling(SCREAMING_SNAKE_CASE)
           model.to(SCREAMING_SNAKE_CASE)
           model.eval()

           _A					:     Optional[int]     = floats_tensor([self.batch_size, 1, self.image_size, self.image_size])
           _A					:     Optional[int]     = model(SCREAMING_SNAKE_CASE)
           self.parent.assertEqual(result.logits.shape				,							(self.batch_size, 1, self.image_size, self.image_size))


    def        A   (  self      :							Any				,							SCREAMING_SNAKE_CASE      :							Optional[Any]				,							SCREAMING_SNAKE_CASE      :							Optional[int]				,							SCREAMING_SNAKE_CASE      :							Any):
           _A					:     Dict     = self.type_sequence_label_size
           _A					:     Optional[int]     = SwinvaForImageClassification(SCREAMING_SNAKE_CASE)
           model.to(SCREAMING_SNAKE_CASE)
           model.eval()
           _A					:     int     = model(SCREAMING_SNAKE_CASE				,							labels=SCREAMING_SNAKE_CASE)
           self.parent.assertEqual(result.logits.shape				,							(self.batch_size, self.type_sequence_label_size))


    def        A   (  self      :							Any):
           _A					:     Union[str, Any]     = self.prepare_config_and_inputs()
           _A  ,			_A  ,			_A					:     List[str]     = config_and_inputs
           _A					:     Optional[int]     = {'pixel_values': pixel_values}
           return config, inputs_dict




@require_torch
class 			__lowerCamelCase			(	a_    , a_    , unittest.TestCase	):
    """simple docstring"""
    a													=   (
        (SwinvaModel, SwinvaForImageClassification, SwinvaForMaskedImageModeling) if is_torch_available() else ()
    )
    a													=   (
        {"feature-extraction": SwinvaModel, "image-classification": SwinvaForImageClassification}
        if is_torch_available()
        else {}
    )

    a													=   False
    a													=   False
    a													=   False
    a													=   False


    def        A   (  self      :							int):
           _A					:     List[Any]     = SwinvaModelTester(self)
           _A					:     Dict     = ConfigTester(self				,							config_class=SCREAMING_SNAKE_CASE				,							embed_dim=37)


    def        A   (  self      :							List[str]):
           self.config_tester.create_and_test_config_to_json_string()
           self.config_tester.create_and_test_config_to_json_file()
           self.config_tester.create_and_test_config_from_and_save_pretrained()
           self.config_tester.create_and_test_config_with_num_labels()
           self.config_tester.check_config_can_be_init_without_params()
           self.config_tester.check_config_arguments_init()


    def        A   (  self      :							Tuple):
           _A					:     Union[str, Any]     = self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_model(*SCREAMING_SNAKE_CASE)


    @unittest.skip(reason='Got `CUDA error: misaligned address` with PyTorch 2.0.0.')
    def        A   (  self      :							Dict):
           pass


    @unittest.skip(reason='Swinv2 does not use inputs_embeds')
    def        A   (  self      :							str):
           pass


    def        A   (  self      :							Any):
           _A  ,			_A					:     List[Any]     = self.model_tester.prepare_config_and_inputs_for_common()

           for model_class in self.all_model_classes:
                  _A					:     Tuple     = model_class(SCREAMING_SNAKE_CASE)
                  self.assertIsInstance(model.get_input_embeddings()				,							(nn.Module))
                  _A					:     Tuple     = model.get_output_embeddings()
                  self.assertTrue(x is None or isinstance(SCREAMING_SNAKE_CASE				,							nn.Linear))


    def        A   (  self      :							Any):
           _A  ,			_A					:     Union[str, Any]     = self.model_tester.prepare_config_and_inputs_for_common()

           for model_class in self.all_model_classes:
                  _A					:     Any     = model_class(SCREAMING_SNAKE_CASE)
                  _A					:     List[str]     = inspect.signature(model.forward)
                  # signature.parameters is an OrderedDict => so arg_names order is deterministic
                  _A					:     Tuple     = [*signature.parameters.keys()]

                  _A					:     Dict     = ['pixel_values']
                  self.assertListEqual(arg_names[:1]				,							SCREAMING_SNAKE_CASE)


    def        A   (  self      :							int):
           _A  ,			_A					:     List[str]     = self.model_tester.prepare_config_and_inputs_for_common()
           _A					:     Optional[int]     = True

           for model_class in self.all_model_classes:
                  _A					:     Union[str, Any]     = True
                  _A					:     Optional[Any]     = False
                  _A					:     Union[str, Any]     = True
                  _A					:     Optional[Any]     = model_class(SCREAMING_SNAKE_CASE)
                  model.to(SCREAMING_SNAKE_CASE)
                  model.eval()
                  with torch.no_grad():
                         _A					:     Optional[Any]     = model(**self._prepare_for_class(SCREAMING_SNAKE_CASE				,							SCREAMING_SNAKE_CASE))
                  _A					:     str     = outputs.attentions
                  _A					:     int     = len(self.model_tester.depths)
                  self.assertEqual(len(SCREAMING_SNAKE_CASE)				,							SCREAMING_SNAKE_CASE)

                  # check that output_attentions also work using config
                  del inputs_dict["output_attentions"]
                  _A					:     int     = True
                  _A					:     int     = config.window_size**2
                  _A					:     Optional[int]     = model_class(SCREAMING_SNAKE_CASE)
                  model.to(SCREAMING_SNAKE_CASE)
                  model.eval()
                  with torch.no_grad():
                         _A					:     Union[str, Any]     = model(**self._prepare_for_class(SCREAMING_SNAKE_CASE				,							SCREAMING_SNAKE_CASE))
                  _A					:     List[str]     = outputs.attentions
                  self.assertEqual(len(SCREAMING_SNAKE_CASE)				,							SCREAMING_SNAKE_CASE)

                  self.assertListEqual(
                      list(attentions[0].shape[-3:])				,							[self.model_tester.num_heads[0], window_size_squared, window_size_squared]				,							)
                  _A					:     int     = len(SCREAMING_SNAKE_CASE)

                  # Check attention is always last and order is fine
                  _A					:     Optional[Any]     = True
                  _A					:     Any     = True
                  _A					:     str     = model_class(SCREAMING_SNAKE_CASE)
                  model.to(SCREAMING_SNAKE_CASE)
                  model.eval()
                  with torch.no_grad():
                         _A					:     Optional[int]     = model(**self._prepare_for_class(SCREAMING_SNAKE_CASE				,							SCREAMING_SNAKE_CASE))

                  if hasattr(self.model_tester				,							'num_hidden_states_types'):
                         _A					:     int     = self.model_tester.num_hidden_states_types
                  else:
                         # also another +1 for reshaped_hidden_states
                         _A					:     Union[str, Any]     = 2
                  self.assertEqual(out_len + added_hidden_states				,							len(SCREAMING_SNAKE_CASE))

                  _A					:     Dict     = outputs.attentions

                  self.assertEqual(len(SCREAMING_SNAKE_CASE)				,							SCREAMING_SNAKE_CASE)

                  self.assertListEqual(
                      list(self_attentions[0].shape[-3:])				,							[self.model_tester.num_heads[0], window_size_squared, window_size_squared]				,							)


    def        A   (  self      :							Optional[Any]				,							SCREAMING_SNAKE_CASE      :							List[Any]				,							SCREAMING_SNAKE_CASE      :							List[Any]				,							SCREAMING_SNAKE_CASE      :							Tuple				,							SCREAMING_SNAKE_CASE      :							str):
           _A					:     List[str]     = model_class(SCREAMING_SNAKE_CASE)
           model.to(SCREAMING_SNAKE_CASE)
           model.eval()

           with torch.no_grad():
                  _A					:     Any     = model(**self._prepare_for_class(SCREAMING_SNAKE_CASE				,							SCREAMING_SNAKE_CASE))

           _A					:     Dict     = outputs.hidden_states

           _A					:     str     = getattr(
               self.model_tester				,							'expected_num_hidden_layers'				,							len(self.model_tester.depths) + 1)
           self.assertEqual(len(SCREAMING_SNAKE_CASE)				,							SCREAMING_SNAKE_CASE)

           # Swinv2 has a different seq_length
           _A					:     Union[str, Any]     = (
               config.patch_size
               if isinstance(config.patch_size				,							collections.abc.Iterable)
               else (config.patch_size, config.patch_size)
           )

           _A					:     int     = (image_size[1] // patch_size[1]) * (image_size[0] // patch_size[0])

           self.assertListEqual(
               list(hidden_states[0].shape[-2:])				,							[num_patches, self.model_tester.embed_dim]				,							)

           _A					:     Optional[int]     = outputs.reshaped_hidden_states
           self.assertEqual(len(SCREAMING_SNAKE_CASE)				,							SCREAMING_SNAKE_CASE)

           _A  ,			_A  ,			_A  ,			_A					:     Optional[Any]     = reshaped_hidden_states[0].shape
           _A					:     Optional[int]     = (
               reshaped_hidden_states[0].view(SCREAMING_SNAKE_CASE				,							SCREAMING_SNAKE_CASE				,							height * width).permute(0				,							2				,							1)
           )
           self.assertListEqual(
               list(reshaped_hidden_states.shape[-2:])				,							[num_patches, self.model_tester.embed_dim]				,							)


    def        A   (  self      :							Tuple):
           _A  ,			_A					:     List[Any]     = self.model_tester.prepare_config_and_inputs_for_common()

           _A					:     Dict     = (
               self.model_tester.image_size
               if isinstance(self.model_tester.image_size				,							collections.abc.Iterable)
               else (self.model_tester.image_size, self.model_tester.image_size)
           )

           for model_class in self.all_model_classes:
                  _A					:     Any     = True
                  self.check_hidden_states_output(SCREAMING_SNAKE_CASE				,							SCREAMING_SNAKE_CASE				,							SCREAMING_SNAKE_CASE				,							SCREAMING_SNAKE_CASE)

                  # check that output_hidden_states also work using config
                  del inputs_dict["output_hidden_states"]
                  _A					:     Dict     = True

                  self.check_hidden_states_output(SCREAMING_SNAKE_CASE				,							SCREAMING_SNAKE_CASE				,							SCREAMING_SNAKE_CASE				,							SCREAMING_SNAKE_CASE)


    def        A   (  self      :							List[str]):
           _A  ,			_A					:     List[str]     = self.model_tester.prepare_config_and_inputs_for_common()
           _A					:     List[Any]     = 3

           _A					:     Any     = (
               self.model_tester.image_size
               if isinstance(self.model_tester.image_size				,							collections.abc.Iterable)
               else (self.model_tester.image_size, self.model_tester.image_size)
           )
           _A					:     Dict     = (
               config.patch_size
               if isinstance(config.patch_size				,							collections.abc.Iterable)
               else (config.patch_size, config.patch_size)
           )

           _A					:     List[str]     = image_size[0] + patch_size[0] - (image_size[0] % patch_size[0])
           _A					:     str     = image_size[1] + patch_size[1] - (image_size[1] % patch_size[1])

           for model_class in self.all_model_classes:
                  _A					:     List[str]     = True
                  self.check_hidden_states_output(SCREAMING_SNAKE_CASE				,							SCREAMING_SNAKE_CASE				,							SCREAMING_SNAKE_CASE				,							(padded_height, padded_width))

                  # check that output_hidden_states also work using config
                  del inputs_dict["output_hidden_states"]
                  _A					:     List[Any]     = True
                  self.check_hidden_states_output(SCREAMING_SNAKE_CASE				,							SCREAMING_SNAKE_CASE				,							SCREAMING_SNAKE_CASE				,							(padded_height, padded_width))


    def        A   (  self      :							str):
           _A					:     List[Any]     = self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_for_masked_image_modeling(*SCREAMING_SNAKE_CASE)


    def        A   (  self      :							List[Any]):
           _A					:     Any     = self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_for_image_classification(*SCREAMING_SNAKE_CASE)


    @slow
    def        A   (  self      :							List[str]):
           for model_name in SWINV2_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
                  _A					:     int     = SwinvaModel.from_pretrained(SCREAMING_SNAKE_CASE)
                  self.assertIsNotNone(SCREAMING_SNAKE_CASE)


    def        A   (  self      :							Union[str, Any]):
           _A  ,			_A					:     Optional[int]     = self.model_tester.prepare_config_and_inputs_for_common()

           _A					:     Dict     = _config_zero_init(SCREAMING_SNAKE_CASE)
           for model_class in self.all_model_classes:
                  _A					:     Optional[Any]     = model_class(config=SCREAMING_SNAKE_CASE)
                  for name, param in model.named_parameters():
                         if "embeddings" not in name and "logit_scale" not in name and param.requires_grad:
                                self.assertIn(
                                    ((param.data.mean() * 1e9).round() / 1e9).item()				,							[0.0, 1.0]				,							msg=F'Parameter {name} of model {model_class} seems not properly initialized'				,							)




@require_vision
@require_torch
class 			__lowerCamelCase			(	unittest.TestCase	):
    """simple docstring"""


    @cached_property
    def        A   (  self      :							List[str]):
           return (
               AutoImageProcessor.from_pretrained('microsoft/swinv2-tiny-patch4-window8-256')
               if is_vision_available()
               else None
           )


    @slow
    def        A   (  self      :							Union[str, Any]):
           _A					:     List[Any]     = SwinvaForImageClassification.from_pretrained('microsoft/swinv2-tiny-patch4-window8-256').to(
               SCREAMING_SNAKE_CASE)
           _A					:     Any     = self.default_image_processor

           _A					:     List[Any]     = Image.open('./tests/fixtures/tests_samples/COCO/000000039769.png')
           _A					:     List[str]     = image_processor(images=SCREAMING_SNAKE_CASE				,							return_tensors='pt').to(SCREAMING_SNAKE_CASE)

           # forward pass
           with torch.no_grad():
                  _A					:     int     = model(**SCREAMING_SNAKE_CASE)

           # verify the logits
           _A					:     Tuple     = torch.Size((1, 1000))
           self.assertEqual(outputs.logits.shape				,							SCREAMING_SNAKE_CASE)
           _A					:     int     = torch.tensor([-0.3947, -0.4306, 0.0026]).to(SCREAMING_SNAKE_CASE)
           self.assertTrue(torch.allclose(outputs.logits[0, :3]				,							SCREAMING_SNAKE_CASE				,							atol=1e-4))










'''simple docstring'''







# This code is adapted from OpenAI's release
# https://github.com/openai/human-eval/blob/master/human_eval/execution.py

import contextlib
import faulthandler
import io
import multiprocessing
import os
import platform
import signal
import tempfile






def 				lowerCAmelCase__	(    lowerCamelCase					:      Optional[int]  ,lowerCamelCase					:      List[Any]  ,lowerCamelCase					:      Tuple  ,lowerCamelCase					:      List[str]       ):
       _A					:     Dict     = multiprocessing.Manager()
       _A					:     List[Any]     = manager.list()

       _A					:     Dict     = multiprocessing.Process(target=lowerCamelCase  ,args=(check_program, result, timeout)       )
       p.start()
       p.join(timeout=timeout + 1       )
       if p.is_alive():
              p.kill()

       if not result:
              result.append('timed out'       )

       return {
           "task_id": task_id,
           "passed": result[0] == "passed",
           "result": result[0],
           "completion_id": completion_id,
       }






def 				lowerCAmelCase__	(    lowerCamelCase					:      Optional[int]  ,lowerCamelCase					:      Union[str, Any]  ,lowerCamelCase					:      Optional[Any]       ):
       with create_tempdir():
              # These system calls are needed when cleaning up tempdir.
              import os
              import shutil

              _A					:     Any     = shutil.rmtree
              _A					:     Optional[int]     = os.rmdir
              _A					:     str     = os.chdir

              # Disable functionalities that can make destructive changes to the test.
              reliability_guard()

              # Run program.
              try:
                     _A					:     str     = {}
                     with swallow_io():
                            with time_limit(lowerCamelCase       ):
                                   exec(lowerCamelCase  ,lowerCamelCase       )
                     result.append('passed'       )
              except TimeoutException:
                     result.append('timed out'       )
              except BaseException as e:
                     result.append(F'failed: {e}'       )

              # Needed for cleaning up.
              _A					:     Optional[int]     = rmtree
              _A					:     Optional[Any]     = rmdir
              _A					:     Dict     = chdir






@contextlib.contextmanager
def 				lowerCAmelCase__	(    lowerCamelCase					:      int       ):
       def signal_handler(lowerCamelCase					:      str  ,lowerCamelCase					:      Any       ):
              raise TimeoutException('Timed out!'       )

       signal.setitimer(signal.ITIMER_REAL  ,lowerCamelCase       )
       signal.signal(signal.SIGALRM  ,lowerCamelCase       )
       try:
              yield
       finally:
              signal.setitimer(signal.ITIMER_REAL  ,0       )






@contextlib.contextmanager
def 				lowerCAmelCase__	(    ):
       _A					:     Any     = WriteOnlyStringIO()
       with contextlib.redirect_stdout(lowerCamelCase       ):
              with contextlib.redirect_stderr(lowerCamelCase       ):
                     with redirect_stdin(lowerCamelCase       ):
                            yield






@contextlib.contextmanager
def 				lowerCAmelCase__	(    ):
       with tempfile.TemporaryDirectory() as dirname:
              with chdir(lowerCamelCase       ):
                     yield dirname


class 			__lowerCamelCase			(	a_	):
    """simple docstring"""
    pass




class 			__lowerCamelCase			(	io.StringIO	):
    """simple docstring"""


    def        A   (  self      :							Tuple				,							*SCREAMING_SNAKE_CASE      :							Any				,							**SCREAMING_SNAKE_CASE      :							Dict):
           raise OSError


    def        A   (  self      :							Optional[int]				,							*SCREAMING_SNAKE_CASE      :							List[str]				,							**SCREAMING_SNAKE_CASE      :							Optional[Any]):
           raise OSError


    def        A   (  self      :							Optional[int]				,							*SCREAMING_SNAKE_CASE      :							str				,							**SCREAMING_SNAKE_CASE      :							Optional[int]):
           raise OSError


    def        A   (  self      :							Union[str, Any]				,							*SCREAMING_SNAKE_CASE      :							Optional[int]				,							**SCREAMING_SNAKE_CASE      :							Tuple):
           return False




class 			__lowerCamelCase			(	contextlib._RedirectStream	):  # type: ignore
    """simple docstring"""
    a													=   "stdin"






@contextlib.contextmanager
def 				lowerCAmelCase__	(    lowerCamelCase					:      Tuple       ):
       if root == ".":
              yield
              return
       _A					:     Any     = os.getcwd()
       os.chdir(lowerCamelCase       )
       try:
              yield
       except BaseException as exc:
              raise exc
       finally:
              os.chdir(lowerCamelCase       )






def 				lowerCAmelCase__	(    lowerCamelCase					:      List[Any]=None       ):

       if maximum_memory_bytes is not None:
              import resource

              resource.setrlimit(resource.RLIMIT_AS  ,(maximum_memory_bytes, maximum_memory_bytes)       )
              resource.setrlimit(resource.RLIMIT_DATA  ,(maximum_memory_bytes, maximum_memory_bytes)       )
              if not platform.uname().system == "Darwin":
                     resource.setrlimit(resource.RLIMIT_STACK  ,(maximum_memory_bytes, maximum_memory_bytes)       )

       faulthandler.disable()

       import builtins

       _A					:     List[Any]     = None
       _A					:     Dict     = None

       import os

       _A					:     Union[str, Any]     = '1'

       _A					:     int     = None
       _A					:     Optional[int]     = None
       _A					:     int     = None
       _A					:     Any     = None
       _A					:     Optional[int]     = None
       _A					:     Union[str, Any]     = None
       _A					:     List[Any]     = None
       _A					:     int     = None
       _A					:     List[Any]     = None
       _A					:     Tuple     = None
       _A					:     Any     = None
       _A					:     Tuple     = None
       _A					:     Optional[int]     = None
       _A					:     Optional[Any]     = None
       _A					:     str     = None
       _A					:     Dict     = None
       _A					:     List[str]     = None
       _A					:     Union[str, Any]     = None
       _A					:     Union[str, Any]     = None
       _A					:     str     = None
       _A					:     str     = None
       _A					:     str     = None
       _A					:     Any     = None
       _A					:     Union[str, Any]     = None
       _A					:     str     = None
       _A					:     List[str]     = None
       _A					:     Union[str, Any]     = None

       import shutil

       _A					:     int     = None
       _A					:     Any     = None
       _A					:     List[Any]     = None

       import subprocess

       _A					:     Optional[Any]     = None  # type: ignore

       _A					:     List[Any]     = None

       import sys

       _A					:     Any     = None
       _A					:     Tuple     = None
       _A					:     str     = None
       _A					:     Tuple     = None
       _A					:     List[str]     = None






