




'''simple docstring'''



import unittest

import numpy as np

from transformers import ElectraConfig, is_flax_available
from transformers.testing_utils import require_flax, slow

from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask


if is_flax_available():
     from transformers.models.electra.modeling_flax_electra import (
         FlaxElectraForCausalLM,
         FlaxElectraForMaskedLM,
         FlaxElectraForMultipleChoice,
         FlaxElectraForPreTraining,
         FlaxElectraForQuestionAnswering,
         FlaxElectraForSequenceClassification,
         FlaxElectraForTokenClassification,
         FlaxElectraModel,
     )





class 			lowerCAmelCase      (       unittest.TestCase):


       def __init__(      self			,     __SCREAMING_SNAKE_CASE			,     __SCREAMING_SNAKE_CASE=13			,     __SCREAMING_SNAKE_CASE=7			,     __SCREAMING_SNAKE_CASE=True			,     __SCREAMING_SNAKE_CASE=True			,     __SCREAMING_SNAKE_CASE=True			,     __SCREAMING_SNAKE_CASE=True			,     __SCREAMING_SNAKE_CASE=99			,     __SCREAMING_SNAKE_CASE=24			,     __SCREAMING_SNAKE_CASE=32			,     __SCREAMING_SNAKE_CASE=5			,     __SCREAMING_SNAKE_CASE=4			,     __SCREAMING_SNAKE_CASE=37			,     __SCREAMING_SNAKE_CASE="gelu"			,     __SCREAMING_SNAKE_CASE=0.1			,     __SCREAMING_SNAKE_CASE=0.1			,     __SCREAMING_SNAKE_CASE=512			,     __SCREAMING_SNAKE_CASE=16			,     __SCREAMING_SNAKE_CASE=2			,     __SCREAMING_SNAKE_CASE=0.02			,     __SCREAMING_SNAKE_CASE=4			,     )					->     List[Any]:



            '''simple docstring'''




            __snake_case			    =     parent
            __snake_case			    =     batch_size
            __snake_case			    =     seq_length
            __snake_case			    =     is_training
            __snake_case			    =     use_attention_mask
            __snake_case			    =     use_token_type_ids
            __snake_case			    =     use_labels
            __snake_case			    =     vocab_size
            __snake_case			    =     hidden_size
            __snake_case			    =     embedding_size
            __snake_case			    =     num_hidden_layers
            __snake_case			    =     num_attention_heads
            __snake_case			    =     intermediate_size
            __snake_case			    =     hidden_act
            __snake_case			    =     hidden_dropout_prob
            __snake_case			    =     attention_probs_dropout_prob
            __snake_case			    =     max_position_embeddings
            __snake_case			    =     type_vocab_size
            __snake_case			    =     type_sequence_label_size
            __snake_case			    =     initializer_range
            __snake_case			    =     num_choices


       def 					lowerCAmelCase					(      self     )					->     Tuple:



            '''simple docstring'''




            __snake_case			    =     ids_tensor([self.batch_size, self.seq_length]			,     self.vocab_size     )

            __snake_case			    =     None
            if self.use_attention_mask:
                 __snake_case			    =     random_attention_mask([self.batch_size, self.seq_length]     )

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

            __snake_case			    =     ElectraConfig(
                vocab_size=self.vocab_size			,     hidden_size=self.hidden_size			,     embedding_size=self.embedding_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			,     initializer_range=self.initializer_range			,     )

            return config, input_ids, token_type_ids, attention_mask




       def 					lowerCAmelCase					(      self     )					->     Union[str, Any]:



            '''simple docstring'''




            __snake_case			    =     self.prepare_config_and_inputs()
            __snake_case    ,			__snake_case    ,			__snake_case    ,			__snake_case			    =     config_and_inputs
            __snake_case			    =     {'''input_ids''': input_ids, '''token_type_ids''': token_type_ids, '''attention_mask''': attention_mask}
            return config, inputs_dict





@require_flax
class 			lowerCAmelCase      (       __lowerCAmelCase ,      unittest.TestCase):
       __lowercase     :					Union[str, Any]       				=	True

       __lowercase     :					str       				=	(
           (
               FlaxElectraModel,
               FlaxElectraForCausalLM,
               FlaxElectraForMaskedLM,
               FlaxElectraForPreTraining,
               FlaxElectraForTokenClassification,
               FlaxElectraForQuestionAnswering,
               FlaxElectraForMultipleChoice,
               FlaxElectraForSequenceClassification,
           )
           if is_flax_available()
           else ()
       )


       def 					lowerCAmelCase					(      self     )					->     int:



            '''simple docstring'''




            __snake_case			    =     FlaxElectraModelTester(self     )




       @slow
       def 					lowerCAmelCase					(      self     )					->     int:



            '''simple docstring'''




            for model_class_name in self.all_model_classes:
                 if model_class_name == FlaxElectraForMaskedLM:
                      __snake_case			    =     model_class_name.from_pretrained('''google/electra-small-generator'''     )
                 else:
                      __snake_case			    =     model_class_name.from_pretrained('''google/electra-small-discriminator'''     )
                 __snake_case			    =     model(np.ones((1, 1)     )     )
                 self.assertIsNotNone(__SCREAMING_SNAKE_CASE     )












'''simple docstring'''



from __future__ import annotations

import math
from itertools import permutations







def 	_UpperCamelCase       (_lowerCamelCase							:   int		)->      bool:




     '''simple docstring'''





     if 1 < number < 4:
          # 2 and 3 are primes
          return True
     elif number < 2 or number % 2 == 0 or number % 3 == 0:
          # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes
          return False

     # All primes number are in format of 6k +/- 1
     for i in range(5      ,		int(math.sqrt(_lowerCamelCase		) + 1		)      ,		6		):
          if number % i == 0 or number % (i + 2) == 0:
               return False
     return True







def 	_UpperCamelCase       (_lowerCamelCase							:   int = 7		)->      int:




     '''simple docstring'''





     __snake_case			    =     ''''''.join(str(_lowerCamelCase		) for i in range(1      ,		n + 1		)		)
     __snake_case			    =     [int(''''''.join(_lowerCamelCase		)		) for i in permutations(_lowerCamelCase      ,		_lowerCamelCase		)]
     __snake_case			    =     [num for num in perm_list if is_prime(_lowerCamelCase		)]
     return max(_lowerCamelCase		) if pandigitals else 0


if __name__ == "__main__":
     print(F"""{solution() = }""")






