


"""simple docstring"""





from copy import deepcopy
from unittest.case import TestCase

import pytest

from datasets.arrow_dataset import Dataset
from datasets.features import Audio, ClassLabel, Features, Image, Sequence, Value
from datasets.info import DatasetInfo
from datasets.tasks import (
    AudioClassification,
    AutomaticSpeechRecognition,
    ImageClassification,
    LanguageModeling,
    QuestionAnsweringExtractive,
    Summarization,
    TextClassification,
    task_template_from_dict,
)
from datasets.utils.py_utils import asdict


snake_case__		:  Any     					=					{
    '''id''': '''5733be284776f41900661182''',
    '''title''': '''University_of_Notre_Dame''',
    '''context''': '''Architecturally, the school has a Catholic character. Atop the Main Building\'s gold dome is a golden statue of the Virgin Mary. Immediately in front of the Main Building and facing it, is a copper statue of Christ with arms upraised with the legend "Venite Ad Me Omnes". Next to the Main Building is the Basilica of the Sacred Heart. Immediately behind the basilica is the Grotto, a Marian place of prayer and reflection. It is a replica of the grotto at Lourdes, France where the Virgin Mary reputedly appeared to Saint Bernadette Soubirous in 1858. At the end of the main drive (and in a direct line that connects through 3 statues and the Gold Dome), is a simple, modern stone statue of Mary.''',
    '''question''': '''To whom did the Virgin Mary allegedly appear in 1858 in Lourdes France?''',
    '''answers''': {'''text''': ['''Saint Bernadette Soubirous'''], '''answer_start''': [515]},
}


@pytest.mark.parametrize(
    '''task_cls'''			, [
        AudioClassification,
        AutomaticSpeechRecognition,
        ImageClassification,
        LanguageModeling,
        QuestionAnsweringExtractive,
        Summarization,
        TextClassification,
    ]			, )
def   _snake_case    (    _snake_case					:      Optional[Any]      ):
      lowerCAmelCase       :						Any							= task_cls()
      lowerCAmelCase       :						int							= asdict(_snake_case      )
      lowerCAmelCase       :						List[str]							= task_template_from_dict(_snake_case      )
      assert task == reloaded



class 		snake_case_:






     def   lowerCamelCase__  (						self	:       Union[str, Any]					):
           lowerCAmelCase       :						List[str]							= LanguageModeling(text_column='''input_text'''					)
           assert {"input_text": "text"} == task.column_mapping






     def   lowerCamelCase__  (						self	:       Optional[Any]					):
           lowerCAmelCase       :						Tuple							= Features({'''text''': Value('''string'''					)}					)
           lowerCAmelCase       :						List[str]							= {'text_column': 'input_text'}
           lowerCAmelCase       :						Dict							= LanguageModeling.from_dict(__lowercase					)
           assert "language-modeling" == task.task
           assert input_schema == task.input_schema



class 		snake_case_(							a__      ):






     def   lowerCamelCase__  (						self	:       List[str]					):
           lowerCAmelCase       :						Optional[Any]							= sorted(['''pos''', '''neg''']					)






     def   lowerCamelCase__  (						self	:       List[str]					):
           lowerCAmelCase       :						List[str]							= TextClassification(text_column='''input_text'''       ,					label_column='''input_label'''					)
           self.assertDictEqual({'''input_text''': '''text''', '''input_label''': '''labels'''}       ,					task.column_mapping					)






     def   lowerCamelCase__  (						self	:       str					):
           lowerCAmelCase       :						List[Any]							= Features({'''text''': Value('''string'''					)}					)
           # Labels are cast to tuple during `TextClassification.__post_init__`, so we do the same here
           lowerCAmelCase       :						int							= Features({'''labels''': ClassLabel}					)
           lowerCAmelCase       :						Optional[int]							= {'text_column': 'input_text', 'label_column': 'input_labels'}
           lowerCAmelCase       :						Dict							= TextClassification.from_dict(__lowercase					)
           self.assertEqual('''text-classification'''       ,					task.task					)
           self.assertEqual(__lowercase       ,					task.input_schema					)
           self.assertEqual(__lowercase       ,					task.label_schema					)






     def   lowerCamelCase__  (						self	:       List[str]					):
           lowerCAmelCase       :						List[Any]							= TextClassification(text_column='''input_text'''       ,					label_column='''input_label'''					)
           self.assertEqual(task.label_schema['''labels''']       ,					__lowercase					)
           lowerCAmelCase       :						Any							= task.align_with_features(Features({'''input_label''': ClassLabel(names=self.labels					)}					)					)
           self.assertEqual(task.label_schema['''labels''']       ,					ClassLabel(names=self.labels					)					)



class 		snake_case_(							a__      ):






     def   lowerCamelCase__  (						self	:       Optional[int]					):
           lowerCAmelCase       :						Any							= QuestionAnsweringExtractive(
               context_column='''input_context'''       ,					question_column='''input_question'''       ,					answers_column='''input_answers'''					)
           self.assertDictEqual(
               {'''input_context''': '''context''', '''input_question''': '''question''', '''input_answers''': '''answers'''}       ,					task.column_mapping					)






     def   lowerCamelCase__  (						self	:       str					):
           lowerCAmelCase       :						List[str]							= Features({'''question''': Value('''string'''					), '''context''': Value('''string'''					)}					)
           lowerCAmelCase       :						List[Any]							= Features(
               {
                   '''answers''': Sequence(
                       {
                           '''text''': Value('''string'''					),
                           '''answer_start''': Value('''int32'''					),
                       }					)
               }					)
           lowerCAmelCase       :						Optional[Any]							= {
               'context_column': 'input_input_context',
               'question_column': 'input_question',
               'answers_column': 'input_answers',
           }
           lowerCAmelCase       :						Dict							= QuestionAnsweringExtractive.from_dict(__lowercase					)
           self.assertEqual('''question-answering-extractive'''       ,					task.task					)
           self.assertEqual(__lowercase       ,					task.input_schema					)
           self.assertEqual(__lowercase       ,					task.label_schema					)



class 		snake_case_(							a__      ):






     def   lowerCamelCase__  (						self	:       str					):
           lowerCAmelCase       :						Dict							= Summarization(text_column='''input_text'''       ,					summary_column='''input_summary'''					)
           self.assertDictEqual({'''input_text''': '''text''', '''input_summary''': '''summary'''}       ,					task.column_mapping					)






     def   lowerCamelCase__  (						self	:       Tuple					):
           lowerCAmelCase       :						Optional[int]							= Features({'''text''': Value('''string'''					)}					)
           lowerCAmelCase       :						List[Any]							= Features({'''summary''': Value('''string'''					)}					)
           lowerCAmelCase       :						Optional[Any]							= {'text_column': 'input_text', 'summary_column': 'input_summary'}
           lowerCAmelCase       :						List[Any]							= Summarization.from_dict(__lowercase					)
           self.assertEqual('''summarization'''       ,					task.task					)
           self.assertEqual(__lowercase       ,					task.input_schema					)
           self.assertEqual(__lowercase       ,					task.label_schema					)



class 		snake_case_(							a__      ):






     def   lowerCamelCase__  (						self	:       List[Any]					):
           lowerCAmelCase       :						Any							= AutomaticSpeechRecognition(audio_column='''input_audio'''       ,					transcription_column='''input_transcription'''					)
           self.assertDictEqual({'''input_audio''': '''audio''', '''input_transcription''': '''transcription'''}       ,					task.column_mapping					)






     def   lowerCamelCase__  (						self	:       Union[str, Any]					):
           lowerCAmelCase       :						List[Any]							= Features({'''audio''': Audio()}					)
           lowerCAmelCase       :						Any							= Features({'''transcription''': Value('''string'''					)}					)
           lowerCAmelCase       :						int							= {
               'audio_column': 'input_audio',
               'transcription_column': 'input_transcription',
           }
           lowerCAmelCase       :						Optional[int]							= AutomaticSpeechRecognition.from_dict(__lowercase					)
           self.assertEqual('''automatic-speech-recognition'''       ,					task.task					)
           self.assertEqual(__lowercase       ,					task.input_schema					)
           self.assertEqual(__lowercase       ,					task.label_schema					)



class 		snake_case_(							a__      ):






     def   lowerCamelCase__  (						self	:       Union[str, Any]					):
           lowerCAmelCase       :						List[Any]							= sorted(['''pos''', '''neg''']					)






     def   lowerCamelCase__  (						self	:       Union[str, Any]					):
           lowerCAmelCase       :						Optional[Any]							= AudioClassification(audio_column='''input_audio'''       ,					label_column='''input_label'''					)
           self.assertDictEqual({'''input_audio''': '''audio''', '''input_label''': '''labels'''}       ,					task.column_mapping					)






     def   lowerCamelCase__  (						self	:       List[Any]					):
           lowerCAmelCase       :						List[str]							= Features({'''audio''': Audio()}					)
           lowerCAmelCase       :						Tuple							= Features({'''labels''': ClassLabel}					)
           lowerCAmelCase       :						List[Any]							= {
               'audio_column': 'input_image',
               'label_column': 'input_label',
           }
           lowerCAmelCase       :						List[str]							= AudioClassification.from_dict(__lowercase					)
           self.assertEqual('''audio-classification'''       ,					task.task					)
           self.assertEqual(__lowercase       ,					task.input_schema					)
           self.assertEqual(__lowercase       ,					task.label_schema					)






     def   lowerCamelCase__  (						self	:       Optional[int]					):
           lowerCAmelCase       :						List[Any]							= AudioClassification(audio_column='''input_audio'''       ,					label_column='''input_label'''					)
           self.assertEqual(task.label_schema['''labels''']       ,					__lowercase					)
           lowerCAmelCase       :						List[str]							= task.align_with_features(Features({'''input_label''': ClassLabel(names=self.labels					)}					)					)
           self.assertEqual(task.label_schema['''labels''']       ,					ClassLabel(names=self.labels					)					)



class 		snake_case_(							a__      ):






     def   lowerCamelCase__  (						self	:       int					):
           lowerCAmelCase       :						Any							= sorted(['''pos''', '''neg''']					)






     def   lowerCamelCase__  (						self	:       Optional[int]					):
           lowerCAmelCase       :						Dict							= ImageClassification(image_column='''input_image'''       ,					label_column='''input_label'''					)
           self.assertDictEqual({'''input_image''': '''image''', '''input_label''': '''labels'''}       ,					task.column_mapping					)






     def   lowerCamelCase__  (						self	:       Optional[int]					):
           lowerCAmelCase       :						List[str]							= Features({'''image''': Image()}					)
           lowerCAmelCase       :						Tuple							= Features({'''labels''': ClassLabel}					)
           lowerCAmelCase       :						str							= {
               'image_column': 'input_image',
               'label_column': 'input_label',
           }
           lowerCAmelCase       :						Tuple							= ImageClassification.from_dict(__lowercase					)
           self.assertEqual('''image-classification'''       ,					task.task					)
           self.assertEqual(__lowercase       ,					task.input_schema					)
           self.assertEqual(__lowercase       ,					task.label_schema					)






     def   lowerCamelCase__  (						self	:       Tuple					):
           lowerCAmelCase       :						Union[str, Any]							= ImageClassification(image_column='''input_image'''       ,					label_column='''input_label'''					)
           self.assertEqual(task.label_schema['''labels''']       ,					__lowercase					)
           lowerCAmelCase       :						str							= task.align_with_features(Features({'''input_label''': ClassLabel(names=self.labels					)}					)					)
           self.assertEqual(task.label_schema['''labels''']       ,					ClassLabel(names=self.labels					)					)



class 		snake_case_(							a__      ):






     def   lowerCamelCase__  (						self	:       List[Any]					):
           lowerCAmelCase       :						List[str]							= DatasetInfo(task_templates=QuestionAnsweringExtractive()					)
           lowerCAmelCase       :						Tuple							= Dataset.from_dict({k: [v] for k, v in SAMPLE_QUESTION_ANSWERING_EXTRACTIVE.items()}       ,					info=__lowercase					)
           assert isinstance(dataset.info.task_templates       ,					__lowercase					)
           assert len(dataset.info.task_templates					) == 1

           def keep_task(UpperCamelCase_	:       List[Any]					):
                 return x

           def dont_keep_task(UpperCamelCase_	:       List[Any]					):
                 lowerCAmelCase       :						Union[str, Any]							= deepcopy(__lowercase					)
                 lowerCAmelCase       :						List[Any]							= 0
                 return out

           lowerCAmelCase       :						List[Any]							= dataset.map(__lowercase					)
           assert mapped_dataset.info.task_templates == dataset.info.task_templates
           # reload from cache
           lowerCAmelCase       :						Union[str, Any]							= dataset.map(__lowercase					)
           assert mapped_dataset.info.task_templates == dataset.info.task_templates

           lowerCAmelCase       :						Tuple							= dataset.map(__lowercase					)
           assert mapped_dataset.info.task_templates == []
           # reload from cache
           lowerCAmelCase       :						str							= dataset.map(__lowercase					)
           assert mapped_dataset.info.task_templates == []






     def   lowerCamelCase__  (						self	:       List[Any]					):
           lowerCAmelCase       :						Optional[int]							= Features({'''text''': Value('''string'''					), '''label''': ClassLabel(names=('''pos''', '''neg''')					)}					)
           lowerCAmelCase       :						int							= TextClassification(text_column='''text'''       ,					label_column='''label'''					)
           lowerCAmelCase       :						Optional[Any]							= DatasetInfo(features=__lowercase       ,					task_templates=__lowercase					)
           lowerCAmelCase       :						Optional[int]							= Dataset.from_dict({'''text''': ['''A sentence.'''], '''label''': ['''pos''']}       ,					info=__lowercase					)

           def process(UpperCamelCase_	:       str					):
                 return example

           lowerCAmelCase       :						List[str]							= dataset.remove_columns('''label'''					)
           lowerCAmelCase       :						Optional[int]							= modified_dataset.map(__lowercase					)
           assert mapped_dataset.info.task_templates == []








def    snake_case   (				A		,  A     )				->				int:




	'''simple docstring'''


	if a < b:
		return gcd(A		,  A     )
	if a % b == 0:
		return b
	return gcd(A		,  a % b     )






def    snake_case   (				A		,  A		,  A     )				->				int:




	'''simple docstring'''


	if y == 0:
		return 1
	lowerCamelCase_				:						int				  =				power(A		,  y // 2		,  A     ) % mod
	lowerCamelCase_				:						List[Any]				  =				(temp * temp) % mod
	if y % 2 == 1:
		lowerCamelCase_				:						str				  =				(temp * x) % mod
	return temp






def    snake_case   (				A     )				->				bool:




	'''simple docstring'''


	lowerCamelCase_				:						Union[str, Any]				  =				2
	while b < n:
		if gcd(A		,  A     ) == 1 and power(A		,  n - 1		,  A     ) != 1:
			return False
		b += 1
	return True


if __name__ == "__main__":
							UpperCamelCase__						=		int(input('Enter number: ').strip())
							if is_carmichael_number(number):
														print(F'{number} is a Carmichael Number.')
							else:
														print(F'{number} is not a Carmichael Number.')
