





'''simple docstring'''






import unittest

import numpy as np

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

from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask


if is_flax_available():
						from transformers.models.roberta.modeling_flax_roberta import (
						    FlaxRobertaForCausalLM,
						    FlaxRobertaForMaskedLM,
						    FlaxRobertaForMultipleChoice,
						    FlaxRobertaForQuestionAnswering,
						    FlaxRobertaForSequenceClassification,
						    FlaxRobertaForTokenClassification,
						    FlaxRobertaModel,
						)







class 		UpperCAmelCase   (				unittest.TestCase):


		"""simple docstring"""







		def __init__(				self    :					Any							,	UpperCamelCase__    :					str							,	UpperCamelCase__    :					List[str]=13							,	UpperCamelCase__    :					Optional[Any]=7							,	UpperCamelCase__    :					int=True							,	UpperCamelCase__    :					Dict=True							,	UpperCamelCase__    :					Union[str, Any]=True							,	UpperCamelCase__    :					Tuple=True							,	UpperCamelCase__    :					Optional[Any]=99							,	UpperCamelCase__    :					Tuple=32							,	UpperCamelCase__    :					Dict=5							,	UpperCamelCase__    :					List[str]=4							,	UpperCamelCase__    :					Union[str, Any]=37							,	UpperCamelCase__    :					Optional[int]="gelu"							,	UpperCamelCase__    :					List[str]=0.1							,	UpperCamelCase__    :					Optional[Any]=0.1							,	UpperCamelCase__    :					int=512							,	UpperCamelCase__    :					List[Any]=16							,	UpperCamelCase__    :					int=2							,	UpperCamelCase__    :					List[Any]=0.02							,	UpperCamelCase__    :					Optional[int]=4							,	)     ->						str:
				_UpperCamelCase       			=parent
				_UpperCamelCase       			=batch_size
				_UpperCamelCase       			=seq_length
				_UpperCamelCase       			=is_training
				_UpperCamelCase       			=use_attention_mask
				_UpperCamelCase       			=use_token_type_ids
				_UpperCamelCase       			=use_labels
				_UpperCamelCase       			=vocab_size
				_UpperCamelCase       			=hidden_size
				_UpperCamelCase       			=num_hidden_layers
				_UpperCamelCase       			=num_attention_heads
				_UpperCamelCase       			=intermediate_size
				_UpperCamelCase       			=hidden_act
				_UpperCamelCase       			=hidden_dropout_prob
				_UpperCamelCase       			=attention_probs_dropout_prob
				_UpperCamelCase       			=max_position_embeddings
				_UpperCamelCase       			=type_vocab_size
				_UpperCamelCase       			=type_sequence_label_size
				_UpperCamelCase       			=initializer_range
				_UpperCamelCase       			=num_choices


		def   UpperCamelCase__      (				self    :					Any  )     ->						Union[str, Any]:
				_UpperCamelCase       			=ids_tensor([self.batch_size, self.seq_length]							,	self.vocab_size  )

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

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

				_UpperCamelCase       			=RobertaConfig(
				    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=UpperCamelCase__							,	initializer_range=self.initializer_range							,	)

				return config, input_ids, token_type_ids, attention_mask


		def   UpperCamelCase__      (				self    :					Optional[int]  )     ->						List[str]:
				_UpperCamelCase       			=self.prepare_config_and_inputs()
				_UpperCamelCase			,     _UpperCamelCase			,     _UpperCamelCase			,     _UpperCamelCase       			=config_and_inputs
				_UpperCamelCase       			={'''input_ids''': input_ids, '''token_type_ids''': token_type_ids, '''attention_mask''': attention_mask}
				return config, inputs_dict




		def   UpperCamelCase__      (				self    :					int  )     ->						Optional[Any]:
				_UpperCamelCase       			=self.prepare_config_and_inputs()
				_UpperCamelCase			,     _UpperCamelCase			,     _UpperCamelCase			,     _UpperCamelCase       			=config_and_inputs

				_UpperCamelCase       			=True
				_UpperCamelCase       			=floats_tensor([self.batch_size, self.seq_length, self.hidden_size]  )
				_UpperCamelCase       			=ids_tensor([self.batch_size, self.seq_length]							,	vocab_size=2  )

				return (
				    config,
				    input_ids,
				    token_type_ids,
				    encoder_hidden_states,
				    encoder_attention_mask,
				)







@require_flax
class 		UpperCAmelCase   (				lowercase_   ,     unittest.TestCase):


		"""simple docstring"""







		lowerCAmelCase_					=				True

		lowerCAmelCase_					=				(
		    (
		        FlaxRobertaModel,
		        FlaxRobertaForCausalLM,
		        FlaxRobertaForMaskedLM,
		        FlaxRobertaForSequenceClassification,
		        FlaxRobertaForTokenClassification,
		        FlaxRobertaForMultipleChoice,
		        FlaxRobertaForQuestionAnswering,
		    )
		    if is_flax_available()
		    else ()
		)


		def   UpperCamelCase__      (				self    :					Dict  )     ->						List[Any]:
				_UpperCamelCase       			=FlaxRobertaModelTester(self  )




		@slow
		def   UpperCamelCase__      (				self    :					List[str]  )     ->						Dict:
				for model_class_name in self.all_model_classes:
						_UpperCamelCase       			=model_class_name.from_pretrained('''roberta-base'''							,	from_pt=UpperCamelCase__  )
						_UpperCamelCase       			=model(np.ones((1, 1)  )  )
						self.assertIsNotNone(UpperCamelCase__  )













'''simple docstring'''






import argparse
import datetime


def 					_a   (__SCREAMING_SNAKE_CASE   ):


  """simple docstring"""

  _UpperCamelCase       			={
      '''0''': '''Sunday''',
      '''1''': '''Monday''',
      '''2''': '''Tuesday''',
      '''3''': '''Wednesday''',
      '''4''': '''Thursday''',
      '''5''': '''Friday''',
      '''6''': '''Saturday''',
  }

  _UpperCamelCase       			={0: 1, 1: 2, 2: 3, 3: 4, 4: 5, 5: 6, 6: 0}

  # Validate
  if not 0 < len(__SCREAMING_SNAKE_CASE   ) < 11:
    raise ValueError('''Must be 10 characters long'''   )

  # Get month
  _UpperCamelCase       			=int(date_input[0] + date_input[1]   )
  # Validate
  if not 0 < m < 13:
    raise ValueError('''Month must be between 1 - 12'''   )

  _UpperCamelCase       			=date_input[2]
  # Validate
  if sep_a not in ["-", "/"]:
    raise ValueError('''Date separator must be \'-\' or \'/\''''   )

  # Get day
  _UpperCamelCase       			=int(date_input[3] + date_input[4]   )
  # Validate
  if not 0 < d < 32:
    raise ValueError('''Date must be between 1 - 31'''   )

  # Get second separator
  _UpperCamelCase       			=date_input[5]
  # Validate
  if sep_a not in ["-", "/"]:
    raise ValueError('''Date separator must be \'-\' or \'/\''''   )

  # Get year
  _UpperCamelCase       			=int(date_input[6] + date_input[7] + date_input[8] + date_input[9]   )
  # Arbitrary year range
  if not 45 < y < 8500:
    raise ValueError(
        '''Year out of range. There has to be some sort of limit...right?'''   )

  # Get datetime obj for validation
  _UpperCamelCase       			=datetime.date(int(__SCREAMING_SNAKE_CASE   )  ,      int(__SCREAMING_SNAKE_CASE   )  ,      int(__SCREAMING_SNAKE_CASE   )   )

  # Start math
  if m <= 2:
    _UpperCamelCase       			=y - 1
    _UpperCamelCase       			=m + 12
  # maths var
  _UpperCamelCase       			=int(str(__SCREAMING_SNAKE_CASE   )[:2]   )
  _UpperCamelCase       			=int(str(__SCREAMING_SNAKE_CASE   )[2:]   )
  _UpperCamelCase       			=int(2.6 * m - 5.3_9   )
  _UpperCamelCase       			=int(c / 4   )
  _UpperCamelCase       			=int(k / 4   )
  _UpperCamelCase       			=int(d + k   )
  _UpperCamelCase       			=int(t + u + v + x   )
  _UpperCamelCase       			=int(z - (2 * c)   )
  _UpperCamelCase       			=round(w % 7   )
  # End math

  # Validate math
  if f != convert_datetime_days[dt_ck.weekday()]:
    raise AssertionError('''The date was evaluated incorrectly. Contact developer.'''   )

  # Response
  _UpperCamelCase       			=f'''Your date {date_input}, is a {days[str(__SCREAMING_SNAKE_CASE   )]}!'''
  return response


if __name__ == "__main__":
      import doctest

      doctest.testmod()
      __lowerCamelCase						: List[Any]		=   argparse.ArgumentParser(
          description=(
              'Find out what day of the week nearly any date is or was. Enter '
              'date as a string in the mm-dd-yyyy or mm/dd/yyyy format'
          )
      )
      parser.add_argument(
          'date_input', type=str, help='Date as a string (mm-dd-yyyy or mm/dd/yyyy)'
      )
      __lowerCamelCase						: Union[str, Any]		=   parser.parse_args()
      zeller(args.date_input)






