
__magic_name__  :  Union[str, Any]     			=   (1, 1_5_3, 3_7_0, 3_7_1, 1_6_3_4, 2_4_6_7_8_0_5_1, 1_1_5_1_3_2_2_1_9_0_1_8_7_6_3_9_9_2_5_6_5_0_9_5_5_9_7_9_7_3_9_7_1_5_2_2_4_0_1)
__magic_name__  :  Dict     			=   (-1_5_3, -1, 0, 1.2, 2_0_0, 'A', [], {}, None)





def        lowerCAmelCase       (				snake_case__   :      Dict )->			bool:
    if not isinstance(snake_case__				,					snake_case__ ) or n < 1:
        return False

    # Initialization of sum and number of digits.
    A_								=					0
    A_								=					0
    A_								=					n
    # Calculation of digits of the number
    while temp > 0:
        number_of_digits += 1
        temp //= 10
    # Dividing number into separate digits and find Armstrong number
    A_								=					n
    while temp > 0:
        A_								=					temp % 10
        total += rem**number_of_digits
        temp //= 10
    return n == total





def        lowerCAmelCase       (				snake_case__   :      Dict )->			bool:
    if not isinstance(snake_case__				,					snake_case__ ) or n < 1:
        return False

    # Init a "histogram" of the digits
    A_								=					[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    A_								=					0
    A_								=					0
    A_								=					n
    while temp > 0:
        A_								=					divmod(snake_case__				,					10 )
        digit_histogram[rem] += 1
        digit_total += 1

    for cnt, i in zip(snake_case__				,					range(len(snake_case__ ) ) ):
        total += cnt * i**digit_total

    return n == total





def        lowerCAmelCase       (				snake_case__   :      Tuple )->			bool:
    if not isinstance(snake_case__				,					snake_case__ ) or n < 1:
        return False
    A_								=					len(str(snake_case__ ) )  # the power that all digits will be raised to
    # check if sum of each digit multiplied expo times is equal to number
    return n == sum(int(snake_case__ ) ** expo for i in str(snake_case__ ) )





def        lowerCAmelCase       (				)->			Optional[Any]:
    A_								=					int(input("Enter an integer to see if it is an Armstrong number: " ).strip() )
    print(f'{num} is {"" if armstrong_number(snake_case__ ) else "not "}an Armstrong number.' )
    print(f'{num} is {"" if narcissistic_number(snake_case__ ) else "not "}an Armstrong number.' )
    print(f'{num} is {"" if pluperfect_number(snake_case__ ) else "not "}an Armstrong number.' )


if __name__ == "__main__":
     import doctest

     doctest.testmod()
     main()







import shutil
import tempfile
import unittest

import numpy as np
import pytest

from transformers.testing_utils import require_vision
from transformers.utils import is_vision_available


if is_vision_available():
    from PIL import Image

    from transformers import AutoProcessor, BertTokenizer, CLIPImageProcessor, GitProcessor, PreTrainedTokenizerFast






@require_vision
class     __UpperCAmelCase(    unittest.TestCase				):






 """simple docstring"""




 def  UpperCAmelCase   (    self      ):

        """simple docstring"""

        A_							:       int	      =				tempfile.mkdtemp()

        A_							:       str	      =				CLIPImageProcessor()
        A_							:       List[Any]	      =				BertTokenizer.from_pretrained(
            '''hf-internal-testing/tiny-random-BertModel''' ,       model_input_names=['''input_ids''', '''attention_mask''']      )

        A_							:       Optional[int]	      =				GitProcessor(__magic_name__ ,       __magic_name__      )

        processor.save_pretrained(self.tmpdirname      )
 def  UpperCAmelCase   (    self ,       **__magic_name__      ):

        """simple docstring"""

        return AutoProcessor.from_pretrained(self.tmpdirname ,       **__magic_name__      ).tokenizer
 def  UpperCAmelCase   (    self ,       **__magic_name__      ):

        """simple docstring"""

        return AutoProcessor.from_pretrained(self.tmpdirname ,       **__magic_name__      ).image_processor
 def  UpperCAmelCase   (    self      ):

        """simple docstring"""

        shutil.rmtree(self.tmpdirname      )
 def  UpperCAmelCase   (    self      ):

        """simple docstring"""

        A_							:       Union[str, Any]	      =				[np.random.randint(255 ,       size=(3, 30, 400) ,       dtype=np.uinta      )]

        A_							:       Union[str, Any]	      =				[Image.fromarray(np.moveaxis(__magic_name__ ,       0 ,       -1      )      ) for x in image_inputs]

        return image_inputs
 def  UpperCAmelCase   (    self      ):

        """simple docstring"""

        A_							:       Any	      =				GitProcessor(tokenizer=self.get_tokenizer() ,       image_processor=self.get_image_processor()      )
        processor.save_pretrained(self.tmpdirname      )

        A_							:       int	      =				self.get_tokenizer(bos_token='''(BOS)''' ,       eos_token='''(EOS)'''      )
        A_							:       str	      =				self.get_image_processor(do_normalize=__magic_name__ ,       padding_value=1.0      )

        A_							:       int	      =				GitProcessor.from_pretrained(
            self.tmpdirname ,       bos_token='''(BOS)''' ,       eos_token='''(EOS)''' ,       do_normalize=__magic_name__ ,       padding_value=1.0      )

        self.assertEqual(processor.tokenizer.get_vocab() ,       tokenizer_add_kwargs.get_vocab()      )
        self.assertIsInstance(processor.tokenizer ,       __magic_name__      )

        self.assertEqual(processor.image_processor.to_json_string() ,       image_processor_add_kwargs.to_json_string()      )
        self.assertIsInstance(processor.image_processor ,       __magic_name__      )
 def  UpperCAmelCase   (    self      ):

        """simple docstring"""

        A_							:       List[str]	      =				self.get_image_processor()
        A_							:       Tuple	      =				self.get_tokenizer()

        A_							:       Optional[int]	      =				GitProcessor(tokenizer=__magic_name__ ,       image_processor=__magic_name__      )

        A_							:       str	      =				self.prepare_image_inputs()

        A_							:       List[str]	      =				image_processor(__magic_name__ ,       return_tensors='''np'''      )
        A_							:       int	      =				processor(images=__magic_name__ ,       return_tensors='''np'''      )

        for key in input_feat_extract.keys():
               self.assertAlmostEqual(input_feat_extract[key].sum() ,       input_processor[key].sum() ,       delta=1e-2      )
 def  UpperCAmelCase   (    self      ):

        """simple docstring"""

        A_							:       List[str]	      =				self.get_image_processor()
        A_							:       str	      =				self.get_tokenizer()

        A_							:       List[str]	      =				GitProcessor(tokenizer=__magic_name__ ,       image_processor=__magic_name__      )

        A_							:       Tuple	      =				'''lower newer'''

        A_							:       Tuple	      =				processor(text=__magic_name__      )

        A_							:       List[Any]	      =				tokenizer(__magic_name__ ,       return_token_type_ids=__magic_name__      )

        for key in encoded_tok.keys():
               self.assertListEqual(encoded_tok[key] ,       encoded_processor[key]      )
 def  UpperCAmelCase   (    self      ):

        """simple docstring"""

        A_							:       List[str]	      =				self.get_image_processor()
        A_							:       Tuple	      =				self.get_tokenizer()

        A_							:       List[str]	      =				GitProcessor(tokenizer=__magic_name__ ,       image_processor=__magic_name__      )

        A_							:       List[Any]	      =				'''lower newer'''
        A_							:       Dict	      =				self.prepare_image_inputs()

        A_							:       Union[str, Any]	      =				processor(text=__magic_name__ ,       images=__magic_name__      )

        self.assertListEqual(list(inputs.keys()      ) ,       ['''input_ids''', '''attention_mask''', '''pixel_values''']      )

        # test if it raises when no input is passed
        with pytest.raises(__magic_name__      ):
               processor()
 def  UpperCAmelCase   (    self      ):

        """simple docstring"""

        A_							:       Optional[Any]	      =				self.get_image_processor()
        A_							:       Optional[int]	      =				self.get_tokenizer()

        A_							:       Optional[int]	      =				GitProcessor(tokenizer=__magic_name__ ,       image_processor=__magic_name__      )

        A_							:       List[Any]	      =				[[1, 4, 5, 8, 1, 0, 8], [3, 4, 3, 1, 1, 8, 9]]

        A_							:       List[Any]	      =				processor.batch_decode(__magic_name__      )
        A_							:       Dict	      =				tokenizer.batch_decode(__magic_name__      )

        self.assertListEqual(__magic_name__ ,       __magic_name__      )
 def  UpperCAmelCase   (    self      ):

        """simple docstring"""

        A_							:       int	      =				self.get_image_processor()
        A_							:       Optional[int]	      =				self.get_tokenizer()

        A_							:       str	      =				GitProcessor(tokenizer=__magic_name__ ,       image_processor=__magic_name__      )

        A_							:       Tuple	      =				'''lower newer'''
        A_							:       List[str]	      =				self.prepare_image_inputs()

        A_							:       Optional[Any]	      =				processor(text=__magic_name__ ,       images=__magic_name__      )

        # For now the processor supports only ['input_ids', 'attention_mask', 'pixel_values']
        self.assertListEqual(list(inputs.keys()      ) ,       ['''input_ids''', '''attention_mask''', '''pixel_values''']      )


